Previous 15994 Revisions Next

r1368 Tuesday 4th December, 2007 at 05:28:36 UTC by Dirk Best
Sync with MAMEUI 0.121.2.
[src/mess/osd/windows]messlib.c windows.mak
[src/mess/osd/winui]cfgfile.c devview.c layoutms.c mess32.rc mess32ui.c mess32ui.h messui.c* messui.h* messui.rc* ms32util.c ms32util.h msuiutil.c* msuiutil.h* optionsms.c propertiesms.c softwarepicker.c
[src/osd/winui]audit32.c audit32.h bitmask.c bitmask.h columnedit.c columnedit.h datafile.c datafile.h datamap.c datamap.h dialogs.c dialogs.h dijoystick.c dijoystick.h directdraw.c directdraw.h directinput.c directinput.h directories.c directories.h dirwatch.c dirwatch.h dxdecode.c dxdecode.h file.h help.c help.h history.c history.h layout.c m32main.c m32opts.c m32opts.h m32util.c m32util.h mame32.h mame32.rc mameui.rc* mkhelp.c mui_audit.c* mui_audit.h* mui_main.c* mui_opts.c* mui_opts.h* mui_util.c* mui_util.h* picker.c picker.h properties.c properties.h resource.h resource.hm screenshot.c screenshot.h splitters.c splitters.h tabview.c tabview.h treeview.c treeview.h ui.mak verinfo.c win32ui.c win32ui.h winui.c* winui.h* winui.mak
[src/osd/winui/help]cntx_help.txt* mameui.hhc* mameui.hhk* mameui.hhp* mameui.hm* reshelp.h* stoplist.stp*
[src/osd/winui/help/docs]Command Line Settings.htm* Mame License.htm* Mame Statement of Purpose.htm* whatsnew.txt*
[src/osd/winui/help/html]mameui_art.htm* mameui_changes.txt* mameui_credits.htm* mameui_download.htm* mameui_filemenu.htm* mameui_help.htm* mameui_installprocedures.htm* mameui_optionsmenu.htm* mameui_overview.htm* mameui_playing.htm* mameui_properties.htm* mameui_settings.htm* mameui_support.htm* mameui_systemreq.htm* mameui_viewmenu.htm* mameui_visual_elements.htm* mameui_whatsnew32.htm*
[src/osd/winui/help/images]1.jpg* 2.jpg* 3.jpg* 4.jpg* 5.jpg* 6.jpg* 7.jpg* 8.jpg* bkground.gif* folder.gif* int.jpg* mame321.gif* statusbar.gif* toolbar.gif*
[src/osd/winui/res]mame32.ico mame32.manifest mameui.ico* mameui.manifest*

src/osd/winui/m32util.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32   -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13/***************************************************************************
14
15  M32Util.c
16
17 ***************************************************************************/
18
19#define WIN32_LEAN_AND_MEAN
20#include <windows.h>
21#include <shellapi.h>
22#include <shlwapi.h>
23#include <assert.h>
24#include <stdio.h>
25#include <tchar.h>
26
27#include "unzip.h"
28#include "bitmask.h"
29#include "screenshot.h"
30#include "sound/samples.h"
31#include "mame32.h"
32#include "m32util.h"
33#include "winutf8.h"
34#include "strconv.h"
35
36
37/***************************************************************************
38   function prototypes
39 ***************************************************************************/
40
41/***************************************************************************
42   External variables
43 ***************************************************************************/
44
45/***************************************************************************
46   Internal structures
47 ***************************************************************************/
48static struct DriversInfo
49{
50   BOOL isClone;
51   BOOL isBroken;
52   BOOL isHarddisk;
53   BOOL hasOptionalBIOS;
54   BOOL isStereo;
55   BOOL isMultiMon;
56   BOOL isVector;
57   BOOL usesRoms;
58   BOOL usesSamples;
59   BOOL usesTrackball;
60   BOOL usesLightGun;
61   BOOL supportsSaveState;
62   BOOL isVertical;
63} *drivers_info = NULL;
64
65
66/***************************************************************************
67   External functions
68 ***************************************************************************/
69
70/*
71   ErrorMsg
72*/
73void __cdecl ErrorMsg(const char* fmt, ...)
74{
75   static FILE*   pFile = NULL;
76   DWORD         dwWritten;
77   char         buf[5000];
78   char         buf2[5000];
79   va_list       va;
80
81   va_start(va, fmt);
82
83   vsprintf(buf, fmt, va);
84
85   win_message_box_utf8(GetActiveWindow(), buf, MAME32NAME, MB_OK | MB_ICONERROR);
86
87   strcpy(buf2, MAME32NAME ": ");
88   strcat(buf2,buf);
89   strcat(buf2, "\n");
90
91   WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf2, strlen(buf2), &dwWritten, NULL);
92
93   if (pFile == NULL)
94      pFile = fopen("debug.txt", "wt");
95
96   if (pFile != NULL)
97   {
98      fprintf(pFile, "%s", buf2);
99      fflush(pFile);
100   }
101
102   va_end(va);
103}
104
105void __cdecl dprintf(const char* fmt, ...)
106{
107   char    buf[5000];
108   va_list va;
109
110   va_start(va, fmt);
111
112   _vsnprintf(buf,sizeof(buf),fmt,va);
113
114   win_output_debug_string_utf8(buf);
115
116   va_end(va);
117}
118
119UINT GetDepth(HWND hWnd)
120{
121   UINT   nBPP;
122   HDC    hDC;
123
124   hDC = GetDC(hWnd);
125   
126   nBPP = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
127
128   ReleaseDC(hWnd, hDC);
129
130   return nBPP;
131}
132
133/*
134 * Return TRUE if comctl32.dll is version 4.71 or greater
135 * otherwise return FALSE.
136 */
137LONG GetCommonControlVersion()
138{
139   HMODULE hModule = GetModuleHandle(TEXT("comctl32"));
140
141   if (hModule)
142   {
143      FARPROC lpfnICCE = GetProcAddress(hModule, "InitCommonControlsEx");
144
145      if (NULL != lpfnICCE)
146      {
147         FARPROC lpfnDLLI = GetProcAddress(hModule, "DllInstall");
148
149         if (NULL != lpfnDLLI)
150         {
151            /* comctl 4.71 or greater */
152
153            // see if we can find out exactly
154           
155            DLLGETVERSIONPROC pDllGetVersion;
156            pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hModule, "DllGetVersion");
157
158            /* Because some DLLs might not implement this function, you
159               must test for it explicitly. Depending on the particular
160               DLL, the lack of a DllGetVersion function can be a useful
161               indicator of the version. */
162
163            if(pDllGetVersion)
164            {
165               DLLVERSIONINFO dvi;
166               HRESULT hr;
167
168               ZeroMemory(&dvi, sizeof(dvi));
169               dvi.cbSize = sizeof(dvi);
170
171               hr = (*pDllGetVersion)(&dvi);
172
173               if (SUCCEEDED(hr))
174               {
175                  return PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
176               }
177            }
178            return PACKVERSION(4,71);
179         }
180         return PACKVERSION(4,7);
181      }
182      return PACKVERSION(4,0);
183   }
184   /* DLL not found */
185   return PACKVERSION(0,0);
186}
187
188void DisplayTextFile(HWND hWnd, const char *cName)
189{
190   HINSTANCE hErr;
191   LPCTSTR     msg = 0;
192   LPTSTR    tName;
193   
194   tName = tstring_from_utf8(cName);
195   if( !tName )
196      return;
197
198   hErr = ShellExecute(hWnd, NULL, tName, NULL, NULL, SW_SHOWNORMAL);
199   if ((FPTR)hErr > 32)
200   {
201      free(tName);
202      return;
203   }
204
205   switch((FPTR)hErr)
206   {
207   case 0:
208      msg = TEXT("The operating system is out of memory or resources.");
209      break;
210
211   case ERROR_FILE_NOT_FOUND:
212      msg = TEXT("The specified file was not found.");
213      break;
214
215   case SE_ERR_NOASSOC :
216      msg = TEXT("There is no application associated with the given filename extension.");
217      break;
218
219   case SE_ERR_OOM :
220      msg = TEXT("There was not enough memory to complete the operation.");
221      break;
222
223   case SE_ERR_PNF :
224      msg = TEXT("The specified path was not found.");
225      break;
226
227   case SE_ERR_SHARE :
228      msg = TEXT("A sharing violation occurred.");
229      break;
230
231   default:
232      msg = TEXT("Unknown error.");
233   }
234 
235   MessageBox(NULL, msg, tName, MB_OK);
236   
237   free(tName);
238}
239
240char* MyStrStrI(const char* pFirst, const char* pSrch)
241{
242   char* cp = (char*)pFirst;
243   char* s1;
244   char* s2;
245   
246   while (*cp)
247   {
248      s1 = cp;
249      s2 = (char*)pSrch;
250     
251      while (*s1 && *s2 && !mame_strnicmp(s1, s2, 1))
252         s1++, s2++;
253     
254      if (!*s2)
255         return cp;
256     
257      cp++;
258   }
259   return NULL;
260}
261
262char * ConvertToWindowsNewlines(const char *source)
263{
264   static char buf[40000];
265   char *dest;
266
267   dest = buf;
268   while (*source != 0)
269   {
270      if (*source == '\n')
271      {
272         *dest++ = '\r';
273         *dest++ = '\n';
274      }
275      else
276         *dest++ = *source;
277      source++;
278   }
279   *dest = 0;
280   return buf;
281}
282
283/* Lop off path and extention from a source file name
284 * This assumes their is a pathname passed to the function
285 * like src\drivers\blah.c
286 */
287const char * GetDriverFilename(int nIndex)
288{
289   static char tmp[40];
290   char *ptmp;
291
292   const char *s = drivers[nIndex]->source_file;
293
294   tmp[0] = '\0';
295
296   ptmp = strrchr(s, '\\');
297   if (ptmp == NULL)
298      ptmp = strrchr(s, '/');
299   if (ptmp == NULL)
300      return s;
301
302   ptmp++;
303   strcpy(tmp,ptmp);
304   return tmp;
305}
306
307static struct DriversInfo* GetDriversInfo(int driver_index)
308{
309   if (drivers_info == NULL)
310   {
311      int ndriver, i;
312      drivers_info = malloc(sizeof(struct DriversInfo) * driver_list_get_count(drivers));
313      for (ndriver = 0; ndriver < driver_list_get_count(drivers); ndriver++)
314      {
315         const game_driver *gamedrv = drivers[ndriver];
316         struct DriversInfo *gameinfo = &drivers_info[ndriver];
317         const rom_entry *region, *rom;
318         machine_config drv;
319         const input_port_entry *input_ports;
320         int speakernum, num_speakers;
321         gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1);
322         gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0);
323         gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0);
324         gameinfo->isHarddisk = FALSE;
325         gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE;
326         for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
327         {
328            if (ROMREGION_ISDISKDATA(region))
329               gameinfo->isHarddisk = TRUE;
330         }
331         gameinfo->hasOptionalBIOS = FALSE;
332         if (gamedrv->rom != NULL)
333         {
334            for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++)
335            {
336               if (ROMENTRY_ISSYSTEM_BIOS(rom))
337               {
338                  gameinfo->hasOptionalBIOS = TRUE;
339                  break;
340               }
341            }
342         }
343         expand_machine_driver(gamedrv->drv, &drv);
344
345         num_speakers = 0;
346         for (speakernum = 0; speakernum < MAX_SPEAKER; speakernum++)
347            if (drv.speaker[speakernum].tag != NULL)
348               num_speakers++;
349
350         gameinfo->isStereo = (num_speakers > 1);
351         //gameinfo->isMultiMon = ((drv.video_attributes & VIDEO_DUAL_MONITOR) != 0);
352         // Was removed from Core
353         gameinfo->isMultiMon = 0;
354         gameinfo->isVector = ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0);
355         gameinfo->usesRoms = FALSE;
356         for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
357            for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
358            {
359               gameinfo->usesRoms = TRUE;
360               break;
361            }
362         gameinfo->usesSamples = FALSE;
363         
364         if (HAS_SAMPLES || HAS_VLM5030)
365         {
366            for (i = 0; drv.sound[i].type && i < MAX_SOUND; i++)
367            {
368               const char **samplenames = NULL;
369               
370#if (HAS_SAMPLES || HAS_VLM5030)
371               for( i = 0; drv.sound[i].type && i < MAX_SOUND; i++ )
372               {
373#if (HAS_SAMPLES)
374                  if( drv.sound[i].type == SOUND_SAMPLES )
375                     samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames;
376#endif
377               }
378#endif
379               if (samplenames != 0 && samplenames[0] != 0)
380               {
381                  gameinfo->usesSamples = TRUE;
382                  break;
383               }
384            }
385         }
386
387         gameinfo->usesTrackball = FALSE;
388         gameinfo->usesLightGun = FALSE;
389         if (gamedrv->ipt != NULL)
390         {
391            begin_resource_tracking();
392            input_ports = input_port_allocate(gamedrv->ipt, NULL);
393            while (1)
394            {
395               UINT32 type;
396               type = input_ports->type;
397               if (type == IPT_END)
398                  break;
399               if (type == IPT_DIAL || type == IPT_PADDLE ||
400                  type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y ||
401                  type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y)
402                  gameinfo->usesTrackball = TRUE;
403               if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y)
404                  gameinfo->usesLightGun = TRUE;
405               input_ports++;
406            }
407            end_resource_tracking();
408         }
409      }
410   }
411   return &drivers_info[driver_index];
412}
413
414BOOL DriverIsClone(int driver_index)
415{
416    return GetDriversInfo(driver_index)->isClone;
417}
418
419BOOL DriverIsBroken(int driver_index)
420{
421   return GetDriversInfo(driver_index)->isBroken;
422}
423
424BOOL DriverIsHarddisk(int driver_index)
425{
426   return GetDriversInfo(driver_index)->isHarddisk;
427}
428
429BOOL DriverIsBios(int driver_index)
430{
431   BOOL bBios = FALSE;
432   if( !( (drivers[driver_index]->flags & GAME_IS_BIOS_ROOT ) == 0)   )
433      bBios = TRUE;
434   return bBios;
435}
436
437
438BOOL DriverHasOptionalBIOS(int driver_index)
439{
440   return GetDriversInfo(driver_index)->hasOptionalBIOS;
441}
442
443BOOL DriverIsStereo(int driver_index)
444{
445   return GetDriversInfo(driver_index)->isStereo;
446}
447BOOL DriverIsMultiMon(int driver_index)
448{
449   return GetDriversInfo(driver_index)->isMultiMon;
450}
451
452BOOL DriverIsVector(int driver_index)
453{
454   return GetDriversInfo(driver_index)->isVector;
455}
456
457BOOL DriverUsesRoms(int driver_index)
458{
459   return GetDriversInfo(driver_index)->usesRoms;
460}
461
462BOOL DriverUsesSamples(int driver_index)
463{
464   return GetDriversInfo(driver_index)->usesSamples;
465}
466
467BOOL DriverUsesTrackball(int driver_index)
468{
469   return GetDriversInfo(driver_index)->usesTrackball;
470}
471
472BOOL DriverUsesLightGun(int driver_index)
473{
474   return GetDriversInfo(driver_index)->usesLightGun;
475}
476
477BOOL DriverSupportsSaveState(int driver_index)
478{
479   return GetDriversInfo(driver_index)->supportsSaveState;
480}
481
482BOOL DriverIsVertical(int driver_index) {
483   return GetDriversInfo(driver_index)->isVertical;
484}
485
486void FlushFileCaches(void)
487{
488   zip_file_cache_clear();
489}
490
491void FreeIfAllocated(char **s)
492{
493   if (*s)
494      free(*s);
495   *s = NULL;
496}
497
498BOOL StringIsSuffixedBy(const char *s, const char *suffix)
499{
500   return (strlen(s) > strlen(suffix)) && (strcmp(s + strlen(s) - strlen(suffix), suffix) == 0);
501}
502
503/***************************************************************************
504   Win32 wrappers
505 ***************************************************************************/
506
507BOOL SafeIsAppThemed(void)
508{
509   BOOL bResult = FALSE;
510   HMODULE hThemes;
511   BOOL (WINAPI *pfnIsAppThemed)(void);
512   
513   hThemes = LoadLibrary(TEXT("uxtheme.dll"));
514   if (hThemes != NULL)
515   {
516      pfnIsAppThemed = (BOOL (WINAPI *)(void)) GetProcAddress(hThemes, "IsAppThemed");
517      if (pfnIsAppThemed != NULL)
518         bResult = pfnIsAppThemed();
519      FreeLibrary(hThemes);
520   }
521   return bResult;
522
523}
524
525
526
527//============================================================
528//  win_extract_icon_utf8
529//============================================================
530
531HICON win_extract_icon_utf8(HINSTANCE inst, const char* exefilename, UINT iconindex)
532{
533   HICON icon = 0;
534   TCHAR* t_exefilename = tstring_from_utf8(exefilename);
535   if( !t_exefilename )
536      return icon;
537   
538   icon = ExtractIcon(inst, t_exefilename, iconindex);
539   
540   free(t_exefilename);
541   
542   return icon;
543}
544
545
546
547//============================================================
548//  win_tstring_strdup
549//============================================================
550
551TCHAR* win_tstring_strdup(LPCTSTR str)
552{
553   TCHAR *cpy = NULL;
554   if (str != NULL)
555   {
556      cpy = malloc((_tcslen(str) + 1) * sizeof(TCHAR));
557      if (cpy != NULL)
558         _tcscpy(cpy, str);
559   }
560   return cpy;
561}
562
563//============================================================
564//  win_create_file_utf8
565//============================================================
566
567HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD sharemode,
568                        LPSECURITY_ATTRIBUTES securityattributes, DWORD creationdisposition,
569                        DWORD flagsandattributes, HANDLE templatehandle)
570{
571   HANDLE result = 0;
572   TCHAR* t_filename = tstring_from_utf8(filename);
573   if( !t_filename )
574      return result;
575   
576   result = CreateFile(t_filename, desiredmode, sharemode, securityattributes, creationdisposition,
577                  flagsandattributes, templatehandle);
578
579   free(t_filename);
580                 
581   return result;
582}
583
584//============================================================
585//  win_get_current_directory_utf8
586//============================================================
587
588DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer)
589{
590   DWORD result = 0;
591   TCHAR* t_buffer = NULL;
592   char* utf8_buffer = NULL;
593   
594   if( bufferlength > 0 ) {
595      t_buffer = malloc((bufferlength * sizeof(TCHAR)) + 1);
596      if( !t_buffer )
597         return result;
598   }
599   
600   result = GetCurrentDirectory(bufferlength, t_buffer);
601   
602   if( bufferlength > 0 ) {
603      utf8_buffer = utf8_from_tstring(t_buffer);
604      if( !utf8_buffer ) {
605         free(t_buffer);
606         return result;
607      }
608   }
609     
610   strncpy(buffer, utf8_buffer, bufferlength);
611   
612   if( utf8_buffer )
613      free(utf8_buffer);
614   
615   if( t_buffer )
616      free(t_buffer);
617   
618   return result;
619}
620
621//============================================================
622//  win_find_first_file_utf8
623//============================================================
624
625HANDLE win_find_first_file_utf8(const char* filename, LPWIN32_FIND_DATA findfiledata)
626{
627   HANDLE result = 0;
628   TCHAR* t_filename = tstring_from_utf8(filename);
629   if( !t_filename )
630      return result;
631   
632   result = FindFirstFile(t_filename, findfiledata);
633   
634   free(t_filename);
635   
636   return result;
637}
src/osd/winui/win32ui.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13 /***************************************************************************
14
15  win32ui.c
16
17  Win32 GUI code.
18
19  Created 8/12/97 by Christopher Kirmse (ckirmse@ricochet.net)
20  Additional code November 1997 by Jeff Miller (miller@aa.net)
21  More July 1998 by Mike Haaland (mhaaland@hypertech.com)
22  Added Spitters/Property Sheets/Removed Tabs/Added Tree Control in
23  Nov/Dec 1998 - Mike Haaland
24
25***************************************************************************/
26
27#define WIN32_LEAN_AND_MEAN
28#define _WIN32_IE 0x0500
29#include <windows.h>
30#include <windowsx.h>
31#include <shellapi.h>
32#include <stdio.h>
33#include <ctype.h>
34#include <io.h>
35#include <fcntl.h>
36#include <commctrl.h>
37#include <dlgs.h>
38#include <string.h>
39#include <sys/stat.h>
40#include <wingdi.h>
41#include <time.h>
42#include <tchar.h>
43
44#include <driver.h>
45#include <osdepend.h>
46#include <unzip.h>
47
48#include "resource.h"
49#include "resource.hm"
50
51#include "screenshot.h"
52#include "mame32.h"
53#include "m32util.h"
54#include "file.h"
55#include "audit32.h"
56#include "directories.h"
57#include "m32opts.h"
58#include "properties.h"
59#include "columnedit.h"
60#include "picker.h"
61#include "tabview.h"
62#include "bitmask.h"
63#include "treeview.h"
64#include "splitters.h"
65#include "dirwatch.h"
66#include "help.h"
67#include "history.h"
68#include "dialogs.h"
69#include "state.h"
70#include "winmain.h"
71#include "winutf8.h"
72#include "strconv.h"
73#include "input.h"
74#include "windows/window.h"
75
76#include "directdraw.h"
77#include "directinput.h"
78#include "dijoystick.h"     /* For DIJoystick avalibility. */
79
80#ifdef MESS
81#include "mess32ui.h"
82#include "messopts.h"
83#endif // MESS
84
85#ifdef _MSC_VER
86#define snprintf _snprintf
87#endif
88
89#ifndef LVS_EX_LABELTIP
90#define LVS_EX_LABELTIP         0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
91#endif // LVS_EX_LABELTIP
92
93// fix warning: cast does not match function type
94#if defined(__GNUC__) && defined(ListView_CreateDragImage)
95#undef ListView_CreateDragImage
96#endif
97
98#ifndef ListView_CreateDragImage
99#define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
100    (HIMAGELIST)(LRESULT)(int)SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
101#endif // ListView_CreateDragImage
102
103#ifndef TreeView_EditLabel
104#define TreeView_EditLabel(w, i) \
105    SNDMSG(w,TVM_EDITLABEL,0,(LPARAM)(i))
106#endif // TreeView_EditLabel
107
108#ifndef HDF_SORTUP
109#define HDF_SORTUP 0x400
110#endif // HDF_SORTUP
111
112#ifndef HDF_SORTDOWN
113#define HDF_SORTDOWN 0x200
114#endif // HDF_SORTDOWN
115
116#ifndef LVM_SETBKIMAGEA
117#define LVM_SETBKIMAGEA         (LVM_FIRST + 68)
118#endif // LVM_SETBKIMAGEA
119
120#ifndef LVM_SETBKIMAGEW
121#define LVM_SETBKIMAGEW         (LVM_FIRST + 138)
122#endif // LVM_SETBKIMAGEW
123
124#ifndef LVM_GETBKIMAGEA
125#define LVM_GETBKIMAGEA         (LVM_FIRST + 69)
126#endif // LVM_GETBKIMAGEA
127
128#ifndef LVM_GETBKIMAGEW
129#define LVM_GETBKIMAGEW         (LVM_FIRST + 139)
130#endif // LVM_GETBKIMAGEW
131
132#ifndef LVBKIMAGE
133
134typedef struct tagLVBKIMAGEA
135{
136   ULONG ulFlags;
137   HBITMAP hbm;
138   LPSTR pszImage;
139   UINT cchImageMax;
140   int xOffsetPercent;
141   int yOffsetPercent;
142} LVBKIMAGEA, *LPLVBKIMAGEA;
143
144typedef struct tagLVBKIMAGEW
145{
146   ULONG ulFlags;
147   HBITMAP hbm;
148   LPWSTR pszImage;
149   UINT cchImageMax;
150   int xOffsetPercent;
151   int yOffsetPercent;
152} LVBKIMAGEW, *LPLVBKIMAGEW;
153
154#ifdef UNICODE
155#define LVBKIMAGE               LVBKIMAGEW
156#define LPLVBKIMAGE             LPLVBKIMAGEW
157#define LVM_SETBKIMAGE          LVM_SETBKIMAGEW
158#define LVM_GETBKIMAGE          LVM_GETBKIMAGEW
159#else
160#define LVBKIMAGE               LVBKIMAGEA
161#define LPLVBKIMAGE             LPLVBKIMAGEA
162#define LVM_SETBKIMAGE          LVM_SETBKIMAGEA
163#define LVM_GETBKIMAGE          LVM_GETBKIMAGEA
164#endif
165#endif
166
167#ifndef LVBKIF_SOURCE_NONE
168#define LVBKIF_SOURCE_NONE      0x00000000
169#endif // LVBKIF_SOURCE_NONE
170
171#ifndef LVBKIF_SOURCE_HBITMAP
172#define LVBKIF_SOURCE_HBITMAP   0x00000001
173#endif
174
175#ifndef LVBKIF_SOURCE_URL
176#define LVBKIF_SOURCE_URL       0x00000002
177#endif // LVBKIF_SOURCE_URL
178
179#ifndef LVBKIF_SOURCE_MASK
180#define LVBKIF_SOURCE_MASK      0x00000003
181#endif // LVBKIF_SOURCE_MASK
182
183#ifndef LVBKIF_STYLE_NORMAL
184#define LVBKIF_STYLE_NORMAL     0x00000000
185#endif // LVBKIF_STYLE_NORMAL
186
187#ifndef LVBKIF_STYLE_TILE
188#define LVBKIF_STYLE_TILE       0x00000010
189#endif // LVBKIF_STYLE_TILE
190
191#ifndef LVBKIF_STYLE_MASK
192#define LVBKIF_STYLE_MASK       0x00000010
193#endif // LVBKIF_STYLE_MASK
194
195#ifndef ListView_SetBkImage
196#define ListView_SetBkImage(hwnd, plvbki) \
197    (BOOL)SNDMSG((hwnd), LVM_SETBKIMAGE, 0, (LPARAM)(plvbki))
198#endif // ListView_SetBkImage
199
200#ifndef ListView_GetBkImage
201#define ListView_GetBkImage(hwnd, plvbki) \
202    (BOOL)SNDMSG((hwnd), LVM_GETBKIMAGE, 0, (LPARAM)(plvbki))
203#endif // ListView_GetBkImage
204
205#define MM_PLAY_GAME (WM_APP + 15000)
206
207#define JOYGUI_MS 100
208
209#define JOYGUI_TIMER 1
210#define SCREENSHOT_TIMER 2
211#define GAMEWND_TIMER 3
212
213/* Max size of a sub-menu */
214#define DBU_MIN_WIDTH  292
215#define DBU_MIN_HEIGHT 190
216
217int MIN_WIDTH  = DBU_MIN_WIDTH;
218int MIN_HEIGHT = DBU_MIN_HEIGHT;
219
220/* Max number of bkground picture files */
221#define MAX_BGFILES 100
222
223#ifndef LVS_EX_LABELTIP
224#define LVS_EX_LABELTIP         0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
225#endif
226
227#define NO_FOLDER -1
228#define STATESAVE_VERSION 1
229
230/***************************************************************************
231 externally defined global variables
232 ***************************************************************************/
233extern const ICONDATA g_iconData[];
234extern const TCHAR g_szPlayGameString[];
235extern const char g_szGameCountString[];
236
237typedef struct _play_options play_options;
238struct _play_options
239{
240   const char *record;         // OPTION_RECORD
241   const char *playback;      // OPTION_PLAYBACK
242   const char *state;         // OPTION_STATE
243   const char *wavwrite;      // OPTION_WAVWRITE
244   const char *mngwrite;      // OPTION_MNGWRITE
245};
246
247/***************************************************************************
248    function prototypes
249 ***************************************************************************/
250
251static BOOL             Win32UI_init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
252static void             Win32UI_exit(void);
253
254static BOOL             PumpMessage(void);
255static BOOL             OnIdle(HWND hWnd);
256static void             OnSize(HWND hwnd, UINT state, int width, int height);
257static LRESULT CALLBACK MameWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
258
259static void             SetView(int menu_id);
260static void             ResetListView(void);
261static void             UpdateGameList(BOOL bUpdateRomAudit, BOOL bUpdateSampleAudit);
262static void             DestroyIcons(void);
263static void             ReloadIcons(void);
264static void             PollGUIJoystick(void);
265//static void             PressKey(HWND hwnd,UINT vk);
266static BOOL             MameCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify);
267static void             KeyboardKeyDown(int syskey, int vk_code, int special);
268static void             KeyboardKeyUp(int syskey, int vk_code, int special);
269static void             KeyboardStateClear(void);
270
271static void             UpdateStatusBar(void);
272//static BOOL             PickerHitTest(HWND hWnd);
273static BOOL             TreeViewNotify(NMHDR *nm);
274
275static void             ResetBackground(char *szFile);
276static void            RandomSelectBackground(void);
277static void             LoadBackgroundBitmap(void);
278static void             PaintBackgroundImage(HWND hWnd, HRGN hRgn, int x, int y);
279
280static int CLIB_DECL    DriverDataCompareFunc(const void *arg1,const void *arg2);
281static int              GamePicker_Compare(HWND hwndPicker, int index1, int index2, int sort_subitem);
282
283static void             DisableSelection(void);
284static void             EnableSelection(int nGame);
285
286static HICON         GetSelectedPickItemIcon(void);
287static void             SetRandomPickItem(void);
288static void            PickColor(COLORREF *cDefault);
289
290static LPTREEFOLDER     GetSelectedFolder(void);
291static HICON         GetSelectedFolderIcon(void);
292
293static LRESULT CALLBACK HistoryWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
294static LRESULT CALLBACK PictureFrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
295static LRESULT CALLBACK PictureWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
296static INT_PTR CALLBACK LanguageDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
297
298static BOOL             SelectLanguageFile(HWND hWnd, TCHAR* filename);
299static void             MamePlayRecordGame(void);
300static void             MamePlayBackGame(void);
301static void             MamePlayRecordWave(void);
302static void             MamePlayRecordMNG(void);
303static void            MameLoadState(void);
304static void             MamePlayGameWithOptions(int nGame, const play_options *playopts);
305static BOOL             GameCheck(void);
306static BOOL             FolderCheck(void);
307
308static void             ToggleScreenShot(void);
309static void             AdjustMetrics(void);
310//static void             EnablePlayOptions(int nIndex, core_options *o);
311
312/* Icon routines */
313static DWORD            GetShellLargeIconSize(void);
314static DWORD            GetShellSmallIconSize(void);
315static void             CreateIcons(void);
316static int              GetIconForDriver(int nItem);
317static void             AddDriverIcon(int nItem,int default_icon_index);
318
319// Context Menu handlers
320static void             UpdateMenu(HMENU hMenu);
321static void             InitTreeContextMenu(HMENU hTreeMenu);
322static void             InitBodyContextMenu(HMENU hBodyContextMenu);
323static void             ToggleShowFolder(int folder);
324static BOOL             HandleTreeContextMenu( HWND hWnd, WPARAM wParam, LPARAM lParam);
325static BOOL             HandleScreenShotContextMenu( HWND hWnd, WPARAM wParam, LPARAM lParam);
326static void            GamePicker_OnHeaderContextMenu(POINT pt, int nColumn);
327static void            GamePicker_OnBodyContextMenu(POINT pt);
328
329static void             InitListView(void);
330/* Re/initialize the ListView header columns */
331static void             ResetColumnDisplay(BOOL first_time);
332
333static void             CopyToolTipText (LPTOOLTIPTEXT lpttt);
334
335static void             ProgressBarShow(void);
336static void             ProgressBarHide(void);
337static void             ResizeProgressBar(void);
338static void             ProgressBarStep(void);
339static void             ProgressBarStepParam(int iGameIndex, int nGameCount);
340
341static HWND             InitProgressBar(HWND hParent);
342static HWND             InitToolbar(HWND hParent);
343static HWND             InitStatusBar(HWND hParent);
344
345static LRESULT          Statusbar_MenuSelect (HWND hwnd, WPARAM wParam, LPARAM lParam);
346
347static void             UpdateHistory(void);
348
349
350void RemoveCurrentGameCustomFolder(void);
351void RemoveGameCustomFolder(int driver_index);
352
353void BeginListViewDrag(NM_LISTVIEW *pnmv);
354void MouseMoveListViewDrag(POINTS pt);
355void ButtonUpListViewDrag(POINTS p);
356
357void CalculateBestScreenShotRect(HWND hWnd, RECT *pRect, BOOL restrict_height);
358
359BOOL MouseHasBeenMoved(void);
360void SwitchFullScreenMode(void);
361
362/***************************************************************************
363    External variables
364 ***************************************************************************/
365
366/***************************************************************************
367    Internal structures
368 ***************************************************************************/
369
370/*
371 * These next two structs represent how the icon information
372 * is stored in an ICO file.
373 */
374typedef struct
375{
376   BYTE    bWidth;               /* Width of the image */
377   BYTE    bHeight;              /* Height of the image (times 2) */
378   BYTE    bColorCount;          /* Number of colors in image (0 if >=8bpp) */
379   BYTE    bReserved;            /* Reserved */
380   WORD    wPlanes;              /* Color Planes */
381   WORD    wBitCount;            /* Bits per pixel */
382   DWORD   dwBytesInRes;         /* how many bytes in this resource? */
383   DWORD   dwImageOffset;        /* where in the file is this image */
384} ICONDIRENTRY, *LPICONDIRENTRY;
385
386typedef struct
387{
388   UINT            Width, Height, Colors; /* Width, Height and bpp */
389   LPBYTE          lpBits;                /* ptr to DIB bits */
390   DWORD           dwNumBytes;            /* how many bytes? */
391   LPBITMAPINFO    lpbi;                  /* ptr to header */
392   LPBYTE          lpXOR;                 /* ptr to XOR image bits */
393   LPBYTE          lpAND;                 /* ptr to AND image bits */
394} ICONIMAGE, *LPICONIMAGE;
395
396/* Which edges of a control are anchored to the corresponding side of the parent window */
397#define RA_LEFT     0x01
398#define RA_RIGHT    0x02
399#define RA_TOP      0x04
400#define RA_BOTTOM   0x08
401#define RA_ALL      0x0F
402
403#define RA_END  0
404#define RA_ID   1
405#define RA_HWND 2
406
407typedef struct
408{
409   int         type;       /* Either RA_ID or RA_HWND, to indicate which member of u is used; or RA_END
410                        to signify last entry */
411   union                   /* Can identify a child window by control id or by handle */
412   {
413      int     id;         /* Window control id */
414      HWND    hwnd;       /* Window handle */
415   } u;
416   BOOL      setfont;   /* Do we set this item's font? */
417   int         action;     /* What to do when control is resized */
418   void        *subwindow; /* Points to a Resize structure for this subwindow; NULL if none */
419} ResizeItem;
420
421typedef struct
422{
423   RECT        rect;       /* Client rect of window; must be initialized before first resize */
424   ResizeItem* items;      /* Array of subitems to be resized */
425} Resize;
426
427static void ResizeWindow(HWND hParent, Resize *r);
428static void SetAllWindowsFont(HWND hParent, const Resize *r, HFONT hFont, BOOL bRedraw);
429
430/* List view Icon defines */
431#define LG_ICONMAP_WIDTH    GetSystemMetrics(SM_CXICON)
432#define LG_ICONMAP_HEIGHT   GetSystemMetrics(SM_CYICON)
433#define ICONMAP_WIDTH       GetSystemMetrics(SM_CXSMICON)
434#define ICONMAP_HEIGHT      GetSystemMetrics(SM_CYSMICON)
435
436typedef struct tagPOPUPSTRING
437{
438   HMENU hMenu;
439   UINT uiString;
440} POPUPSTRING;
441
442#define MAX_MENUS 3
443
444#define SPLITTER_WIDTH   4
445#define MIN_VIEW_WIDTH   10
446
447// Struct needed for Game Window Communication
448
449typedef struct
450{
451   LPPROCESS_INFORMATION ProcessInfo;
452   HWND hwndFound;
453} FINDWINDOWHANDLE;
454
455/***************************************************************************
456    Internal variables
457 ***************************************************************************/
458
459static HWND   hMain  = NULL;
460static HACCEL hAccel = NULL;
461
462static HWND hwndList  = NULL;
463static HWND hTreeView = NULL;
464static HWND hProgWnd  = NULL;
465static HWND hTabCtrl  = NULL;
466
467static HINSTANCE hInst = NULL;
468
469static HFONT hFont = NULL;     /* Font for list view */
470
471static int optionfolder_count = 0;
472
473/* global data--know where to send messages */
474static BOOL in_emulation;
475
476/* idle work at startup */
477static BOOL idle_work;
478
479/* object pool in use */
480static object_pool *mame32_pool;
481
482static int  game_index;
483static int  progBarStep;
484
485static BOOL bDoGameCheck = FALSE;
486
487/* Tree control variables */
488static BOOL bShowTree      = 1;
489static BOOL bShowToolBar   = 1;
490static BOOL bShowStatusBar = 1;
491static BOOL bShowTabCtrl   = 1;
492static BOOL bProgressShown = FALSE;
493static BOOL bListReady     = FALSE;
494
495#define   WM_MAME32_FILECHANGED   (WM_USER + 0)
496#define   WM_MAME32_AUDITGAME      (WM_USER + 1)
497
498static PDIRWATCHER s_pWatcher;
499
500/* use a joystick subsystem in the gui? */
501static struct OSDJoystick* g_pJoyGUI = NULL;
502
503/* store current keyboard state (in internal codes) here */
504static input_code keyboard_state[ 2048 ]; /* __code_max #defines the number of internal key_codes */
505
506/* search */
507static char g_SearchText[256];
508/* table copied from windows/inputs.c */
509// table entry indices
510#define MAME_KEY      0
511#define DI_KEY         1
512#define VIRTUAL_KEY      2
513#define ASCII_KEY      3
514
515// master keyboard translation table
516static const int win_key_trans_table[][4] =
517{
518   // MAME key             dinput key          virtual key     ascii
519   { ITEM_ID_ESC,          DIK_ESCAPE,         VK_ESCAPE,       27 },
520   { ITEM_ID_1,          DIK_1,            '1',         '1' },
521   { ITEM_ID_2,          DIK_2,            '2',         '2' },
522   { ITEM_ID_3,          DIK_3,            '3',         '3' },
523   { ITEM_ID_4,          DIK_4,            '4',         '4' },
524   { ITEM_ID_5,          DIK_5,            '5',         '5' },
525   { ITEM_ID_6,          DIK_6,            '6',         '6' },
526   { ITEM_ID_7,          DIK_7,            '7',         '7' },
527   { ITEM_ID_8,          DIK_8,            '8',         '8' },
528   { ITEM_ID_9,          DIK_9,            '9',         '9' },
529   { ITEM_ID_0,          DIK_0,            '0',         '0' },
530   { ITEM_ID_BACKSPACE,   DIK_BACK,          VK_BACK,       8 },
531   { ITEM_ID_TAB,          DIK_TAB,          VK_TAB,       9 },
532   { ITEM_ID_Q,          DIK_Q,            'Q',         'Q' },
533   { ITEM_ID_W,          DIK_W,            'W',         'W' },
534   { ITEM_ID_E,          DIK_E,            'E',         'E' },
535   { ITEM_ID_R,          DIK_R,            'R',         'R' },
536   { ITEM_ID_T,          DIK_T,            'T',         'T' },
537   { ITEM_ID_Y,          DIK_Y,            'Y',         'Y' },
538   { ITEM_ID_U,          DIK_U,            'U',         'U' },
539   { ITEM_ID_I,          DIK_I,            'I',         'I' },
540   { ITEM_ID_O,          DIK_O,            'O',         'O' },
541   { ITEM_ID_P,          DIK_P,            'P',         'P' },
542   { ITEM_ID_OPENBRACE,   DIK_LBRACKET,       VK_OEM_4,      '[' },
543   { ITEM_ID_CLOSEBRACE,   DIK_RBRACKET,       VK_OEM_6,      ']' },
544   { ITEM_ID_ENTER,       DIK_RETURN,       VK_RETURN,       13 },
545   { ITEM_ID_LCONTROL,    DIK_LCONTROL,       VK_LCONTROL,    0 },
546   { ITEM_ID_A,          DIK_A,            'A',         'A' },
547   { ITEM_ID_S,          DIK_S,            'S',         'S' },
548   { ITEM_ID_D,          DIK_D,            'D',         'D' },
549   { ITEM_ID_F,          DIK_F,            'F',         'F' },
550   { ITEM_ID_G,          DIK_G,            'G',         'G' },
551   { ITEM_ID_H,          DIK_H,            'H',         'H' },
552   { ITEM_ID_J,          DIK_J,            'J',         'J' },
553   { ITEM_ID_K,          DIK_K,            'K',         'K' },
554   { ITEM_ID_L,          DIK_L,            'L',         'L' },
555   { ITEM_ID_COLON,       DIK_SEMICOLON,      VK_OEM_1,      ';' },
556   { ITEM_ID_QUOTE,       DIK_APOSTROPHE,      VK_OEM_7,      '\'' },
557   { ITEM_ID_TILDE,       DIK_GRAVE,          VK_OEM_3,      '`' },
558   { ITEM_ID_LSHIFT,       DIK_LSHIFT,       VK_LSHIFT,       0 },
559   { ITEM_ID_BACKSLASH,   DIK_BACKSLASH,       VK_OEM_5,      '\\' },
560   { ITEM_ID_Z,          DIK_Z,            'Z',         'Z' },
561   { ITEM_ID_X,          DIK_X,            'X',         'X' },
562   { ITEM_ID_C,          DIK_C,            'C',         'C' },
563   { ITEM_ID_V,          DIK_V,            'V',         'V' },
564   { ITEM_ID_B,          DIK_B,            'B',         'B' },
565   { ITEM_ID_N,          DIK_N,            'N',         'N' },
566   { ITEM_ID_M,          DIK_M,            'M',         'M' },
567   { ITEM_ID_SLASH,       DIK_SLASH,          VK_OEM_2,      '/' },
568   { ITEM_ID_RSHIFT,       DIK_RSHIFT,       VK_RSHIFT,       0 },
569   { ITEM_ID_ASTERISK,    DIK_MULTIPLY,       VK_MULTIPLY,   '*' },
570   { ITEM_ID_LALT,       DIK_LMENU,          VK_LMENU,       0 },
571   { ITEM_ID_SPACE,       DIK_SPACE,          VK_SPACE,      ' ' },
572   { ITEM_ID_CAPSLOCK,    DIK_CAPITAL,       VK_CAPITAL,    0 },
573   { ITEM_ID_F1,          DIK_F1,            VK_F1,          0 },
574   { ITEM_ID_F2,          DIK_F2,            VK_F2,          0 },
575   { ITEM_ID_F3,          DIK_F3,            VK_F3,          0 },
576   { ITEM_ID_F4,          DIK_F4,            VK_F4,          0 },
577   { ITEM_ID_F5,          DIK_F5,            VK_F5,          0 },
578   { ITEM_ID_F6,          DIK_F6,            VK_F6,          0 },
579   { ITEM_ID_F7,          DIK_F7,            VK_F7,          0 },
580   { ITEM_ID_F8,          DIK_F8,            VK_F8,          0 },
581   { ITEM_ID_F9,          DIK_F9,            VK_F9,          0 },
582   { ITEM_ID_F10,          DIK_F10,         VK_F10,       0 },
583   { ITEM_ID_NUMLOCK,       DIK_NUMLOCK,      VK_NUMLOCK,    0 },
584   { ITEM_ID_SCRLOCK,       DIK_SCROLL,         VK_SCROLL,       0 },
585   { ITEM_ID_7_PAD,       DIK_NUMPAD7,      VK_NUMPAD7,    0 },
586   { ITEM_ID_8_PAD,       DIK_NUMPAD8,      VK_NUMPAD8,    0 },
587   { ITEM_ID_9_PAD,       DIK_NUMPAD9,      VK_NUMPAD9,    0 },
588   { ITEM_ID_MINUS_PAD,   DIK_SUBTRACT,      VK_SUBTRACT,    0 },
589   { ITEM_ID_4_PAD,       DIK_NUMPAD4,      VK_NUMPAD4,    0 },
590   { ITEM_ID_5_PAD,       DIK_NUMPAD5,      VK_NUMPAD5,    0 },
591   { ITEM_ID_6_PAD,       DIK_NUMPAD6,      VK_NUMPAD6,    0 },
592   { ITEM_ID_PLUS_PAD,    DIK_ADD,         VK_ADD,       0 },
593   { ITEM_ID_1_PAD,       DIK_NUMPAD1,      VK_NUMPAD1,    0 },
594   { ITEM_ID_2_PAD,       DIK_NUMPAD2,      VK_NUMPAD2,    0 },
595   { ITEM_ID_3_PAD,       DIK_NUMPAD3,      VK_NUMPAD3,    0 },
596   { ITEM_ID_0_PAD,       DIK_NUMPAD0,      VK_NUMPAD0,    0 },
597   { ITEM_ID_DEL_PAD,       DIK_DECIMAL,      VK_DECIMAL,    0 },
598   { ITEM_ID_F11,          DIK_F11,         VK_F11,       0 },
599   { ITEM_ID_F12,          DIK_F12,         VK_F12,       0 },
600   { ITEM_ID_F13,          DIK_F13,         VK_F13,       0 },
601   { ITEM_ID_F14,          DIK_F14,         VK_F14,       0 },
602   { ITEM_ID_F15,          DIK_F15,         VK_F15,       0 },
603   { ITEM_ID_ENTER_PAD,   DIK_NUMPADENTER,   VK_RETURN,       0 },
604   { ITEM_ID_RCONTROL,    DIK_RCONTROL,      VK_RCONTROL,    0 },
605   { ITEM_ID_SLASH_PAD,   DIK_DIVIDE,         VK_DIVIDE,       0 },
606   { ITEM_ID_PRTSCR,       DIK_SYSRQ,          0,             0 },
607   { ITEM_ID_RALT,       DIK_RMENU,         VK_RMENU,       0 },
608   { ITEM_ID_HOME,       DIK_HOME,         VK_HOME,       0 },
609   { ITEM_ID_UP,          DIK_UP,            VK_UP,          0 },
610   { ITEM_ID_PGUP,       DIK_PRIOR,         VK_PRIOR,       0 },
611   { ITEM_ID_LEFT,       DIK_LEFT,         VK_LEFT,       0 },
612   { ITEM_ID_RIGHT,       DIK_RIGHT,         VK_RIGHT,       0 },
613   { ITEM_ID_END,          DIK_END,         VK_END,       0 },
614   { ITEM_ID_DOWN,       DIK_DOWN,         VK_DOWN,       0 },
615   { ITEM_ID_PGDN,       DIK_NEXT,         VK_NEXT,       0 },
616   { ITEM_ID_INSERT,       DIK_INSERT,         VK_INSERT,       0 },
617   { ITEM_ID_DEL,          DIK_DELETE,         VK_DELETE,       0 },
618   { ITEM_ID_LWIN,       DIK_LWIN,         VK_LWIN,       0 },
619   { ITEM_ID_RWIN,       DIK_RWIN,         VK_RWIN,       0 },
620   { ITEM_ID_MENU,       DIK_APPS,         VK_APPS,       0 },
621   { ITEM_ID_PAUSE,       DIK_PAUSE,         VK_PAUSE,      0 },
622   { ITEM_ID_CANCEL,      0,               VK_CANCEL,      0 },
623};
624
625
626
627typedef struct
628{
629   char      name[40];       // functionality name (optional)
630   input_seq   is;            // the input sequence (the keys pressed)
631   UINT      func_id;        // the identifier
632   input_seq* (*getiniptr)(void);// pointer to function to get the value from .ini file
633} GUISequence;
634
635static GUISequence GUISequenceControl[]=
636{
637   {"gui_key_up",                SEQ_DEF_0,    ID_UI_UP,           Get_ui_key_up },
638   {"gui_key_down",              SEQ_DEF_0,    ID_UI_DOWN,         Get_ui_key_down },
639   {"gui_key_left",              SEQ_DEF_0,    ID_UI_LEFT,         Get_ui_key_left },
640   {"gui_key_right",             SEQ_DEF_0,    ID_UI_RIGHT,        Get_ui_key_right },
641   {"gui_key_start",             SEQ_DEF_0,    ID_UI_START,        Get_ui_key_start },
642   {"gui_key_pgup",              SEQ_DEF_0,    ID_UI_PGUP,         Get_ui_key_pgup },
643   {"gui_key_pgdwn",             SEQ_DEF_0,    ID_UI_PGDOWN,       Get_ui_key_pgdwn },
644   {"gui_key_home",              SEQ_DEF_0,    ID_UI_HOME,         Get_ui_key_home },
645   {"gui_key_end",               SEQ_DEF_0,    ID_UI_END,          Get_ui_key_end },
646   {"gui_key_ss_change",         SEQ_DEF_0,    IDC_SSFRAME,        Get_ui_key_ss_change },
647   {"gui_key_history_up",        SEQ_DEF_0,    ID_UI_HISTORY_UP,   Get_ui_key_history_up },
648   {"gui_key_history_down",      SEQ_DEF_0,    ID_UI_HISTORY_DOWN, Get_ui_key_history_down },
649   
650   {"gui_key_context_filters",    SEQ_DEF_0,    ID_CONTEXT_FILTERS,       Get_ui_key_context_filters },
651   {"gui_key_select_random",      SEQ_DEF_0,    ID_CONTEXT_SELECT_RANDOM, Get_ui_key_select_random },
652   {"gui_key_game_audit",         SEQ_DEF_0,    ID_GAME_AUDIT,            Get_ui_key_game_audit },
653   {"gui_key_game_properties",    SEQ_DEF_0,    ID_GAME_PROPERTIES,       Get_ui_key_game_properties },
654   {"gui_key_help_contents",      SEQ_DEF_0,    ID_HELP_CONTENTS,         Get_ui_key_help_contents },
655   {"gui_key_update_gamelist",    SEQ_DEF_0,    ID_UPDATE_GAMELIST,       Get_ui_key_update_gamelist },
656   {"gui_key_view_folders",       SEQ_DEF_0,    ID_VIEW_FOLDERS,          Get_ui_key_view_folders },
657   {"gui_key_view_fullscreen",    SEQ_DEF_0,    ID_VIEW_FULLSCREEN,       Get_ui_key_view_fullscreen },
658   {"gui_key_view_pagetab",       SEQ_DEF_0,    ID_VIEW_PAGETAB,          Get_ui_key_view_pagetab },
659   {"gui_key_view_picture_area",  SEQ_DEF_0,    ID_VIEW_PICTURE_AREA,     Get_ui_key_view_picture_area },
660   {"gui_key_view_status",        SEQ_DEF_0,    ID_VIEW_STATUS,           Get_ui_key_view_status },
661   {"gui_key_view_toolbars",      SEQ_DEF_0,    ID_VIEW_TOOLBARS,         Get_ui_key_view_toolbars },
662
663   {"gui_key_view_tab_cabinet",     SEQ_DEF_0,  ID_VIEW_TAB_CABINET,       Get_ui_key_view_tab_cabinet },
664   {"gui_key_view_tab_cpanel",      SEQ_DEF_0,  ID_VIEW_TAB_CONTROL_PANEL, Get_ui_key_view_tab_cpanel },
665   {"gui_key_view_tab_flyer",       SEQ_DEF_0,  ID_VIEW_TAB_FLYER,         Get_ui_key_view_tab_flyer },
666   {"gui_key_view_tab_history",     SEQ_DEF_0,  ID_VIEW_TAB_HISTORY,       Get_ui_key_view_tab_history },
667   {"gui_key_view_tab_marquee",     SEQ_DEF_0,  ID_VIEW_TAB_MARQUEE,       Get_ui_key_view_tab_marquee },
668   {"gui_key_view_tab_screenshot",  SEQ_DEF_0,  ID_VIEW_TAB_SCREENSHOT,    Get_ui_key_view_tab_screenshot },
669   {"gui_key_view_tab_title",       SEQ_DEF_0,  ID_VIEW_TAB_TITLE,         Get_ui_key_view_tab_title },
670   {"gui_key_view_tab_pcb",         SEQ_DEF_0,  ID_VIEW_TAB_PCB,          Get_ui_key_view_tab_pcb },
671   {"gui_key_quit",                 SEQ_DEF_0,  ID_FILE_EXIT,              Get_ui_key_quit },
672};
673
674
675#define NUM_GUI_SEQUENCES (sizeof(GUISequenceControl) / sizeof(GUISequenceControl[0]))
676
677
678static UINT    lastColumnClick   = 0;
679static WNDPROC g_lpHistoryWndProc = NULL;
680static WNDPROC g_lpPictureFrameWndProc = NULL;
681static WNDPROC g_lpPictureWndProc = NULL;
682
683static POPUPSTRING popstr[MAX_MENUS + 1];
684
685/* Tool and Status bar variables */
686static HWND hStatusBar = 0;
687static HWND hToolBar   = 0;
688
689/* Column Order as Displayed */
690static BOOL oldControl = FALSE;
691static BOOL xpControl = FALSE;
692
693/* Used to recalculate the main window layout */
694static int  bottomMargin;
695static int  topMargin;
696static int  have_history = FALSE;
697
698static BOOL have_selection = FALSE;
699
700static HBITMAP hMissing_bitmap;
701
702/* Icon variables */
703static HIMAGELIST   hLarge = NULL;
704static HIMAGELIST   hSmall = NULL;
705static HIMAGELIST   hHeaderImages = NULL;
706static int          *icon_index = NULL; /* for custom per-game icons */
707
708static TBBUTTON tbb[] =
709{
710   {0, ID_VIEW_FOLDERS,    TBSTATE_ENABLED, TBSTYLE_CHECK,      {0, 0}, 0, 0},
711   {1, ID_VIEW_PICTURE_AREA,TBSTATE_ENABLED, TBSTYLE_CHECK,      {0, 0}, 0, 1},
712   {0, 0,                  TBSTATE_ENABLED, TBSTYLE_SEP,        {0, 0}, 0, 0},
713   {2, ID_VIEW_LARGE_ICON, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 2},
714   {3, ID_VIEW_SMALL_ICON, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 3},
715   {4, ID_VIEW_LIST_MENU,  TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 4},
716   {5, ID_VIEW_DETAIL,     TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 5},
717   {6, ID_VIEW_GROUPED, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 6},
718   {0, 0,                  TBSTATE_ENABLED, TBSTYLE_SEP,        {0, 0}, 0, 0},
719   {7, ID_HELP_ABOUT,      TBSTATE_ENABLED, TBSTYLE_BUTTON,     {0, 0}, 0, 7},
720   {8, ID_HELP_CONTENTS,   TBSTATE_ENABLED, TBSTYLE_BUTTON,     {0, 0}, 0, 8}
721};
722
723#define NUM_TOOLBUTTONS (sizeof(tbb) / sizeof(tbb[0]))
724
725#define NUM_TOOLTIPS 8
726
727static const TCHAR szTbStrings[NUM_TOOLTIPS + 1][30] =
728{
729   TEXT("Toggle Folder List"),
730   TEXT("Toggle Screen Shot"),
731   TEXT("Large Icons"),
732   TEXT("Small Icons"),
733   TEXT("List"),
734   TEXT("Details"),
735   TEXT("Grouped"),
736   TEXT("About"),
737   TEXT("Help")
738};
739
740static const int CommandToString[] =
741{
742   ID_VIEW_FOLDERS,
743   ID_VIEW_PICTURE_AREA,
744   ID_VIEW_LARGE_ICON,
745   ID_VIEW_SMALL_ICON,
746   ID_VIEW_LIST_MENU,
747   ID_VIEW_DETAIL,
748   ID_VIEW_GROUPED,
749   ID_HELP_ABOUT,
750   ID_HELP_CONTENTS,
751   -1
752};
753
754static const int s_nPickers[] =
755{
756   IDC_LIST
757#ifdef MESS
758   ,IDC_SWLIST
759#endif
760};
761
762/* How to resize main window */
763static ResizeItem main_resize_items[] =
764{
765   { RA_HWND, { 0 },            FALSE, RA_LEFT  | RA_RIGHT  | RA_TOP,     NULL },
766   { RA_HWND, { 0 },            FALSE, RA_LEFT  | RA_RIGHT  | RA_BOTTOM,  NULL },
767   { RA_ID,   { IDC_DIVIDER },  FALSE, RA_LEFT  | RA_RIGHT  | RA_TOP,     NULL },
768   { RA_ID,   { IDC_TREE },     TRUE,   RA_LEFT  | RA_BOTTOM | RA_TOP,     NULL },
769   { RA_ID,   { IDC_LIST },     TRUE,   RA_ALL,                            NULL },
770   { RA_ID,   { IDC_SPLITTER }, FALSE,   RA_LEFT  | RA_BOTTOM | RA_TOP,     NULL },
771   { RA_ID,   { IDC_SPLITTER2 },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
772   { RA_ID,   { IDC_SSFRAME },  FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
773   { RA_ID,   { IDC_SSPICTURE },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
774   { RA_ID,   { IDC_HISTORY },  TRUE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
775   { RA_ID,   { IDC_SSTAB },    FALSE,   RA_RIGHT | RA_TOP,                 NULL },
776#ifdef MESS
777   { RA_ID,   { IDC_SWLIST },    TRUE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
778   { RA_ID,   { IDC_SPLITTER3 },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
779#endif /* MESS */
780   { RA_END,  { 0 },            FALSE, 0,                                 NULL }
781};
782
783static Resize main_resize = { {0, 0, 0, 0}, main_resize_items };
784
785/* last directory for common file dialogs */
786TCHAR last_directory[MAX_PATH];
787
788/* system-wide window message sent out with an ATOM of the current game name
789   each time it changes */
790static UINT g_mame32_message = 0;
791static BOOL g_bDoBroadcast   = FALSE;
792
793static BOOL use_gui_romloading = FALSE;
794
795static BOOL g_listview_dragging = FALSE;
796HIMAGELIST himl_drag;
797int game_dragged; /* which game started the drag */
798HTREEITEM prev_drag_drop_target; /* which tree view item we're currently highlighting */
799
800static BOOL g_in_treeview_edit = FALSE;
801
802typedef struct
803{
804    const char *name;
805    int index;
806} driver_data_type;
807static driver_data_type *sorted_drivers;
808
809/***************************************************************************
810    Global variables
811 ***************************************************************************/
812
813/* Background Image handles also accessed from TreeView.c */
814static HPALETTE         hPALbg   = 0;
815static HBITMAP          hBackground  = 0;
816static MYBITMAPINFO     bmDesc;
817
818/* List view Column text */
819LPCTSTR column_names[COLUMN_MAX] =
820{
821#ifdef MESS
822   TEXT("System"),
823#else
824   TEXT("Game"),
825#endif
826   TEXT("Screen"),
827   //TEXT("ROMs"),
828   TEXT("Samples"),
829   TEXT("Directory"),
830   TEXT("Type"),
831   TEXT("Trackball"),
832   TEXT("Played"),
833   TEXT("Manufacturer"),
834   TEXT("Year"),
835   TEXT("Clone Of"),
836   TEXT("Source"),
837   TEXT("Play Time")
838};
839
840/***************************************************************************
841    Message Macros
842 ***************************************************************************/
843
844#ifndef StatusBar_GetItemRect
845#define StatusBar_GetItemRect(hWnd, iPart, lpRect) \
846    SendMessage(hWnd, SB_GETRECT, (WPARAM) iPart, (LPARAM) (LPRECT) lpRect)
847#endif
848
849#ifndef ToolBar_CheckButton
850#define ToolBar_CheckButton(hWnd, idButton, fCheck) \
851    SendMessage(hWnd, TB_CHECKBUTTON, (WPARAM)idButton, (LPARAM)MAKELONG(fCheck, 0))
852#endif
853
854/***************************************************************************
855    External functions
856 ***************************************************************************/
857#if 0
858static void CopyOptions(core_options *pDestOpts, core_options *pSourceOpts)
859{
860   options_enumerator *enumerator;
861   const char *option_name;
862   const char *option_value;
863
864   enumerator = options_enumerator_begin(pSourceOpts);
865   if (enumerator != NULL)
866   {
867      while((option_name = options_enumerator_next(enumerator)) != NULL)
868      {
869         option_value = options_get_string(pSourceOpts, option_name);
870         if (option_value != NULL)
871         {
872            dprintf("CopyOptions(): Copying %s = \"%s\"\n", option_name, option_value);
873            options_set_string(pDestOpts, option_name, option_value, OPTION_PRIORITY_CMDLINE);
874         }
875      }
876      options_enumerator_free(enumerator);
877   }
878}
879
880static BOOL WaitWithMessageLoop(HANDLE hEvent)
881{
882   DWORD dwRet;
883   MSG   msg;
884
885   while (1)
886   {
887      dwRet = MsgWaitForMultipleObjects(1, &hEvent, FALSE, INFINITE, QS_ALLINPUT);
888
889      if (dwRet == WAIT_OBJECT_0)
890         return TRUE;
891
892      if (dwRet != WAIT_OBJECT_0 + 1)
893         break;
894
895      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
896      {
897         TranslateMessage(&msg);
898         DispatchMessage(&msg);
899         if (WaitForSingleObject(hEvent, 0) == WAIT_OBJECT_0)
900            return TRUE;
901      }
902   }
903   return FALSE;
904}
905#endif
906
907static DWORD RunMAME(int nGameIndex, const play_options *playopts)
908{
909   time_t start, end;
910   double elapsedtime;
911   DWORD dwExitCode = 0;
912   int i;
913   core_options *mame_opts;
914
915   // set up MAME options
916   mame_opts = mame_options_init(mame_win_options);
917
918   // Tell mame were to get the INIs
919   options_set_string(mame_opts, OPTION_INIPATH, GetIniDir(), OPTION_PRIORITY_CMDLINE);
920
921#ifdef MESS
922   // add MESS specific device options
923   mess_add_device_options(mame_opts, drivers[nGameIndex]);
924#endif // MESS
925
926   // set any specified play options
927   if (playopts != NULL)
928   {
929      if (playopts->record != NULL)
930         options_set_string(mame_opts, OPTION_RECORD, playopts->record, OPTION_PRIORITY_CMDLINE);
931      if (playopts->playback != NULL)
932         options_set_string(mame_opts, OPTION_PLAYBACK, playopts->playback, OPTION_PRIORITY_CMDLINE);
933      if (playopts->state != NULL)
934         options_set_string(mame_opts, OPTION_STATE, playopts->state, OPTION_PRIORITY_CMDLINE);
935      if (playopts->wavwrite != NULL)
936         options_set_string(mame_opts, OPTION_WAVWRITE, playopts->wavwrite, OPTION_PRIORITY_CMDLINE);
937      if (playopts->mngwrite != NULL)
938         options_set_string(mame_opts, OPTION_MNGWRITE, playopts->mngwrite, OPTION_PRIORITY_CMDLINE);
939   }
940
941   // Mame will parse all the needed .ini files.
942
943   // prepare MAME32 to run the game
944   ShowWindow(hMain, SW_HIDE);
945
946   for (i = 0; i < ARRAY_LENGTH(s_nPickers); i++)
947      Picker_ClearIdle(GetDlgItem(hMain, s_nPickers[i]));
948
949   // run the emulation
950   options_set_string(mame_opts, OPTION_GAMENAME, drivers[nGameIndex]->name, OPTION_PRIORITY_CMDLINE);
951   // Time the game run.
952   time(&start);
953   mame_execute(mame_opts);
954   // Calc the duration
955   time(&end);
956   elapsedtime = end - start;
957   // Increment our playtime.
958   IncrementPlayTime(nGameIndex, elapsedtime);
959   // the emulation is complete; continue
960   for (i = 0; i < ARRAY_LENGTH(s_nPickers); i++)
961      Picker_ResetIdle(GetDlgItem(hMain, s_nPickers[i]));
962   ShowWindow(hMain, SW_SHOW);
963   SetForegroundWindow(hMain);
964
965   return dwExitCode;
966}
967
968int Mame32Main(HINSTANCE    hInstance,
969                   LPSTR        lpCmdLine,
970                   int          nCmdShow)
971{
972   dprintf("MAME32 starting\n");
973
974   use_gui_romloading = TRUE;
975
976   if (__argc != 1)
977   {
978      /* Rename main because gcc will use it instead of WinMain even with -mwindows */
979      extern int DECL_SPEC mame_main(int, char**);
980      exit(mame_main(__argc, __argv));
981   }
982   if (!Win32UI_init(hInstance, lpCmdLine, nCmdShow))
983      return 1;
984
985   // pump message, but quit on WM_QUIT
986   while(PumpMessage())
987      ;
988
989   Win32UI_exit();
990   return 0;
991}
992
993
994HWND GetMainWindow(void)
995{
996   return hMain;
997}
998
999HWND GetTreeView(void)
1000{
1001   return hTreeView;
1002}
1003
1004HIMAGELIST GetLargeImageList(void)
1005{
1006   return hLarge;
1007}
1008
1009HIMAGELIST GetSmallImageList(void)
1010{
1011   return hSmall;
1012}
1013
1014object_pool *GetMame32MemoryPool(void)
1015{
1016   return mame32_pool;
1017}
1018
1019void GetRealColumnOrder(int order[])
1020{
1021   int tmpOrder[COLUMN_MAX];
1022   int nColumnMax;
1023   int i;
1024
1025   nColumnMax = Picker_GetNumColumns(hwndList);
1026
1027   /* Get the Column Order and save it */
1028   if (!oldControl)
1029   {
1030      ListView_GetColumnOrderArray(hwndList, nColumnMax, tmpOrder);
1031
1032      for (i = 0; i < nColumnMax; i++)
1033      {
1034         order[i] = Picker_GetRealColumnFromViewColumn(hwndList, tmpOrder[i]);
1035      }
1036   }
1037}
1038
1039/*
1040 * PURPOSE: Format raw data read from an ICO file to an HICON
1041 * PARAMS:  PBYTE ptrBuffer  - Raw data from an ICO file
1042 *          UINT nBufferSize - Size of buffer ptrBuffer
1043 * RETURNS: HICON - handle to the icon, NULL for failure
1044 * History: July '95 - Created
1045 *          March '00- Seriously butchered from MSDN for mine own
1046 *          purposes, sayeth H0ek.
1047 */
1048HICON FormatICOInMemoryToHICON(PBYTE ptrBuffer, UINT nBufferSize)
1049{
1050   ICONIMAGE           IconImage;
1051   LPICONDIRENTRY      lpIDE = NULL;
1052   UINT                nNumImages;
1053   UINT                nBufferIndex = 0;
1054   HICON               hIcon = NULL;
1055
1056   /* Is there a WORD? */
1057   if (nBufferSize < sizeof(WORD))
1058   {
1059      return NULL;
1060   }
1061
1062   /* Was it 'reserved' ?    (ie 0) */
1063   if ((WORD)(ptrBuffer[nBufferIndex]) != 0)
1064   {
1065      return NULL;
1066   }
1067
1068   nBufferIndex += sizeof(WORD);
1069
1070   /* Is there a WORD? */
1071   if (nBufferSize - nBufferIndex < sizeof(WORD))
1072   {
1073      return NULL;
1074   }
1075
1076   /* Was it type 1? */
1077   if ((WORD)(ptrBuffer[nBufferIndex]) != 1)
1078   {
1079      return NULL;
1080   }
1081
1082   nBufferIndex += sizeof(WORD);
1083
1084   /* Is there a WORD? */
1085   if (nBufferSize - nBufferIndex < sizeof(WORD))
1086   {
1087      return NULL;
1088   }
1089
1090   /* Then that's the number of images in the ICO file */
1091   nNumImages = (WORD)(ptrBuffer[nBufferIndex]);
1092
1093   /* Is there at least one icon in the file? */
1094   if ( nNumImages < 1 )
1095   {
1096      return NULL;
1097   }
1098
1099   nBufferIndex += sizeof(WORD);
1100
1101   /* Is there enough space for the icon directory entries? */
1102   if ((nBufferIndex + nNumImages * sizeof(ICONDIRENTRY)) > nBufferSize)
1103   {
1104      return NULL;
1105   }
1106
1107   /* Assign icon directory entries from buffer */
1108   lpIDE = (LPICONDIRENTRY)(&ptrBuffer[nBufferIndex]);
1109   nBufferIndex += nNumImages * sizeof (ICONDIRENTRY);
1110
1111   IconImage.dwNumBytes = lpIDE->dwBytesInRes;
1112
1113   /* Seek to beginning of this image */
1114   if ( lpIDE->dwImageOffset > nBufferSize )
1115   {
1116      return NULL;
1117   }
1118
1119   nBufferIndex = lpIDE->dwImageOffset;
1120
1121   /* Read it in */
1122   if ((nBufferIndex + lpIDE->dwBytesInRes) > nBufferSize)
1123   {
1124      return NULL;
1125   }
1126
1127   IconImage.lpBits = &ptrBuffer[nBufferIndex];
1128   nBufferIndex += lpIDE->dwBytesInRes;
1129#if 0  // Not sure we want odd sized icons.
1130   hIcon = CreateIconFromResourceEx(IconImage.lpBits, IconImage.dwNumBytes, TRUE, 0x00030000,
1131         (*(LPBITMAPINFOHEADER)(IconImage.lpBits)).biWidth, (*(LPBITMAPINFOHEADER)(IconImage.lpBits)).biHeight/2, 0 );
1132#endif
1133   /* It failed, odds are good we're on NT so try the non-Ex way */
1134   if (hIcon == NULL)
1135   {
1136      /* We would break on NT if we try with a 16bpp image */
1137      if (((LPBITMAPINFO)IconImage.lpBits)->bmiHeader.biBitCount != 16)
1138      {
1139         hIcon = CreateIconFromResource(IconImage.lpBits, IconImage.dwNumBytes, TRUE, 0x00030000);
1140      }
1141   }
1142   return hIcon;
1143}
1144
1145HICON LoadIconFromFile(const char *iconname)
1146{
1147   HICON hIcon = 0;
1148   struct stat file_stat;
1149   char tmpStr[MAX_PATH];
1150   char tmpIcoName[MAX_PATH];
1151   const char* sDirName = GetImgDir();
1152   PBYTE bufferPtr;
1153   zip_error ziperr;
1154   zip_file *zip;
1155   const zip_file_header *entry;
1156
1157   sprintf(tmpStr, "%s/%s.ico", GetIconsDir(), iconname);
1158   if (stat(tmpStr, &file_stat) != 0
1159   || (hIcon = win_extract_icon_utf8(hInst, tmpStr, 0)) == 0)
1160   {
1161      sprintf(tmpStr, "%s/%s.ico", sDirName, iconname);
1162      if (stat(tmpStr, &file_stat) != 0
1163      || (hIcon = win_extract_icon_utf8(hInst, tmpStr, 0)) == 0)
1164      {
1165         sprintf(tmpStr, "%s/icons.zip", GetIconsDir());
1166         sprintf(tmpIcoName, "%s.ico", iconname);
1167
1168         ziperr = zip_file_open(tmpStr, &zip);
1169         if (ziperr == ZIPERR_NONE)
1170         {
1171            entry = zip_file_first_file(zip);
1172            while(!hIcon && entry)
1173            {
1174               if (!mame_stricmp(entry->filename, tmpIcoName))
1175               {
1176                  bufferPtr = malloc(entry->uncompressed_length);
1177                  if (bufferPtr)
1178                  {
1179                     ziperr = zip_file_decompress(zip, bufferPtr, entry->uncompressed_length);
1180                     if (ziperr == ZIPERR_NONE)
1181                     {
1182                        hIcon = FormatICOInMemoryToHICON(bufferPtr, entry->uncompressed_length);
1183                     }
1184                     free(bufferPtr);
1185                  }
1186               }
1187               entry = zip_file_next_file(zip);
1188            }
1189            zip_file_close(zip);
1190         }
1191      }
1192   }
1193   return hIcon;
1194}
1195
1196/* Return the number of folders with options */
1197int GetNumOptionFolders()
1198{
1199   return optionfolder_count;
1200}
1201
1202/* Return the number of folders with options */
1203void SetNumOptionFolders(int count)
1204{
1205   optionfolder_count = count;
1206}
1207
1208/* search */
1209const char * GetSearchText(void)
1210{
1211   return g_SearchText;
1212}
1213
1214
1215/* Sets the treeview and listviews sizes in accordance with their visibility and the splitters */
1216static void ResizeTreeAndListViews(BOOL bResizeHidden)
1217{
1218   int i;
1219   int nLastWidth = 0;
1220   int nLastWidth2 = 0;
1221   int nLeftWindowWidth = 0;
1222   RECT rect;
1223   BOOL bVisible;
1224   int nLastOverlap = -1;
1225
1226   /* Size the List Control in the Picker */
1227   GetClientRect(hMain, &rect);
1228
1229   if (bShowStatusBar)
1230      rect.bottom -= bottomMargin;
1231   if (bShowToolBar)
1232      rect.top += topMargin;
1233
1234   /* Tree control */
1235   ShowWindow(GetDlgItem(hMain, IDC_TREE), bShowTree ? SW_SHOW : SW_HIDE);
1236
1237   for (i = 0; g_splitterInfo[i].nSplitterWindow; i++)
1238   {
1239      bVisible = GetWindowLong(GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow), GWL_STYLE) & WS_VISIBLE ? TRUE : FALSE;
1240      if (bResizeHidden || bVisible)
1241      {
1242         nLeftWindowWidth = nSplitterOffset[i] - SPLITTER_WIDTH/2 - nLastWidth;
1243
1244         /* special case for the rightmost pane when the screenshot is gone */
1245         if (!GetShowScreenShot() && !g_splitterInfo[i+1].nSplitterWindow)
1246            nLeftWindowWidth = rect.right - nLastWidth;
1247
1248         /* woah?  are we overlapping ourselves? */
1249         if ((nLeftWindowWidth < MIN_VIEW_WIDTH) && (i != nLastOverlap))
1250         {
1251            nLastOverlap = i;
1252            nLastWidth = nLastWidth2;
1253            nLeftWindowWidth = nSplitterOffset[i] - MIN_VIEW_WIDTH - (SPLITTER_WIDTH*3/2) - nLastWidth;
1254            i--;
1255         }
1256
1257         MoveWindow(GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow), nLastWidth, rect.top + 2,
1258            nLeftWindowWidth, (rect.bottom - rect.top) - 4 , TRUE);
1259
1260         MoveWindow(GetDlgItem(hMain, g_splitterInfo[i].nSplitterWindow), nSplitterOffset[i], rect.top + 2,
1261            SPLITTER_WIDTH, (rect.bottom - rect.top) - 4, TRUE);
1262      }
1263
1264      if (bVisible)
1265      {
1266         nLastWidth2 = nLastWidth;
1267         nLastWidth += nLeftWindowWidth + SPLITTER_WIDTH;
1268      }
1269   }
1270}
1271
1272/* Adjust the list view and screenshot button based on GetShowScreenShot() */
1273void UpdateScreenShot(void)
1274{
1275   RECT rect;
1276   int  nWidth;
1277   RECT fRect;
1278   POINT p = {0, 0};
1279
1280   /* first time through can't do this stuff */
1281   if (hwndList == NULL)
1282      return;
1283
1284   /* Size the List Control in the Picker */
1285   GetClientRect(hMain, &rect);
1286
1287   if (bShowStatusBar)
1288      rect.bottom -= bottomMargin;
1289   if (bShowToolBar)
1290      rect.top += topMargin;
1291
1292   if (GetShowScreenShot())
1293   {
1294      nWidth = nSplitterOffset[GetSplitterCount() - 1];
1295      CheckMenuItem(GetMenu(hMain),ID_VIEW_PICTURE_AREA, MF_CHECKED);
1296      ToolBar_CheckButton(hToolBar, ID_VIEW_PICTURE_AREA, MF_CHECKED);
1297   }
1298   else
1299   {
1300      nWidth = rect.right;
1301      CheckMenuItem(GetMenu(hMain),ID_VIEW_PICTURE_AREA, MF_UNCHECKED);
1302      ToolBar_CheckButton(hToolBar, ID_VIEW_PICTURE_AREA, MF_UNCHECKED);
1303   }
1304
1305   ResizeTreeAndListViews(FALSE);
1306
1307   FreeScreenShot();
1308
1309   if (have_selection)
1310   {
1311#ifdef MESS
1312      if (!g_szSelectedItem[0] || !LoadScreenShotEx(Picker_GetSelectedItem(hwndList), g_szSelectedItem,
1313         TabView_GetCurrentTab(hTabCtrl)))
1314#endif
1315      {
1316         // load and set image, or empty it if we don't have one
1317         LoadScreenShot(Picker_GetSelectedItem(hwndList), TabView_GetCurrentTab(hTabCtrl));
1318      }
1319   }
1320
1321   // figure out if we have a history or not, to place our other windows properly
1322   UpdateHistory();
1323
1324   // setup the picture area
1325
1326   if (GetShowScreenShot())
1327   {
1328      DWORD dwStyle;
1329      DWORD dwStyleEx;
1330      BOOL showing_history;
1331
1332      ClientToScreen(hMain, &p);
1333      GetWindowRect(GetDlgItem(hMain, IDC_SSFRAME), &fRect);
1334      OffsetRect(&fRect, -p.x, -p.y);
1335
1336      // show history on this tab IFF
1337      // - we have history for the game
1338      // - we're on the first tab
1339      // - we DON'T have a separate history tab
1340      showing_history = (have_history && (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() || GetHistoryTab() == TAB_ALL ) &&
1341                     GetShowTab(TAB_HISTORY) == FALSE);
1342      CalculateBestScreenShotRect(GetDlgItem(hMain, IDC_SSFRAME), &rect,showing_history);
1343         
1344      dwStyle   = GetWindowLong(GetDlgItem(hMain, IDC_SSPICTURE), GWL_STYLE);
1345      dwStyleEx = GetWindowLong(GetDlgItem(hMain, IDC_SSPICTURE), GWL_EXSTYLE);
1346         
1347      AdjustWindowRectEx(&rect, dwStyle, FALSE, dwStyleEx);
1348      MoveWindow(GetDlgItem(hMain, IDC_SSPICTURE),
1349               fRect.left  + rect.left,
1350               fRect.top   + rect.top,
1351               rect.right  - rect.left,
1352               rect.bottom - rect.top,
1353               TRUE);
1354     
1355      ShowWindow(GetDlgItem(hMain,IDC_SSPICTURE),
1356               (TabView_GetCurrentTab(hTabCtrl) != TAB_HISTORY) ? SW_SHOW : SW_HIDE);
1357      ShowWindow(GetDlgItem(hMain,IDC_SSFRAME),SW_SHOW);
1358      ShowWindow(GetDlgItem(hMain,IDC_SSTAB),bShowTabCtrl ? SW_SHOW : SW_HIDE);
1359
1360      InvalidateRect(GetDlgItem(hMain,IDC_SSPICTURE),NULL,FALSE);
1361   }
1362   else
1363   {
1364      ShowWindow(GetDlgItem(hMain,IDC_SSPICTURE),SW_HIDE);
1365      ShowWindow(GetDlgItem(hMain,IDC_SSFRAME),SW_HIDE);
1366      ShowWindow(GetDlgItem(hMain,IDC_SSTAB),SW_HIDE);
1367   }
1368
1369}
1370
1371void ResizePickerControls(HWND hWnd)
1372{
1373   RECT frameRect;
1374   RECT rect, sRect;
1375   int  nListWidth, nScreenShotWidth;
1376   static BOOL firstTime = TRUE;
1377   int  doSSControls = TRUE;
1378   int i, nSplitterCount;
1379
1380   nSplitterCount = GetSplitterCount();
1381
1382   /* Size the List Control in the Picker */
1383   GetClientRect(hWnd, &rect);
1384
1385   /* Calc the display sizes based on g_splitterInfo */
1386   if (firstTime)
1387   {
1388      RECT rWindow;
1389
1390      for (i = 0; i < nSplitterCount; i++)
1391         nSplitterOffset[i] = rect.right * g_splitterInfo[i].dPosition;
1392
1393      GetWindowRect(hStatusBar, &rWindow);
1394      bottomMargin = rWindow.bottom - rWindow.top;
1395      GetWindowRect(hToolBar, &rWindow);
1396      topMargin = rWindow.bottom - rWindow.top;
1397      /*buttonMargin = (sRect.bottom + 4); */
1398
1399      firstTime = FALSE;
1400   }
1401   else
1402   {
1403      doSSControls = GetShowScreenShot();
1404   }
1405
1406   if (bShowStatusBar)
1407      rect.bottom -= bottomMargin;
1408
1409   if (bShowToolBar)
1410      rect.top += topMargin;
1411
1412   MoveWindow(GetDlgItem(hWnd, IDC_DIVIDER), rect.left, rect.top - 4, rect.right, 2, TRUE);
1413
1414   ResizeTreeAndListViews(TRUE);
1415
1416   nListWidth = nSplitterOffset[nSplitterCount-1];
1417   nScreenShotWidth = (rect.right - nListWidth) - 4;
1418
1419   /* Screen shot Page tab control */
1420   if (bShowTabCtrl)
1421   {
1422      MoveWindow(GetDlgItem(hWnd, IDC_SSTAB), nListWidth + 4, rect.top + 2,
1423         nScreenShotWidth - 2, rect.top + 20, doSSControls);
1424      rect.top += 20;
1425   }
1426
1427   /* resize the Screen shot frame */
1428   MoveWindow(GetDlgItem(hWnd, IDC_SSFRAME), nListWidth + 4, rect.top + 2,
1429      nScreenShotWidth - 2, (rect.bottom - rect.top) - 4, doSSControls);
1430
1431   /* The screen shot controls */
1432   GetClientRect(GetDlgItem(hWnd, IDC_SSFRAME), &frameRect);
1433
1434   /* Text control - game history */
1435   sRect.left = nListWidth + 14;
1436   sRect.right = sRect.left + (nScreenShotWidth - 22);
1437
1438   
1439   if (GetShowTab(TAB_HISTORY))
1440   {
1441      // We're using the new mode, with the history filling the entire tab (almost)
1442      sRect.top = rect.top + 14;
1443      sRect.bottom = (rect.bottom - rect.top) - 30;   
1444   }
1445   else
1446   {
1447      // We're using the original mode, with the history beneath the SS picture
1448      sRect.top = rect.top + 264;
1449      sRect.bottom = (rect.bottom - rect.top) - 278;
1450   }
1451
1452   MoveWindow(GetDlgItem(hWnd, IDC_HISTORY),
1453      sRect.left, sRect.top,
1454      sRect.right - sRect.left, sRect.bottom, doSSControls);
1455
1456   /* the other screen shot controls will be properly placed in UpdateScreenshot() */
1457
1458}
1459
1460char *ModifyThe(const char *str)
1461{
1462   static int  bufno = 0;
1463   static char buffer[4][255];
1464
1465   if (strncmp(str, "The ", 4) == 0)
1466   {
1467      char *s, *p;
1468      char temp[255];
1469
1470      strcpy(temp, &str[4]);
1471
1472      bufno = (bufno + 1) % 4;
1473
1474      s = buffer[bufno];
1475
1476      /* Check for version notes in parens */
1477      p = strchr(temp, '(');
1478      if (p)
1479      {
1480         p[-1] = '\0';
1481      }
1482
1483      strcpy(s, temp);
1484      strcat(s, ", The");
1485
1486      if (p)
1487      {
1488         strcat(s, " ");
1489         strcat(s, p);
1490      }
1491
1492      return s;
1493   }
1494   return (char *)str;
1495}
1496
1497HBITMAP GetBackgroundBitmap(void)
1498{
1499   return hBackground;
1500}
1501
1502HPALETTE GetBackgroundPalette(void)
1503{
1504   return hPALbg;
1505}
1506
1507MYBITMAPINFO * GetBackgroundInfo(void)
1508{
1509   return &bmDesc;
1510}
1511
1512BOOL GetUseOldControl(void)
1513{
1514   return oldControl;
1515}
1516
1517BOOL GetUseXPControl(void)
1518{
1519   return xpControl;
1520}
1521
1522int GetMinimumScreenShotWindowWidth(void)
1523{
1524   BITMAP bmp;
1525   GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
1526
1527   return bmp.bmWidth + 6; // 6 is for a little breathing room
1528}
1529
1530
1531int GetDriverIndex(const game_driver *driver)
1532{
1533   return GetGameNameIndex(driver->name);
1534}
1535
1536int GetParentIndex(const game_driver *driver)
1537{
1538   return GetGameNameIndex(driver->parent);
1539}
1540
1541int GetParentRomSetIndex(const game_driver *driver)
1542{
1543   int nParentIndex = GetGameNameIndex(driver->parent);
1544
1545   if( nParentIndex >= 0)
1546   {
1547      if ((drivers[nParentIndex]->flags & GAME_IS_BIOS_ROOT) == 0)
1548         return nParentIndex;
1549   }
1550
1551   return -1;
1552}
1553
1554int GetGameNameIndex(const char *name)
1555{
1556   driver_data_type *driver_index_info;
1557   driver_data_type key;
1558   key.name = name;
1559
1560   // uses our sorted array of driver names to get the index in log time
1561   driver_index_info = bsearch(&key,sorted_drivers,driver_list_get_count(drivers),sizeof(driver_data_type),
1562                        DriverDataCompareFunc);
1563
1564   if (driver_index_info == NULL)
1565      return -1;
1566
1567   return driver_index_info->index;
1568
1569}
1570
1571int GetIndexFromSortedIndex(int sorted_index)
1572{
1573   return sorted_drivers[sorted_index].index;
1574}
1575
1576/***************************************************************************
1577    Internal functions
1578 ***************************************************************************/
1579
1580// used for our sorted array of game names
1581int CLIB_DECL DriverDataCompareFunc(const void *arg1,const void *arg2)
1582{
1583    return strcmp( ((driver_data_type *)arg1)->name, ((driver_data_type *)arg2)->name );
1584}
1585
1586static void ResetBackground(char *szFile)
1587{
1588   char szDestFile[MAX_PATH];
1589
1590   /* The MAME core load the .png file first, so we only need replace this file */
1591   sprintf(szDestFile, "%s\\bkground.png", GetBgDir());
1592   win_set_file_attributes_utf8(szDestFile, FILE_ATTRIBUTE_NORMAL);
1593   win_copy_file_utf8(szFile, szDestFile, FALSE);
1594}
1595
1596static void RandomSelectBackground(void)
1597{
1598   struct _finddata_t c_file;
1599   long hFile;
1600   char szFile[MAX_PATH];
1601   int count=0;
1602   const char *szDir=GetBgDir();
1603   char *buf=malloc(_MAX_FNAME * MAX_BGFILES);
1604
1605   if (buf == NULL)
1606      return;
1607
1608   sprintf(szFile, "%s\\*.bmp", szDir);
1609   hFile = _findfirst(szFile, &c_file);
1610   if (hFile != -1L)
1611   {
1612      int Done = 0;
1613      while (!Done && count < MAX_BGFILES)
1614      {
1615         memcpy(buf + count * _MAX_FNAME, c_file.name, _MAX_FNAME);
1616         count++;
1617         Done = _findnext(hFile, &c_file);
1618      }
1619      _findclose(hFile);
1620   }
1621   sprintf(szFile, "%s\\*.png", szDir);
1622   hFile = _findfirst(szFile, &c_file);
1623   if (hFile != -1L)
1624   {
1625      int Done = 0;
1626      while (!Done && count < MAX_BGFILES)
1627      {
1628         memcpy(buf + count * _MAX_FNAME, c_file.name, _MAX_FNAME);
1629         count++;
1630         Done = _findnext(hFile, &c_file);
1631      }
1632      _findclose(hFile);
1633   }
1634
1635   if (count)
1636   {
1637#ifdef rand
1638#undef rand
1639#endif
1640
1641      srand( (unsigned)time( NULL ) );
1642      sprintf(szFile, "%s\\%s", szDir, buf + (rand() % count) * _MAX_FNAME);
1643      ResetBackground(szFile);
1644   }
1645
1646   free(buf);
1647}
1648
1649void SetMainTitle(void)
1650{
1651   char version[50];
1652   char buffer[100];
1653
1654   sscanf(build_version,"%s",version);
1655   snprintf(buffer, ARRAY_LENGTH(buffer), "%s %s", MAME32NAME, version);
1656   win_set_window_text_utf8(hMain,buffer);
1657}
1658
1659static void winui_output_error(void *param, const char *format, va_list argptr)
1660{
1661   char buffer[1024];
1662
1663   // if we are in fullscreen mode, go to windowed mode
1664   if ((video_config.windowed == 0) && (win_window_list != NULL))
1665      winwindow_toggle_full_screen();
1666
1667   vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr);
1668   win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, APPNAME, MB_OK);
1669}
1670
1671static void memory_error(const char *message)
1672{
1673   win_message_box_utf8(hMain, message, APPNAME, MB_OK);
1674   exit(-1);
1675}
1676
1677static BOOL Win32UI_init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
1678{
1679   extern int mame_validitychecks(int game);
1680   WNDCLASS   wndclass;
1681   RECT      rect;
1682   int i, nSplitterCount;
1683   extern FOLDERDATA g_folderData[];
1684   extern FILTER_ITEM g_filterList[];
1685   extern const char *history_filename;
1686   extern const char *mameinfo_filename;
1687   LONG common_control_version = GetCommonControlVersion();
1688   int validity_failed = 0;
1689   TCHAR* t_inpdir;
1690   LONG_PTR l;
1691
1692   dprintf("about to init options\n");
1693   if (!OptionsInit())
1694      return FALSE;
1695   dprintf("options loaded\n");
1696
1697   srand((unsigned)time(NULL));
1698
1699   // output errors to message boxes
1700   mame_set_output_channel(OUTPUT_CHANNEL_ERROR, winui_output_error, NULL, NULL, NULL);
1701
1702   // create the memory pool
1703   mame32_pool = pool_alloc(memory_error);
1704
1705   // custom per-game icons
1706   icon_index = pool_malloc(mame32_pool, sizeof(int) * driver_list_get_count(drivers));
1707   memset(icon_index, '\0', sizeof(int) * driver_list_get_count(drivers));
1708
1709   // sorted list of drivers by name
1710   sorted_drivers = (driver_data_type *) pool_malloc(mame32_pool, sizeof(driver_data_type) * driver_list_get_count(drivers));
1711   memset(sorted_drivers, '\0', sizeof(driver_data_type) * driver_list_get_count(drivers));
1712   for (i = 0; i < driver_list_get_count(drivers); i++)
1713   {
1714      sorted_drivers[i].name = drivers[i]->name;
1715      sorted_drivers[i].index = i;
1716   }
1717   qsort(sorted_drivers, driver_list_get_count(drivers), sizeof(driver_data_type), DriverDataCompareFunc);
1718
1719   // set up window class
1720   wndclass.style         = CS_HREDRAW | CS_VREDRAW;
1721   wndclass.lpfnWndProc   = MameWindowProc;
1722   wndclass.cbClsExtra    = 0;
1723   wndclass.cbWndExtra    = DLGWINDOWEXTRA;
1724   wndclass.hInstance      = hInstance;
1725   wndclass.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAME32_ICON));
1726   wndclass.hCursor      = NULL;
1727   wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
1728   wndclass.lpszMenuName  = MAKEINTRESOURCE(IDR_UI_MENU);
1729   wndclass.lpszClassName = TEXT("MainClass");
1730
1731   RegisterClass(&wndclass);
1732
1733#ifdef MESS
1734   DevView_RegisterClass();
1735#endif //MESS
1736
1737   InitCommonControls();
1738
1739   // Are we using an Old comctl32.dll?
1740   dprintf("common controlversion %i %i",common_control_version >> 16,
1741         common_control_version & 0xffff);
1742         
1743   oldControl = (common_control_version < PACKVERSION(4,71));
1744   xpControl = (common_control_version >= PACKVERSION(6,0));
1745   if (oldControl)
1746   {
1747      char buf[] = MAME32NAME " has detected an old version of comctl32.dll\n\n"
1748                "Game Properties, many configuration options and\n"
1749                "features are not available without an updated DLL\n\n"
1750                "Please install the common control update found at:\n\n"
1751                "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp\n\n"
1752                "Would you like to continue without using the new features?\n";
1753
1754      if (IDNO == win_message_box_utf8(0, buf, MAME32NAME " Outdated comctl32.dll Warning", MB_YESNO | MB_ICONWARNING))
1755         return FALSE;
1756    }
1757
1758   g_mame32_message = RegisterWindowMessage(TEXT("MAME32"));
1759   g_bDoBroadcast = GetBroadcast();
1760
1761   HelpInit();
1762   
1763   t_inpdir = tstring_from_utf8(GetInpDir());
1764   if( ! t_inpdir )
1765      return FALSE;
1766
1767   _tcscpy(last_directory,t_inpdir);
1768   free(t_inpdir);
1769   hMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, NULL);
1770   if (hMain == NULL)
1771   {
1772      dprintf("error creating main dialog, aborting");
1773      return FALSE;
1774   }
1775
1776   s_pWatcher = DirWatcher_Init(hMain, WM_MAME32_FILECHANGED);
1777   if (s_pWatcher)
1778   {
1779      DirWatcher_Watch(s_pWatcher, 0, GetRomDirs(), TRUE);
1780      DirWatcher_Watch(s_pWatcher, 1, GetSampleDirs(), TRUE);
1781   }
1782
1783   SetMainTitle();
1784   hTabCtrl = GetDlgItem(hMain, IDC_SSTAB);
1785   
1786   {
1787      struct TabViewOptions opts;
1788
1789      static struct TabViewCallbacks s_tabviewCallbacks =
1790      {
1791         GetShowTabCtrl,         // pfnGetShowTabCtrl
1792         SetCurrentTab,         // pfnSetCurrentTab
1793         GetCurrentTab,         // pfnGetCurrentTab
1794         SetShowTab,            // pfnSetShowTab
1795         GetShowTab,            // pfnGetShowTab
1796
1797         GetImageTabShortName,   // pfnGetTabShortName
1798         GetImageTabLongName,   // pfnGetTabLongName
1799         UpdateScreenShot      // pfnOnSelectionChanged
1800      };
1801
1802      memset(&opts, 0, sizeof(opts));
1803      opts.pCallbacks = &s_tabviewCallbacks;
1804      opts.nTabCount = MAX_TAB_TYPES;
1805
1806      if (!SetupTabView(hTabCtrl, &opts))
1807         return FALSE;
1808   }
1809
1810   /* subclass history window */
1811   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_HISTORY), GWLP_WNDPROC);
1812   g_lpHistoryWndProc = (WNDPROC)l;
1813   SetWindowLongPtr(GetDlgItem(hMain, IDC_HISTORY), GWLP_WNDPROC, (LONG_PTR)HistoryWndProc);
1814
1815   /* subclass picture frame area */
1816   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_SSFRAME), GWLP_WNDPROC);
1817   g_lpPictureFrameWndProc = (WNDPROC)l;
1818   SetWindowLongPtr(GetDlgItem(hMain, IDC_SSFRAME), GWLP_WNDPROC, (LONG_PTR)PictureFrameWndProc);
1819
1820   /* subclass picture area */
1821   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_SSPICTURE), GWLP_WNDPROC);
1822   g_lpPictureWndProc = (WNDPROC)l;
1823   SetWindowLongPtr(GetDlgItem(hMain, IDC_SSPICTURE), GWLP_WNDPROC, (LONG_PTR)PictureWndProc);
1824
1825   /* Load the pic for the default screenshot. */
1826   hMissing_bitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT));
1827
1828   /* Stash hInstance for later use */
1829   hInst = hInstance;
1830
1831   hToolBar   = InitToolbar(hMain);
1832   hStatusBar = InitStatusBar(hMain);
1833   hProgWnd   = InitProgressBar(hStatusBar);
1834
1835   main_resize_items[0].u.hwnd = hToolBar;
1836   main_resize_items[1].u.hwnd = hStatusBar;
1837
1838   /* In order to handle 'Large Fonts' as the Windows
1839    * default setting, we need to make the dialogs small
1840    * enough to fit in our smallest window size with
1841    * large fonts, then resize the picker, tab and button
1842    * controls to fill the window, no matter which font
1843    * is currently set.  This will still look like bad
1844    * if the user uses a bigger default font than 125%
1845    * (Large Fonts) on the Windows display setting tab.
1846    *
1847    * NOTE: This has to do with Windows default font size
1848    * settings, NOT our picker font size.
1849    */
1850
1851   GetClientRect(hMain, &rect);
1852
1853   hTreeView = GetDlgItem(hMain, IDC_TREE);
1854   hwndList  = GetDlgItem(hMain, IDC_LIST);
1855
1856   history_filename = mame_strdup(GetHistoryFileName());
1857   mameinfo_filename = mame_strdup(GetMAMEInfoFileName());
1858
1859   if (!InitSplitters())
1860      return FALSE;
1861
1862   nSplitterCount = GetSplitterCount();
1863   for (i = 0; i < nSplitterCount; i++)
1864   {
1865      HWND hWnd;
1866      HWND hWndLeft;
1867      HWND hWndRight;
1868
1869      hWnd = GetDlgItem(hMain, g_splitterInfo[i].nSplitterWindow);
1870      hWndLeft = GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow);
1871      hWndRight = GetDlgItem(hMain, g_splitterInfo[i].nRightWindow);
1872
1873      AddSplitter(hWnd, hWndLeft, hWndRight, g_splitterInfo[i].pfnAdjust);
1874   }
1875
1876   /* Initial adjustment of controls on the Picker window */
1877   ResizePickerControls(hMain);
1878
1879   TabView_UpdateSelection(hTabCtrl);
1880
1881   bDoGameCheck = GetGameCheck();
1882   idle_work    = TRUE;
1883   game_index   = 0;
1884
1885   bShowTree      = GetShowFolderList();
1886   bShowToolBar   = GetShowToolBar();
1887   bShowStatusBar = GetShowStatusBar();
1888   bShowTabCtrl   = GetShowTabCtrl();
1889
1890   CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
1891   ToolBar_CheckButton(hToolBar, ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
1892   CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
1893   ShowWindow(hToolBar, (bShowToolBar) ? SW_SHOW : SW_HIDE);
1894   CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
1895   ShowWindow(hStatusBar, (bShowStatusBar) ? SW_SHOW : SW_HIDE);
1896   CheckMenuItem(GetMenu(hMain), ID_VIEW_PAGETAB, (bShowTabCtrl) ? MF_CHECKED : MF_UNCHECKED);
1897
1898   if (oldControl)
1899   {
1900      EnableMenuItem(GetMenu(hMain), ID_CUSTOMIZE_FIELDS, MF_GRAYED);
1901      EnableMenuItem(GetMenu(hMain), ID_GAME_PROPERTIES,   MF_GRAYED);
1902      EnableMenuItem(GetMenu(hMain), ID_OPTIONS_DEFAULTS, MF_GRAYED);
1903   }
1904
1905   /* Init DirectDraw */
1906   if (!DirectDraw_Initialize())
1907   {
1908      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIRECTX), NULL, DirectXDialogProc);
1909      return FALSE;
1910   }
1911
1912   if (GetRandomBackground())
1913      RandomSelectBackground();
1914
1915   LoadBackgroundBitmap();
1916
1917   dprintf("about to init tree");
1918   InitTree(g_folderData, g_filterList);
1919   dprintf("did init tree");
1920
1921   /* Initialize listview columns */
1922#ifdef MESS
1923   InitMessPicker();
1924#endif
1925   InitListView();
1926   SetFocus(hwndList);
1927
1928   /* Reset the font */
1929   {
1930      LOGFONT logfont;
1931
1932      GetListFont(&logfont);
1933      hFont = CreateFontIndirect(&logfont);
1934      if (hFont != NULL)
1935         SetAllWindowsFont(hMain, &main_resize, hFont, FALSE);
1936   }
1937
1938   /* Init DirectInput */
1939   if (!DirectInputInitialize())
1940   {
1941      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIRECTX), NULL, DirectXDialogProc);
1942      return FALSE;
1943   }
1944
1945   AdjustMetrics();
1946   UpdateScreenShot();
1947
1948   hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_TAB_KEYS));
1949
1950   /* clear keyboard state */
1951   KeyboardStateClear();
1952
1953   for (i = 0; i < NUM_GUI_SEQUENCES; i++)
1954   {
1955      input_seq *is1;
1956      input_seq *is2;
1957      is1 = &(GUISequenceControl[i].is);
1958      is2 = GUISequenceControl[i].getiniptr();
1959      // FIXME
1960      //input_seq_copy(is1, is2);
1961      //dprintf("seq =%s is: %4i %4i %4i %4i\n",GUISequenceControl[i].name, (*is1)[0], (*is1)[1], (*is1)[2], (*is1)[3]);
1962   }
1963
1964   if (GetJoyGUI() == TRUE)
1965   {
1966      g_pJoyGUI = &DIJoystick;
1967      if (g_pJoyGUI->init() != 0)
1968         g_pJoyGUI = NULL;
1969      else
1970         SetTimer(hMain, JOYGUI_TIMER, JOYGUI_MS, NULL);
1971   }
1972   else
1973      g_pJoyGUI = NULL;
1974
1975   if (GetHideMouseOnStartup())
1976   {   
1977      /*  For some reason the mouse is centered when a game is exited, which of
1978         course causes a WM_MOUSEMOVE event that shows the mouse. So we center
1979         it now, before the startup coords are initilized, and that way the mouse
1980         will still be hidden when exiting from a game (i hope) :)
1981      */     
1982      SetCursorPos(GetSystemMetrics(SM_CXSCREEN)/2,GetSystemMetrics(SM_CYSCREEN)/2);
1983     
1984      // Then hide it
1985      ShowCursor(FALSE);
1986   }
1987
1988   dprintf("about to show window\n");
1989
1990   nCmdShow = GetWindowState();
1991   if (nCmdShow == SW_HIDE || nCmdShow == SW_MINIMIZE || nCmdShow == SW_SHOWMINIMIZED)
1992   {
1993      nCmdShow = SW_RESTORE;
1994   }
1995
1996   if (GetRunFullScreen())
1997   {
1998      LONG lMainStyle;
1999
2000      // Remove menu
2001      SetMenu(hMain,NULL);
2002
2003      // Frameless dialog (fake fullscreen)
2004      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
2005      lMainStyle = lMainStyle & (WS_BORDER ^ 0xffffffff);
2006      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
2007
2008      nCmdShow = SW_MAXIMIZE;
2009   }
2010
2011   ShowWindow(hMain, nCmdShow);
2012
2013   
2014   switch (GetViewMode())
2015   {
2016   case VIEW_LARGE_ICONS :
2017      SetView(ID_VIEW_LARGE_ICON);
2018      break;
2019   case VIEW_SMALL_ICONS :
2020      SetView(ID_VIEW_SMALL_ICON);
2021      break;
2022   case VIEW_INLIST :
2023      SetView(ID_VIEW_LIST_MENU);
2024      break;
2025   case VIEW_REPORT :
2026      SetView(ID_VIEW_DETAIL);
2027      break;
2028   case VIEW_GROUPED :
2029   default :
2030      SetView(ID_VIEW_GROUPED);
2031      break;
2032   }
2033
2034   if (GetCycleScreenshot() > 0)
2035   {
2036      SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL); //scale to Seconds
2037   }
2038
2039   if (validity_failed)
2040   {
2041      win_message_box_utf8(hMain, MAMENAME " has failed its validity checks.  The GUI will "
2042         "still work, but emulations will fail to execute", MAMENAME, MB_OK);
2043   }
2044
2045   return TRUE;
2046}
2047
2048
2049static void Win32UI_exit()
2050{
2051    if (g_bDoBroadcast == TRUE)
2052    {
2053        ATOM a = GlobalAddAtom(TEXT(""));
2054        SendMessage(HWND_BROADCAST, g_mame32_message, a, a);
2055        GlobalDeleteAtom(a);
2056    }
2057
2058   if (g_pJoyGUI != NULL)
2059      g_pJoyGUI->exit();
2060
2061   /* Free GDI resources */
2062
2063   if (hMissing_bitmap)
2064   {
2065      DeleteObject(hMissing_bitmap);
2066      hMissing_bitmap = NULL;
2067   }
2068
2069   if (hBackground)
2070   {
2071      DeleteObject(hBackground);
2072      hBackground = NULL;
2073   }
2074   
2075   if (hPALbg)
2076   {
2077      DeleteObject(hPALbg);
2078      hPALbg = NULL;
2079   }
2080   
2081   if (hFont)
2082   {
2083      DeleteObject(hFont);
2084      hFont = NULL;
2085   }
2086   
2087   DestroyIcons();
2088
2089   DestroyAcceleratorTable(hAccel);
2090
2091   DirectInputClose();
2092   DirectDraw_Close();
2093
2094   SetSavedFolderID(GetCurrentFolderID());
2095
2096   SaveOptions();
2097
2098   FreeFolders();
2099
2100    /* DestroyTree(hTreeView); */
2101
2102   FreeScreenShot();
2103
2104   OptionsExit();
2105
2106   HelpExit();
2107
2108   pool_free(mame32_pool);
2109   mame32_pool = NULL;
2110}
2111
2112static LRESULT CALLBACK MameWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
2113{
2114   MINMAXINFO   *mminfo;
2115   int       i;
2116   TCHAR szClass[128];
2117
2118   switch (message)
2119   {
2120   case WM_CTLCOLORSTATIC:
2121      if (hBackground && (HWND)lParam == GetDlgItem(hMain, IDC_HISTORY))
2122      {
2123         static HBRUSH hBrush=0;
2124         HDC hDC=(HDC)wParam;
2125         LOGBRUSH lb;
2126
2127         if (hBrush)
2128            DeleteObject(hBrush);
2129         lb.lbStyle  = BS_HOLLOW;
2130         hBrush = CreateBrushIndirect(&lb);
2131         SetBkMode(hDC, TRANSPARENT);
2132         SetTextColor(hDC, GetListFontColor());
2133         return (LRESULT) hBrush;
2134      }
2135      break;
2136
2137   case WM_INITDIALOG:
2138      /* Initialize info for resizing subitems */
2139      GetClientRect(hWnd, &main_resize.rect);
2140      return TRUE;
2141
2142   case WM_SETFOCUS:
2143      SetFocus(hwndList);
2144      break;
2145
2146   case WM_SETTINGCHANGE:
2147      AdjustMetrics();
2148      return 0;
2149
2150   case WM_SIZE:
2151      OnSize(hWnd, wParam, LOWORD(lParam), HIWORD(wParam));
2152      return TRUE;
2153
2154   case WM_MENUSELECT:
2155      return Statusbar_MenuSelect(hWnd, wParam, lParam);
2156
2157   case MM_PLAY_GAME:
2158      MamePlayGame();
2159      return TRUE;
2160
2161   case WM_INITMENUPOPUP:
2162      UpdateMenu(GetMenu(hWnd));
2163      break;
2164
2165   case WM_CONTEXTMENU:
2166      if (HandleTreeContextMenu(hWnd, wParam, lParam)
2167      ||   HandleScreenShotContextMenu(hWnd, wParam, lParam))
2168         return FALSE;
2169      break;
2170
2171   case WM_COMMAND:
2172      return MameCommand(hWnd,(int)(LOWORD(wParam)),(HWND)(lParam),(UINT)HIWORD(wParam));
2173
2174   case WM_GETMINMAXINFO:
2175      /* Don't let the window get too small; it can break resizing */
2176      mminfo = (MINMAXINFO *) lParam;
2177      mminfo->ptMinTrackSize.x = MIN_WIDTH;
2178      mminfo->ptMinTrackSize.y = MIN_HEIGHT;
2179      return 0;
2180
2181   case WM_TIMER:
2182      switch (wParam)
2183      {
2184      case JOYGUI_TIMER:
2185         PollGUIJoystick();
2186         break;
2187      case SCREENSHOT_TIMER:
2188         TabView_CalculateNextTab(hTabCtrl);
2189         UpdateScreenShot();
2190         TabView_UpdateSelection(hTabCtrl);
2191         break;
2192      default:
2193         break;
2194      }
2195      return TRUE;
2196
2197   case WM_CLOSE:
2198      {
2199         /* save current item */
2200         RECT rect;
2201         AREA area;
2202         int nItem;
2203         WINDOWPLACEMENT wndpl;
2204         UINT state;
2205
2206         wndpl.length = sizeof(WINDOWPLACEMENT);
2207         GetWindowPlacement(hMain, &wndpl);
2208         state = wndpl.showCmd;
2209
2210         /* Restore the window before we attempt to save parameters,
2211          * This fixed the lost window on startup problem, among other problems
2212          */
2213         if (state == SW_MINIMIZE || state == SW_SHOWMINIMIZED || state == SW_MAXIMIZE)
2214         {
2215            if( wndpl.flags & WPF_RESTORETOMAXIMIZED || state == SW_MAXIMIZE)
2216               state = SW_MAXIMIZE;
2217            else
2218            {
2219               state = SW_RESTORE;
2220               ShowWindow(hWnd, SW_RESTORE);
2221            }
2222         }
2223         for (i = 0; i < GetSplitterCount(); i++)
2224            SetSplitterPos(i, nSplitterOffset[i]);
2225         SetWindowState(state);
2226
2227         for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
2228            Picker_SaveColumnWidths(GetDlgItem(hMain, s_nPickers[i]));
2229
2230         GetWindowRect(hWnd, &rect);
2231         area.x      = rect.left;
2232         area.y      = rect.top;
2233         area.width   = rect.right  - rect.left;
2234         area.height = rect.bottom - rect.top;
2235         SetWindowArea(&area);
2236
2237         /* Save the users current game options and default game */
2238         nItem = Picker_GetSelectedItem(hwndList);
2239         SetDefaultGame(ModifyThe(drivers[nItem]->name));
2240
2241         /* hide window to prevent orphan empty rectangles on the taskbar */
2242         /* ShowWindow(hWnd,SW_HIDE); */
2243            DestroyWindow( hWnd );
2244
2245         /* PostQuitMessage(0); */
2246         break;
2247      }
2248
2249   case WM_DESTROY:
2250        PostQuitMessage(0);
2251      return 0;
2252
2253   case WM_LBUTTONDOWN:
2254      OnLButtonDown(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2255      break;
2256
2257      /*
2258        Check to see if the mouse has been moved by the user since
2259        startup. I'd like this checking to be done only in the
2260        main WinProc (here), but somehow the WM_MOUSEDOWN messages
2261        are eaten up before they reach MameWindowProc. That's why
2262        there is one check for each of the subclassed windows too.
2263   
2264        POSSIBLE BUGS:
2265        I've included this check in the subclassed windows, but a
2266        mose move in either the title bar, the menu, or the
2267        toolbar will not generate a WM_MOUSEOVER message. At least
2268        not one that I know how to pick up. A solution could maybe
2269        be to subclass those too, but that's too much work :)
2270      */
2271     
2272   case WM_MOUSEMOVE:
2273   {
2274      if (MouseHasBeenMoved())
2275         ShowCursor(TRUE);
2276     
2277      if (g_listview_dragging)
2278         MouseMoveListViewDrag(MAKEPOINTS(lParam));
2279      else
2280         /* for splitters */
2281         OnMouseMove(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2282      break;
2283   }
2284
2285   case WM_LBUTTONUP:
2286       if (g_listview_dragging)
2287          ButtonUpListViewDrag(MAKEPOINTS(lParam));
2288      else
2289         /* for splitters */
2290         OnLButtonUp(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2291      break;
2292
2293   case WM_NOTIFY:
2294      /* Where is this message intended to go */
2295      {
2296         LPNMHDR lpNmHdr = (LPNMHDR)lParam;
2297
2298         /* Fetch tooltip text */
2299         if (lpNmHdr->code == TTN_NEEDTEXT)
2300         {
2301            LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)lParam;
2302            CopyToolTipText(lpttt);
2303         }
2304
2305         if (lpNmHdr->hwndFrom == hTreeView)
2306            return TreeViewNotify(lpNmHdr);
2307
2308         GetClassName(lpNmHdr->hwndFrom, szClass, sizeof(szClass) / sizeof(szClass[0]));
2309         if (!_tcscmp(szClass, TEXT("SysListView32")))
2310            return Picker_HandleNotify(lpNmHdr);   
2311         if (!_tcscmp(szClass, TEXT("SysTabControl32")))
2312            return TabView_HandleNotify(lpNmHdr);
2313      }
2314      break;
2315
2316   case WM_DRAWITEM:
2317      {
2318         LPDRAWITEMSTRUCT lpDis = (LPDRAWITEMSTRUCT)lParam;
2319
2320         GetClassName(lpDis->hwndItem, szClass, sizeof(szClass) / sizeof(szClass[0]));
2321         if (!_tcscmp(szClass, TEXT("SysListView32")))
2322            Picker_HandleDrawItem(GetDlgItem(hMain, lpDis->CtlID), lpDis);
2323      }
2324      break;
2325
2326   case WM_MEASUREITEM :
2327   {
2328      LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
2329
2330      // tell the list view that each row (item) should be just taller than our font
2331
2332      //DefWindowProc(hWnd, message, wParam, lParam);
2333      //dprintf("default row height calculation gives %u\n",lpmis->itemHeight);
2334
2335      TEXTMETRIC tm;
2336      HDC hDC = GetDC(NULL);
2337      HFONT hFontOld = (HFONT)SelectObject(hDC,hFont);
2338
2339      GetTextMetrics(hDC,&tm);
2340     
2341      lpmis->itemHeight = tm.tmHeight + tm.tmExternalLeading + 1;
2342      if (lpmis->itemHeight < 17)
2343         lpmis->itemHeight = 17;
2344      //dprintf("we would do %u\n",tm.tmHeight + tm.tmExternalLeading + 1);
2345      SelectObject(hDC,hFontOld);
2346      ReleaseDC(NULL,hDC);
2347
2348      return TRUE;
2349   }
2350
2351   case WM_MAME32_FILECHANGED:
2352      {
2353         char szFileName[32];
2354         char *s;
2355         int nGameIndex;
2356         int (*pfnGetAuditResults)(int driver_index) = NULL;
2357         void (*pfnSetAuditResults)(int driver_index, int audit_results) = NULL;
2358
2359         switch(HIWORD(wParam))
2360         {
2361            case 0:
2362               pfnGetAuditResults = GetRomAuditResults;
2363               pfnSetAuditResults = SetRomAuditResults;
2364               break;
2365
2366            case 1:
2367               pfnGetAuditResults = GetSampleAuditResults;
2368               pfnSetAuditResults = SetSampleAuditResults;
2369               break;
2370         }
2371
2372         if (pfnGetAuditResults && pfnSetAuditResults)
2373         {
2374            int nParentIndex = -1;
2375
2376            snprintf(szFileName, sizeof(szFileName), "%s", (LPCSTR) lParam);
2377            s = strchr(szFileName, '.');
2378            if (s)
2379               *s = '\0';
2380            s = strchr(szFileName, '\\');
2381            if (s)
2382               *s = '\0';
2383
2384            for (nGameIndex = 0; drivers[nGameIndex]; nGameIndex++)
2385            {
2386               for (nParentIndex = nGameIndex; nGameIndex == -1; nParentIndex = GetParentIndex(drivers[nParentIndex]))
2387               {
2388                  if (!mame_stricmp(drivers[nParentIndex]->name, szFileName))
2389                  {
2390                     if (pfnGetAuditResults(nGameIndex) != UNKNOWN)
2391                     {
2392                        pfnSetAuditResults(nGameIndex, UNKNOWN);
2393                        PostMessage(hMain, WM_MAME32_AUDITGAME, wParam, nGameIndex);
2394                     }
2395                     break;
2396                  }
2397               }
2398            }
2399         }
2400      }
2401      break;
2402
2403   case WM_MAME32_AUDITGAME:
2404      {
2405         LV_FINDINFO lvfi;
2406         int nGameIndex;
2407
2408         nGameIndex = lParam;
2409
2410         switch(HIWORD(wParam))
2411         {
2412            case 0:
2413               Mame32VerifyRomSet(nGameIndex);
2414               break;
2415            case 1:
2416               Mame32VerifySampleSet(nGameIndex);
2417               break;
2418         }
2419
2420         memset(&lvfi, 0, sizeof(lvfi));
2421         lvfi.flags   = LVFI_PARAM;
2422         lvfi.lParam = nGameIndex;
2423
2424         i = ListView_FindItem(hwndList, -1, &lvfi);
2425         if (i != -1)
2426         {
2427            ListView_RedrawItems(hwndList, i, i);
2428         }
2429      }
2430      break;
2431
2432   default:
2433
2434      break;
2435   }
2436
2437   return DefWindowProc(hWnd, message, wParam, lParam);
2438}
2439
2440static int HandleKeyboardGUIMessage(HWND hWnd, UINT message, UINT wParam, LONG lParam)
2441{
2442   switch (message)
2443   {
2444      case WM_CHAR: /* List-View controls use this message for searching the items "as user types" */
2445         //MessageBox(NULL,"wm_char message arrived","TitleBox",MB_OK);
2446         return TRUE;
2447
2448      case WM_KEYDOWN:
2449         KeyboardKeyDown(0, wParam, lParam);
2450         return TRUE;
2451
2452      case WM_KEYUP:
2453         KeyboardKeyUp(0, wParam, lParam);
2454         return TRUE;
2455
2456      case WM_SYSKEYDOWN:
2457         KeyboardKeyDown(1, wParam, lParam);
2458         return TRUE;
2459
2460      case WM_SYSKEYUP:
2461         KeyboardKeyUp(1, wParam, lParam);
2462         return TRUE;
2463   }
2464
2465   return FALSE;   /* message not processed */
2466}
2467
2468static BOOL PumpMessage()
2469{
2470   MSG msg;
2471
2472   if (!GetMessage(&msg, NULL, 0, 0))
2473    {
2474      return FALSE;
2475    }
2476
2477   if (IsWindow(hMain))
2478   {
2479      BOOL absorbed_key = FALSE;
2480      if (GetKeyGUI())
2481         absorbed_key = HandleKeyboardGUIMessage(msg.hwnd, msg.message,
2482                                       msg.wParam, msg.lParam);
2483      else
2484         absorbed_key = TranslateAccelerator(hMain, hAccel, &msg);
2485
2486      if (!absorbed_key)
2487      {
2488         if (!IsDialogMessage(hMain, &msg))
2489         {
2490            TranslateMessage(&msg);
2491            DispatchMessage(&msg);
2492         }
2493      }
2494   }
2495
2496   return TRUE;
2497}
2498
2499static BOOL FolderCheck(void)
2500{
2501   
2502   char *pDescription = NULL;
2503   int nGameIndex = 0;
2504   int i=0;
2505   int iStep = 0;
2506   LV_FINDINFO lvfi;
2507   int nCount = ListView_GetItemCount(hwndList);
2508   BOOL changed = FALSE;
2509
2510   MSG msg;
2511   for(i=0; i<nCount;i++)
2512   {
2513      LV_ITEM lvi;
2514
2515      lvi.iItem = i;
2516      lvi.iSubItem = 0;
2517      lvi.mask    = LVIF_PARAM;
2518      ListView_GetItem(hwndList, &lvi);
2519      nGameIndex  = lvi.lParam;
2520      SetRomAuditResults(nGameIndex, UNKNOWN);
2521      SetSampleAuditResults(nGameIndex, UNKNOWN);
2522   }
2523   if( nCount > 0)
2524      ProgressBarShow();
2525   else
2526      return FALSE;
2527   if( nCount < 100 )
2528      iStep = 100 / nCount;
2529   else
2530      iStep = nCount/100;
2531   UpdateListView();
2532   UpdateWindow(hMain);
2533   for(i=0; i<nCount;i++)
2534   {
2535      LV_ITEM lvi;
2536
2537      lvi.iItem = i;
2538      lvi.iSubItem = 0;
2539      lvi.mask    = LVIF_PARAM;
2540      ListView_GetItem(hwndList, &lvi);
2541      nGameIndex  = lvi.lParam;
2542      if (GetRomAuditResults(nGameIndex) == UNKNOWN)
2543      {
2544         Mame32VerifyRomSet(nGameIndex);
2545         changed = TRUE;
2546      }
2547
2548      if (GetSampleAuditResults(nGameIndex) == UNKNOWN)
2549      {
2550         Mame32VerifySampleSet(nGameIndex);
2551         changed = TRUE;
2552      }
2553
2554      lvfi.flags   = LVFI_PARAM;
2555      lvfi.lParam = nGameIndex;
2556
2557      i = ListView_FindItem(hwndList, -1, &lvfi);
2558      if (changed && i != -1);
2559      {
2560         ListView_RedrawItems(hwndList, i, i);
2561         while( PeekMessage( &msg, hwndList, 0, 0, PM_REMOVE ) != 0)
2562         {
2563            TranslateMessage(&msg);
2564            DispatchMessage(&msg);
2565         }
2566      }
2567      changed = FALSE;
2568      if ((i % iStep) == 0)
2569         ProgressBarStepParam(i, nCount);
2570   }
2571   ProgressBarHide();
2572   pDescription = ModifyThe(drivers[Picker_GetSelectedItem(hwndList)]->description);
2573   SetStatusBarText(0, pDescription);
2574   UpdateStatusBar();
2575   return TRUE;
2576}
2577
2578static BOOL GameCheck(void)
2579{
2580   LV_FINDINFO lvfi;
2581   int i;
2582   BOOL changed = FALSE;
2583
2584   if (game_index == 0)
2585      ProgressBarShow();
2586
2587   if (game_index >= driver_list_get_count(drivers))
2588   {
2589      bDoGameCheck = FALSE;
2590      ProgressBarHide();
2591      ResetWhichGamesInFolders();
2592      return FALSE;
2593   }
2594
2595   if (GetRomAuditResults(game_index) == UNKNOWN)
2596   {
2597      Mame32VerifyRomSet(game_index);
2598      changed = TRUE;
2599   }
2600
2601   if (GetSampleAuditResults(game_index) == UNKNOWN)
2602   {
2603      Mame32VerifySampleSet(game_index);
2604      changed = TRUE;
2605   }
2606
2607   lvfi.flags   = LVFI_PARAM;
2608   lvfi.lParam = game_index;
2609
2610   i = ListView_FindItem(hwndList, -1, &lvfi);
2611   if (changed && i != -1);
2612      ListView_RedrawItems(hwndList, i, i);
2613   if ((game_index % progBarStep) == 0)
2614      ProgressBarStep();
2615   game_index++;
2616
2617   return changed;
2618}
2619
2620static BOOL OnIdle(HWND hWnd)
2621{
2622   static int bFirstTime = TRUE;
2623   static int bResetList = TRUE;
2624
2625   char *pDescription;
2626   int driver_index;
2627
2628   if (bFirstTime)
2629   {
2630      bResetList = FALSE;
2631      bFirstTime = FALSE;
2632   }
2633   if (bDoGameCheck)
2634   {
2635      bResetList |= GameCheck();
2636      return idle_work;
2637   }
2638   // NPW 17-Jun-2003 - Commenting this out because it is redundant
2639   // and it causes the game to reset back to the original game after an F5
2640   // refresh
2641   //driver_index = GetGameNameIndex(GetDefaultGame());
2642   //SetSelectedPickItem(driver_index);
2643
2644   // in case it's not found, get it back
2645   driver_index = Picker_GetSelectedItem(hwndList);
2646
2647   pDescription = ModifyThe(drivers[driver_index]->description);
2648   SetStatusBarText(0, pDescription);
2649   idle_work = FALSE;
2650   UpdateStatusBar();
2651   bFirstTime = TRUE;
2652
2653   if (!idle_work)
2654      PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, TRUE),(LPARAM)NULL);
2655   return idle_work;
2656}
2657
2658static void OnSize(HWND hWnd, UINT nState, int nWidth, int nHeight)
2659{
2660   static BOOL firstTime = TRUE;
2661
2662   if (nState != SIZE_MAXIMIZED && nState != SIZE_RESTORED)
2663      return;
2664
2665   ResizeWindow(hWnd, &main_resize);
2666   ResizeProgressBar();
2667   if (firstTime == FALSE)
2668      OnSizeSplitter(hMain);
2669   //firstTime = FALSE;
2670   /* Update the splitters structures as appropriate */
2671   RecalcSplitters();
2672   if (firstTime == FALSE)
2673      ResizePickerControls(hMain);
2674   firstTime = FALSE;
2675   UpdateScreenShot();
2676}
2677
2678
2679
2680static HWND GetResizeItemWindow(HWND hParent, const ResizeItem *ri)
2681{
2682   HWND hControl;
2683   if (ri->type == RA_ID)
2684      hControl = GetDlgItem(hParent, ri->u.id);
2685   else
2686      hControl = ri->u.hwnd;
2687   return hControl;
2688}
2689
2690
2691
2692static void SetAllWindowsFont(HWND hParent, const Resize *r, HFONT hTheFont, BOOL bRedraw)
2693{
2694   int i;
2695   HWND hControl;
2696
2697   for (i = 0; r->items[i].type != RA_END; i++)
2698   {
2699      if (r->items[i].setfont)
2700      {
2701         hControl = GetResizeItemWindow(hParent, &r->items[i]);
2702         SetWindowFont(hControl, hTheFont, bRedraw);
2703      }
2704   }
2705}
2706
2707
2708
2709static void ResizeWindow(HWND hParent, Resize *r)
2710{
2711   int cmkindex = 0, dx, dy, dx1, dtempx;
2712   HWND hControl;
2713   RECT parent_rect, rect;
2714   ResizeItem *ri;
2715   POINT p = {0, 0};
2716
2717   if (hParent == NULL)
2718      return;
2719
2720   /* Calculate change in width and height of parent window */
2721   GetClientRect(hParent, &parent_rect);
2722   //dx = parent_rect.right - r->rect.right;
2723   dtempx = parent_rect.right - r->rect.right;
2724   dy = parent_rect.bottom - r->rect.bottom;
2725   dx = dtempx/2;
2726   dx1 = dtempx - dx;
2727   ClientToScreen(hParent, &p);
2728
2729   while (r->items[cmkindex].type != RA_END)
2730   {
2731      ri = &r->items[cmkindex];
2732      if (ri->type == RA_ID)
2733         hControl = GetDlgItem(hParent, ri->u.id);
2734      else
2735         hControl = ri->u.hwnd;
2736
2737      if (hControl == NULL)
2738      {
2739         cmkindex++;
2740         continue;
2741      }
2742
2743      /* Get control's rectangle relative to parent */
2744      GetWindowRect(hControl, &rect);
2745      OffsetRect(&rect, -p.x, -p.y);
2746
2747      if (!(ri->action & RA_LEFT))
2748         rect.left += dx;
2749
2750      if (!(ri->action & RA_TOP))
2751         rect.top += dy;
2752
2753      if (ri->action & RA_RIGHT)
2754         rect.right += dx;
2755
2756      if (ri->action & RA_BOTTOM)
2757         rect.bottom += dy;
2758
2759      MoveWindow(hControl, rect.left, rect.top,
2760               (rect.right - rect.left),
2761               (rect.bottom - rect.top), TRUE);
2762
2763      /* Take care of subcontrols, if appropriate */
2764      if (ri->subwindow != NULL)
2765         ResizeWindow(hControl, ri->subwindow);
2766
2767      cmkindex++;
2768   }
2769
2770   /* Record parent window's new location */
2771   memcpy(&r->rect, &parent_rect, sizeof(RECT));
2772}
2773
2774static void ProgressBarShow()
2775{
2776   RECT rect;
2777   int  widths[2] = {150, -1};
2778
2779   if (driver_list_get_count(drivers) < 100)
2780      progBarStep = 100 / driver_list_get_count(drivers);
2781   else
2782      progBarStep = (driver_list_get_count(drivers) / 100);
2783
2784   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)2, (LPARAM)(LPINT)widths);
2785   SendMessage(hProgWnd, PBM_SETRANGE, 0, (LPARAM)MAKELONG(0, driver_list_get_count(drivers)));
2786   SendMessage(hProgWnd, PBM_SETSTEP, (WPARAM)progBarStep, 0);
2787   SendMessage(hProgWnd, PBM_SETPOS, 0, 0);
2788
2789   StatusBar_GetItemRect(hStatusBar, 1, &rect);
2790
2791   MoveWindow(hProgWnd, rect.left, rect.top,
2792            rect.right - rect.left,
2793            rect.bottom - rect.top, TRUE);
2794
2795   bProgressShown = TRUE;
2796}
2797
2798static void ProgressBarHide()
2799{
2800   RECT rect;
2801   int  widths[4];
2802   HDC  hDC;
2803   SIZE size;
2804   int  numParts = 4;
2805
2806   if (hProgWnd == NULL)
2807   {
2808      return;
2809   }
2810
2811   hDC = GetDC(hProgWnd);
2812
2813   ShowWindow(hProgWnd, SW_HIDE);
2814
2815   GetTextExtentPoint32(hDC, TEXT("MMX"), 3, &size);
2816   widths[3] = size.cx;
2817   GetTextExtentPoint32(hDC, TEXT("MMMM games"), 10, &size);
2818   widths[2] = size.cx;
2819   //Just specify 24 instead of 30, gives us sufficient space to display the message, and saves some space
2820   GetTextExtentPoint32(hDC, TEXT("Screen flip support is missing"), 24, &size);
2821   widths[1] = size.cx;
2822
2823   ReleaseDC(hProgWnd, hDC);
2824
2825   widths[0] = -1;
2826   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)1, (LPARAM)(LPINT)widths);
2827   StatusBar_GetItemRect(hStatusBar, 0, &rect);
2828
2829   widths[0] = (rect.right - rect.left) - (widths[1] + widths[2] + widths[3]);
2830   widths[1] += widths[0];
2831   widths[2] += widths[1];
2832   widths[3] = -1;
2833
2834   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)numParts, (LPARAM)(LPINT)widths);
2835   UpdateStatusBar();
2836
2837   bProgressShown = FALSE;
2838}
2839
2840static void ResizeProgressBar()
2841{
2842   if (bProgressShown)
2843   {
2844      RECT rect;
2845      int  widths[2] = {150, -1};
2846
2847      SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)2, (LPARAM)(LPINT)widths);
2848      StatusBar_GetItemRect(hStatusBar, 1, &rect);
2849      MoveWindow(hProgWnd, rect.left, rect.top,
2850               rect.right  - rect.left,
2851               rect.bottom - rect.top, TRUE);
2852   }
2853   else
2854   {
2855      ProgressBarHide();
2856   }
2857}
2858
2859static void ProgressBarStepParam(int iGameIndex, int nGameCount)
2860{
2861   SetStatusBarTextF(0, "Game search %d%% complete",
2862         ((iGameIndex + 1) * 100) / nGameCount);
2863   if (iGameIndex == 0)
2864      ShowWindow(hProgWnd, SW_SHOW);
2865   SendMessage(hProgWnd, PBM_STEPIT, 0, 0);
2866}
2867
2868static void ProgressBarStep()
2869{
2870   ProgressBarStepParam(game_index, driver_list_get_count(drivers));
2871}
2872
2873static HWND InitProgressBar(HWND hParent)
2874{
2875   RECT rect;
2876
2877   StatusBar_GetItemRect(hStatusBar, 0, &rect);
2878
2879   rect.left += 150;
2880
2881   return CreateWindowEx(WS_EX_STATICEDGE,
2882         PROGRESS_CLASS,
2883         TEXT("Progress Bar"),
2884         WS_CHILD | PBS_SMOOTH,
2885         rect.left,
2886         rect.top,
2887         rect.right   - rect.left,
2888         rect.bottom - rect.top,
2889         hParent,
2890         NULL,
2891         hInst,
2892         NULL);
2893}
2894
2895static void CopyToolTipText(LPTOOLTIPTEXT lpttt)
2896{
2897   int   i;
2898   int   iButton = lpttt->hdr.idFrom;
2899   static TCHAR String[1024];
2900   BOOL bConverted = FALSE;
2901   TCHAR* t_gameinfostatus;
2902
2903   /* Map command ID to string index */
2904   for (i = 0; CommandToString[i] != -1; i++)
2905   {
2906      if (CommandToString[i] == iButton)
2907      {
2908         iButton = i;
2909         bConverted = TRUE;
2910         break;
2911      }
2912   }
2913   if( bConverted )
2914   {
2915      /* Check for valid parameter */
2916      if(iButton > NUM_TOOLTIPS)
2917      {
2918         _tcscpy(String,TEXT("Invalid Button Index"));
2919      }
2920      else
2921      {
2922         _tcscpy(String,szTbStrings[iButton]);
2923      }
2924   }
2925   else if ( iButton <= 2 )
2926   {
2927      //Statusbar
2928      SendMessage(lpttt->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 200);
2929      if( iButton != 1)
2930         SendMessage(hStatusBar, SB_GETTEXT, (WPARAM)iButton, (LPARAM)&String );
2931      else {
2932         //for first pane we get the Status directly, to get the line breaks
2933         t_gameinfostatus = tstring_from_utf8( GameInfoStatus(Picker_GetSelectedItem(hwndList), FALSE));
2934         if( !t_gameinfostatus )
2935            return;
2936         _tcscpy(String, t_gameinfostatus);
2937         free(t_gameinfostatus);
2938      }
2939   }
2940   else
2941      _tcscpy(String,TEXT("Invalid Button Index"));
2942
2943   lpttt->lpszText = String;
2944}
2945
2946static HWND InitToolbar(HWND hParent)
2947{
2948   HWND hToolBar = CreateToolbarEx(hParent,
2949                     WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
2950                     CCS_TOP | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
2951                     1,
2952                     8,
2953                     hInst,
2954                     IDB_TOOLBAR,
2955                     tbb,
2956                     NUM_TOOLBUTTONS,
2957                     16,
2958                     16,
2959                     0,
2960                     0,
2961                     sizeof(TBBUTTON));
2962   RECT rect;
2963   int idx;
2964   int iPosX, iPosY, iHeight;
2965
2966   // get Edit Control position
2967   idx = SendMessage(hToolBar, TB_BUTTONCOUNT, (WPARAM)0, (LPARAM)0) - 1;
2968   SendMessage(hToolBar, TB_GETITEMRECT, (WPARAM)idx, (LPARAM)&rect);
2969   iPosX = rect.right + 10;
2970   iPosY = rect.top + 1;
2971   iHeight = rect.bottom - rect.top - 2;
2972
2973   // create Edit Control
2974   win_create_window_ex_utf8( 0L, "Edit", SEARCH_PROMPT, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT,
2975               iPosX, iPosY, 200, iHeight, hToolBar, (HMENU)ID_TOOLBAR_EDIT, hInst, NULL );
2976
2977   return hToolBar;
2978}
2979
2980static HWND InitStatusBar(HWND hParent)
2981{
2982   HMENU hMenu = GetMenu(hParent);
2983
2984   popstr[0].hMenu    = 0;
2985   popstr[0].uiString = 0;
2986   popstr[1].hMenu    = hMenu;
2987   popstr[1].uiString = IDS_UI_FILE;
2988   popstr[2].hMenu    = GetSubMenu(hMenu, 1);
2989   popstr[2].uiString = IDS_VIEW_TOOLBAR;
2990   popstr[3].hMenu    = 0;
2991   popstr[3].uiString = 0;
2992
2993   return CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
2994                       CCS_BOTTOM | SBARS_SIZEGRIP | SBT_TOOLTIPS,
2995                       TEXT("Ready"),
2996                       hParent,
2997                       2);
2998}
2999
3000
3001static LRESULT Statusbar_MenuSelect(HWND hwnd, WPARAM wParam, LPARAM lParam)
3002{
3003   UINT  fuFlags   = (UINT)HIWORD(wParam);
3004   HMENU hMainMenu = NULL;
3005   int   iMenu    = 0;
3006
3007   /* Handle non-system popup menu descriptions. */
3008   if (  (fuFlags & MF_POPUP)
3009   &&   (!(fuFlags & MF_SYSMENU)))
3010   {
3011      for (iMenu = 1; iMenu < MAX_MENUS; iMenu++)
3012      {
3013         if ((HMENU)lParam == popstr[iMenu].hMenu)
3014         {
3015            hMainMenu = (HMENU)lParam;
3016            break ;
3017         }
3018      }
3019   }
3020
3021   if (hMainMenu)
3022   {
3023      /* Display helpful text in status bar */
3024      MenuHelp(WM_MENUSELECT, wParam, lParam, hMainMenu, hInst,
3025             hStatusBar, (UINT *)&popstr[iMenu]);
3026   }
3027   else
3028   {
3029      UINT nZero = 0;
3030      MenuHelp(WM_MENUSELECT, wParam, lParam, NULL, hInst,
3031             hStatusBar, &nZero);
3032   }
3033
3034   return 0;
3035}
3036
3037static void UpdateStatusBar()
3038{
3039   LPTREEFOLDER lpFolder = GetCurrentFolder();
3040   int        games_shown = 0;
3041   int        i = -1;
3042
3043   if (!lpFolder)
3044      return;
3045
3046   while (1)
3047   {
3048      i = FindGame(lpFolder,i+1);
3049      if (i == -1)
3050         break;
3051
3052      if (!GameFiltered(i, lpFolder->m_dwFlags))
3053         games_shown++;
3054   }
3055
3056   /* Show number of games in the current 'View' in the status bar */
3057   SetStatusBarTextF(2, g_szGameCountString, games_shown);
3058
3059   i = Picker_GetSelectedItem(hwndList);
3060
3061   if (games_shown == 0)
3062      DisableSelection();
3063   else
3064   {
3065      const char* pStatus = GameInfoStatus(i, FALSE);
3066      SetStatusBarText(1, pStatus);
3067   }
3068}
3069
3070static void UpdateHistory(void)
3071{
3072   HDC hDC;
3073   RECT rect;
3074   TEXTMETRIC     tm ;
3075   int nLines, nLineHeight;
3076   //DWORD dwStyle = GetWindowLong(GetDlgItem(hMain, IDC_HISTORY), GWL_STYLE);
3077   have_history = FALSE;
3078
3079   if (GetSelectedPick() >= 0)
3080   {
3081      char *histText = GetGameHistory(Picker_GetSelectedItem(hwndList));
3082
3083      have_history = (histText && histText[0]) ? TRUE : FALSE;
3084      win_set_window_text_utf8(GetDlgItem(hMain, IDC_HISTORY), histText);
3085   }
3086
3087   if (have_history && GetShowScreenShot()
3088      && ((TabView_GetCurrentTab(hTabCtrl) == TAB_HISTORY) ||
3089         (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ||
3090         (TAB_ALL == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ))
3091   {
3092      Edit_GetRect(GetDlgItem(hMain, IDC_HISTORY),&rect);
3093      nLines = Edit_GetLineCount(GetDlgItem(hMain, IDC_HISTORY) );
3094      hDC = GetDC(GetDlgItem(hMain, IDC_HISTORY));
3095      GetTextMetrics (hDC, &tm);
3096      nLineHeight = tm.tmHeight - tm.tmInternalLeading;
3097      if( ( (rect.bottom - rect.top) / nLineHeight) < (nLines) )
3098      {
3099         //more than one Page, so show Scrollbar
3100         SetScrollRange(GetDlgItem(hMain, IDC_HISTORY), SB_VERT, 0, nLines, TRUE);
3101      }
3102      else
3103      {
3104         //hide Scrollbar
3105         SetScrollRange(GetDlgItem(hMain, IDC_HISTORY),SB_VERT, 0, 0, TRUE);
3106
3107      }
3108       ShowWindow(GetDlgItem(hMain, IDC_HISTORY), SW_SHOW);
3109   }
3110   else
3111      ShowWindow(GetDlgItem(hMain, IDC_HISTORY), SW_HIDE);
3112
3113}
3114
3115
3116static void DisableSelection()
3117{
3118   MENUITEMINFO   mmi;
3119   HMENU         hMenu = GetMenu(hMain);
3120   BOOL         prev_have_selection = have_selection;
3121
3122   mmi.cbSize      = sizeof(mmi);
3123   mmi.fMask      = MIIM_TYPE;
3124   mmi.fType      = MFT_STRING;
3125   mmi.dwTypeData = (TCHAR *) TEXT("&Play");
3126   mmi.cch       = _tcslen(mmi.dwTypeData);
3127   SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mmi);
3128
3129   EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_GRAYED);
3130   EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_GRAYED);
3131   EnableMenuItem(hMenu, ID_GAME_PROPERTIES,      MF_GRAYED);
3132
3133   SetStatusBarText(0, "No Selection");
3134   SetStatusBarText(1, "");
3135   SetStatusBarText(3, "");
3136
3137   have_selection = FALSE;
3138
3139   if (prev_have_selection != have_selection)
3140      UpdateScreenShot();
3141}
3142
3143static void EnableSelection(int nGame)
3144{
3145   TCHAR         buf[200];
3146   const char *   pText;
3147   MENUITEMINFO   mmi;
3148   HMENU         hMenu = GetMenu(hMain);
3149   TCHAR*          t_description;
3150
3151#ifdef MESS
3152   MyFillSoftwareList(nGame, FALSE);
3153#endif
3154
3155   t_description = tstring_from_utf8(ConvertAmpersandString(ModifyThe(drivers[nGame]->description)));
3156   if( !t_description )
3157      return;
3158
3159   _sntprintf(buf, sizeof(buf) / sizeof(buf[0]), g_szPlayGameString, t_description);
3160   mmi.cbSize      = sizeof(mmi);
3161   mmi.fMask      = MIIM_TYPE;
3162   mmi.fType      = MFT_STRING;
3163   mmi.dwTypeData = buf;
3164   mmi.cch       = _tcslen(mmi.dwTypeData);
3165   SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mmi);
3166
3167   pText = ModifyThe(drivers[nGame]->description);
3168   SetStatusBarText(0, pText);
3169   /* Add this game's status to the status bar */
3170   pText = GameInfoStatus(nGame, FALSE);
3171   SetStatusBarText(1, pText);
3172   SetStatusBarText(3, "");
3173
3174   /* If doing updating game status and the game name is NOT pacman.... */
3175
3176   EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_ENABLED);
3177   EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_ENABLED);
3178
3179   if (!oldControl)
3180      EnableMenuItem(hMenu, ID_GAME_PROPERTIES, MF_ENABLED);
3181
3182   if (bProgressShown && bListReady == TRUE)
3183   {
3184      SetDefaultGame(ModifyThe(drivers[nGame]->name));
3185   }
3186   have_selection = TRUE;
3187
3188   UpdateScreenShot();
3189
3190   free(t_description);
3191}
3192
3193static void PaintBackgroundImage(HWND hWnd, HRGN hRgn, int x, int y)
3194{
3195   RECT      rcClient;
3196   HRGN      rgnBitmap;
3197   HPALETTE   hPAL;
3198   HDC       hDC = GetDC(hWnd);
3199   int       i, j;
3200   HDC       htempDC;
3201   HBITMAP    oldBitmap;
3202
3203   /* x and y are offsets within the background image that should be at 0,0 in hWnd */
3204
3205   /* So we don't paint over the control's border */
3206   GetClientRect(hWnd, &rcClient);
3207
3208   htempDC = CreateCompatibleDC(hDC);
3209   oldBitmap = SelectObject(htempDC, hBackground);
3210
3211   if (hRgn == NULL)
3212   {
3213      /* create a region of our client area */
3214      rgnBitmap = CreateRectRgnIndirect(&rcClient);
3215      SelectClipRgn(hDC, rgnBitmap);
3216      DeleteObject(rgnBitmap);
3217   }
3218   else
3219   {
3220      /* use the passed in region */
3221      SelectClipRgn(hDC, hRgn);
3222   }
3223
3224   hPAL = GetBackgroundPalette();
3225   if (hPAL == NULL)
3226      hPAL = CreateHalftonePalette(hDC);
3227
3228   if (GetDeviceCaps(htempDC, RASTERCAPS) & RC_PALETTE && hPAL != NULL)
3229   {
3230      SelectPalette(htempDC, hPAL, FALSE);
3231      RealizePalette(htempDC);
3232   }
3233
3234   for (i = rcClient.left-x; i < rcClient.right; i += bmDesc.bmWidth)
3235      for (j = rcClient.top-y; j < rcClient.bottom; j += bmDesc.bmHeight)
3236         BitBlt(hDC, i, j, bmDesc.bmWidth, bmDesc.bmHeight, htempDC, 0, 0, SRCCOPY);
3237   
3238   SelectObject(htempDC, oldBitmap);
3239   DeleteDC(htempDC);
3240   
3241   if (GetBackgroundPalette() == NULL)
3242   {
3243      DeleteObject(hPAL);
3244      hPAL = NULL;
3245   }
3246
3247   ReleaseDC(hWnd, hDC);
3248}
3249
3250static LPCSTR GetCloneParentName(int nItem)
3251{
3252   int nParentIndex = -1;
3253
3254   if (DriverIsClone(nItem) == TRUE)
3255   {
3256      nParentIndex = GetParentIndex(drivers[nItem]);
3257      if( nParentIndex >= 0)
3258         return ModifyThe(drivers[nParentIndex]->description);
3259   }
3260   return "";
3261}
3262
3263#if 0
3264static BOOL PickerHitTest(HWND hWnd)
3265{
3266   RECT         rect;
3267   POINTS         p;
3268   DWORD         res = GetMessagePos();
3269   LVHITTESTINFO   htInfo;
3270
3271   ZeroMemory(&htInfo,sizeof(LVHITTESTINFO));
3272   p = MAKEPOINTS(res);
3273   GetWindowRect(hWnd, &rect);
3274   htInfo.pt.x = p.x - rect.left;
3275   htInfo.pt.y = p.y - rect.top;
3276   ListView_HitTest(hWnd, &htInfo);
3277
3278   return (! (htInfo.flags & LVHT_NOWHERE));
3279}
3280#endif
3281
3282static BOOL TreeViewNotify(LPNMHDR nm)
3283{
3284   switch (nm->code)
3285   {
3286   case TVN_SELCHANGED :
3287   {
3288      HTREEITEM hti = TreeView_GetSelection(hTreeView);
3289      TVITEM     tvi;
3290
3291      tvi.mask  = TVIF_PARAM | TVIF_HANDLE;
3292      tvi.hItem = hti;
3293     
3294      if (TreeView_GetItem(hTreeView, &tvi))
3295      {
3296         SetCurrentFolder((LPTREEFOLDER)tvi.lParam);
3297         if (bListReady)
3298         {
3299            ResetListView();
3300            UpdateScreenShot();
3301         }
3302      }
3303      return TRUE;
3304   }
3305   case TVN_BEGINLABELEDIT :
3306   {
3307      TV_DISPINFO *ptvdi = (TV_DISPINFO *)nm;
3308      LPTREEFOLDER folder = (LPTREEFOLDER)ptvdi->item.lParam;
3309
3310      if (folder->m_dwFlags & F_CUSTOM)
3311      {
3312         // user can edit custom folder names
3313         g_in_treeview_edit = TRUE;
3314         return FALSE;
3315      }
3316      // user can't edit built in folder names
3317      return TRUE;
3318   }
3319   case TVN_ENDLABELEDIT :
3320   {
3321      TV_DISPINFO *ptvdi = (TV_DISPINFO *)nm;
3322      LPTREEFOLDER folder = (LPTREEFOLDER)ptvdi->item.lParam;
3323      char* szText;
3324      BOOL result;
3325
3326      g_in_treeview_edit = FALSE;
3327
3328      if (ptvdi->item.pszText == NULL || _tcslen(ptvdi->item.pszText) == 0)
3329         return FALSE;
3330         
3331      szText = utf8_from_tstring(ptvdi->item.pszText);
3332      if( !szText )
3333         return FALSE;
3334
3335      result = TryRenameCustomFolder(folder,szText);
3336     
3337      free(szText);
3338     
3339      return result;
3340   }
3341   }
3342   return FALSE;
3343}
3344
3345
3346
3347static void GamePicker_OnHeaderContextMenu(POINT pt, int nColumn)
3348{
3349   // Right button was clicked on header
3350   HMENU hMenuLoad;
3351   HMENU hMenu;
3352
3353   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_HEADER));
3354   hMenu = GetSubMenu(hMenuLoad, 0);
3355   lastColumnClick = nColumn;
3356   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hMain,NULL);
3357
3358   DestroyMenu(hMenuLoad);
3359}
3360
3361
3362
3363char* ConvertAmpersandString(const char *s)
3364{
3365   /* takes a string and changes any ampersands to double ampersands,
3366      for setting text of window controls that don't allow us to disable
3367      the ampersand underlining.
3368    */
3369   /* returns a static buffer--use before calling again */
3370
3371   static char buf[200];
3372   char *ptr;
3373
3374   ptr = buf;
3375   while (*s)
3376   {
3377      if (*s == '&')
3378         *ptr++ = *s;
3379      *ptr++ = *s++;
3380   }
3381   *ptr = 0;
3382
3383   return buf;
3384}
3385
3386static int GUI_seq_pressed(const input_seq *seq)
3387{
3388   int codenum;
3389   int res = 1;
3390   int invert = 0;
3391   int count = 0;
3392
3393   for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
3394   {
3395      input_code code = seq->code[codenum];
3396
3397      switch (code)
3398      {
3399         case SEQCODE_OR :
3400            if (res && count)
3401               return 1;
3402            res = 1;
3403            count = 0;
3404            break;
3405         case SEQCODE_NOT :
3406            invert = !invert;
3407            break;
3408         default:
3409            if (res)
3410            {
3411               int pressed = keyboard_state[code];
3412               if ((pressed != 0) == invert)
3413                  res = 0;
3414            }
3415            invert = 0;
3416            ++count;
3417      }
3418   }
3419   return res && count;
3420}
3421
3422static void check_for_GUI_action(void)
3423{
3424   int i;
3425
3426   for (i = 0; i < NUM_GUI_SEQUENCES; i++)
3427   {
3428      input_seq *is = &(GUISequenceControl[i].is);
3429
3430      if (GUI_seq_pressed(is))
3431      {
3432         dprintf("seq =%s pressed\n", GUISequenceControl[i].name);
3433         switch (GUISequenceControl[i].func_id)
3434         {
3435         case ID_GAME_AUDIT:
3436         case ID_GAME_PROPERTIES:
3437         case ID_CONTEXT_FILTERS:
3438         case ID_UI_START:
3439            KeyboardStateClear(); /* beacuse whe won't receive KeyUp mesage when we loose focus */
3440            break;
3441         default:
3442            break;
3443         }
3444         SendMessage(hMain, WM_COMMAND, GUISequenceControl[i].func_id, 0);
3445      }
3446   }
3447}
3448
3449static void KeyboardStateClear(void)
3450{
3451   memset(keyboard_state, 0, sizeof(keyboard_state));
3452   dprintf("keyboard gui state cleared.\n");
3453}
3454
3455
3456static void KeyboardKeyDown(int syskey, int vk_code, int special)
3457{
3458   int i, found = 0;
3459   input_code icode = 0;
3460   int special_code = (special >> 24) & 1;
3461   int scancode = (special>>16) & 0xff;
3462
3463   if ((vk_code==VK_MENU) || (vk_code==VK_CONTROL) || (vk_code==VK_SHIFT))
3464   {
3465      found = 1;
3466
3467      /* a hack for right shift - it's better to use Direct X for keyboard input it seems......*/
3468      if (vk_code==VK_SHIFT)
3469         if (scancode>0x30) /* on my keyboard left shift scancode is 0x2a, right shift is 0x36 */
3470            special_code = 1;
3471
3472      if (special_code) /* right hand keys */
3473      {
3474         switch(vk_code)
3475         {
3476         case VK_MENU:
3477            icode = KEYCODE_RALT;
3478            break;
3479         case VK_CONTROL:
3480            icode = KEYCODE_RCONTROL;
3481            break;
3482         case VK_SHIFT:
3483            icode = KEYCODE_RSHIFT;
3484            break;
3485         }
3486      }
3487      else /* left hand keys */
3488      {
3489         switch(vk_code)
3490         {
3491         case VK_MENU:
3492            icode = KEYCODE_LALT;
3493            break;
3494         case VK_CONTROL:
3495            icode = KEYCODE_LCONTROL;
3496            break;
3497         case VK_SHIFT:
3498            icode = KEYCODE_LSHIFT;
3499            break;
3500         }
3501      }
3502   }
3503   else
3504   {
3505      for (i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++)
3506      {
3507         if ( vk_code == win_key_trans_table[i][VIRTUAL_KEY])
3508         {
3509            icode = win_key_trans_table[i][MAME_KEY];
3510            found = 1;
3511            break;
3512         }
3513      }
3514   }
3515   if (!found)
3516   {
3517      dprintf("VK_code pressed not found =  %i\n",vk_code);
3518      //MessageBox(NULL,"keydown message arrived not processed","TitleBox",MB_OK);
3519      return;
3520   }
3521   dprintf("VK_code pressed found =  %i, sys=%i, mame_keycode=%i special=%08x\n", vk_code, syskey, icode, special);
3522   keyboard_state[icode] = 1;
3523   check_for_GUI_action();
3524}
3525
3526static void KeyboardKeyUp(int syskey, int vk_code, int special)
3527{
3528   int i, found = 0;
3529   input_code icode = 0;
3530   int special_code = (special >> 24) & 1;
3531   int scancode = (special>>16) & 0xff;
3532
3533   if ((vk_code==VK_MENU) || (vk_code==VK_CONTROL) || (vk_code==VK_SHIFT))
3534   {
3535      found = 1;
3536
3537      /* a hack for right shift - it's better to use Direct X for keyboard input it seems......*/
3538      if (vk_code==VK_SHIFT)
3539         if (scancode>0x30) /* on my keyboard left shift scancode is 0x2a, right shift is 0x36 */
3540            special_code = 1;
3541
3542      if (special_code) /* right hand keys */
3543      {
3544         switch(vk_code)
3545         {
3546         case VK_MENU:
3547            icode = KEYCODE_RALT;
3548            break;
3549         case VK_CONTROL:
3550            icode = KEYCODE_RCONTROL;
3551            break;
3552         case VK_SHIFT:
3553            icode = KEYCODE_RSHIFT;
3554            break;
3555         }
3556      }
3557      else /* left hand keys */
3558      {
3559         switch(vk_code)
3560         {
3561         case VK_MENU:
3562            icode = KEYCODE_LALT;
3563            break;
3564         case VK_CONTROL:
3565            icode = KEYCODE_LCONTROL;
3566            break;
3567         case VK_SHIFT:
3568            icode = KEYCODE_LSHIFT;
3569            break;
3570         }
3571      }
3572   }
3573   else
3574   {
3575      for (i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++)
3576      {
3577         if (vk_code == win_key_trans_table[i][VIRTUAL_KEY])
3578         {
3579            icode = win_key_trans_table[i][MAME_KEY];
3580            found = 1;
3581            break;
3582         }
3583      }
3584   }
3585   if (!found)
3586   {
3587      dprintf("VK_code released not found =  %i",vk_code);
3588      //MessageBox(NULL,"keyup message arrived not processed","TitleBox",MB_OK);
3589      return;
3590   }
3591   keyboard_state[icode] = 0;
3592   dprintf("VK_code released found=  %i, sys=%i, mame_keycode=%i special=%08x\n", vk_code, syskey, icode, special );
3593   check_for_GUI_action();
3594}
3595
3596static void PollGUIJoystick()
3597{
3598   // For the exec timer, will keep track of how long the button has been pressed 
3599   static int exec_counter = 0;
3600   const char* exec_command;
3601   TCHAR* t_exec_command;
3602 
3603   if (in_emulation)
3604      return;
3605
3606   if (g_pJoyGUI == NULL)
3607      return;
3608
3609   g_pJoyGUI->poll_joysticks();
3610
3611
3612   // User pressed UP
3613   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyUp(0), GetUIJoyUp(1), GetUIJoyUp(2),GetUIJoyUp(3))))
3614   {
3615      SendMessage(hMain, WM_COMMAND, ID_UI_UP, 0);
3616   }
3617   
3618   // User pressed DOWN
3619   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyDown(0), GetUIJoyDown(1), GetUIJoyDown(2),GetUIJoyDown(3))))
3620   {
3621      SendMessage(hMain, WM_COMMAND, ID_UI_DOWN, 0);
3622   }
3623   
3624   // User pressed LEFT
3625   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyLeft(0), GetUIJoyLeft(1), GetUIJoyLeft(2),GetUIJoyLeft(3))))
3626   {
3627      SendMessage(hMain, WM_COMMAND, ID_UI_LEFT, 0);
3628   }
3629
3630   // User pressed RIGHT
3631   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyRight(0), GetUIJoyRight(1), GetUIJoyRight(2),GetUIJoyRight(3))))
3632   {
3633      SendMessage(hMain, WM_COMMAND, ID_UI_RIGHT, 0);
3634   }
3635
3636   // User pressed START GAME
3637   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyStart(0), GetUIJoyStart(1), GetUIJoyStart(2),GetUIJoyStart(3))))
3638   {
3639      SendMessage(hMain, WM_COMMAND, ID_UI_START, 0);
3640   }
3641
3642   // User pressed PAGE UP
3643   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyPageUp(0), GetUIJoyPageUp(1), GetUIJoyPageUp(2),GetUIJoyPageUp(3))))
3644   {
3645      SendMessage(hMain, WM_COMMAND, ID_UI_PGUP, 0);
3646   }
3647
3648   // User pressed PAGE DOWN
3649   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyPageDown(0), GetUIJoyPageDown(1), GetUIJoyPageDown(2),GetUIJoyPageDown(3))))
3650   {
3651      SendMessage(hMain, WM_COMMAND, ID_UI_PGDOWN, 0);
3652   }
3653
3654   // User pressed HOME
3655   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHome(0), GetUIJoyHome(1), GetUIJoyHome(2),GetUIJoyHome(3))))
3656   {
3657      SendMessage(hMain, WM_COMMAND, ID_UI_HOME, 0);
3658   }
3659
3660   // User pressed END
3661   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyEnd(0), GetUIJoyEnd(1), GetUIJoyEnd(2),GetUIJoyEnd(3))))
3662   {
3663      SendMessage(hMain, WM_COMMAND, ID_UI_END, 0);
3664   }
3665
3666   // User pressed CHANGE SCREENSHOT
3667   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoySSChange(0), GetUIJoySSChange(1), GetUIJoySSChange(2),GetUIJoySSChange(3))))
3668   {
3669      SendMessage(hMain, WM_COMMAND, IDC_SSFRAME, 0);
3670   }
3671   
3672   // User pressed SCROLL HISTORY UP
3673   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHistoryUp(0), GetUIJoyHistoryUp(1), GetUIJoyHistoryUp(2),GetUIJoyHistoryUp(3))))
3674   {
3675      SendMessage(hMain, WM_COMMAND, ID_UI_HISTORY_UP, 0);
3676   }
3677   
3678   // User pressed SCROLL HISTORY DOWN
3679   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHistoryDown(0), GetUIJoyHistoryDown(1), GetUIJoyHistoryDown(2),GetUIJoyHistoryDown(3))))
3680   {
3681      SendMessage(hMain, WM_COMMAND, ID_UI_HISTORY_DOWN, 0);
3682   }
3683 
3684  // User pressed EXECUTE COMMANDLINE
3685   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyExec(0), GetUIJoyExec(1), GetUIJoyExec(2),GetUIJoyExec(3))))
3686   {
3687      if (++exec_counter >= GetExecWait()) // Button has been pressed > exec timeout
3688      {
3689         PROCESS_INFORMATION pi;
3690         STARTUPINFO si;
3691         
3692         // Reset counter
3693         exec_counter = 0;
3694
3695         ZeroMemory( &si, sizeof(si) );
3696         ZeroMemory( &pi, sizeof(pi) );
3697         si.dwFlags = STARTF_FORCEONFEEDBACK;
3698         si.cb = sizeof(si);
3699         
3700         exec_command = GetExecCommand();
3701         t_exec_command = tstring_from_utf8(exec_command);
3702         if( !t_exec_command )
3703            return;
3704         CreateProcess(NULL, t_exec_command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
3705         
3706         free(t_exec_command);
3707
3708         // We will not wait for the process to finish cause it might be a background task
3709         // The process won't get closed when MAME32 closes either.
3710
3711         // But close the handles cause we won't need them anymore. Will not close process.
3712         CloseHandle(pi.hProcess);
3713         CloseHandle(pi.hThread);
3714      }
3715   }
3716   else
3717   {
3718      // Button has been released within the timeout period, reset the counter
3719      exec_counter = 0;
3720   }
3721}
3722
3723#if 0
3724static void PressKey(HWND hwnd, UINT vk)
3725{
3726   SendMessage(hwnd, WM_KEYDOWN, vk, 0);
3727   SendMessage(hwnd, WM_KEYUP,   vk, 0xc0000000);
3728}
3729#endif
3730
3731static void SetView(int menu_id)
3732{
3733   BOOL force_reset = FALSE;
3734   int i;
3735
3736   // first uncheck previous menu item, check new one
3737   CheckMenuRadioItem(GetMenu(hMain), ID_VIEW_LARGE_ICON, ID_VIEW_GROUPED, menu_id, MF_CHECKED);
3738   ToolBar_CheckButton(hToolBar, menu_id, MF_CHECKED);
3739
3740   if (Picker_GetViewID(hwndList) == VIEW_GROUPED || menu_id == ID_VIEW_GROUPED)
3741   {
3742      // this changes the sort order, so redo everything
3743      force_reset = TRUE;
3744   }
3745
3746   for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
3747      Picker_SetViewID(GetDlgItem(hMain, s_nPickers[i]), menu_id - ID_VIEW_LARGE_ICON);
3748
3749   if (force_reset)
3750   {
3751      for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
3752         Picker_Sort(GetDlgItem(hMain, s_nPickers[i]));
3753   }
3754}
3755
3756static void ResetListView()
3757{
3758   int    i;
3759   int    current_game;
3760   LV_ITEM lvi;
3761   BOOL   no_selection = FALSE;
3762   LPTREEFOLDER lpFolder = GetCurrentFolder();
3763
3764   if (!lpFolder)
3765    {
3766      return;
3767    }
3768
3769   /* If the last folder was empty, no_selection is TRUE */
3770   if (have_selection == FALSE)
3771    {
3772      no_selection = TRUE;
3773    }
3774
3775   current_game = Picker_GetSelectedItem(hwndList);
3776
3777   SetWindowRedraw(hwndList,FALSE);
3778
3779   ListView_DeleteAllItems(hwndList);
3780
3781   // hint to have it allocate it all at once
3782   ListView_SetItemCount(hwndList,driver_list_get_count(drivers));
3783
3784   lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
3785   lvi.stateMask = 0;
3786
3787   i = -1;
3788
3789   do
3790   {
3791      /* Add the games that are in this folder */
3792      if ((i = FindGame(lpFolder, i + 1)) != -1)
3793      {
3794         if (GameFiltered(i, lpFolder->m_dwFlags))
3795            continue;
3796
3797         lvi.iItem    = i;
3798         lvi.iSubItem = 0;
3799         lvi.lParam    = i;
3800         lvi.pszText  = LPSTR_TEXTCALLBACK;
3801         lvi.iImage    = I_IMAGECALLBACK;
3802         ListView_InsertItem(hwndList, &lvi);
3803      }
3804   } while (i != -1);
3805
3806   Picker_Sort(hwndList);
3807
3808   if (bListReady)
3809   {
3810       /* If last folder was empty, select the first item in this folder */
3811       if (no_selection)
3812          Picker_SetSelectedPick(hwndList, 0);
3813      else
3814          Picker_SetSelectedItem(hwndList, current_game);
3815   }
3816
3817   /*RS Instead of the Arrange Call that was here previously on all Views
3818       We now need to set the ViewMode for SmallIcon again,
3819       for an explanation why, see SetView*/
3820   if (GetViewMode() == VIEW_SMALL_ICONS)
3821      SetView(ID_VIEW_SMALL_ICON);
3822
3823   SetWindowRedraw(hwndList, TRUE);
3824
3825   UpdateStatusBar();
3826
3827}
3828
3829static void UpdateGameList(BOOL bUpdateRomAudit, BOOL bUpdateSampleAudit)
3830{
3831   int i;
3832
3833   for (i = 0; i < driver_list_get_count(drivers); i++)
3834   {
3835      if (bUpdateRomAudit && DriverUsesRoms(i))
3836         SetRomAuditResults(i, UNKNOWN);
3837      if (bUpdateSampleAudit && DriverUsesSamples(i))
3838         SetSampleAuditResults(i, UNKNOWN);
3839   }
3840
3841   idle_work    = TRUE;
3842   bDoGameCheck = TRUE;
3843   game_index    = 0;
3844
3845   ReloadIcons();
3846
3847   // Let REFRESH also load new background if found
3848   LoadBackgroundBitmap();
3849   InvalidateRect(hMain,NULL,TRUE);
3850   Picker_ResetIdle(hwndList);
3851}
3852
3853UINT_PTR CALLBACK CFHookProc(
3854  HWND hdlg,      // handle to dialog box
3855  UINT uiMsg,     // message identifier
3856  WPARAM wParam,  // message parameter
3857  LPARAM lParam   // message parameter
3858)
3859{
3860   int iIndex, i;
3861   COLORREF cCombo, cList;
3862   switch (uiMsg)
3863   {
3864      case WM_INITDIALOG:
3865         SendDlgItemMessage(hdlg, cmb4, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom"));
3866         iIndex = SendDlgItemMessage(hdlg, cmb4, CB_GETCOUNT, 0, 0);
3867         cList = GetListFontColor();
3868         SendDlgItemMessage(hdlg, cmb4, CB_SETITEMDATA,(WPARAM)iIndex-1,(LPARAM)cList );
3869         for( i = 0; i< iIndex; i++)
3870         {
3871            cCombo = SendDlgItemMessage(hdlg, cmb4, CB_GETITEMDATA,(WPARAM)i,0 );
3872            if( cList == cCombo)
3873            {
3874               SendDlgItemMessage(hdlg, cmb4, CB_SETCURSEL,(WPARAM)i,0 );
3875               break;
3876            }
3877         }
3878         break;
3879      case WM_COMMAND:
3880         if( LOWORD(wParam) == cmb4)
3881         {
3882            switch (HIWORD(wParam))
3883            {
3884               case CBN_SELCHANGE:  // The color ComboBox changed selection
3885                  iIndex = (int)SendDlgItemMessage(hdlg, cmb4,
3886                                         CB_GETCURSEL, 0, 0L);
3887                  if( iIndex == SendDlgItemMessage(hdlg, cmb4, CB_GETCOUNT, 0, 0)-1)
3888                  {
3889                     //Custom color selected
3890                      cList = GetListFontColor();
3891                      PickColor(&cList);
3892                     SendDlgItemMessage(hdlg, cmb4, CB_DELETESTRING, iIndex, 0);
3893                     SendDlgItemMessage(hdlg, cmb4, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom"));
3894                     SendDlgItemMessage(hdlg, cmb4, CB_SETITEMDATA,(WPARAM)iIndex,(LPARAM)cList);
3895                     SendDlgItemMessage(hdlg, cmb4, CB_SETCURSEL,(WPARAM)iIndex,0 );
3896                     return TRUE;
3897                  }
3898            }
3899         }
3900         break;
3901   }
3902   return FALSE;
3903}
3904
3905static void PickFont(void)
3906{
3907   LOGFONT font;
3908   CHOOSEFONT cf;
3909   TCHAR szClass[128];
3910   HWND hWnd;
3911
3912   GetListFont(&font);
3913   font.lfQuality = DEFAULT_QUALITY;
3914
3915   cf.lStructSize = sizeof(CHOOSEFONT);
3916   cf.hwndOwner   = hMain;
3917   cf.lpLogFont   = &font;
3918   cf.lpfnHook = &CFHookProc;
3919   cf.rgbColors   = GetListFontColor();
3920   cf.Flags      = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_EFFECTS | CF_ENABLEHOOK;
3921   if (!ChooseFont(&cf))
3922      return;
3923
3924   SetListFont(&font);
3925   if (hFont != NULL)
3926      DeleteObject(hFont);
3927   hFont = CreateFontIndirect(&font);
3928   if (hFont != NULL)
3929   {
3930      COLORREF textColor = cf.rgbColors;
3931
3932      if (textColor == RGB(255,255,255))
3933      {
3934         textColor = RGB(240, 240, 240);
3935      }
3936
3937      SetAllWindowsFont(hMain, &main_resize, hFont, TRUE);
3938
3939      hWnd = GetWindow(hMain, GW_CHILD);
3940      while(hWnd)
3941      {
3942         if (GetClassName(hWnd, szClass, sizeof(szClass) / sizeof(szClass[0])))
3943         {
3944            if (!_tcscmp(szClass, TEXT("SysListView32")))
3945            {
3946               ListView_SetTextColor(hWnd, textColor);
3947            }
3948            else if (!_tcscmp(szClass, TEXT("SysTreeView32")))
3949            {
3950               TreeView_SetTextColor(hTreeView, textColor);
3951            }
3952         }
3953         hWnd = GetWindow(hWnd, GW_HWNDNEXT);
3954      }
3955      SetListFontColor(cf.rgbColors);
3956      ResetListView();
3957   }
3958}
3959
3960static void PickColor(COLORREF *cDefault)
3961{
3962    CHOOSECOLOR cc;
3963    COLORREF choice_colors[16];
3964    int i;
3965   
3966    for (i=0;i<16;i++)
3967       choice_colors[i] = GetCustomColor(i);
3968 
3969    cc.lStructSize = sizeof(CHOOSECOLOR);
3970    cc.hwndOwner   = hMain;
3971    cc.rgbResult   = *cDefault;
3972    cc.lpCustColors = choice_colors;
3973    cc.Flags       = CC_ANYCOLOR | CC_RGBINIT | CC_SOLIDCOLOR;
3974    if (!ChooseColor(&cc))
3975       return;
3976    for (i=0;i<16;i++)
3977       SetCustomColor(i,choice_colors[i]);
3978    *cDefault = cc.rgbResult;
3979}
3980 
3981static void PickCloneColor(void)
3982{
3983    COLORREF cClonecolor;
3984    cClonecolor = GetListCloneColor();
3985    PickColor( &cClonecolor);
3986    SetListCloneColor(cClonecolor);
3987    InvalidateRect(hwndList,NULL,FALSE);
3988}
3989 
3990static BOOL MameCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify)
3991{
3992   int i;
3993   LPTREEFOLDER folder;
3994   char* t_szFile;
3995   
3996   switch (id)
3997   {
3998   case ID_FILE_PLAY:
3999      MamePlayGame();
4000      return TRUE;
4001
4002   case ID_FILE_PLAY_RECORD:
4003      MamePlayRecordGame();
4004      return TRUE;
4005
4006   case ID_FILE_PLAY_BACK:
4007      MamePlayBackGame();
4008      return TRUE;
4009
4010   case ID_FILE_PLAY_RECORD_WAVE:
4011      MamePlayRecordWave();
4012      return TRUE;
4013
4014   case ID_FILE_PLAY_RECORD_MNG:
4015      MamePlayRecordMNG();
4016      return TRUE;
4017
4018   case ID_FILE_LOADSTATE :
4019      MameLoadState();
4020      return TRUE;
4021
4022   case ID_FILE_AUDIT:
4023      AuditDialog(hMain);
4024      ResetWhichGamesInFolders();
4025      ResetListView();
4026      SetFocus(hwndList);
4027      return TRUE;
4028
4029   case ID_FILE_EXIT:
4030      PostMessage(hMain, WM_CLOSE, 0, 0);
4031      return TRUE;
4032
4033   case ID_VIEW_LARGE_ICON:
4034      SetView(ID_VIEW_LARGE_ICON);
4035      return TRUE;
4036
4037   case ID_VIEW_SMALL_ICON:
4038      SetView(ID_VIEW_SMALL_ICON);
4039      ResetListView();
4040      return TRUE;
4041
4042   case ID_VIEW_LIST_MENU:
4043      SetView(ID_VIEW_LIST_MENU);
4044      return TRUE;
4045
4046   case ID_VIEW_DETAIL:
4047      SetView(ID_VIEW_DETAIL);
4048      return TRUE;
4049
4050   case ID_VIEW_GROUPED:
4051      SetView(ID_VIEW_GROUPED);
4052      return TRUE;
4053
4054   /* Arrange Icons submenu */
4055   case ID_VIEW_BYGAME:
4056      SetSortReverse(FALSE);
4057      SetSortColumn(COLUMN_GAMES);
4058      Picker_Sort(hwndList);
4059      break;
4060
4061   case ID_VIEW_BYDIRECTORY:
4062      SetSortReverse(FALSE);
4063      SetSortColumn(COLUMN_DIRECTORY);
4064      Picker_Sort(hwndList);
4065      break;
4066
4067   case ID_VIEW_BYMANUFACTURER:
4068      SetSortReverse(FALSE);
4069      SetSortColumn(COLUMN_MANUFACTURER);
4070      Picker_Sort(hwndList);
4071      break;
4072
4073   case ID_VIEW_BYTIMESPLAYED:
4074      SetSortReverse(FALSE);
4075      SetSortColumn(COLUMN_PLAYED);
4076      Picker_Sort(hwndList);
4077      break;
4078
4079   case ID_VIEW_BYTYPE:
4080      SetSortReverse(FALSE);
4081      SetSortColumn(COLUMN_TYPE);
4082      Picker_Sort(hwndList);
4083      break;
4084
4085   case ID_VIEW_BYYEAR:
4086      SetSortReverse(FALSE);
4087      SetSortColumn(COLUMN_YEAR);
4088      Picker_Sort(hwndList);
4089      break;
4090
4091   case ID_VIEW_FOLDERS:
4092      bShowTree = !bShowTree;
4093      SetShowFolderList(bShowTree);
4094      CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
4095      ToolBar_CheckButton(hToolBar, ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
4096      UpdateScreenShot();
4097      break;
4098
4099   case ID_VIEW_TOOLBARS:
4100      bShowToolBar = !bShowToolBar;
4101      SetShowToolBar(bShowToolBar);
4102      CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
4103      ToolBar_CheckButton(hToolBar, ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
4104      ShowWindow(hToolBar, (bShowToolBar) ? SW_SHOW : SW_HIDE);
4105      ResizePickerControls(hMain);
4106      UpdateScreenShot();
4107      break;
4108
4109   case ID_VIEW_STATUS:
4110      bShowStatusBar = !bShowStatusBar;
4111      SetShowStatusBar(bShowStatusBar);
4112      CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
4113      ToolBar_CheckButton(hToolBar, ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
4114      ShowWindow(hStatusBar, (bShowStatusBar) ? SW_SHOW : SW_HIDE);
4115      ResizePickerControls(hMain);
4116      UpdateScreenShot();
4117      break;
4118
4119   case ID_VIEW_PAGETAB:
4120      bShowTabCtrl = !bShowTabCtrl;
4121      SetShowTabCtrl(bShowTabCtrl);
4122      ShowWindow(hTabCtrl, (bShowTabCtrl) ? SW_SHOW : SW_HIDE);
4123      ResizePickerControls(hMain);
4124      UpdateScreenShot();
4125      InvalidateRect(hMain,NULL,TRUE);
4126      break;
4127
4128      /*
4129        Switches to fullscreen mode. No check mark handeling
4130        for this item cause in fullscreen mode the menu won't
4131        be visible anyways.
4132      */   
4133   case ID_VIEW_FULLSCREEN:
4134      SwitchFullScreenMode();
4135      break;
4136
4137   case ID_TOOLBAR_EDIT:
4138      {
4139         char buf[256];
4140
4141         win_get_window_text_utf8(hwndCtl, buf, sizeof(buf));
4142         switch (codeNotify)
4143         {
4144         case EN_CHANGE:
4145            //put search routine here first, add a 200ms timer later.
4146            if ((!_stricmp(buf, SEARCH_PROMPT) && !_stricmp(g_SearchText, "")) ||
4147                (!_stricmp(g_SearchText, SEARCH_PROMPT) && !_stricmp(buf, "")))
4148            {
4149               strcpy(g_SearchText, buf);
4150            }
4151            else
4152            {
4153               strcpy(g_SearchText, buf);
4154               ResetListView();
4155            }
4156            break;
4157         case EN_SETFOCUS:
4158            if (!_stricmp(buf, SEARCH_PROMPT))
4159               win_set_window_text_utf8(hwndCtl, "");
4160            break;
4161         case EN_KILLFOCUS:
4162            if (strlen(buf) == 0)
4163               win_set_window_text_utf8(hwndCtl, SEARCH_PROMPT);
4164            break;
4165         }
4166      }
4167      break;
4168
4169   case ID_GAME_AUDIT:
4170      InitGameAudit(0);
4171      if (!oldControl)
4172      {
4173         InitPropertyPageToPage(hInst, hwnd, GetSelectedPickItemIcon(), OPTIONS_GAME, -1, Picker_GetSelectedItem(hwndList), AUDIT_PAGE);
4174      }
4175      /* Just in case the toggle MMX on/off */
4176      UpdateStatusBar();
4177      break;
4178
4179   /* ListView Context Menu */
4180   case ID_CONTEXT_ADD_CUSTOM:
4181   {
4182       int  nResult;
4183
4184      nResult = DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_CUSTOM_FILE),
4185                         hMain,AddCustomFileDialogProc,Picker_GetSelectedItem(hwndList));
4186      SetFocus(hwndList);
4187      break;
4188   }
4189
4190   case ID_CONTEXT_REMOVE_CUSTOM:
4191   {
4192       RemoveCurrentGameCustomFolder();
4193      break;
4194   }
4195
4196   /* Tree Context Menu */
4197   case ID_CONTEXT_FILTERS:
4198      if (DialogBox(GetModuleHandle(NULL),
4199         MAKEINTRESOURCE(IDD_FILTERS), hMain, FilterDialogProc) == TRUE)
4200         ResetListView();
4201      SetFocus(hwndList);
4202      return TRUE;
4203
4204      // ScreenShot Context Menu
4205      // select current tab
4206   case ID_VIEW_TAB_SCREENSHOT :
4207   case ID_VIEW_TAB_FLYER :
4208   case ID_VIEW_TAB_CABINET :
4209   case ID_VIEW_TAB_MARQUEE :
4210   case ID_VIEW_TAB_TITLE :
4211   case ID_VIEW_TAB_CONTROL_PANEL :
4212   case ID_VIEW_TAB_PCB :
4213   case ID_VIEW_TAB_HISTORY:
4214      if (id == ID_VIEW_TAB_HISTORY && GetShowTab(TAB_HISTORY) == FALSE)
4215         break;
4216
4217      TabView_SetCurrentTab(hTabCtrl, id - ID_VIEW_TAB_SCREENSHOT);
4218      UpdateScreenShot();
4219      TabView_UpdateSelection(hTabCtrl);
4220      break;
4221
4222      // toggle tab's existence
4223   case ID_TOGGLE_TAB_SCREENSHOT :
4224   case ID_TOGGLE_TAB_FLYER :
4225   case ID_TOGGLE_TAB_CABINET :
4226   case ID_TOGGLE_TAB_MARQUEE :
4227   case ID_TOGGLE_TAB_TITLE :
4228   case ID_TOGGLE_TAB_CONTROL_PANEL :
4229   case ID_TOGGLE_TAB_PCB :
4230   case ID_TOGGLE_TAB_HISTORY :
4231   {
4232      int toggle_flag = id - ID_TOGGLE_TAB_SCREENSHOT;
4233
4234      if (AllowedToSetShowTab(toggle_flag,!GetShowTab(toggle_flag)) == FALSE)
4235      {
4236         // attempt to hide the last tab
4237         // should show error dialog? hide picture area? or ignore?
4238         break;
4239      }
4240
4241      SetShowTab(toggle_flag,!GetShowTab(toggle_flag));
4242
4243      TabView_Reset(hTabCtrl);
4244
4245      if (TabView_GetCurrentTab(hTabCtrl) == toggle_flag && GetShowTab(toggle_flag) == FALSE)
4246      {
4247         // we're deleting the tab we're on, so go to the next one
4248         TabView_CalculateNextTab(hTabCtrl);
4249      }
4250
4251
4252      // Resize the controls in case we toggled to another history
4253      // mode (and the history control needs resizing).
4254
4255      ResizePickerControls(hMain);
4256      UpdateScreenShot();
4257   
4258      TabView_UpdateSelection(hTabCtrl);
4259
4260      break;
4261   }
4262
4263   /* Header Context Menu */
4264   case ID_SORT_ASCENDING:
4265      SetSortReverse(FALSE);
4266      SetSortColumn(Picker_GetRealColumnFromViewColumn(hwndList, lastColumnClick));
4267      Picker_Sort(hwndList);
4268      break;
4269
4270   case ID_SORT_DESCENDING:
4271      SetSortReverse(TRUE);
4272      SetSortColumn(Picker_GetRealColumnFromViewColumn(hwndList, lastColumnClick));
4273      Picker_Sort(hwndList);
4274      break;
4275
4276   case ID_CUSTOMIZE_FIELDS:
4277      if (DialogBox(GetModuleHandle(NULL),
4278         MAKEINTRESOURCE(IDD_COLUMNS), hMain, ColumnDialogProc) == TRUE)
4279         ResetColumnDisplay(FALSE);
4280      SetFocus(hwndList);
4281      return TRUE;
4282
4283   /* View Menu */
4284   case ID_VIEW_LINEUPICONS:
4285      if( codeNotify == FALSE)
4286         ResetListView();
4287      else
4288      {
4289         /*it was sent after a refresh (F5) was done, we only reset the View if "available" is the selected folder
4290           as it doesn't affect the others*/
4291         folder = GetSelectedFolder();
4292         if( folder )
4293         {
4294            if (folder->m_nFolderId == FOLDER_AVAILABLE )
4295               ResetListView();
4296
4297         }
4298      }
4299      break;
4300
4301   case ID_GAME_PROPERTIES:
4302      if (!oldControl)
4303      {
4304         folder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
4305         InitPropertyPage(hInst, hwnd, GetSelectedPickItemIcon(), OPTIONS_GAME, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4306#ifdef MESS
4307         {
4308            extern BOOL g_bModifiedSoftwarePaths;
4309            if (g_bModifiedSoftwarePaths) {
4310               g_bModifiedSoftwarePaths = FALSE;
4311               MessUpdateSoftwareList();
4312            }
4313         }
4314#endif
4315      }
4316      /* Just in case the toggle MMX on/off */
4317      UpdateStatusBar();
4318      break;
4319
4320   case ID_FOLDER_PROPERTIES:
4321      if (!oldControl)
4322      {
4323         folder = GetSelectedFolder();
4324         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), (folder->m_nFolderId == FOLDER_VECTOR) ? OPTIONS_VECTOR : OPTIONS_SOURCE, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4325         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4326      }
4327      /* Just in case the toggle MMX on/off */
4328      UpdateStatusBar();
4329      break;
4330
4331   case ID_FOLDER_SOURCEPROPERTIES:
4332      if (!oldControl)
4333      {
4334         folder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
4335         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), (folder->m_nFolderId == FOLDER_VECTOR) ? OPTIONS_VECTOR : OPTIONS_SOURCE , folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4336         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4337      }
4338      /* Just in case the toggle MMX on/off */
4339      UpdateStatusBar();
4340      break;
4341
4342   case ID_FOLDER_VECTORPROPERTIES:
4343      if (!oldControl)
4344      {
4345         folder = GetFolderByID( FOLDER_VECTOR );
4346         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), OPTIONS_VECTOR, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4347         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4348      }
4349      /* Just in case the toggle MMX on/off */
4350      UpdateStatusBar();
4351      break;
4352
4353   case ID_FOLDER_AUDIT:
4354      FolderCheck();
4355      /* Just in case the toggle MMX on/off */
4356      UpdateStatusBar();
4357      break;
4358
4359   case ID_VIEW_PICTURE_AREA :
4360      ToggleScreenShot();
4361      break;
4362
4363   case ID_UPDATE_GAMELIST:
4364      UpdateGameList(TRUE, TRUE);
4365      break;
4366
4367   case ID_OPTIONS_FONT:
4368      PickFont();
4369      return TRUE;
4370
4371   case ID_OPTIONS_CLONE_COLOR:
4372      PickCloneColor();
4373      return TRUE;
4374
4375   case ID_OPTIONS_DEFAULTS:
4376      /* Check the return value to see if changes were applied */
4377      if (!oldControl)
4378      {
4379         InitDefaultPropertyPage(hInst, hwnd);
4380         SaveDefaultOptions();
4381      }
4382      SetFocus(hwndList);
4383      return TRUE;
4384
4385   case ID_OPTIONS_DIR:
4386      {
4387         int  nResult;
4388         BOOL bUpdateRoms;
4389         BOOL bUpdateSamples;
4390#ifdef MESS
4391         BOOL bUpdateSoftware;
4392#endif
4393
4394         nResult = DialogBox(GetModuleHandle(NULL),
4395                        MAKEINTRESOURCE(IDD_DIRECTORIES),
4396                        hMain,
4397                        DirectoriesDialogProc);
4398
4399         SaveDefaultOptions();
4400
4401         bUpdateRoms    = ((nResult & DIRDLG_ROMS)    == DIRDLG_ROMS)   ? TRUE : FALSE;
4402         bUpdateSamples = ((nResult & DIRDLG_SAMPLES) == DIRDLG_SAMPLES) ? TRUE : FALSE;
4403#ifdef MESS
4404         bUpdateSoftware = ((nResult & DIRDLG_SOFTWARE) == DIRDLG_SOFTWARE) ? TRUE : FALSE;
4405
4406         if (bUpdateSoftware)
4407            MessUpdateSoftwareList();
4408#endif /* MESS */
4409
4410         if (s_pWatcher)
4411         {
4412            if (bUpdateRoms)
4413               DirWatcher_Watch(s_pWatcher, 0, GetRomDirs(), TRUE);
4414            if (bUpdateSamples)
4415               DirWatcher_Watch(s_pWatcher, 1, GetSampleDirs(), TRUE);
4416         }
4417
4418         /* update game list */
4419         if (bUpdateRoms == TRUE || bUpdateSamples == TRUE)
4420            UpdateGameList(bUpdateRoms, bUpdateSamples);
4421
4422         SetFocus(hwndList);
4423      }
4424      return TRUE;
4425
4426   case ID_OPTIONS_RESET_DEFAULTS:
4427      if (DialogBox(GetModuleHandle(NULL),
4428                 MAKEINTRESOURCE(IDD_RESET), hMain, ResetDialogProc) == TRUE)
4429        {
4430         // these may have been changed
4431         SaveDefaultOptions();
4432         DestroyWindow(hwnd);
4433         PostQuitMessage(0);
4434      } else {
4435         ResetListView();
4436         SetFocus(hwndList);
4437      }
4438      return TRUE;
4439
4440   case ID_OPTIONS_INTERFACE:
4441      DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_INTERFACE_OPTIONS),
4442              hMain, InterfaceDialogProc);
4443      SaveDefaultOptions();
4444
4445      KillTimer(hMain, SCREENSHOT_TIMER);
4446      if( GetCycleScreenshot() > 0)
4447      {
4448         SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL ); // Scale to seconds
4449      }
4450
4451      return TRUE;
4452
4453   case ID_OPTIONS_BG:
4454      {
4455         OPENFILENAME OpenFileName;
4456         static TCHAR szFile[MAX_PATH] = TEXT("\0");
4457         TCHAR*       t_bgdir = tstring_from_utf8(GetBgDir());
4458         if( !t_bgdir )
4459            return FALSE;
4460
4461         OpenFileName.lStructSize       = sizeof(OPENFILENAME);
4462         OpenFileName.hwndOwner         = hMain;
4463         OpenFileName.hInstance         = 0;
4464         OpenFileName.lpstrFilter       = TEXT("Image Files (*.png, *.bmp)\0*.PNG;*.BMP\0");
4465         OpenFileName.lpstrCustomFilter = NULL;
4466         OpenFileName.nMaxCustFilter    = 0;
4467         OpenFileName.nFilterIndex      = 1;
4468         OpenFileName.lpstrFile         = szFile;
4469         OpenFileName.nMaxFile          = sizeof(szFile);
4470         OpenFileName.lpstrFileTitle    = NULL;
4471         OpenFileName.nMaxFileTitle     = 0;
4472         OpenFileName.lpstrInitialDir   = t_bgdir;
4473         OpenFileName.lpstrTitle        = TEXT("Select a Background Image");
4474         OpenFileName.nFileOffset       = 0;
4475         OpenFileName.nFileExtension    = 0;
4476         OpenFileName.lpstrDefExt       = NULL;
4477         OpenFileName.lCustData         = 0;                                                 
4478         OpenFileName.lpfnHook          = NULL;
4479         OpenFileName.lpTemplateName    = NULL;                                   
4480         OpenFileName.Flags             = OFN_NOCHANGEDIR | OFN_SHOWHELP | OFN_EXPLORER;
4481
4482         if (GetOpenFileName(&OpenFileName))
4483         {
4484            t_szFile = utf8_from_tstring(szFile);
4485            if( !t_szFile )
4486               return FALSE;
4487            ResetBackground(t_szFile);
4488            LoadBackgroundBitmap();
4489            InvalidateRect(hMain, NULL, TRUE);
4490            free(t_bgdir);
4491            free(t_szFile);
4492            return TRUE;
4493         }
4494         free(t_bgdir);
4495      }
4496      break;
4497
4498   case ID_OPTIONS_LANGUAGE:
4499      DialogBox(GetModuleHandle(NULL),
4500              MAKEINTRESOURCE(IDD_LANGUAGE),
4501              hMain,
4502              LanguageDialogProc);
4503      return TRUE;
4504
4505   case ID_HELP_ABOUT:
4506      DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUT),
4507              hMain, AboutDialogProc);
4508      SetFocus(hwndList);
4509      return TRUE;
4510
4511   case IDOK :
4512      /* cmk -- might need to check more codes here, not sure */
4513      if (codeNotify != EN_CHANGE && codeNotify != EN_UPDATE)
4514      {
4515         /* enter key */
4516         if (g_in_treeview_edit)
4517         {
4518            TreeView_EndEditLabelNow(hTreeView, FALSE);
4519            return TRUE;
4520         }
4521         else
4522            if (have_selection)
4523               MamePlayGame();
4524      }
4525      break;
4526
4527   case IDCANCEL : /* esc key */
4528      if (g_in_treeview_edit)
4529         TreeView_EndEditLabelNow(hTreeView, TRUE);
4530      break;
4531
4532   case IDC_PLAY_GAME :
4533      if (have_selection)
4534         MamePlayGame();
4535      break;
4536
4537   case ID_UI_START:
4538      SetFocus(hwndList);
4539      MamePlayGame();
4540      break;
4541
4542   case ID_UI_UP:
4543      Picker_SetSelectedPick(hwndList, GetSelectedPick() - 1);
4544       break;
4545
4546   case ID_UI_DOWN:
4547      Picker_SetSelectedPick(hwndList, GetSelectedPick() + 1);
4548       break;
4549
4550   case ID_UI_PGUP:
4551      Picker_SetSelectedPick(hwndList, GetSelectedPick() - ListView_GetCountPerPage(hwndList));
4552       break;
4553
4554   case ID_UI_PGDOWN:
4555      if ( (GetSelectedPick() + ListView_GetCountPerPage(hwndList)) < ListView_GetItemCount(hwndList) )
4556         Picker_SetSelectedPick(hwndList,  GetSelectedPick() + ListView_GetCountPerPage(hwndList) );
4557      else
4558         Picker_SetSelectedPick(hwndList,  ListView_GetItemCount(hwndList)-1 );
4559       break;
4560
4561   case ID_UI_HOME:
4562      Picker_SetSelectedPick(hwndList, 0);
4563       break;
4564
4565   case ID_UI_END:
4566      Picker_SetSelectedPick(hwndList,  ListView_GetItemCount(hwndList)-1 );
4567      break;
4568   case ID_UI_LEFT:
4569      /* hmmmmm..... */
4570      SendMessage(hwndList,WM_HSCROLL, SB_LINELEFT, 0);
4571       break;
4572
4573   case ID_UI_RIGHT:
4574      /* hmmmmm..... */
4575      SendMessage(hwndList,WM_HSCROLL, SB_LINERIGHT, 0);
4576       break;
4577   case ID_UI_HISTORY_UP:
4578      /* hmmmmm..... */
4579      {
4580         HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
4581         SendMessage(hHistory, EM_SCROLL, SB_PAGEUP, 0);
4582      }
4583       break;
4584
4585   case ID_UI_HISTORY_DOWN:
4586      /* hmmmmm..... */
4587      {
4588         HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
4589         SendMessage(hHistory, EM_SCROLL, SB_PAGEDOWN, 0);
4590      }
4591       break;
4592
4593   case IDC_SSFRAME:
4594      TabView_CalculateNextTab(hTabCtrl);
4595      UpdateScreenShot();
4596      TabView_UpdateSelection(hTabCtrl);
4597      break;
4598
4599   case ID_CONTEXT_SELECT_RANDOM:
4600      SetRandomPickItem();
4601      break;
4602
4603   case ID_CONTEXT_RESET_PLAYTIME:
4604      ResetPlayTime( Picker_GetSelectedItem(hwndList) );
4605      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
4606      break;
4607
4608   case ID_CONTEXT_RESET_PLAYCOUNT:
4609      ResetPlayCount( Picker_GetSelectedItem(hwndList) );
4610      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
4611      break;
4612
4613   case ID_CONTEXT_RENAME_CUSTOM :
4614      TreeView_EditLabel(hTreeView,TreeView_GetSelection(hTreeView));
4615      break;
4616
4617   default:
4618      if (id >= ID_CONTEXT_SHOW_FOLDER_START && id < ID_CONTEXT_SHOW_FOLDER_END)
4619      {
4620         ToggleShowFolder(id - ID_CONTEXT_SHOW_FOLDER_START);
4621         break;
4622      }
4623      for (i = 0; g_helpInfo[i].nMenuItem > 0; i++)
4624      {
4625         if (g_helpInfo[i].nMenuItem == id)
4626         {
4627            if (g_helpInfo[i].bIsHtmlHelp)
4628               HelpFunction(hMain, g_helpInfo[i].lpFile, HH_DISPLAY_TOPIC, 0);
4629            else
4630               DisplayTextFile(hMain, g_helpInfo[i].lpFile);
4631            return FALSE;
4632         }
4633      }
4634#ifdef MESS
4635      return MessCommand(hwnd, id, hwndCtl, codeNotify);
4636#else
4637      break;
4638#endif
4639   }
4640
4641   return FALSE;
4642}
4643
4644static void LoadBackgroundBitmap()
4645{
4646   HGLOBAL hDIBbg;
4647   char*   pFileName = 0;
4648
4649   if (hBackground)
4650   {
4651      DeleteObject(hBackground);
4652      hBackground = 0;
4653   }
4654
4655   if (hPALbg)
4656   {
4657      DeleteObject(hPALbg);
4658      hPALbg = 0;
4659   }
4660
4661   /* Pick images based on number of colors avaliable. */
4662   if (GetDepth(hwndList) <= 8)
4663   {
4664      pFileName = (char *)"bkgnd16";
4665      /*nResource = IDB_BKGROUND16;*/
4666   }
4667   else
4668   {
4669      pFileName = (char *)"bkground";
4670      /*nResource = IDB_BKGROUND;*/
4671   }
4672
4673   if (LoadDIB(pFileName, &hDIBbg, &hPALbg, BACKGROUND))
4674   {
4675      HDC hDC = GetDC(hwndList);
4676      hBackground = DIBToDDB(hDC, hDIBbg, &bmDesc);
4677      GlobalFree(hDIBbg);
4678      ReleaseDC(hwndList, hDC);
4679   }
4680}
4681
4682static void ResetColumnDisplay(BOOL first_time)
4683{
4684   int driver_index;
4685
4686   if (!first_time)
4687      Picker_ResetColumnDisplay(hwndList);
4688
4689   ResetListView();
4690
4691   driver_index = GetGameNameIndex(GetDefaultGame());
4692   Picker_SetSelectedItem(hwndList, driver_index);
4693}
4694
4695int GamePicker_GetItemImage(HWND hwndPicker, int nItem)
4696{
4697   return GetIconForDriver(nItem);
4698}
4699
4700const TCHAR *GamePicker_GetItemString(HWND hwndPicker, int nItem, int nColumn,
4701   TCHAR *pszBuffer, UINT nBufferLength)
4702{
4703   const TCHAR *s = NULL;
4704   const char* utf8_s = NULL;
4705   char playtime_buf[256];
4706
4707   switch(nColumn)
4708   {
4709      case COLUMN_GAMES:
4710         /* Driver description */
4711         utf8_s = ModifyThe(drivers[nItem]->description);
4712         break;
4713      case COLUMN_ORIENTATION:
4714         utf8_s = DriverIsVertical(nItem) ? "Vertical" : "Horizontal";
4715         break;
4716#if 0
4717      case COLUMN_ROMS:
4718         /* Has Roms */
4719         utf8_s = GetAuditString(GetRomAuditResults(nItem));
4720         break;
4721#endif
4722      case COLUMN_SAMPLES:
4723         /* Samples */
4724         if (DriverUsesSamples(nItem))
4725            utf8_s = GetAuditString(GetSampleAuditResults(nItem));
4726         break;
4727
4728      case COLUMN_DIRECTORY:
4729         /* Driver name (directory) */
4730         utf8_s = drivers[nItem]->name;
4731         break;
4732
4733      case COLUMN_SRCDRIVERS:
4734         /* Source drivers */
4735         utf8_s = GetDriverFilename(nItem);
4736         break;
4737
4738      case COLUMN_PLAYTIME:
4739         /* Source drivers */
4740         GetTextPlayTime(nItem, playtime_buf);
4741         utf8_s = playtime_buf;
4742         break;
4743
4744      case COLUMN_TYPE:
4745        {
4746            machine_config drv;
4747            expand_machine_driver(drivers[nItem]->drv,&drv);
4748
4749         /* Vector/Raster */
4750         if (drv.video_attributes & VIDEO_TYPE_VECTOR)
4751            s = TEXT("Vector");
4752         else
4753            s = TEXT("Raster");
4754         break;
4755        }
4756      case COLUMN_TRACKBALL:
4757         /* Trackball */
4758         if (DriverUsesTrackball(nItem))
4759            s = TEXT("Yes");
4760         else
4761            s = TEXT("No");
4762         break;
4763
4764      case COLUMN_PLAYED:
4765         /* times played */
4766         _sntprintf(pszBuffer, nBufferLength, TEXT("%i"), GetPlayCount(nItem));
4767         s = pszBuffer;
4768         break;
4769
4770      case COLUMN_MANUFACTURER:
4771         /* Manufacturer */
4772         utf8_s = drivers[nItem]->manufacturer;
4773         break;
4774
4775      case COLUMN_YEAR:
4776         /* Year */
4777         utf8_s = drivers[nItem]->year;
4778         break;
4779
4780      case COLUMN_CLONE:
4781         utf8_s = GetCloneParentName(nItem);
4782         break;
4783   }
4784   
4785   if( utf8_s )
4786   {
4787      TCHAR* t_s = tstring_from_utf8(utf8_s);
4788      if( !t_s )
4789         return s;
4790     
4791      _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s);     
4792      free(t_s);
4793     
4794      s = pszBuffer;
4795   }
4796   
4797   return s;
4798}
4799
4800static void GamePicker_LeavingItem(HWND hwndPicker, int nItem)
4801{
4802   // leaving item
4803   // printf("leaving %s\n",drivers[nItem]->name);
4804}
4805
4806static void GamePicker_EnteringItem(HWND hwndPicker, int nItem)
4807{
4808   TCHAR* t_description;
4809   ATOM a;
4810   // printf("entering %s\n",drivers[nItem]->name);
4811   if (g_bDoBroadcast == TRUE)
4812   {
4813      t_description = tstring_from_utf8(drivers[nItem]->description);
4814      if( !t_description )
4815         return;
4816      a = GlobalAddAtom(t_description);
4817      SendMessage(HWND_BROADCAST, g_mame32_message, a, a);
4818      GlobalDeleteAtom(a);
4819      free(t_description);
4820   }
4821
4822   EnableSelection(nItem);
4823#ifdef MESS
4824   MessReadMountedSoftware(nItem);
4825#endif
4826}
4827
4828static int GamePicker_FindItemParent(HWND hwndPicker, int nItem)
4829{
4830   return GetParentRomSetIndex(drivers[nItem]);
4831}
4832
4833/* Initialize the Picker and List controls */
4834static void InitListView()
4835{
4836   LVBKIMAGE bki;
4837   TCHAR path[MAX_PATH];
4838   TCHAR* t_bgdir;
4839
4840   static const struct PickerCallbacks s_gameListCallbacks =
4841   {
4842      SetSortColumn,            /* pfnSetSortColumn */
4843      GetSortColumn,            /* pfnGetSortColumn */
4844      SetSortReverse,            /* pfnSetSortReverse */
4845      GetSortReverse,            /* pfnGetSortReverse */
4846      SetViewMode,            /* pfnSetViewMode */
4847      GetViewMode,            /* pfnGetViewMode */
4848      SetColumnWidths,         /* pfnSetColumnWidths */
4849      GetColumnWidths,         /* pfnGetColumnWidths */
4850      SetColumnOrder,            /* pfnSetColumnOrder */
4851      GetColumnOrder,            /* pfnGetColumnOrder */
4852      SetColumnShown,            /* pfnSetColumnShown */
4853      GetColumnShown,            /* pfnGetColumnShown */
4854      GetOffsetClones,         /* pfnGetOffsetChildren */
4855
4856      GamePicker_Compare,         /* pfnCompare */
4857      MamePlayGame,            /* pfnDoubleClick */
4858      GamePicker_GetItemString,   /* pfnGetItemString */
4859      GamePicker_GetItemImage,   /* pfnGetItemImage */
4860      GamePicker_LeavingItem,      /* pfnLeavingItem */
4861      GamePicker_EnteringItem,   /* pfnEnteringItem */
4862      BeginListViewDrag,         /* pfnBeginListViewDrag */
4863      GamePicker_FindItemParent,   /* pfnFindItemParent */
4864      OnIdle,                     /* pfnIdle */
4865      GamePicker_OnHeaderContextMenu,   /* pfnOnHeaderContextMenu */
4866      GamePicker_OnBodyContextMenu   /* pfnOnBodyContextMenu */
4867   };
4868
4869   struct PickerOptions opts;
4870
4871   // subclass the list view
4872   memset(&opts, 0, sizeof(opts));
4873   opts.pCallbacks = &s_gameListCallbacks;
4874   opts.nColumnCount = COLUMN_MAX;
4875   opts.ppszColumnNames = column_names;
4876   SetupPicker(hwndList, &opts);
4877
4878   ListView_SetTextBkColor(hwndList, CLR_NONE);
4879   ListView_SetBkColor(hwndList, CLR_NONE);
4880   t_bgdir = tstring_from_utf8(GetBgDir());
4881   if( !t_bgdir )
4882      return;
4883   _stprintf(path, TEXT("%s\\bkground.png"), t_bgdir);
4884   bki.ulFlags = LVBKIF_SOURCE_URL | LVBKIF_STYLE_TILE;
4885   bki.pszImage = path;
4886   if( hBackground )   
4887      ListView_SetBkImage(hwndList, &bki);
4888
4889   CreateIcons();
4890
4891   ResetColumnDisplay(TRUE);
4892
4893   // Allow selection to change the default saved game
4894   bListReady = TRUE;
4895   free(t_bgdir);
4896}
4897
4898static void AddDriverIcon(int nItem,int default_icon_index)
4899{
4900   HICON hIcon = 0;
4901   int nParentIndex = -1;
4902
4903   /* if already set to rom or clone icon, we've been here before */
4904   if (icon_index[nItem] == 1 || icon_index[nItem] == 3)
4905      return;
4906
4907   hIcon = LoadIconFromFile((char *)drivers[nItem]->name);
4908   if (hIcon == NULL)
4909   {
4910      nParentIndex = GetParentIndex(drivers[nItem]);
4911      if( nParentIndex >= 0)
4912      {
4913         hIcon = LoadIconFromFile((char *)drivers[nParentIndex]->name);
4914         nParentIndex = GetParentIndex(drivers[nParentIndex]);
4915         if (hIcon == NULL && nParentIndex >= 0)
4916            hIcon = LoadIconFromFile((char *)drivers[nParentIndex]->name);
4917      }
4918   }
4919
4920   if (hIcon != NULL)
4921   {
4922      int nIconPos = ImageList_AddIcon(hSmall, hIcon);
4923      ImageList_AddIcon(hLarge, hIcon);
4924      if (nIconPos != -1)
4925         icon_index[nItem] = nIconPos;
4926   }
4927   if (icon_index[nItem] == 0)
4928      icon_index[nItem] = default_icon_index;
4929}
4930
4931static void DestroyIcons(void)
4932{
4933   if (hSmall != NULL)
4934   {
4935      ImageList_Destroy(hSmall);
4936      hSmall = NULL;
4937   }
4938
4939   if (icon_index != NULL)
4940   {
4941      int i;
4942      for (i=0;i<driver_list_get_count(drivers);i++)
4943         icon_index[i] = 0; // these are indices into hSmall
4944   }
4945
4946   if (hLarge != NULL)
4947   {
4948      ImageList_Destroy(hLarge);
4949      hLarge = NULL;
4950   }
4951
4952   if (hHeaderImages != NULL)
4953   {
4954      ImageList_Destroy(hHeaderImages);
4955      hHeaderImages = NULL;
4956   }
4957
4958}
4959
4960static void ReloadIcons(void)
4961{
4962   HICON hIcon;
4963   INT i;
4964
4965   // clear out all the images
4966   ImageList_RemoveAll(hSmall);
4967   ImageList_RemoveAll(hLarge);
4968
4969   if (icon_index != NULL)
4970   {
4971      for (i=0;i<driver_list_get_count(drivers);i++)
4972         icon_index[i] = 0; // these are indices into hSmall
4973   }
4974
4975   for (i = 0; g_iconData[i].icon_name; i++)
4976   {
4977      hIcon = LoadIconFromFile((char *) g_iconData[i].icon_name);
4978      if (hIcon == NULL)
4979         hIcon = LoadIcon(hInst, MAKEINTRESOURCE(g_iconData[i].resource));
4980
4981      ImageList_AddIcon(hSmall, hIcon);
4982      ImageList_AddIcon(hLarge, hIcon);
4983   }
4984}
4985
4986static DWORD GetShellLargeIconSize(void)
4987{
4988   DWORD  dwSize, dwLength = 512, dwType = REG_SZ;
4989   TCHAR  szBuffer[512];
4990   HKEY   hKey;
4991
4992   /* Get the Key */
4993   RegOpenKey(HKEY_CURRENT_USER, TEXT("Control Panel\\desktop\\WindowMetrics"), &hKey);
4994   /* Save the last size */
4995   RegQueryValueEx(hKey, TEXT("Shell Icon Size"), NULL, &dwType, (LPBYTE)szBuffer, &dwLength);
4996   dwSize = _ttol(szBuffer);
4997   if (dwSize < 32)
4998      dwSize = 32;
4999
5000   if (dwSize > 48)
5001      dwSize = 48;
5002
5003   /* Clean up */
5004   RegCloseKey(hKey);
5005   return dwSize;
5006}
5007
5008static DWORD GetShellSmallIconSize(void)
5009{
5010   DWORD dwSize = ICONMAP_WIDTH;
5011
5012   if (dwSize < 48)
5013   {
5014      if (dwSize < 32)
5015         dwSize = 16;
5016      else
5017         dwSize = 32;
5018   }
5019   else
5020   {
5021      dwSize = 48;
5022   }
5023   return dwSize;
5024}
5025
5026// create iconlist for Listview control
5027static void CreateIcons(void)
5028{
5029   DWORD dwLargeIconSize = GetShellLargeIconSize();
5030   HICON hIcon;
5031   int icon_count;
5032   DWORD dwStyle;
5033   int i;
5034
5035   icon_count = 0;
5036   while(g_iconData[icon_count].icon_name)
5037      icon_count++;
5038
5039   // the current window style affects the sizing of the rows when changing
5040   // between list views, so put it in small icon mode temporarily while we associate
5041   // our image list
5042   //
5043   // using large icon mode instead kills the horizontal scrollbar when doing
5044   // full refresh, which seems odd (it should recreate the scrollbar when
5045   // set back to report mode, for example, but it doesn't).
5046
5047   dwStyle = GetWindowLong(hwndList,GWL_STYLE);
5048   SetWindowLong(hwndList,GWL_STYLE,(dwStyle & ~LVS_TYPEMASK) | LVS_ICON);
5049
5050   hSmall = ImageList_Create(GetShellSmallIconSize(),GetShellSmallIconSize(),
5051                       ILC_COLORDDB | ILC_MASK, icon_count, icon_count + 5000);
5052   hLarge = ImageList_Create(dwLargeIconSize, dwLargeIconSize,
5053                       ILC_COLORDDB | ILC_MASK, icon_count, icon_count + 5000);
5054
5055   if (NULL == hSmall || NULL == hLarge) {
5056      win_message_box_utf8(hwndList, "Cannot allocate Icon lists", "Allocation error - Exiting", IDOK);
5057      PostQuitMessage(0);
5058   }
5059
5060   ReloadIcons();
5061
5062   // Associate the image lists with the list view control.
5063   (void)ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL);
5064   (void)ListView_SetImageList(hwndList, hLarge, LVSIL_NORMAL);
5065
5066   // restore our view
5067   SetWindowLong(hwndList,GWL_STYLE,dwStyle);
5068
5069#ifdef MESS
5070   CreateMessIcons();
5071#endif
5072
5073   // Now set up header specific stuff
5074   hHeaderImages = ImageList_Create(8,8,ILC_COLORDDB | ILC_MASK,2,2);
5075   hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_HEADER_UP));
5076   ImageList_AddIcon(hHeaderImages,hIcon);
5077   hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_HEADER_DOWN));
5078   ImageList_AddIcon(hHeaderImages,hIcon);
5079
5080   for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
5081      Picker_SetHeaderImageList(GetDlgItem(hMain, s_nPickers[i]), hHeaderImages);
5082}
5083
5084
5085
5086static int GamePicker_Compare(HWND hwndPicker, int index1, int index2, int sort_subitem)
5087{
5088   int value = 0;  /* Default to 0, for unknown case */
5089   const char *name1 = NULL;
5090   const char *name2 = NULL;
5091   int nTemp1, nTemp2;
5092
5093#ifdef DEBUG
5094   if (strcmp(drivers[index1]->name,"1941") == 0 && strcmp(drivers[index2]->name,"1942") == 0)
5095   {
5096      dprintf("comparing 1941, 1942");
5097   }
5098
5099   if (strcmp(drivers[index1]->name,"1942") == 0 && strcmp(drivers[index2]->name,"1941") == 0)
5100   {
5101      dprintf("comparing 1942, 1941");
5102   }
5103#endif
5104
5105   switch (sort_subitem)
5106   {
5107   case COLUMN_GAMES:
5108      return mame_stricmp(ModifyThe(drivers[index1]->description),
5109                  ModifyThe(drivers[index2]->description));
5110      break;
5111
5112   case COLUMN_ORIENTATION:
5113      nTemp1 = DriverIsVertical(index1) ? 1 : 0;
5114      nTemp2 = DriverIsVertical(index2) ? 1 : 0;
5115      value = nTemp1 - nTemp2;
5116      break;
5117#if 0
5118   case COLUMN_ROMS:
5119      nTemp1 = GetRomAuditResults(index1);
5120      nTemp2 = GetRomAuditResults(index2);
5121
5122      if (IsAuditResultKnown(nTemp1) == FALSE && IsAuditResultKnown(nTemp2) == FALSE)
5123         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5124
5125      if (IsAuditResultKnown(nTemp1) == FALSE)
5126      {
5127         value = 1;
5128         break;
5129      }
5130
5131      if (IsAuditResultKnown(nTemp2) == FALSE)
5132      {
5133         value = -1;
5134         break;
5135      }
5136
5137      // ok, both are known
5138      if (IsAuditResultYes(nTemp1) && IsAuditResultYes(nTemp2))
5139         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5140     
5141      if (IsAuditResultNo(nTemp1) && IsAuditResultNo(nTemp2))
5142         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5143
5144      if (IsAuditResultYes(nTemp1) && IsAuditResultNo(nTemp2))
5145         value = -1;
5146      else
5147         value = 1;
5148      break;
5149#endif
5150   case COLUMN_SAMPLES:
5151      nTemp1 = -1;
5152      if (DriverUsesSamples(index1))
5153      {
5154         int audit_result = GetSampleAuditResults(index1);
5155         if (IsAuditResultKnown(audit_result))
5156         {
5157            if (IsAuditResultYes(audit_result))
5158               nTemp1 = 1;
5159            else
5160               nTemp1 = 0;
5161         }
5162         else
5163            nTemp1 = 2;
5164      }
5165
5166      nTemp2 = -1;
5167      if (DriverUsesSamples(index2))
5168      {
5169         int audit_result = GetSampleAuditResults(index1);
5170         if (IsAuditResultKnown(audit_result))
5171         {
5172            if (IsAuditResultYes(audit_result))
5173               nTemp2 = 1;
5174            else
5175               nTemp2 = 0;
5176         }
5177         else
5178            nTemp2 = 2;
5179      }
5180      value = nTemp2 - nTemp1;
5181      break;
5182
5183   case COLUMN_DIRECTORY:
5184      value = mame_stricmp(drivers[index1]->name, drivers[index2]->name);
5185      break;
5186
5187      case COLUMN_SRCDRIVERS:
5188      value = mame_stricmp(drivers[index1]->source_file, drivers[index2]->source_file);
5189      break;
5190
5191   case COLUMN_PLAYTIME:
5192      value = GetPlayTime(index1) - GetPlayTime(index2);
5193      break;
5194
5195   case COLUMN_TYPE:
5196    {
5197        machine_config drv1,drv2;
5198        expand_machine_driver(drivers[index1]->drv,&drv1);
5199        expand_machine_driver(drivers[index2]->drv,&drv2);
5200
5201      value = (drv1.video_attributes & VIDEO_TYPE_VECTOR) -
5202            (drv2.video_attributes & VIDEO_TYPE_VECTOR);
5203      break;
5204    }
5205   case COLUMN_TRACKBALL:
5206      value = DriverUsesTrackball(index1) - DriverUsesTrackball(index2);
5207      break;
5208
5209   case COLUMN_PLAYED:
5210      value = GetPlayCount(index1) - GetPlayCount(index2);
5211      break;
5212
5213   case COLUMN_MANUFACTURER:
5214      value = mame_stricmp(drivers[index1]->manufacturer, drivers[index2]->manufacturer);
5215      break;
5216
5217   case COLUMN_YEAR:
5218      value = mame_stricmp(drivers[index1]->year, drivers[index2]->year);
5219      break;
5220
5221   case COLUMN_CLONE:
5222      name1 = GetCloneParentName(index1);
5223      name2 = GetCloneParentName(index2);
5224
5225      if (*name1 == '\0')
5226         name1 = NULL;
5227      if (*name2 == '\0')
5228         name2 = NULL;
5229
5230      if (NULL == name1 && NULL == name2)
5231         value = 0;
5232      else if (name2 == NULL)
5233         value = -1;
5234      else if (name1 == NULL)
5235         value = 1;
5236      else
5237         value = mame_stricmp(name1, name2);
5238      break;
5239   }
5240
5241   // Handle same comparisons here
5242   if (0 == value && COLUMN_GAMES != sort_subitem)
5243   {
5244      value = GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5245   }
5246#ifdef DEBUG
5247   if ((strcmp(drivers[index1]->name,"1941") == 0 && strcmp(drivers[index2]->name,"1942") == 0) ||
5248      (strcmp(drivers[index1]->name,"1942") == 0 && strcmp(drivers[index2]->name,"1941") == 0))
5249      dprintf("result: %i",value);
5250#endif
5251
5252   return value;
5253}
5254
5255int GetSelectedPick()
5256{
5257   /* returns index of listview selected item */
5258   /* This will return -1 if not found */
5259   return ListView_GetNextItem(hwndList, -1, LVIS_SELECTED | LVIS_FOCUSED);
5260}
5261
5262static HICON GetSelectedPickItemIcon()
5263{
5264   LV_ITEM lvi;
5265
5266   lvi.iItem = GetSelectedPick();
5267   lvi.iSubItem = 0;
5268   lvi.mask = LVIF_IMAGE;
5269   ListView_GetItem(hwndList, &lvi);
5270
5271   return ImageList_GetIcon(hLarge, lvi.iImage, ILD_TRANSPARENT);
5272}
5273
5274static void SetRandomPickItem()
5275{
5276   int nListCount;
5277
5278   nListCount = ListView_GetItemCount(hwndList);
5279
5280   if (nListCount > 0)
5281   {
5282      Picker_SetSelectedPick(hwndList, rand() % nListCount);
5283   }
5284}
5285
5286BOOL CommonFileDialog(common_file_dialog_proc cfd, char *filename, int filetype)
5287{
5288   BOOL success;
5289   OPENFILENAME of;
5290   TCHAR* t_filename;
5291   TCHAR* t_statedir = 0;
5292   TCHAR* t_artdir = 0;
5293   TCHAR t_filename_buffer[MAX_PATH]  = {0, };
5294   char *utf8_filename;
5295
5296   // convert the filename to UTF-8 and copy into buffer
5297   t_filename = tstring_from_utf8(filename);
5298   if (t_filename != NULL)
5299   {
5300      _sntprintf(t_filename_buffer, ARRAY_LENGTH(t_filename_buffer), TEXT("%s"), t_filename);
5301      free(t_filename);
5302   }
5303
5304   of.lStructSize       = sizeof(of);
5305   of.hwndOwner         = hMain;
5306   of.hInstance         = NULL;
5307   switch (filetype)
5308   {
5309   case FILETYPE_INPUT_FILES :
5310      of.lpstrFilter   = TEXT(MAMENAME " input files (*.inp,*.zip)\0*.inp;*.zip\0All files (*.*)\0*.*\0");
5311      break;
5312   case FILETYPE_SAVESTATE_FILES :
5313      of.lpstrFilter   = TEXT(MAMENAME " savestate files (*.sta)\0*.sta;\0All files (*.*)\0*.*\0");
5314      break;
5315   case FILETYPE_WAVE_FILES :
5316      of.lpstrFilter   = TEXT("sounds (*.wav)\0*.wav;\0All files (*.*)\0*.*\0");
5317      break;
5318   case FILETYPE_MNG_FILES :
5319      of.lpstrFilter   = TEXT("videos (*.mng)\0*.mng;\0All files (*.*)\0*.*\0");
5320      break;
5321   case FILETYPE_EFFECT_FILES :
5322      of.lpstrFilter   = TEXT("effects (*.png)\0*.png;\0All files (*.*)\0*.*\0");
5323      break;
5324   }
5325   of.lpstrCustomFilter = NULL;
5326   of.nMaxCustFilter    = 0;
5327   of.nFilterIndex      = 1;
5328   of.lpstrFile         = t_filename_buffer;
5329   of.nMaxFile          = ARRAY_LENGTH(t_filename_buffer);
5330   of.lpstrFileTitle    = NULL;
5331   of.nMaxFileTitle     = 0;
5332   if (filetype == FILETYPE_SAVESTATE_FILES)
5333   {
5334      t_statedir = tstring_from_utf8(GetStateDir());
5335      if( !t_statedir )
5336         return FALSE;
5337
5338      of.lpstrInitialDir = t_statedir;
5339   }
5340   else
5341   {
5342      if (filetype == FILETYPE_EFFECT_FILES)
5343      {
5344         t_artdir = tstring_from_utf8(GetArtDir());
5345         if( !t_artdir )
5346            return FALSE;
5347
5348         of.lpstrInitialDir = t_artdir;
5349      }
5350      else
5351         of.lpstrInitialDir = last_directory;
5352   }
5353   of.lpstrTitle        = NULL;
5354   of.Flags             = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
5355   of.nFileOffset       = 0;
5356   of.nFileExtension    = 0;
5357   switch (filetype)
5358   {
5359   case FILETYPE_INPUT_FILES :
5360      of.lpstrDefExt       = TEXT("inp");
5361      break;
5362   case FILETYPE_SAVESTATE_FILES :
5363      of.lpstrDefExt       = TEXT("sta");
5364      break;
5365   case FILETYPE_WAVE_FILES :
5366      of.lpstrDefExt       = TEXT("wav");
5367      break;
5368   case FILETYPE_MNG_FILES :
5369      of.lpstrDefExt       = TEXT("mng");
5370      break;
5371   case FILETYPE_EFFECT_FILES :
5372      of.lpstrDefExt       = TEXT("png");
5373      break;
5374   }
5375   of.lCustData         = 0;
5376   of.lpfnHook          = NULL;
5377   of.lpTemplateName    = NULL;
5378
5379   success = cfd(&of);
5380   if (success)
5381   {
5382      //dprintf("got filename %s nFileExtension %u\n",filename,of.nFileExtension);
5383      /*GetDirectory(filename,last_directory,sizeof(last_directory));*/
5384   }
5385   
5386   if( t_artdir )
5387      free(t_artdir);
5388   if( t_statedir )
5389      free(t_statedir);
5390
5391   utf8_filename = utf8_from_tstring(t_filename_buffer);
5392   if (utf8_filename != NULL)
5393   {
5394      snprintf(filename, MAX_PATH, "%s", utf8_filename);
5395   }
5396
5397   return success;
5398}
5399
5400static BOOL SelectLanguageFile(HWND hWnd, TCHAR* filename)
5401{
5402   OPENFILENAME of;
5403
5404   of.lStructSize       = sizeof(of);
5405   of.hwndOwner         = hWnd;
5406   of.hInstance         = NULL;
5407   of.lpstrFilter       = TEXT(MAMENAME " Language files (*.lng)\0*.lng\0");
5408   of.lpstrCustomFilter = NULL;
5409   of.nMaxCustFilter    = 0;
5410   of.nFilterIndex      = 1;
5411   of.lpstrFile         = filename;
5412   of.nMaxFile          = MAX_PATH;
5413   of.lpstrFileTitle    = NULL;
5414   of.nMaxFileTitle     = 0;
5415   of.lpstrInitialDir   = NULL;
5416   of.lpstrTitle        = NULL;
5417   of.Flags             = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
5418   of.nFileOffset       = 0;
5419   of.nFileExtension    = 0;
5420   of.lpstrDefExt       = TEXT("lng");
5421   of.lCustData         = 0;
5422   of.lpfnHook          = NULL;
5423   of.lpTemplateName    = NULL;
5424
5425   return GetOpenFileName(&of);
5426}
5427
5428static INT_PTR CALLBACK LanguageDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
5429{
5430   TCHAR pLangFile[MAX_PATH];
5431   DWORD dwHelpIDs[] = { IDC_LANGUAGECHECK, HIDC_LANGUAGECHECK,
5432                    IDC_LANGUAGEEDIT,  HIDC_LANGUAGEEDIT,
5433                    0, 0};
5434   char* utf8_LangFile;
5435
5436   switch (Msg)
5437   {
5438   case WM_INITDIALOG:
5439      {
5440         const char* pLang = GetLanguage();
5441         if (pLang == NULL || *pLang == '\0')
5442         {
5443            win_set_window_text_utf8(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), "");
5444            Button_SetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK), FALSE);
5445            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   FALSE);
5446            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), FALSE);
5447         }
5448         else
5449         {
5450            win_set_window_text_utf8(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLang);
5451            Button_SetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK), TRUE);
5452            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   TRUE);
5453            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), TRUE);
5454         }
5455
5456         return TRUE;
5457      }
5458
5459   case WM_HELP:
5460      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, (DWORD_PTR)dwHelpIDs);
5461      break;
5462
5463   case WM_CONTEXTMENU:
5464      HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, (DWORD_PTR)dwHelpIDs);
5465      break;
5466
5467   case WM_COMMAND:
5468      switch (GET_WM_COMMAND_ID(wParam, lParam))
5469      {
5470      case IDOK:
5471         Edit_GetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile, MAX_PATH);
5472         utf8_LangFile = utf8_from_tstring(pLangFile);
5473         if( !utf8_LangFile )
5474            return FALSE;
5475         SetLanguage(utf8_LangFile);
5476         free(utf8_LangFile);
5477
5478      case IDCANCEL:
5479         EndDialog(hDlg, 0);
5480         return TRUE;
5481
5482      case IDC_LANGUAGECHECK:
5483      {
5484         BOOL bCheck = Button_GetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK));
5485         EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   bCheck);
5486         EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), bCheck);
5487         if (bCheck == FALSE)
5488            Edit_SetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), TEXT(""));
5489         return TRUE;
5490      }
5491
5492      case IDC_LANGUAGEBROWSE:
5493         Edit_GetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile, MAX_PATH);
5494         if (SelectLanguageFile(hDlg, pLangFile) == TRUE)
5495            Edit_SetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile);
5496         break;
5497      }
5498      break;
5499   }
5500   return 0;
5501}
5502
5503void SetStatusBarText(int part_index, const char *message)
5504{
5505   TCHAR* t_message = tstring_from_utf8(message);
5506   if( !t_message )
5507      return;
5508   SendMessage(hStatusBar, SB_SETTEXT, (WPARAM) part_index, (LPARAM)(LPCTSTR) win_tstring_strdup(t_message));
5509   free(t_message);
5510}
5511
5512void SetStatusBarTextF(int part_index, const char *fmt, ...)
5513{
5514   char buf[256];
5515   va_list va;
5516
5517   va_start(va, fmt);
5518   vsprintf(buf, fmt, va);
5519   va_end(va);
5520
5521   SetStatusBarText(part_index, buf);
5522}
5523
5524static void CLIB_DECL MameMessageBox(const char *fmt, ...)
5525{
5526   char buf[2048];
5527   va_list va;
5528
5529   va_start(va, fmt);
5530   vsprintf(buf, fmt, va);
5531   win_message_box_utf8(GetMainWindow(), buf, MAME32NAME, MB_OK | MB_ICONERROR);
5532   va_end(va);
5533}
5534
5535static void MamePlayBackGame()
5536{
5537   int nGame;
5538   char filename[MAX_PATH];
5539
5540   *filename = 0;
5541
5542   nGame = Picker_GetSelectedItem(hwndList);
5543   if (nGame != -1)
5544      strcpy(filename, drivers[nGame]->name);
5545
5546   if (CommonFileDialog(GetOpenFileName, filename, FILETYPE_INPUT_FILES))
5547   {
5548      file_error fileerr;
5549      mame_file* pPlayBack;
5550      char drive[_MAX_DRIVE];
5551      char dir[_MAX_DIR];
5552      char bare_fname[_MAX_FNAME];
5553      char ext[_MAX_EXT];
5554
5555      char path[MAX_PATH];
5556      char fname[MAX_PATH];
5557      play_options playopts;
5558
5559      _splitpath(filename, drive, dir, bare_fname, ext);
5560
5561      sprintf(path,"%s%s",drive,dir);
5562      sprintf(fname,"%s%s",bare_fname,ext);
5563      if (path[strlen(path)-1] == '\\')
5564         path[strlen(path)-1] = 0; // take off trailing back slash
5565
5566      fileerr = mame_fopen_options(Mame32Global(), SEARCHPATH_INPUTLOG, fname, OPEN_FLAG_READ, &pPlayBack);
5567      if (fileerr != FILERR_NONE)
5568      {
5569         MameMessageBox("Could not open '%s' as a valid input file.", filename);
5570         return;
5571      }
5572
5573      // check for game name embedded in .inp header
5574      if (pPlayBack)
5575      {
5576         inp_header input_header;
5577
5578         // read playback header
5579         mame_fread(pPlayBack, &input_header, sizeof(inp_header));
5580
5581         if (!isalnum(input_header.name[0])) // If first byte is not alpha-numeric
5582            mame_fseek(pPlayBack, 0, SEEK_SET); // old .inp file - no header
5583         else
5584         {
5585            int i;
5586            for (i = 0; drivers[i] != 0; i++) // find game and play it
5587            {
5588               if (strcmp(drivers[i]->name, input_header.name) == 0)
5589               {
5590                  nGame = i;
5591                  break;
5592               }
5593            }
5594         }
5595      }
5596      mame_fclose(pPlayBack);
5597
5598      memset(&playopts, 0, sizeof(playopts));
5599      playopts.playback = fname;
5600      MamePlayGameWithOptions(nGame, &playopts);
5601   }
5602}
5603
5604static void MameLoadState()
5605{
5606   int nGame;
5607   char filename[MAX_PATH];
5608   char selected_filename[MAX_PATH];
5609   play_options playopts;
5610
5611   *filename = 0;
5612
5613   nGame = Picker_GetSelectedItem(hwndList);
5614   if (nGame != -1)
5615   {
5616      strcpy(filename, drivers[nGame]->name);
5617      strcpy(selected_filename, drivers[nGame]->name);
5618   }
5619   if (CommonFileDialog(GetOpenFileName, filename, FILETYPE_SAVESTATE_FILES))
5620   {
5621      mame_file* pSaveState;
5622      char drive[_MAX_DRIVE];
5623      char dir[_MAX_DIR];
5624      char ext[_MAX_EXT];
5625
5626      char path[MAX_PATH];
5627      char fname[MAX_PATH];
5628      char bare_fname[_MAX_FNAME];
5629      char *state_fname;
5630      int rc;
5631
5632      _splitpath(filename, drive, dir, bare_fname, ext);
5633
5634      // parse path
5635      sprintf(path,"%s%s",drive,dir);
5636      sprintf(fname,"%s%s",bare_fname,ext);
5637      if (path[strlen(path)-1] == '\\')
5638         path[strlen(path)-1] = 0; // take off trailing back slash
5639
5640#ifdef MESS
5641      {
5642         state_fname = filename;
5643      }
5644#else // !MESS
5645      {
5646         char *cPos=0;
5647         int  iPos=0;
5648         char romname[MAX_PATH];
5649
5650         cPos = strchr(bare_fname, '-' );
5651         iPos = cPos ? cPos - bare_fname : strlen(bare_fname);
5652         strncpy(romname, bare_fname, iPos );
5653         romname[iPos] = '\0';
5654         if( strcmp(selected_filename,romname) != 0 )
5655         {
5656            MameMessageBox("'%s' is not a valid savestate file for game '%s'.", filename, selected_filename);
5657            return;
5658         }
5659         state_fname = fname;
5660      }
5661#endif // MESS
5662
5663      mame_fopen_options(Mame32Global(), SEARCHPATH_STATE, state_fname, OPEN_FLAG_READ, &pSaveState);
5664      if (pSaveState == NULL)
5665      {
5666         MameMessageBox("Could not open '%s' as a valid savestate file.", filename);
5667         return;
5668      }
5669
5670      // call the MAME core function to check the save state file
5671      rc = state_save_check_file(pSaveState, selected_filename, TRUE, MameMessageBox);
5672      mame_fclose(pSaveState);
5673      if (rc)
5674         return;
5675
5676      memset(&playopts, 0, sizeof(playopts));
5677#ifdef MESS
5678      playopts.state = state_fname;
5679#else
5680      {
5681         char *cPos;
5682         cPos = strrchr(bare_fname, '-' );
5683         cPos = cPos+1;
5684         if( strlen(cPos) >0)
5685         {
5686            playopts.state = cPos;
5687         }
5688      }
5689#endif
5690
5691      MamePlayGameWithOptions(nGame, &playopts);
5692   }
5693}
5694
5695static void MamePlayRecordGame()
5696{
5697   int  nGame;
5698   char filename[MAX_PATH];
5699   *filename = 0;
5700
5701   nGame = Picker_GetSelectedItem(hwndList);
5702   strcpy(filename, drivers[nGame]->name);
5703
5704   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_INPUT_FILES))
5705   {
5706      char drive[_MAX_DRIVE];
5707      char dir[_MAX_DIR];
5708      char fname[_MAX_FNAME];
5709      char ext[_MAX_EXT];
5710      char path[MAX_PATH];
5711      play_options playopts;
5712
5713      _splitpath(filename, drive, dir, fname, ext);
5714
5715      sprintf(path,"%s%s",drive,dir);
5716      if (path[strlen(path)-1] == '\\')
5717         path[strlen(path)-1] = 0; // take off trailing back slash
5718
5719      memset(&playopts, 0, sizeof(playopts));
5720      playopts.record = fname;
5721      MamePlayGameWithOptions(nGame, &playopts);
5722   }
5723}
5724
5725void MamePlayGame(void)
5726{
5727   int nGame;
5728   play_options playopts;
5729
5730   nGame = Picker_GetSelectedItem(hwndList);
5731
5732   memset(&playopts, 0, sizeof(playopts));
5733   MamePlayGameWithOptions(nGame, &playopts);
5734}
5735
5736static void MamePlayRecordWave()
5737{
5738   int  nGame;
5739   char filename[MAX_PATH];
5740   play_options playopts;
5741
5742   nGame = Picker_GetSelectedItem(hwndList);
5743   strcpy(filename, drivers[nGame]->name);
5744
5745   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_WAVE_FILES))
5746   {
5747      memset(&playopts, 0, sizeof(playopts));
5748      playopts.wavwrite = filename;
5749      MamePlayGameWithOptions(nGame, &playopts);
5750   }   
5751}
5752
5753static void MamePlayRecordMNG()
5754{
5755   int  nGame;
5756   char filename[MAX_PATH] = { 0, };
5757   play_options playopts;
5758
5759   nGame = Picker_GetSelectedItem(hwndList);
5760   strcpy(filename, drivers[nGame]->name);
5761
5762   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_MNG_FILES))
5763   {
5764      memset(&playopts, 0, sizeof(playopts));
5765      playopts.mngwrite = filename;
5766      MamePlayGameWithOptions(nGame, &playopts);
5767   }   
5768}
5769
5770static void MamePlayGameWithOptions(int nGame, const play_options *playopts)
5771{
5772   DWORD dwExitCode;
5773
5774#ifdef MESS
5775   if (!MessApproveImageList(hMain, nGame))
5776      return;
5777#endif
5778
5779   if (g_pJoyGUI != NULL)
5780      KillTimer(hMain, JOYGUI_TIMER);
5781   if (GetCycleScreenshot() > 0)
5782      KillTimer(hMain, SCREENSHOT_TIMER);
5783
5784   in_emulation = TRUE;
5785
5786   dwExitCode = RunMAME(nGame, playopts);
5787   if (dwExitCode == 0)
5788   {
5789      IncrementPlayCount(nGame);
5790      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
5791   }
5792   else
5793   {
5794      ShowWindow(hMain, SW_SHOW);
5795   }
5796
5797   in_emulation = FALSE;
5798
5799   // re-sort if sorting on # of times played
5800   if (GetSortColumn() == COLUMN_PLAYED)
5801      Picker_Sort(hwndList);
5802
5803   UpdateStatusBar();
5804
5805   ShowWindow(hMain, SW_SHOW);
5806   SetFocus(hwndList);
5807
5808   if (g_pJoyGUI != NULL)
5809      SetTimer(hMain, JOYGUI_TIMER, JOYGUI_MS, NULL);
5810   if (GetCycleScreenshot() > 0)
5811      SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL); //scale to seconds
5812}
5813
5814/* Toggle ScreenShot ON/OFF */
5815static void ToggleScreenShot(void)
5816{
5817   BOOL showScreenShot = GetShowScreenShot();
5818
5819   SetShowScreenShot((showScreenShot) ? FALSE : TRUE);
5820   UpdateScreenShot();
5821
5822   /* Redraw list view */
5823   if (hBackground != NULL && showScreenShot)
5824      InvalidateRect(hwndList, NULL, FALSE);
5825}
5826
5827static void AdjustMetrics(void)
5828{
5829   HDC hDC;
5830   TEXTMETRIC tm;
5831   int xtraX, xtraY;
5832   AREA area;
5833   int  offX, offY;
5834   int  maxX, maxY;
5835   COLORREF textColor;
5836   TCHAR szClass[128];
5837   HWND hWnd;
5838
5839   /* WM_SETTINGCHANGE also */
5840   xtraX  = GetSystemMetrics(SM_CXFIXEDFRAME); /* Dialog frame width */
5841   xtraY  = GetSystemMetrics(SM_CYFIXEDFRAME); /* Dialog frame height */
5842   xtraY += GetSystemMetrics(SM_CYMENUSIZE);   /* Menu height */
5843   xtraY += GetSystemMetrics(SM_CYCAPTION);   /* Caption Height */
5844   maxX   = GetSystemMetrics(SM_CXSCREEN);    /* Screen Width */
5845   maxY   = GetSystemMetrics(SM_CYSCREEN);    /* Screen Height */
5846
5847   hDC = GetDC(hMain);
5848   GetTextMetrics (hDC, &tm);
5849
5850   /* Convert MIN Width/Height from Dialog Box Units to pixels. */
5851   MIN_WIDTH  = (int)((tm.tmAveCharWidth / 4.0) * DBU_MIN_WIDTH)  + xtraX;
5852   MIN_HEIGHT = (int)((tm.tmHeight      / 8.0) * DBU_MIN_HEIGHT) + xtraY;
5853   ReleaseDC(hMain, hDC);
5854
5855   if ((textColor = GetListFontColor()) == RGB(255, 255, 255))
5856      textColor = RGB(240, 240, 240);
5857
5858   hWnd = GetWindow(hMain, GW_CHILD);
5859   while(hWnd)
5860   {
5861      if (GetClassName(hWnd, szClass, sizeof(szClass) / sizeof(szClass[0])))
5862      {
5863         if (!_tcscmp(szClass, TEXT("SysListView32")))
5864         {
5865            ListView_SetBkColor(hWnd, GetSysColor(COLOR_WINDOW));
5866            ListView_SetTextColor(hWnd, textColor);
5867         }
5868         else if (!_tcscmp(szClass, TEXT("SysTreeView32")))
5869         {
5870            TreeView_SetBkColor(hTreeView, GetSysColor(COLOR_WINDOW));
5871            TreeView_SetTextColor(hTreeView, textColor);
5872         }
5873      }
5874      hWnd = GetWindow(hWnd, GW_HWNDNEXT);
5875   }
5876
5877   GetWindowArea(&area);
5878
5879   offX = area.x + area.width;
5880   offY = area.y + area.height;
5881
5882   if (offX > maxX)
5883   {
5884      offX = maxX;
5885      area.x = (offX - area.width > 0) ? (offX - area.width) : 0;
5886   }
5887   if (offY > maxY)
5888   {
5889      offY = maxY;
5890      area.y = (offY - area.height > 0) ? (offY - area.height) : 0;
5891   }
5892
5893   SetWindowArea(&area);
5894   SetWindowPos(hMain, 0, area.x, area.y, area.width, area.height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
5895}
5896
5897#if 0
5898/* Adjust options - tune them to the currently selected game */
5899static void EnablePlayOptions(int nIndex, core_options *o)
5900{
5901}
5902#endif
5903
5904int FindIconIndex(int nIconResource)
5905{
5906   int i;
5907   for(i = 0; g_iconData[i].icon_name; i++)
5908   {
5909      if (g_iconData[i].resource == nIconResource)
5910         return i;
5911   }
5912   return -1;
5913}
5914
5915int FindIconIndexByName(const char *icon_name)
5916{
5917   int i;
5918   for (i = 0; g_iconData[i].icon_name; i++)
5919   {
5920      if (!strcmp(g_iconData[i].icon_name, icon_name))
5921         return i;
5922   }
5923   return -1;
5924}
5925
5926static int GetIconForDriver(int nItem)
5927{
5928   int iconRoms = 1;
5929
5930   if (DriverUsesRoms(nItem))
5931   {
5932      int audit_result = GetRomAuditResults(nItem);
5933      if (IsAuditResultKnown(audit_result) == FALSE)
5934         return 2;
5935#ifdef SHOW_MISSING_ROMS_ICON
5936      if (IsAuditResultYes(audit_result))
5937         iconRoms = 1;
5938      else
5939         iconRoms = 0;
5940#endif
5941   }
5942
5943   // iconRoms is now either 0 (no roms), 1 (roms), or 2 (unknown)
5944
5945   /* these are indices into icon_names, which maps into our image list
5946    * also must match IDI_WIN_NOROMS + iconRoms
5947     */
5948
5949   // Show Red-X if the ROMs are present and flagged as NOT WORKING
5950   if (iconRoms == 1 && DriverIsBroken(nItem))
5951      iconRoms = FindIconIndex(IDI_WIN_REDX);
5952
5953   // show clone icon if we have roms and game is working
5954   if (iconRoms == 1 && DriverIsClone(nItem))
5955      iconRoms = FindIconIndex(IDI_WIN_CLONE);
5956
5957   // if we have the roms, then look for a custom per-game icon to override
5958   if (iconRoms == 1 || iconRoms == 3)
5959   {
5960      if (icon_index[nItem] == 0)
5961         AddDriverIcon(nItem,iconRoms);
5962      iconRoms = icon_index[nItem];
5963   }
5964
5965   return iconRoms;
5966}
5967
5968static BOOL HandleTreeContextMenu(HWND hWnd, WPARAM wParam, LPARAM lParam)
5969{
5970   HMENU hTreeMenu;
5971   HMENU hMenu;
5972   TVHITTESTINFO hti;
5973   POINT pt;
5974
5975   if ((HWND)wParam != GetDlgItem(hWnd, IDC_TREE))
5976      return FALSE;
5977
5978   pt.x = GET_X_LPARAM(lParam);
5979   pt.y = GET_Y_LPARAM(lParam);
5980   if (pt.x < 0 && pt.y < 0)
5981      GetCursorPos(&pt);
5982
5983   /* select the item that was right clicked or shift-F10'ed */
5984   hti.pt = pt;
5985   ScreenToClient(hTreeView,&hti.pt);
5986   (void)TreeView_HitTest(hTreeView,&hti);
5987   if ((hti.flags & TVHT_ONITEM) != 0)
5988      TreeView_SelectItem(hTreeView,hti.hItem);
5989
5990   hTreeMenu = LoadMenu(hInst,MAKEINTRESOURCE(IDR_CONTEXT_TREE));
5991
5992   InitTreeContextMenu(hTreeMenu);
5993
5994   hMenu = GetSubMenu(hTreeMenu, 0);
5995   
5996   UpdateMenu(hMenu);
5997
5998   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hWnd,NULL);
5999
6000   DestroyMenu(hTreeMenu);
6001
6002   return TRUE;
6003}
6004
6005
6006
6007static void GamePicker_OnBodyContextMenu(POINT pt)
6008{
6009   HMENU hMenuLoad;
6010   HMENU hMenu;
6011
6012   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_MENU));
6013   hMenu = GetSubMenu(hMenuLoad, 0);
6014   InitBodyContextMenu(hMenu);
6015   
6016   UpdateMenu(hMenu);
6017
6018   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hMain,NULL);
6019
6020   DestroyMenu(hMenuLoad);
6021}
6022
6023
6024
6025static BOOL HandleScreenShotContextMenu(HWND hWnd, WPARAM wParam, LPARAM lParam)
6026{
6027   HMENU hMenuLoad;
6028   HMENU hMenu;
6029   POINT pt;
6030
6031   if ((HWND)wParam != GetDlgItem(hWnd, IDC_SSPICTURE) && (HWND)wParam != GetDlgItem(hWnd, IDC_SSFRAME))
6032      return FALSE;
6033
6034   pt.x = GET_X_LPARAM(lParam);
6035   pt.y = GET_Y_LPARAM(lParam);
6036   if (pt.x < 0 && pt.y < 0)
6037      GetCursorPos(&pt);
6038
6039   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_SCREENSHOT));
6040   hMenu = GetSubMenu(hMenuLoad, 0);
6041
6042   UpdateMenu(hMenu);
6043
6044   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hWnd,NULL);
6045
6046   DestroyMenu(hMenuLoad);
6047
6048   return TRUE;
6049}
6050
6051static void UpdateMenu(HMENU hMenu)
6052{
6053   TCHAR         buf[200];
6054   MENUITEMINFO   mItem;
6055   int          nGame = Picker_GetSelectedItem(hwndList);
6056   LPTREEFOLDER lpFolder = GetCurrentFolder();
6057   int i;
6058   const char *pParent;
6059   TCHAR* t_description;
6060
6061   if (have_selection)
6062   {
6063      t_description = tstring_from_utf8(ConvertAmpersandString(ModifyThe(drivers[nGame]->description)));
6064      if( !t_description )
6065         return;
6066     
6067      _sntprintf(buf, ARRAY_LENGTH(buf), g_szPlayGameString, t_description);
6068
6069      mItem.cbSize    = sizeof(mItem);
6070      mItem.fMask     = MIIM_TYPE;
6071      mItem.fType     = MFT_STRING;
6072      mItem.dwTypeData = buf;
6073      mItem.cch       = _tcslen(mItem.dwTypeData);
6074
6075      SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mItem);
6076
6077      EnableMenuItem(hMenu, ID_CONTEXT_SELECT_RANDOM, MF_ENABLED);
6078     
6079      free(t_description);
6080   }
6081   else
6082   {
6083      EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_GRAYED);
6084      EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_GRAYED);
6085      EnableMenuItem(hMenu, ID_GAME_PROPERTIES,      MF_GRAYED);
6086      EnableMenuItem(hMenu, ID_CONTEXT_SELECT_RANDOM, MF_GRAYED);
6087   }
6088
6089   if (oldControl)
6090   {
6091      EnableMenuItem(hMenu, ID_CUSTOMIZE_FIELDS, MF_GRAYED);
6092      EnableMenuItem(hMenu, ID_GAME_PROPERTIES,  MF_GRAYED);
6093      EnableMenuItem(hMenu, ID_OPTIONS_DEFAULTS, MF_GRAYED);
6094   }
6095
6096   if (lpFolder->m_dwFlags & F_CUSTOM)
6097   {
6098       EnableMenuItem(hMenu,ID_CONTEXT_REMOVE_CUSTOM,MF_ENABLED);
6099      EnableMenuItem(hMenu,ID_CONTEXT_RENAME_CUSTOM,MF_ENABLED);
6100   }
6101   else
6102   {
6103       EnableMenuItem(hMenu,ID_CONTEXT_REMOVE_CUSTOM,MF_GRAYED);
6104      EnableMenuItem(hMenu,ID_CONTEXT_RENAME_CUSTOM,MF_GRAYED);
6105   }
6106   pParent = GetFolderNameByID(lpFolder->m_nParent+1);
6107
6108   if (lpFolder->m_dwFlags & F_INIEDIT)
6109      EnableMenuItem(hMenu,ID_FOLDER_PROPERTIES,MF_ENABLED);
6110   else
6111      EnableMenuItem(hMenu,ID_FOLDER_PROPERTIES,MF_GRAYED);
6112
6113   CheckMenuRadioItem(hMenu, ID_VIEW_TAB_SCREENSHOT, ID_VIEW_TAB_HISTORY,
6114                  ID_VIEW_TAB_SCREENSHOT + TabView_GetCurrentTab(hTabCtrl), MF_BYCOMMAND);
6115
6116   // set whether we're showing the tab control or not
6117   if (bShowTabCtrl)
6118      CheckMenuItem(hMenu,ID_VIEW_PAGETAB,MF_BYCOMMAND | MF_CHECKED);
6119   else
6120      CheckMenuItem(hMenu,ID_VIEW_PAGETAB,MF_BYCOMMAND | MF_UNCHECKED);
6121
6122
6123   for (i=0;i<MAX_TAB_TYPES;i++)
6124   {
6125      // disable menu items for tabs we're not currently showing
6126      if (GetShowTab(i))
6127         EnableMenuItem(hMenu,ID_VIEW_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_ENABLED);
6128      else
6129         EnableMenuItem(hMenu,ID_VIEW_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_GRAYED);
6130
6131      // check toggle menu items
6132      if (GetShowTab(i))
6133         CheckMenuItem(hMenu, ID_TOGGLE_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_CHECKED);
6134      else
6135         CheckMenuItem(hMenu, ID_TOGGLE_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_UNCHECKED);
6136   }
6137
6138   for (i=0;i<MAX_FOLDERS;i++)
6139   {
6140      if (GetShowFolder(i))
6141         CheckMenuItem(hMenu,ID_CONTEXT_SHOW_FOLDER_START + i,MF_BYCOMMAND | MF_CHECKED);
6142      else
6143         CheckMenuItem(hMenu,ID_CONTEXT_SHOW_FOLDER_START + i,MF_BYCOMMAND | MF_UNCHECKED);
6144   }
6145
6146}
6147
6148void InitTreeContextMenu(HMENU hTreeMenu)
6149{
6150   MENUITEMINFO mii;
6151   HMENU hMenu;
6152   int i;
6153   extern FOLDERDATA g_folderData[];
6154
6155   ZeroMemory(&mii,sizeof(mii));
6156   mii.cbSize = sizeof(mii);
6157
6158   mii.wID = -1;
6159   mii.fMask = MIIM_SUBMENU | MIIM_ID;
6160
6161   hMenu = GetSubMenu(hTreeMenu, 0);
6162
6163   if (GetMenuItemInfo(hMenu,3,TRUE,&mii) == FALSE)
6164   {
6165      dprintf("can't find show folders context menu");
6166      return;
6167   }
6168
6169   if (mii.hSubMenu == NULL)
6170   {
6171      dprintf("can't find submenu for show folders context menu");
6172      return;
6173   }
6174
6175   hMenu = mii.hSubMenu;
6176   
6177   for (i=0;g_folderData[i].m_lpTitle != NULL;i++)
6178   {
6179      TCHAR* t_title = tstring_from_utf8(g_folderData[i].m_lpTitle);
6180      if( !t_title )
6181         return;
6182     
6183      mii.fMask = MIIM_TYPE | MIIM_ID;
6184      mii.fType = MFT_STRING;
6185      mii.dwTypeData = t_title;
6186      mii.cch = _tcslen(mii.dwTypeData);
6187      mii.wID = ID_CONTEXT_SHOW_FOLDER_START + g_folderData[i].m_nFolderId;
6188
6189
6190      // menu in resources has one empty item (needed for the submenu to setup properly)
6191      // so overwrite this one, append after
6192      if (i == 0)
6193         SetMenuItemInfo(hMenu,ID_CONTEXT_SHOW_FOLDER_START,FALSE,&mii);
6194      else
6195         InsertMenuItem(hMenu,i,FALSE,&mii);
6196         
6197      free(t_title);
6198   }
6199
6200}
6201
6202void InitBodyContextMenu(HMENU hBodyContextMenu)
6203{
6204   LPTREEFOLDER lpFolder;
6205   TCHAR tmp[30];
6206   MENUITEMINFO mii;
6207   ZeroMemory(&mii,sizeof(mii));
6208   mii.cbSize = sizeof(mii);
6209
6210   if (GetMenuItemInfo(hBodyContextMenu,ID_FOLDER_SOURCEPROPERTIES,FALSE,&mii) == FALSE)
6211   {
6212      dprintf("can't find show folders context menu");
6213      return;
6214   }
6215   lpFolder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
6216   _sntprintf(tmp,ARRAY_LENGTH(tmp),TEXT("Properties for %s"),lpFolder->m_lptTitle );
6217   mii.fMask = MIIM_TYPE | MIIM_ID;
6218   mii.fType = MFT_STRING;
6219   mii.dwTypeData = tmp;
6220   mii.cch = _tcslen(mii.dwTypeData);
6221   mii.wID = ID_FOLDER_SOURCEPROPERTIES;
6222
6223
6224   // menu in resources has one default item
6225   // so overwrite this one
6226   SetMenuItemInfo(hBodyContextMenu,ID_FOLDER_SOURCEPROPERTIES,FALSE,&mii);
6227   if( ! DriverIsVector(Picker_GetSelectedItem(hwndList) ) )
6228      EnableMenuItem(hBodyContextMenu, ID_FOLDER_VECTORPROPERTIES, MF_GRAYED);
6229}
6230
6231
6232void ToggleShowFolder(int folder)
6233{
6234   int current_id = GetCurrentFolderID();
6235
6236   SetWindowRedraw(hwndList,FALSE);
6237
6238   SetShowFolder(folder,!GetShowFolder(folder));
6239
6240   ResetTreeViewFolders();
6241   SelectTreeViewFolder(current_id);
6242
6243   SetWindowRedraw(hwndList,TRUE);
6244}
6245
6246static LRESULT CALLBACK HistoryWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6247{
6248   if (hBackground)
6249   {
6250      switch (uMsg)
6251      {
6252       case WM_MOUSEMOVE:
6253      {
6254         if (MouseHasBeenMoved())
6255            ShowCursor(TRUE);
6256         break;
6257      }
6258   
6259      case WM_ERASEBKGND:
6260         return TRUE;
6261      case WM_PAINT:
6262      {
6263         POINT p = { 0, 0 };
6264           
6265         /* get base point of background bitmap */
6266         MapWindowPoints(hWnd,hTreeView,&p,1);
6267         PaintBackgroundImage(hWnd, NULL, p.x, p.y);
6268         /* to ensure our parent procedure repaints the whole client area */
6269         InvalidateRect(hWnd, NULL, FALSE);
6270         break;
6271      }
6272      }
6273   }
6274   return CallWindowProc(g_lpHistoryWndProc, hWnd, uMsg, wParam, lParam);
6275}
6276
6277static LRESULT CALLBACK PictureFrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6278{
6279   switch (uMsg)
6280   {
6281   case WM_MOUSEMOVE:
6282    {
6283      if (MouseHasBeenMoved())
6284         ShowCursor(TRUE);
6285      break;
6286    }
6287 
6288    case WM_NCHITTEST :
6289   {
6290      POINT pt;
6291      RECT  rect;
6292      HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
6293
6294      pt.x = LOWORD(lParam);
6295      pt.y = HIWORD(lParam);
6296      GetWindowRect(hHistory, &rect);
6297      // check if they clicked on the picture area (leave 6 pixel no man's land
6298      // by the history window to reduce mistaken clicks)
6299      // no more no man's land, the Cursor changes when Edit control is left, should be enough feedback
6300      if (have_history &&       
6301         ( ( (TabView_GetCurrentTab(hTabCtrl) == TAB_HISTORY) ||
6302          (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ||
6303         (TAB_ALL == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ) &&
6304//           (rect.top - 6) < pt.y && pt.y < (rect.bottom + 6) ) )
6305                 PtInRect( &rect, pt ) ) )
6306
6307      {
6308         return HTTRANSPARENT;
6309      }
6310      else
6311      {
6312         return HTCLIENT;
6313      }
6314   }
6315   break;
6316   case WM_CONTEXTMENU:
6317      if ( HandleScreenShotContextMenu(hWnd, wParam, lParam))
6318         return FALSE;
6319      break;
6320   }
6321
6322   if (hBackground)
6323   {
6324      switch (uMsg)
6325      {
6326      case WM_ERASEBKGND :
6327         return TRUE;
6328      case WM_PAINT :
6329      {
6330         RECT rect,nodraw_rect;
6331         HRGN region,nodraw_region;
6332         POINT p = { 0, 0 };
6333
6334         /* get base point of background bitmap */
6335         MapWindowPoints(hWnd,hTreeView,&p,1);
6336
6337         /* get big region */
6338         GetClientRect(hWnd,&rect);
6339         region = CreateRectRgnIndirect(&rect);
6340
6341         if (IsWindowVisible(GetDlgItem(hMain,IDC_HISTORY)))
6342         {
6343            /* don't draw over this window */
6344            GetWindowRect(GetDlgItem(hMain,IDC_HISTORY),&nodraw_rect);
6345            MapWindowPoints(HWND_DESKTOP,hWnd,(LPPOINT)&nodraw_rect,2);
6346            nodraw_region = CreateRectRgnIndirect(&nodraw_rect);
6347            CombineRgn(region,region,nodraw_region,RGN_DIFF);
6348            DeleteObject(nodraw_region);
6349         }
6350         if (IsWindowVisible(GetDlgItem(hMain,IDC_SSPICTURE)))
6351         {
6352            /* don't draw over this window */
6353            GetWindowRect(GetDlgItem(hMain,IDC_SSPICTURE),&nodraw_rect);
6354            MapWindowPoints(HWND_DESKTOP,hWnd,(LPPOINT)&nodraw_rect,2);
6355            nodraw_region = CreateRectRgnIndirect(&nodraw_rect);
6356            CombineRgn(region,region,nodraw_region,RGN_DIFF);
6357            DeleteObject(nodraw_region);
6358         }
6359
6360         PaintBackgroundImage(hWnd,region,p.x,p.y);
6361
6362         DeleteObject(region);
6363
6364         /* to ensure our parent procedure repaints the whole client area */
6365         InvalidateRect(hWnd, NULL, FALSE);
6366
6367         break;
6368      }
6369      }
6370   }
6371   return CallWindowProc(g_lpPictureFrameWndProc, hWnd, uMsg, wParam, lParam);
6372}
6373
6374static LRESULT CALLBACK PictureWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6375{
6376   switch (uMsg)
6377   {
6378   case WM_ERASEBKGND :
6379      return TRUE;
6380   case WM_PAINT :
6381   {
6382      PAINTSTRUCT ps;
6383      HDC   hdc,hdc_temp;
6384      RECT rect;
6385      HBITMAP old_bitmap;
6386
6387      int width,height;
6388
6389      RECT rect2;
6390      HBRUSH hBrush;
6391      HBRUSH holdBrush;
6392      HRGN region1, region2;
6393      int nBordersize;
6394      nBordersize = GetScreenshotBorderSize();
6395      hBrush = CreateSolidBrush(GetScreenshotBorderColor());
6396
6397      hdc = BeginPaint(hWnd,&ps);
6398
6399      hdc_temp = CreateCompatibleDC(hdc);
6400      if (ScreenShotLoaded())
6401      {
6402         width = GetScreenShotWidth();
6403         height = GetScreenShotHeight();
6404
6405         old_bitmap = SelectObject(hdc_temp,GetScreenShotHandle());
6406      }
6407      else
6408      {
6409         BITMAP bmp;
6410
6411         GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
6412         width = bmp.bmWidth;
6413         height = bmp.bmHeight;
6414
6415         old_bitmap = SelectObject(hdc_temp,hMissing_bitmap);
6416      }
6417
6418      GetClientRect(hWnd,&rect);
6419
6420      rect2 = rect;
6421      //Configurable Borders around images
6422      rect.bottom -= nBordersize;
6423      if( rect.bottom < 0)
6424         rect.bottom = rect2.bottom;
6425      rect.right -= nBordersize;
6426      if( rect.right < 0)
6427         rect.right = rect2.right;
6428      rect.top += nBordersize;
6429      if( rect.top > rect.bottom )
6430         rect.top = rect2.top;
6431      rect.left += nBordersize;
6432      if( rect.left > rect.right )
6433         rect.left = rect2.left;
6434      region1 = CreateRectRgnIndirect(&rect);
6435      region2 = CreateRectRgnIndirect(&rect2);
6436      CombineRgn(region2,region2,region1,RGN_DIFF);
6437      holdBrush = SelectObject(hdc, hBrush);
6438
6439      FillRgn(hdc,region2, hBrush );
6440      SelectObject(hdc, holdBrush);
6441      DeleteObject(hBrush);
6442
6443      SetStretchBltMode(hdc,STRETCH_HALFTONE);
6444      StretchBlt(hdc,nBordersize,nBordersize,rect.right-rect.left,rect.bottom-rect.top,
6445               hdc_temp,0,0,width,height,SRCCOPY);
6446      SelectObject(hdc_temp,old_bitmap);
6447      DeleteDC(hdc_temp);
6448
6449      EndPaint(hWnd,&ps);
6450
6451      return TRUE;
6452   }
6453   }
6454
6455   return CallWindowProc(g_lpPictureWndProc, hWnd, uMsg, wParam, lParam);
6456}
6457
6458void RemoveCurrentGameCustomFolder(void)
6459{
6460    RemoveGameCustomFolder(Picker_GetSelectedItem(hwndList));
6461}
6462
6463void RemoveGameCustomFolder(int driver_index)
6464{
6465    int i;
6466   TREEFOLDER **folders;
6467   int num_folders;
6468
6469   GetFolders(&folders,&num_folders);
6470   
6471   for (i=0;i<num_folders;i++)
6472   {
6473       if (folders[i]->m_dwFlags & F_CUSTOM && folders[i]->m_nFolderId == GetCurrentFolderID())
6474      {
6475          int current_pick_index;
6476
6477          RemoveFromCustomFolder(folders[i],driver_index);
6478
6479         if (driver_index == Picker_GetSelectedItem(hwndList))
6480         {
6481            /* if we just removed the current game,
6482              move the current selection so that when we rebuild the listview it
6483              leaves the cursor on next or previous one */
6484         
6485            current_pick_index = GetSelectedPick();
6486            Picker_SetSelectedPick(hwndList, GetSelectedPick() + 1);
6487            if (current_pick_index == GetSelectedPick()) /* we must have deleted the last item */
6488              Picker_SetSelectedPick(hwndList, GetSelectedPick() - 1);
6489         }
6490
6491         ResetListView();
6492         return;
6493      }
6494   }
6495   MessageBox(GetMainWindow(), TEXT("Error searching for custom folder"), TEXT(MAME32NAME), MB_OK | MB_ICONERROR);
6496
6497}
6498
6499
6500void BeginListViewDrag(NM_LISTVIEW *pnmv)
6501{
6502    LV_ITEM lvi;
6503   POINT pt;
6504
6505   lvi.iItem = pnmv->iItem;
6506   lvi.mask    = LVIF_PARAM;
6507   ListView_GetItem(hwndList, &lvi);
6508
6509   game_dragged = lvi.lParam;
6510
6511   pt.x = 0;
6512   pt.y = 0;
6513
6514   /* Tell the list view control to create an image to use
6515      for dragging. */
6516    himl_drag = ListView_CreateDragImage(hwndList,pnmv->iItem,&pt);
6517 
6518    /* Start the drag operation. */
6519    ImageList_BeginDrag(himl_drag, 0, 0, 0);
6520
6521   pt = pnmv->ptAction;
6522   ClientToScreen(hwndList,&pt);
6523   ImageList_DragEnter(GetDesktopWindow(),pt.x,pt.y);
6524
6525    /* Hide the mouse cursor, and direct mouse input to the
6526      parent window. */
6527    SetCapture(hMain);
6528
6529   prev_drag_drop_target = NULL;
6530
6531    g_listview_dragging = TRUE;
6532
6533}
6534
6535void MouseMoveListViewDrag(POINTS p)
6536{
6537   HTREEITEM htiTarget;
6538   TV_HITTESTINFO tvht;
6539
6540   POINT pt;
6541   pt.x = p.x;
6542   pt.y = p.y;
6543
6544   ClientToScreen(hMain,&pt);
6545
6546   ImageList_DragMove(pt.x,pt.y);
6547
6548   MapWindowPoints(GetDesktopWindow(),hTreeView,&pt,1);
6549
6550   tvht.pt = pt;
6551   htiTarget = TreeView_HitTest(hTreeView,&tvht);
6552
6553   if (htiTarget != prev_drag_drop_target)
6554   {
6555      ImageList_DragShowNolock(FALSE);
6556      if (htiTarget != NULL)
6557         TreeView_SelectDropTarget(hTreeView,htiTarget);
6558      else
6559         TreeView_SelectDropTarget(hTreeView,NULL);
6560      ImageList_DragShowNolock(TRUE);
6561     
6562      prev_drag_drop_target = htiTarget;
6563   }
6564}
6565
6566void ButtonUpListViewDrag(POINTS p)
6567{
6568    POINT pt;
6569    HTREEITEM htiTarget;
6570   TV_HITTESTINFO tvht;
6571   TVITEM tvi;
6572   
6573   ReleaseCapture();
6574
6575    ImageList_DragLeave(hwndList);
6576    ImageList_EndDrag();
6577   ImageList_Destroy(himl_drag);
6578
6579   TreeView_SelectDropTarget(hTreeView,NULL);
6580
6581   g_listview_dragging = FALSE;
6582
6583   /* see where the game was dragged */
6584
6585   pt.x = p.x;
6586   pt.y = p.y;
6587
6588   MapWindowPoints(hMain,hTreeView,&pt,1);
6589
6590   tvht.pt = pt;
6591   htiTarget = TreeView_HitTest(hTreeView,&tvht);
6592   if (htiTarget == NULL)
6593   {
6594      LVHITTESTINFO lvhtti;
6595      LPTREEFOLDER folder;
6596      RECT rcList;
6597
6598      /* the user dragged a game onto something other than the treeview */
6599      /* try to remove if we're in a custom folder */
6600
6601      /* see if it was dragged within the list view; if so, ignore */
6602
6603      MapWindowPoints(hTreeView,hwndList,&pt,1);
6604      lvhtti.pt = pt;
6605      GetWindowRect(hwndList, &rcList);
6606      ClientToScreen(hwndList, &pt);
6607      if( PtInRect(&rcList, pt) != 0 )
6608         return;
6609
6610      folder = GetCurrentFolder();
6611      if (folder->m_dwFlags & F_CUSTOM)
6612      {
6613         /* dragged out of a custom folder, so let's remove it */
6614         RemoveCurrentGameCustomFolder();
6615      }
6616      return;
6617   }
6618
6619
6620   tvi.lParam = 0;
6621   tvi.mask  = TVIF_PARAM | TVIF_HANDLE;
6622   tvi.hItem = htiTarget;
6623
6624   if (TreeView_GetItem(hTreeView, &tvi))
6625   {
6626      LPTREEFOLDER folder = (LPTREEFOLDER)tvi.lParam;
6627      AddToCustomFolder(folder,game_dragged);
6628   }
6629
6630}
6631
6632static LPTREEFOLDER GetSelectedFolder(void)
6633{
6634   HTREEITEM htree;
6635   TVITEM tvi;
6636   htree = TreeView_GetSelection(hTreeView);
6637   if(htree != NULL)
6638   {
6639      tvi.hItem = htree;
6640      tvi.mask = TVIF_PARAM;
6641      TreeView_GetItem(hTreeView,&tvi);
6642      return (LPTREEFOLDER)tvi.lParam;
6643   }
6644   return NULL;
6645}
6646
6647static HICON GetSelectedFolderIcon(void)
6648{
6649   HTREEITEM htree;
6650   TVITEM tvi;
6651   HIMAGELIST hSmall_icon;
6652   LPTREEFOLDER folder;
6653   htree = TreeView_GetSelection(hTreeView);
6654
6655   if (htree != NULL)
6656   {
6657      tvi.hItem = htree;
6658      tvi.mask = TVIF_PARAM;
6659      TreeView_GetItem(hTreeView,&tvi);
6660     
6661      folder = (LPTREEFOLDER)tvi.lParam;
6662      //hSmall_icon = TreeView_GetImageList(hTreeView,(int)tvi.iImage);
6663      hSmall_icon = NULL;
6664      return ImageList_GetIcon(hSmall_icon, tvi.iImage, ILD_TRANSPARENT);
6665   }
6666   return NULL;
6667}
6668
6669/* Updates all currently displayed Items in the List with the latest Data*/
6670void UpdateListView(void)
6671{
6672   if( (GetViewMode() == VIEW_GROUPED) || (GetViewMode() == VIEW_DETAILS ) )
6673      ListView_RedrawItems(hwndList,ListView_GetTopIndex(hwndList),
6674                      ListView_GetTopIndex(hwndList)+ ListView_GetCountPerPage(hwndList) );
6675}
6676
6677void CalculateBestScreenShotRect(HWND hWnd, RECT *pRect, BOOL restrict_height)
6678{
6679   int    destX, destY;
6680   int    destW, destH;
6681   int      nBorder;
6682   RECT   rect;
6683   /* for scaling */       
6684   int x, y;
6685   int rWidth, rHeight;
6686   double scale;
6687   BOOL bReduce = FALSE;
6688
6689   GetClientRect(hWnd, &rect);
6690
6691   // Scale the bitmap to the frame specified by the passed in hwnd
6692   if (ScreenShotLoaded())
6693   {
6694      x = GetScreenShotWidth();
6695      y = GetScreenShotHeight();
6696   }
6697   else
6698   {
6699      BITMAP bmp;
6700      GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
6701
6702      x = bmp.bmWidth;
6703      y = bmp.bmHeight;
6704   }
6705   rWidth   = (rect.right  - rect.left);
6706   rHeight = (rect.bottom - rect.top);
6707
6708   /* Limit the screen shot to max height of 264 */
6709   if (restrict_height == TRUE && rHeight > 264)
6710   {
6711      rect.bottom = rect.top + 264;
6712      rHeight = 264;
6713   }
6714
6715   /* If the bitmap does NOT fit in the screenshot area */
6716   if (x > rWidth - 10 || y > rHeight - 10)
6717   {
6718      rect.right   -= 10;
6719      rect.bottom -= 10;
6720      rWidth   -= 10;
6721      rHeight -= 10;
6722      bReduce = TRUE;
6723      /* Try to scale it properly */
6724      /*   assumes square pixels, doesn't consider aspect ratio */
6725      if (x > y)
6726         scale = (double)rWidth / x;
6727      else
6728         scale = (double)rHeight / y;
6729
6730      destW = (int)(x * scale);
6731      destH = (int)(y * scale);
6732
6733      /* If it's still too big, scale again */
6734      if (destW > rWidth || destH > rHeight)
6735      {
6736         if (destW > rWidth)
6737            scale = (double)rWidth   / destW;
6738         else
6739            scale = (double)rHeight / destH;
6740
6741         destW = (int)(destW * scale);
6742         destH = (int)(destH * scale);
6743      }
6744   }
6745   else
6746   {
6747      if (GetStretchScreenShotLarger())
6748      {
6749         rect.right   -= 10;
6750         rect.bottom -= 10;
6751         rWidth   -= 10;
6752         rHeight -= 10;
6753         bReduce = TRUE;
6754         // Try to scale it properly
6755         // assumes square pixels, doesn't consider aspect ratio
6756         if (x < y)
6757            scale = (double)rWidth / x;
6758         else
6759            scale = (double)rHeight / y;
6760         
6761         destW = (int)(x * scale);
6762         destH = (int)(y * scale);
6763         
6764         // If it's too big, scale again
6765         if (destW > rWidth || destH > rHeight)
6766         {
6767            if (destW > rWidth)
6768               scale = (double)rWidth   / destW;
6769            else
6770               scale = (double)rHeight / destH;
6771           
6772            destW = (int)(destW * scale);
6773            destH = (int)(destH * scale);
6774         }
6775      }
6776      else
6777      {
6778         // Use the bitmaps size if it fits
6779         destW = x;
6780         destH = y;
6781      }
6782
6783   }
6784
6785
6786   destX = ((rWidth  - destW) / 2);
6787   destY = ((rHeight - destH) / 2);
6788
6789   if (bReduce)
6790   {
6791      destX += 5;
6792      destY += 5;
6793   }
6794   nBorder = GetScreenshotBorderSize();
6795   if( destX > nBorder+1)
6796      pRect->left   = destX - nBorder;
6797   else
6798      pRect->left   = 2;
6799   if( destY > nBorder+1)
6800      pRect->top     = destY - nBorder;
6801   else
6802      pRect->top     = 2;
6803   if( rWidth >= destX + destW + nBorder)
6804      pRect->right  = destX + destW + nBorder;
6805   else
6806      pRect->right  = rWidth - pRect->left;
6807   if( rHeight >= destY + destH + nBorder)
6808      pRect->bottom = destY + destH + nBorder;
6809   else
6810      pRect->bottom = rHeight - pRect->top;
6811}
6812
6813/*
6814  Switches to either fullscreen or normal mode, based on the
6815  current mode.
6816
6817  POSSIBLE BUGS:
6818  Removing the menu might cause problems later if some
6819  function tries to poll info stored in the menu. Don't
6820  know if you've done that, but this was the only way I
6821  knew to remove the menu dynamically.
6822*/
6823
6824void SwitchFullScreenMode(void)
6825{
6826   LONG lMainStyle;
6827   
6828   if (GetRunFullScreen())
6829   {
6830      // Return to normal
6831
6832      // Restore the menu
6833      SetMenu(hMain, LoadMenu(hInst,MAKEINTRESOURCE(IDR_UI_MENU)));
6834     
6835      // Refresh the checkmarks
6836      CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, GetShowFolderList() ? MF_CHECKED : MF_UNCHECKED);
6837      CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, GetShowToolBar() ? MF_CHECKED : MF_UNCHECKED);   
6838      CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, GetShowStatusBar() ? MF_CHECKED : MF_UNCHECKED);
6839      CheckMenuItem(GetMenu(hMain), ID_VIEW_PAGETAB, GetShowTabCtrl() ? MF_CHECKED : MF_UNCHECKED);
6840     
6841      // Add frame to dialog again
6842      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
6843      lMainStyle = lMainStyle | WS_BORDER;
6844      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
6845     
6846      // Show the window maximized
6847      if( GetWindowState() == SW_MAXIMIZE )
6848      {
6849         ShowWindow(hMain, SW_NORMAL);
6850         ShowWindow(hMain, SW_MAXIMIZE);
6851      }
6852      else
6853         ShowWindow(hMain, SW_RESTORE);
6854
6855      SetRunFullScreen(FALSE);
6856   }
6857   else
6858   {
6859      // Set to fullscreen
6860     
6861      // Remove menu
6862      SetMenu(hMain,NULL);
6863
6864      // Frameless dialog (fake fullscreen)
6865      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
6866      lMainStyle = lMainStyle & (WS_BORDER ^ 0xffffffff);
6867      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
6868      if( IsMaximized(hMain) )
6869      {
6870         ShowWindow(hMain, SW_NORMAL);
6871         SetWindowState( SW_MAXIMIZE );
6872      }
6873      ShowWindow(hMain, SW_MAXIMIZE);
6874     
6875      SetRunFullScreen(TRUE);
6876   }
6877}
6878
6879/*
6880  Checks to see if the mouse has been moved since this func
6881  was first called (which is at startup). The reason for
6882  storing the startup coordinates of the mouse is that when
6883  a window is created it generates WM_MOUSEOVER events, even
6884  though the user didn't actually move the mouse. So we need
6885  to know when the WM_MOUSEOVER event is user-triggered.
6886
6887  POSSIBLE BUGS:
6888  Gets polled at every WM_MOUSEMOVE so it might cause lag,
6889  but there's probably another way to code this that's
6890  way better?
6891 
6892*/
6893
6894BOOL MouseHasBeenMoved(void)
6895{
6896    static int mouse_x = -1;
6897    static int mouse_y = -1;
6898   POINT p;
6899
6900   GetCursorPos(&p);
6901
6902    if (mouse_x == -1) // First time
6903    {
6904      mouse_x = p.x;
6905      mouse_y = p.y;
6906    }
6907   
6908   return (p.x != mouse_x || p.y != mouse_y);       
6909}
6910
6911/* End of source file */
src/osd/winui/m32util.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5 
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13#ifndef M32UTIL_H
14#define M32UTIL_H
15
16extern void __cdecl ErrorMsg(const char* fmt, ...);
17extern void __cdecl dprintf(const char* fmt, ...);
18
19extern UINT GetDepth(HWND hWnd);
20
21/* Open a text file */
22extern void DisplayTextFile(HWND hWnd, const char *cName);
23
24#define PACKVERSION(major,minor) MAKELONG(minor,major)
25
26/* Check for old version of comctl32.dll */
27extern LONG GetCommonControlVersion(void);
28
29extern char * MyStrStrI(const char* pFirst, const char* pSrch);
30extern char * ConvertToWindowsNewlines(const char *source);
31
32extern const char * GetDriverFilename(int nIndex);
33
34BOOL DriverIsClone(int driver_index);
35BOOL DriverIsBroken(int driver_index);
36BOOL DriverIsHarddisk(int driver_index);
37BOOL DriverHasOptionalBIOS(int driver_index);
38BOOL DriverIsStereo(int driver_index);
39BOOL DriverIsMultiMon(int driver_index);
40BOOL DriverIsVector(int driver_index);
41BOOL DriverIsBios(int driver_index);
42BOOL DriverUsesRoms(int driver_index);
43BOOL DriverUsesSamples(int driver_index);
44BOOL DriverUsesTrackball(int driver_index);
45BOOL DriverUsesLightGun(int driver_index);
46BOOL DriverSupportsSaveState(int driver_index);
47BOOL DriverIsVertical(int driver_index);
48
49void FlushFileCaches(void);
50
51void FreeIfAllocated(char **s);
52
53BOOL StringIsSuffixedBy(const char *s, const char *suffix);
54
55BOOL SafeIsAppThemed(void);
56
57HICON win_extract_icon_utf8(HINSTANCE inst, const char* exefilename, UINT iconindex);
58TCHAR* win_tstring_strdup(LPCTSTR str);
59HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD sharemode,
60                        LPSECURITY_ATTRIBUTES securityattributes, DWORD creationdisposition,
61                        DWORD flagsandattributes, HANDLE templatehandle);
62DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer);
63HANDLE win_find_first_file_utf8(const char* filename, LPWIN32_FIND_DATA findfiledata);
64
65#endif /* MAME32UTIL_H */
src/osd/winui/win32ui.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5   
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13#ifndef WIN32UI_H
14#define WIN32UI_H
15
16#define WIN32_LEAN_AND_MEAN
17#include <commctrl.h>
18#include <commdlg.h>
19#include <driver.h>
20#include "screenshot.h"
21#include "pool.h"
22#define SEARCH_PROMPT ""
23
24enum
25{
26   TAB_PICKER = 0,
27   TAB_DISPLAY,
28   TAB_MISC,
29   NUM_TABS
30};
31
32enum
33{
34   FILETYPE_INPUT_FILES = 1,
35   FILETYPE_SAVESTATE_FILES = 2,
36   FILETYPE_WAVE_FILES = 3,
37   FILETYPE_MNG_FILES = 5,
38   FILETYPE_EFFECT_FILES = 6
39};
40
41
42typedef struct
43{
44   INT resource;
45   const char *icon_name;
46} ICONDATA;
47
48extern TCHAR last_directory[MAX_PATH];
49
50typedef BOOL (WINAPI *common_file_dialog_proc)(LPOPENFILENAME lpofn);
51BOOL CommonFileDialog(common_file_dialog_proc cfd,char *filename, int filetype);
52
53HWND GetMainWindow(void);
54HWND GetTreeView(void);
55HIMAGELIST GetLargeImageList(void);
56HIMAGELIST GetSmallImageList(void);
57int GetNumOptionFolders(void);
58void SetNumOptionFolders(int count);
59void GetRealColumnOrder(int order[]);
60HICON LoadIconFromFile(const char *iconname);
61void UpdateScreenShot(void);
62void ResizePickerControls(HWND hWnd);
63void MamePlayGame(void);
64int FindIconIndex(int nIconResource);
65int FindIconIndexByName(const char *icon_name);
66int GetSelectedPick(void);
67object_pool *GetMame32MemoryPool(void);
68
69void UpdateListView(void);
70
71// Move The in "The Title (notes)" to "Title, The (notes)"
72char * ModifyThe(const char *str);
73
74// Convert Ampersand so it can display in a static control
75char * ConvertAmpersandString(const char *s);
76
77// globalized for painting tree control
78HBITMAP GetBackgroundBitmap(void);
79HPALETTE GetBackgroundPalette(void);
80MYBITMAPINFO* GetBackgroundInfo(void);
81BOOL GetUseOldControl(void);
82BOOL GetUseXPControl(void);
83
84int GetMinimumScreenShotWindowWidth(void);
85
86// we maintain an array of drivers sorted by name, useful all around
87int GetDriverIndex(const game_driver *driver);
88int GetParentIndex(const game_driver *driver);
89int GetParentRomSetIndex(const game_driver *driver);
90int GetGameNameIndex(const char *name);
91int GetIndexFromSortedIndex(int sorted_index);
92
93// sets text in part of the status bar on the main window
94void SetStatusBarText(int part_index, const char *message);
95void SetStatusBarTextF(int part_index, const char *fmt, ...);
96
97int Mame32Main(HINSTANCE    hInstance,
98                   LPSTR        lpCmdLine,
99                   int          nCmdShow);
100
101BOOL MouseHasBeenMoved(void);
102
103const char * GetSearchText(void);
104#endif
src/osd/winui/mame32.rc
r1367r1368
1// Microsoft Visual C++ generated resource script.
2//
3#include "resource.h"
4
5#ifdef MESS
6#include "resourcems.h"
7#endif
8
9// Generated Help ID header file
10#define APSTUDIO_HIDDEN_SYMBOLS
11#include "resource.hm"
12#undef APSTUDIO_HIDDEN_SYMBOLS
13
14#define APSTUDIO_READONLY_SYMBOLS
15/////////////////////////////////////////////////////////////////////////////
16//
17// Generated from the TEXTINCLUDE 2 resource.
18//
19#define NOWINRES
20#include "windows.h"
21#include "commctrl.h"
22
23/////////////////////////////////////////////////////////////////////////////
24#undef APSTUDIO_READONLY_SYMBOLS
25
26/////////////////////////////////////////////////////////////////////////////
27// English (U.S.) resources
28
29#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
30#ifdef _WIN32
31LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
32#pragma code_page(1252)
33#endif //_WIN32
34
35/////////////////////////////////////////////////////////////////////////////
36//
37// Menu
38//
39
40IDR_MAIN_MENU MENU
41BEGIN
42    POPUP "&File"
43    BEGIN
44        MENUITEM "&Exit",                       ID_FILE_EXIT
45    END
46    POPUP "&Help"
47    BEGIN
48#ifdef MESS
49        MENUITEM "&About MESS",               ID_ABOUT
50#else
51        MENUITEM "&About MAME32",               ID_ABOUT
52#endif
53    END
54END
55
56IDR_UI_MENU MENU
57BEGIN
58    POPUP "&File"
59    BEGIN
60        MENUITEM "&Play",                       ID_FILE_PLAY
61        MENUITEM SEPARATOR
62        MENUITEM "Play and &Record Input...",   ID_FILE_PLAY_RECORD
63        MENUITEM "P&layback Input...",          ID_FILE_PLAY_BACK
64        MENUITEM SEPARATOR
65        MENUITEM "Play and Record &Wave Output...", ID_FILE_PLAY_RECORD_WAVE
66        MENUITEM SEPARATOR
67        MENUITEM "Play and Record &MNG Output...", ID_FILE_PLAY_RECORD_MNG
68        MENUITEM SEPARATOR
69        MENUITEM "Loa&d Savestate...",          ID_FILE_LOADSTATE
70        MENUITEM SEPARATOR
71#ifdef MESS
72        MENUITEM "&Select Random System",       ID_CONTEXT_SELECT_RANDOM
73        MENUITEM SEPARATOR
74        MENUITEM "Op&en Other Software...",     ID_MESS_OPEN_SOFTWARE
75        MENUITEM "&Create Image...",         ID_MESS_CREATE_SOFTWARE
76#ifdef MAME_DEBUG
77        MENUITEM SEPARATOR
78        MENUITEM "Run Tests",               ID_MESS_RUN_TESTS
79#endif
80#else /* !MESS */
81        MENUITEM "&Select Random Game",         ID_CONTEXT_SELECT_RANDOM
82#endif /* MESS */
83        MENUITEM SEPARATOR
84        MENUITEM "Pr&operties",                 ID_GAME_PROPERTIES
85        MENUITEM SEPARATOR
86#ifdef MESS
87        MENUITEM "&Audit all systems",          ID_FILE_AUDIT
88#else
89        MENUITEM "&Audit all games",            ID_FILE_AUDIT
90#endif /* MESS */
91        MENUITEM SEPARATOR
92        MENUITEM "E&xit",                       ID_FILE_EXIT
93    END
94    POPUP "&View"
95    BEGIN
96        MENUITEM "&Toolbar\tAlt+T",             ID_VIEW_TOOLBARS
97        MENUITEM "&Status bar\tAlt+S",          ID_VIEW_STATUS
98        MENUITEM "Fold&er List\tAlt+D",         ID_VIEW_FOLDERS
99        MENUITEM "&Picture Area\tAlt+P",        ID_VIEW_PICTURE_AREA
100        MENUITEM "Screenshot Ta&b\tAlt+B",      ID_VIEW_PAGETAB
101        MENUITEM SEPARATOR
102        MENUITEM "&Fullscreen\tF11",            ID_VIEW_FULLSCREEN
103        MENUITEM SEPARATOR
104        POPUP "S&how Pictures"
105        BEGIN
106            MENUITEM "&Snapshot",                   ID_TOGGLE_TAB_SCREENSHOT
107            MENUITEM "&Flyer",                      ID_TOGGLE_TAB_FLYER
108            MENUITEM "&Cabinet",                    ID_TOGGLE_TAB_CABINET
109            MENUITEM "&Marquee",                    ID_TOGGLE_TAB_MARQUEE
110            MENUITEM "&Title",                      ID_TOGGLE_TAB_TITLE
111            MENUITEM "Control &Panel",              ID_TOGGLE_TAB_CONTROL_PANEL
112            MENUITEM "PC&B",                        ID_TOGGLE_TAB_PCB
113
114            MENUITEM "&History",                    ID_TOGGLE_TAB_HISTORY
115        END
116        MENUITEM SEPARATOR
117        MENUITEM "L&arge Icons",                ID_VIEW_LARGE_ICON
118        MENUITEM "S&mall Icons",                ID_VIEW_SMALL_ICON
119        MENUITEM "&List",                       ID_VIEW_LIST_MENU
120        MENUITEM "&Details",                    ID_VIEW_DETAIL
121        MENUITEM "&Grouped",                    ID_VIEW_GROUPED
122        MENUITEM SEPARATOR
123        POPUP "Arrange &Icons"
124        BEGIN
125            MENUITEM "by &Name",                    ID_VIEW_BYGAME
126            MENUITEM "by D&irectory",               ID_VIEW_BYDIRECTORY
127            MENUITEM "by &Manufacturer",            ID_VIEW_BYMANUFACTURER
128            MENUITEM "by Times &Played",            ID_VIEW_BYTIMESPLAYED
129            MENUITEM "by &Type",                    ID_VIEW_BYTYPE
130            MENUITEM "by &Date",                    ID_VIEW_BYYEAR
131        END
132        MENUITEM "Line &Up Icons",              ID_VIEW_LINEUPICONS
133        MENUITEM SEPARATOR
134        MENUITEM "&Refresh\tF5",                ID_UPDATE_GAMELIST
135        MENUITEM "&Custom Filters...\tCtrl+F",  ID_CONTEXT_FILTERS
136        MENUITEM "Customi&ze Fields...",        ID_CUSTOMIZE_FIELDS
137    END
138    POPUP "&Options"
139    BEGIN
140#ifdef MESS
141        MENUITEM "System List &Font...",          ID_OPTIONS_FONT
142        MENUITEM "System List &Clone Color...",   ID_OPTIONS_CLONE_COLOR
143        MENUITEM "&Directories...",             ID_OPTIONS_DIR
144        MENUITEM "Default System &Options...",    ID_OPTIONS_DEFAULTS
145#else
146        MENUITEM "Game List &Font...",          ID_OPTIONS_FONT
147        MENUITEM "Game List &Clone Color...",   ID_OPTIONS_CLONE_COLOR
148        MENUITEM "&Directories...",             ID_OPTIONS_DIR
149        MENUITEM "Default Game &Options...",    ID_OPTIONS_DEFAULTS
150#endif
151        MENUITEM "&Reset to Default...",        ID_OPTIONS_RESET_DEFAULTS
152        MENUITEM "&Interface Options...",       ID_OPTIONS_INTERFACE
153        MENUITEM "&Background Image...",        ID_OPTIONS_BG
154    END
155    POPUP "&Help"
156    BEGIN
157#ifdef MESS
158        MENUITEM "&Mess Release Notes",         ID_HELP_RELEASE
159        MENUITEM "&New Mess Features",          ID_HELP_WHATS_NEW
160#else
161        MENUITEM "&Contents\tF1",               ID_HELP_CONTENTS
162        MENUITEM "&Troubleshooting",            ID_HELP_TROUBLE
163        MENUITEM SEPARATOR
164        MENUITEM "&New Game Changes",           ID_HELP_WHATS_NEW32
165        MENUITEM "&Mame Release Notes",         ID_HELP_WHATS_NEW
166#endif
167        MENUITEM SEPARATOR
168        MENUITEM "&About",                      ID_HELP_ABOUT
169    END
170END
171
172IDR_CONTEXT_MENU MENU
173BEGIN
174    POPUP "Context Menu"
175    BEGIN
176        MENUITEM "&Play",                       ID_FILE_PLAY
177        MENUITEM SEPARATOR
178        MENUITEM "Play and &Record Input...",   ID_FILE_PLAY_RECORD
179        MENUITEM SEPARATOR
180        MENUITEM "&Add to Custom Folder...",    ID_CONTEXT_ADD_CUSTOM
181        MENUITEM "R&emove From This Folder",    ID_CONTEXT_REMOVE_CUSTOM
182        MENUITEM "&Custom Filters...",          ID_CONTEXT_FILTERS
183        MENUITEM SEPARATOR
184#ifdef MESS
185        MENUITEM "&Select Random System",         ID_CONTEXT_SELECT_RANDOM
186#else
187        MENUITEM "&Select Random Game",         ID_CONTEXT_SELECT_RANDOM
188#endif
189        MENUITEM SEPARATOR
190        MENUITEM "Rese&t Playcount",            ID_CONTEXT_RESET_PLAYCOUNT
191        MENUITEM "Reset Pla&y Time",            ID_CONTEXT_RESET_PLAYTIME
192        MENUITEM SEPARATOR
193        MENUITEM "A&udit",                      ID_GAME_AUDIT
194        MENUITEM SEPARATOR
195        MENUITEM "Pr&operties",                 ID_GAME_PROPERTIES
196        MENUITEM "Source propert&ies",          ID_FOLDER_SOURCEPROPERTIES
197        MENUITEM "&Vector properties",          ID_FOLDER_VECTORPROPERTIES
198    END
199END
200
201IDR_CONTEXT_HEADER MENU
202BEGIN
203    POPUP "Header Context Menu"
204    BEGIN
205        MENUITEM "Sort &Ascending",             ID_SORT_ASCENDING
206        MENUITEM "Sort &Descending",            ID_SORT_DESCENDING
207        MENUITEM SEPARATOR
208        MENUITEM "Customi&ze Fields...",        ID_CUSTOMIZE_FIELDS
209    END
210END
211
212IDR_CONTEXT_TREE MENU
213BEGIN
214    POPUP "Context Menu Tree"
215    BEGIN
216        MENUITEM "&Rename",                     ID_CONTEXT_RENAME_CUSTOM
217        MENUITEM "&Custom Filters...",          ID_CONTEXT_FILTERS
218        MENUITEM SEPARATOR
219        POPUP "&Show Folders"
220        BEGIN
221            MENUITEM "overridden by code",          ID_CONTEXT_SHOW_FOLDER_START
222
223        END
224        MENUITEM SEPARATOR
225        MENUITEM "&Audit",                      ID_FOLDER_AUDIT
226        MENUITEM SEPARATOR
227        MENUITEM "&Properties",                 ID_FOLDER_PROPERTIES
228    END
229END
230
231IDR_CONTEXT_SCREENSHOT MENU
232BEGIN
233    POPUP "Context Screen Shot"
234    BEGIN
235        MENUITEM "Show Tab &Control",           ID_VIEW_PAGETAB
236        MENUITEM SEPARATOR
237        POPUP "S&how Pictures"
238        BEGIN
239            MENUITEM "&Snapshot",                   ID_TOGGLE_TAB_SCREENSHOT
240            MENUITEM "&Flyer",                      ID_TOGGLE_TAB_FLYER
241            MENUITEM "&Cabinet",                    ID_TOGGLE_TAB_CABINET
242            MENUITEM "&Marquee",                    ID_TOGGLE_TAB_MARQUEE
243            MENUITEM "&Title",                      ID_TOGGLE_TAB_TITLE
244            MENUITEM "Control &Panel",              ID_TOGGLE_TAB_CONTROL_PANEL
245            MENUITEM "PC&B",                        ID_TOGGLE_TAB_PCB
246
247            MENUITEM "&History",                    ID_TOGGLE_TAB_HISTORY
248        END
249        MENUITEM SEPARATOR
250        MENUITEM "&Snapshot",                   ID_VIEW_TAB_SCREENSHOT
251        MENUITEM "&Flyer",                      ID_VIEW_TAB_FLYER
252        MENUITEM "&Cabinet",                    ID_VIEW_TAB_CABINET
253        MENUITEM "&Marquee",                    ID_VIEW_TAB_MARQUEE
254        MENUITEM "&Title",                      ID_VIEW_TAB_TITLE
255        MENUITEM "Control &Panel",              ID_VIEW_TAB_CONTROL_PANEL
256        MENUITEM "PC&B",                        ID_VIEW_TAB_PCB
257        MENUITEM "&History",                    ID_VIEW_TAB_HISTORY
258    END
259END
260
261
262#ifdef APSTUDIO_INVOKED
263/////////////////////////////////////////////////////////////////////////////
264//
265// TEXTINCLUDE
266//
267
2681 TEXTINCLUDE
269BEGIN
270    "resource.h\0"
271END
272
2732 TEXTINCLUDE
274BEGIN
275    "#define NOWINRES\r\n"
276    "#include ""windows.h""\r\n"
277    "#include ""commctrl.h""\r\n"
278    "\0"
279END
280
2813 TEXTINCLUDE
282BEGIN
283    "#include ""mamevers.rc"" // Version block\r\n"
284    "\r\n"
285    "\0"
286END
287
288#endif    // APSTUDIO_INVOKED
289
290
291/////////////////////////////////////////////////////////////////////////////
292//
293// Icon
294//
295
296// Icon with lowest ID value placed first to ensure application icon
297// remains consistent on all systems.
298#ifdef MESS
299IDI_MAME32_ICON         ICON                    "res/mess.ico"
300#else
301IDI_MAME32_ICON         ICON                    "res\\mame32.ico"
302#endif
303IDI_WIN_ROMS            ICON                    "res\\win_roms.ico"
304IDI_WIN_NOROMS          ICON                    "res\\win_noro.ico"
305IDI_WIN_UNKNOWN         ICON                    "res\\win_unkn.ico"
306IDI_WIN_CLONE           ICON                    "res\\win_clone.ico"
307IDI_WIN_REDX            ICON                    "res\\win_redx.ico"
308IDI_FOLDER_AVAILABLE    ICON                    "res\\foldavail.ico"
309IDI_FOLDER              ICON                    "res\\folder.ico"
310IDI_FOLDER_MANUFACTURER ICON                    "res\\foldmanu.ico"
311IDI_FOLDER_OPEN         ICON                    "res\\foldopen.ico"
312IDI_FOLDER_UNAVAILABLE  ICON                    "res\\foldunav.ico"
313IDI_FOLDER_HORIZONTAL   ICON                    "res\\horz.ico"
314IDI_FOLDER_VERTICAL     ICON                    "res\\vert.ico"
315IDI_MANUFACTURER        ICON                    "res\\manufact.ico"
316IDI_FOLDER_YEAR         ICON                    "res\\foldyear.ico"
317IDI_FOLDER_SOURCE       ICON                    "res\\foldsrc.ico"
318IDI_WORKING             ICON                    "res\\working.ico"
319IDI_NONWORKING          ICON                    "res\\nonwork.ico"
320IDI_YEAR                ICON                    "res\\year.ico"
321IDI_KEYBOARD            ICON                    "res\\keyboard.ico"
322IDI_JOYSTICK            ICON                    "res\\joystick.ico"
323IDI_CPU                 ICON                    "res\\cpu.ico"
324IDI_SOUND               ICON                    "res\\samples.ico"
325IDI_SOUNDTAB            ICON                    "res\\sound.ico"
326IDI_SOURCE              ICON                    "res\\source.ico"
327IDI_HARDDISK            ICON                    "res\\harddisk.ico"
328IDI_DISPLAY             ICON                    "res\\display.ico"
329IDI_CHECKMARK           ICON                    "res\\checkmark.ico"
330IDI_HEADER_UP           ICON                    "res\\header_up.ico"
331IDI_HEADER_DOWN         ICON                    "res\\header_down.ico"
332
333#ifdef MESS
334IDI_WIN_NOROMSNEEDED    ICON                    "res/win_nrnd.ico"
335IDI_WIN_MISSINGOPTROM   ICON                  "res/win_noor.ico"
336IDI_WIN_FLOP            ICON        "res/win_flop.ico"
337IDI_WIN_CASS            ICON        "res/win_cass.ico"
338IDI_WIN_SERL            ICON        "res/win_serl.ico"
339IDI_WIN_SNAP            ICON        "res/win_snap.ico"
340IDI_WIN_PRIN            ICON        "res/win_prin.ico"
341IDI_WIN_HARD            ICON        "res/win_hard.ico"
342IDI_WIN_CYLN            ICON        "res/win_cyln.ico"
343IDI_WIN_PTAP            ICON        "res/win_ptap.ico"
344IDI_WIN_PCRD            ICON        "res/win_pcrd.ico"
345
346#endif
347
348/////////////////////////////////////////////////////////////////////////////
349//
350// Dialog
351//
352
353IDD_ABOUT DIALOG  0, 0, 296, 129
354STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
355#ifdef MESS
356CAPTION "About MESS"
357#else
358CAPTION "About MAME32"
359#endif
360FONT 8, "MS Shell Dlg"
361BEGIN
362    DEFPUSHBUTTON   "&OK",IDOK,200,109,50,14,WS_GROUP
363#ifdef MESS
364    CTEXT           "Multi Emulator Super System",IDC_STATIC,147,7,142,
365                    11,NOT WS_GROUP
366    CTEXT           "Version 0",IDC_VERSION,147,18,142,11,NOT WS_GROUP
367    CTEXT           "Copyright (C) 1998-2005 The MESS Team",IDC_STATIC,147,
368                    29,142,10,NOT WS_GROUP
369    CTEXT           "MESS GUI based on MAME32 version by",IDC_STATIC,147,51,142,10,NOT
370                    WS_GROUP
371    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,147,44,142,1
372    CTEXT           "Additional MAME32 code by",IDC_STATIC,147,74,142,9
373    CTEXT           "Robert Schlabbach, Dan Miller (Help file)",IDC_STATIC,
374                    147,96,142,9
375    CTEXT           "Michael Soderstrom and Christopher Kirmse",IDC_STATIC,
376                    147,62,142,9,NOT WS_GROUP
377    CTEXT           "Mike Haaland, Andrew Kirmse, Jeff Miller",IDC_STATIC,
378                    147,85,142,9
379#else
380    CTEXT           "Multiple Arcade Machine Emulator",IDC_STATIC,147,7,142,
381                    11,NOT WS_GROUP
382    CTEXT           "Version 0",IDC_VERSION,147,18,142,11,NOT WS_GROUP
383    CTEXT           "Copyright (C) 1997-2007 The MAME Team",IDC_STATIC,147,
384                    29,142,10,NOT WS_GROUP
385    CTEXT           "MAME32 version by",IDC_STATIC,147,51,142,10,NOT
386                    WS_GROUP
387    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,147,44,142,1
388    CTEXT           "Additional MAME32 code by",IDC_STATIC,147,74,142,9
389    CTEXT           "Christopher Kirmse and Michael Soderstrom",IDC_STATIC,
390                    147,62,142,9,NOT WS_GROUP
391    CTEXT           "Mike Haaland, Andrew Kirmse, Jeff Miller",IDC_STATIC,
392                    147,85,142,9
393    CTEXT           "and John Hardy IV",IDC_STATIC,147,96,142,9
394#endif
395    CONTROL         "",IDC_ABOUT,"Static",SS_BITMAP | SS_SUNKEN,7,7,16,14
396END
397
398IDD_DIRECTX DIALOG  0, 0, 236, 69
399STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
400#ifdef MESS
401CAPTION "MESS"
402#else
403CAPTION "MAME32"
404#endif
405FONT 8, "MS Shell Dlg"
406BEGIN
407    DEFPUSHBUTTON   "Go to Microsoft's DirectX Web Page",IDB_WEB_PAGE,48,52,
408                    140,14
409    EDITTEXT        IDC_DIRECTX_HELP,7,0,222,48,ES_MULTILINE |
410                    ES_AUTOHSCROLL | ES_READONLY
411END
412
413IDD_AUDIT DIALOG  0, 0, 283, 188
414STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
415CAPTION "File Audit"
416FONT 8, "MS Shell Dlg"
417BEGIN
418    PUSHBUTTON      "&Pause",IDPAUSE,98,168,40,14
419    PUSHBUTTON      "&Cancel",IDCANCEL,144,168,40,14
420    GROUPBOX        "ROMs",IDC_STATIC,6,4,132,65
421    LTEXT           "Correct:",IDC_STATIC,51,28,32,8
422    CONTROL         "Progress1",IDC_ROMS_PROGRESS,"msctls_progress32",
423                    WS_BORDER | 0x1,14,16,116,8
424    LTEXT           "Incorrect:",IDC_STATIC,51,42,32,8
425    LTEXT           "Total:",IDC_STATIC,51,56,32,8
426    LTEXT           "0",IDC_ROMS_CORRECT,87,28,20,8
427    LTEXT           "0",IDC_ROMS_INCORRECT,87,42,20,8
428    LTEXT           "0",IDC_ROMS_TOTAL,87,56,20,8
429    GROUPBOX        "Samples",IDC_STATIC,145,4,132,65
430    CONTROL         "Progress1",IDC_SAMPLES_PROGRESS,"msctls_progress32",
431                    WS_BORDER | 0x1,153,16,116,8
432    LTEXT           "Correct:",IDC_STATIC,191,28,33,8
433    LTEXT           "Incorrect:",IDC_STATIC,191,42,33,8
434    LTEXT           "Total:",IDC_STATIC,191,56,33,8
435    LTEXT           "0",IDC_SAMPLES_CORRECT,227,28,20,8
436    LTEXT           "0",IDC_SAMPLES_INCORRECT,227,42,20,8
437    LTEXT           "0",IDC_SAMPLES_TOTAL,227,56,20,8
438    GROUPBOX        "Details",IDC_STATIC,6,72,271,90
439    EDITTEXT        IDC_AUDIT_DETAILS,12,82,259,74,ES_MULTILINE |
440                    ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL |
441                    NOT WS_TABSTOP
442END
443
444IDD_DIRECTORIES DIALOG  0, 0, 230, 107
445STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
446CAPTION "Directories"
447FONT 8, "MS Shell Dlg"
448BEGIN
449    LTEXT           "Show directories for:",IDC_STATIC,6,6,67,10
450    COMBOBOX        IDC_DIR_COMBO,6,18,160,79,CBS_DROPDOWNLIST | CBS_SORT |
451                    WS_VSCROLL | WS_TABSTOP
452    LTEXT           "Directories:",IDC_STATIC,6,38,38,10
453    CONTROL         "List1",IDC_DIR_LIST,"SysListView32",LVS_REPORT |
454                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS |
455                    LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER |
456                    WS_TABSTOP,6,50,160,51
457    DEFPUSHBUTTON   "OK",IDOK,173,8,50,14
458    PUSHBUTTON      "Cancel",IDCANCEL,173,26,50,14
459    PUSHBUTTON      "Browse...",IDC_DIR_BROWSE,173,50,50,14
460    PUSHBUTTON      "Insert",IDC_DIR_INSERT,173,68,50,14
461    PUSHBUTTON      "Delete",IDC_DIR_DELETE,173,87,50,14
462END
463
464IDD_COLUMNS DIALOG  0, 0, 302, 145
465STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
466CAPTION "Customize Fields"
467FONT 8, "MS Shell Dlg"
468BEGIN
469    LTEXT           "Available fields:",IDC_STATIC,6,6,80,10,SS_CENTERIMAGE
470    CONTROL         "List1",IDC_LISTAVAILABLECOLUMNS,"SysListView32",
471                    LVS_LIST | LVS_SINGLESEL | LVS_NOCOLUMNHEADER |
472                    LVS_NOSORTHEADER | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,
473                    18,90,100
474    PUSHBUTTON      "Add ->",IDC_BUTTONADD,102,18,46,14,WS_DISABLED
475    PUSHBUTTON      "<- Remove",IDC_BUTTONREMOVE,102,36,46,14,WS_DISABLED
476    LTEXT           "Show these fields in this order:",IDC_STATIC,154,6,96,
477                    10,SS_CENTERIMAGE
478    CONTROL         "List1",IDC_LISTSHOWCOLUMNS,"SysListView32",LVS_LIST |
479                    LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |
480                    WS_BORDER | WS_HSCROLL | WS_TABSTOP,154,18,90,100
481    PUSHBUTTON      "Move Up",IDC_BUTTONMOVEUP,250,18,46,14,WS_DISABLED
482    PUSHBUTTON      "Move Down",IDC_BUTTONMOVEDOWN,250,36,46,14,WS_DISABLED
483    DEFPUSHBUTTON   "OK",IDOK,105,124,44,14
484    PUSHBUTTON      "Cancel",IDCANCEL,155,124,44,14
485END
486
487IDD_PROP_CONTROLLER DIALOGEX 0, 0, 220, 240
488STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
489CAPTION "Controller Mapping"
490FONT 8, "MS Shell Dlg", 0, 0, 0x1
491BEGIN
492    ICON            IDI_JOYSTICK,IDC_STATIC,20,10,20,20
493    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
494                    SS_NOPREFIX
495    GROUPBOX        "Paddle device",IDC_STATIC,4,40,102,28
496    COMBOBOX        IDC_PADDLE,10,50,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
497                    WS_TABSTOP,0,HIDC_PADDLE
498    GROUPBOX        "ADStick device",IDC_STATIC,4,71,102,28
499    COMBOBOX        IDC_ADSTICK,10,80,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
500                    WS_TABSTOP,0,HIDC_ADSTICK
501    GROUPBOX        "Pedal device",IDC_STATIC,4,102,102,28
502    COMBOBOX        IDC_PEDAL,10,112,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
503                    WS_TABSTOP,0,HIDC_PEDAL
504    GROUPBOX        "Mouse device",IDC_STATIC,4,133,102,28
505    COMBOBOX        IDC_MOUSE,10,142,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
506                    WS_TABSTOP,0,HIDC_MOUSE
507    GROUPBOX        "Dial device",IDC_STATIC,113,40,102,28
508    COMBOBOX        IDC_DIAL,119,50,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
509                    WS_TABSTOP,0,HIDC_DIAL
510    GROUPBOX        "Trackball device",IDC_STATIC,113,71,102,28
511    COMBOBOX        IDC_TRACKBALL,119,80,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
512                    WS_TABSTOP,0,HIDC_TRACKBALL
513    GROUPBOX        "Lightgun device",IDC_STATIC,113,102,102,28
514    COMBOBOX        IDC_LIGHTGUNDEVICE,119,112,90,62,CBS_DROPDOWNLIST |
515                    WS_VSCROLL | WS_TABSTOP,0,HIDC_LIGHTGUNDEVICE
516    GROUPBOX        "Positional device",IDC_STATIC,113,133,102,28
517    COMBOBOX        IDC_POSITIONAL,119,142,90,62,CBS_DROPDOWNLIST |
518                    WS_VSCROLL | WS_TABSTOP,0,HIDC_POSITIONAL
519    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
520    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
521                    0,0,HIDC_USE_DEFAULT
522END
523
524IDD_PROP_SCREEN DIALOGEX 0, 0, 220, 240
525STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
526CAPTION "Screen"
527FONT 8, "MS Shell Dlg", 0, 0, 0x1
528BEGIN
529    ICON            IDI_DISPLAY,IDC_STATIC,20,10,21,20
530    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
531                    SS_NOPREFIX
532    GROUPBOX        "Number of screens",IDC_STATIC,4,40,103,24
533    CONTROL         "GammaSlider",IDC_NUMSCREENS,"msctls_trackbar32",
534                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,10,50,75,10,0,
535                    HIDC_NUMSCREENS
536    RTEXT           "1",IDC_NUMSCREENSDISP,84,49,14,10,SS_CENTERIMAGE | NOT
537                    WS_GROUP
538    GROUPBOX        "Screen",IDC_STATIC,4,66,103,29
539    COMBOBOX        IDC_SCREEN,10,76,91,64,CBS_DROPDOWNLIST | WS_VSCROLL |
540                    WS_TABSTOP,0,HIDC_SCREEN
541    GROUPBOX        "",IDC_STATIC,4,97,103,28
542    CONTROL         "Autoselect aspect",IDC_ASPECT,"Button",BS_AUTOCHECKBOX |
543                    WS_TABSTOP,10,97,73,10,0,HIDC_ASPECT
544    LTEXT           "Aspect ratio",IDC_ASPECTRATIOTEXT,17,108,40,11,
545                    SS_CENTERIMAGE | NOT WS_GROUP
546    EDITTEXT        IDC_ASPECTRATION,60,108,14,12,ES_RIGHT | ES_AUTOHSCROLL |
547                    ES_NUMBER,0,HIDC_ASPECTRATION
548    LTEXT           ":",IDC_STATIC,76,108,8,10,SS_CENTERIMAGE | NOT WS_GROUP
549    EDITTEXT        IDC_ASPECTRATIOD,80,108,14,12,ES_RIGHT | ES_AUTOHSCROLL |
550                    ES_NUMBER,0,HIDC_ASPECTRATIOD
551    GROUPBOX        "View",IDC_STATIC,4,128,103,28
552    COMBOBOX        IDC_VIEW,10,137,91,64,CBS_DROPDOWNLIST | WS_VSCROLL |
553                    WS_TABSTOP,0,HIDC_VIEW
554    GROUPBOX        "Screennumber",IDC_SCREENSELECTTEXT,113,40,102,28
555    COMBOBOX        IDC_SCREENSELECT,119,50,90,64,CBS_DROPDOWNLIST |
556                    WS_VSCROLL | WS_TABSTOP,0,HIDC_SCREENSELECT
557    GROUPBOX        "Resolution",IDC_STATIC,113,71,102,76,WS_GROUP
558    GROUPBOX        "Size",IDC_STATIC,119,81,90,28,WS_GROUP
559    COMBOBOX        IDC_SIZES,126,91,77,70,CBS_DROPDOWNLIST | WS_VSCROLL |
560                    WS_TABSTOP,0,HIDC_SIZES
561    GROUPBOX        "Refresh",IDC_REFRESHTEXT,119,112,90,28,WS_GROUP
562    COMBOBOX        IDC_REFRESH,126,121,77,76,CBS_DROPDOWNLIST | WS_VSCROLL |
563                    WS_TABSTOP,0,HIDC_REFRESH
564    CONTROL         "Switch resolutions to fit",IDC_SWITCHRES,"Button",
565                    BS_AUTOCHECKBOX | WS_TABSTOP,119,151,93,10,0,
566                    HIDC_SWITCHRES
567    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
568    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
569                    0,0,HIDC_USE_DEFAULT
570END
571
572IDD_PROP_GAME DIALOG  0, 0, 220, 240
573STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
574CAPTION "General"
575FONT 8, "MS Shell Dlg"
576BEGIN
577    ICON            IDI_MAME32_ICON,IDC_GAME_ICON,20,10,20,20
578    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
579                    SS_NOPREFIX
580    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
581    LTEXT           "Manufactured:",IDC_STATIC,18,45,47,8
582    LTEXT           "Static",IDC_PROP_MANUFACTURED,75,45,139,9,SS_NOPREFIX
583    LTEXT           "Status:",IDC_STATIC,18,55,47,8
584    LTEXT           "Static",IDC_PROP_STATUS,75,55,139,30
585    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,85,178,1
586    LTEXT           "CPU:",IDC_STATIC,18,90,47,8
587    LTEXT           "Static\nStatic\nStatic\nStatic\nStatic",IDC_PROP_CPU,75,
588                    90,139,40
589    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,130,178,1
590    LTEXT           "Sound:",IDC_STATIC,18,135,47,8
591    LTEXT           "Static\nStatic\nStatic\nStatic\nStatic",IDC_PROP_SOUND,
592                    75,135,139,45
593    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,181,178,1
594    LTEXT           "Screen:",IDC_STATIC,18,188,47,8
595    LTEXT           "Static",IDC_PROP_SCREEN,75,188,139,8
596    LTEXT           "Colors:",IDC_STATIC,18,198,47,8
597    LTEXT           "Static",IDC_PROP_COLORS,75,198,139,8
598    LTEXT           "Clone of:",IDC_PROP_CLONEOF_TEXT,18,218,50,8
599    LTEXT           "Static",IDC_PROP_CLONEOF,75,218,130,18
600    LTEXT           "Source:",IDC_STATIC,18,208,47,8
601    LTEXT           "Static",IDC_PROP_SOURCE,75,208,139,8
602END
603
604IDD_PROP_AUDIT DIALOG  0, 0, 220, 240
605STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
606CAPTION "Audit"
607FONT 8, "MS Shell Dlg"
608BEGIN
609    ICON            IDI_CHECKMARK,IDC_STATIC,20,10,20,20
610    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
611                    SS_NOPREFIX
612    LTEXT           "ROM check:",IDC_STATIC,10,40,50,8
613    LTEXT           "Checking...",IDC_PROP_ROMS,66,40,139,8
614    LTEXT           "Sample check:",IDC_STATIC,10,52,50,8
615    LTEXT           "Checking...",IDC_PROP_SAMPLES,66,52,139,8
616    GROUPBOX        "Details",IDC_STATIC,4,64,211,171
617    EDITTEXT        IDC_AUDIT_DETAILS_PROP,10,74,199,155,ES_MULTILINE |
618                    ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL |
619                    NOT WS_TABSTOP
620END
621
622IDD_PROP_DISPLAY DIALOGEX 0, 0, 220, 240
623STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
624CAPTION "Display"
625FONT 8, "MS Shell Dlg", 0, 0, 0x1
626BEGIN
627    ICON            IDI_DISPLAY,IDC_STATIC,20,10,20,20
628    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,169,25,
629                    SS_NOPREFIX
630    CONTROL         "Run in a window",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX |
631                    WS_TABSTOP,10,40,69,10,0,HIDC_WINDOWED
632    CONTROL         "Start out maximized",IDC_MAXIMIZE,"Button",
633                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,74,10,0,HIDC_MAXIMIZE
634    CONTROL         "Enforce aspect ratio",IDC_KEEPASPECT,"Button",
635                    BS_AUTOCHECKBOX | WS_TABSTOP,10,64,77,10,0,
636                    HIDC_KEEPASPECT
637    CONTROL         "Throttle",IDC_THROTTLE,"Button",BS_AUTOCHECKBOX |
638                    WS_TABSTOP,10,76,39,10,0,HIDC_THROTTLE
639    GROUPBOX        "Bitmap prescaling",IDC_STATIC,4,89,103,24
640    CONTROL         "GammaSlider",IDC_PRESCALE,"msctls_trackbar32",TBS_BOTH |
641                    TBS_NOTICKS | WS_TABSTOP,10,99,71,10,0,HIDC_PRESCALE
642    RTEXT           "1.00",IDC_PRESCALEDISP,84,98,14,11,SS_CENTERIMAGE | NOT
643                    WS_GROUP
644    GROUPBOX        "Gamma Correction",IDC_STATIC,4,115,103,24
645    CONTROL         "GammaSlider",IDC_GAMMA,"msctls_trackbar32",TBS_BOTH |
646                    TBS_NOTICKS | WS_TABSTOP,10,125,71,10,0,HIDC_GAMMA
647    RTEXT           "2.00",IDC_GAMMADISP,84,124,14,10,SS_CENTERIMAGE | NOT
648                    WS_GROUP
649    GROUPBOX        "Brightness Correction",IDC_STATIC,4,141,103,24
650    CONTROL         "GammaSlider",IDC_BRIGHTCORRECT,"msctls_trackbar32",
651                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,10,151,71,10,0,
652                    HIDC_BRIGHTCORRECT
653    RTEXT           "1.00",IDC_BRIGHTCORRECTDISP,84,150,14,10,SS_CENTERIMAGE |
654                    NOT WS_GROUP
655    GROUPBOX        "Contrast Correction",IDC_STATIC,4,167,103,24
656    CONTROL         "GammaSlider",IDC_CONTRAST,"msctls_trackbar32",TBS_BOTH |
657                    TBS_NOTICKS | WS_TABSTOP,10,176,71,10,0,HIDC_CONTRAST
658    RTEXT           "1.00",IDC_CONTRASTDISP,84,175,14,11,SS_CENTERIMAGE |
659                    NOT WS_GROUP
660    GROUPBOX        "Pause Brightness",IDC_STATIC,4,193,103,24
661    CONTROL         "Slider1",IDC_PAUSEBRIGHT,"msctls_trackbar32",TBS_BOTH |
662                    TBS_NOTICKS | WS_TABSTOP,10,203,71,10,0,HIDC_PAUSEBRIGHT
663    RTEXT           "0.65",IDC_PAUSEBRIGHTDISP,84,202,14,11,SS_CENTERIMAGE |
664                    NOT WS_GROUP
665    GROUPBOX        "Videomode",IDC_STATIC,113,40,102,28
666    COMBOBOX        IDC_VIDEO_MODE,119,50,90,50,CBS_DROPDOWNLIST | CBS_SORT |
667                    WS_VSCROLL | WS_TABSTOP,0,HIDC_VIDEO_MODE
668    GROUPBOX        "Rotation",IDC_STATIC,113,71,102,55
669    COMBOBOX        IDC_ROTATE,119,81,90,57,CBS_DROPDOWNLIST | WS_VSCROLL |
670                    WS_TABSTOP,0,HIDC_ROTATE
671    CONTROL         "Flip screen upside-down",IDC_FLIPY,"Button",
672                    BS_AUTOCHECKBOX | WS_TABSTOP,119,98,91,10,0,HIDC_FLIPY
673    CONTROL         "Flip screen left-right",IDC_FLIPX,"Button",
674                    BS_AUTOCHECKBOX | WS_TABSTOP,119,110,77,10,0,HIDC_FLIPX
675    GROUPBOX        "Direct3D",IDC_STATIC,113,128,102,57
676    CONTROL         "Use Bilinear filtering",IDC_D3D_FILTER,"Button",
677                    BS_AUTOCHECKBOX | WS_TABSTOP,119,138,85,10,0,
678                    HIDC_D3D_FILTER
679    GROUPBOX        "Version",IDC_STATIC,119,150,90,28
680    COMBOBOX        IDC_D3D_VERSION,125,160,78,95,CBS_DROPDOWNLIST |
681                    WS_VSCROLL | WS_TABSTOP,0,HIDC_D3D_VERSION
682    GROUPBOX        "DirectDraw",IDC_STATIC,113,187,102,26
683    CONTROL         "Stretch using hardware",IDC_HWSTRETCH,"Button",
684                    BS_AUTOCHECKBOX | WS_TABSTOP,119,197,85,10,0,
685                    HIDC_HWSTRETCH
686    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
687    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
688                    0,0,HIDC_USE_DEFAULT
689END
690
691IDD_PROP_SOUND DIALOGEX 0, 0, 220, 240
692STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
693CAPTION "Sound"
694FONT 8, "MS Shell Dlg", 0, 0, 0x1
695BEGIN
696    ICON            IDI_SOUNDTAB,IDC_STATIC,20,10,20,20
697    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
698                    SS_NOPREFIX
699    GROUPBOX        "",IDC_STATIC,4,40,211,122
700    CONTROL         "Enable sound and sound CPUs",IDC_USE_SOUND,"Button",
701                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,112,10,0,
702                    HIDC_USE_SOUND
703    CONTROL         "Use samples",IDC_SAMPLES,"Button",BS_AUTOCHECKBOX |
704                    WS_TABSTOP,10,52,55,10,0,HIDC_SAMPLES
705    GROUPBOX        "Sample rate",IDC_RATETEXT,60,65,100,28
706    COMBOBOX        IDC_SAMPLERATE,66,75,88,60,CBS_DROPDOWNLIST | WS_VSCROLL |
707                    WS_TABSTOP,0,HIDC_SAMPLERATE
708    GROUPBOX        "Volume attenuation",IDC_STATIC,60,96,100,28
709    CONTROL         "Slider1",IDC_VOLUME,"msctls_trackbar32",TBS_BOTH |
710                    TBS_NOTICKS | WS_TABSTOP,66,108,68,10,0,HIDC_VOLUME
711    RTEXT           "0dB",IDC_VOLUMEDISP,132,107,20,11,SS_CENTERIMAGE
712    GROUPBOX        "Audio latency",IDC_AUDIO_LATENCY_TEXT,60,127,100,28
713    CONTROL         "Slider1",IDC_AUDIO_LATENCY,"msctls_trackbar32",TBS_BOTH |
714                    TBS_NOTICKS | WS_TABSTOP,66,139,68,10,0,
715                    HIDC_AUDIO_LATENCY
716    RTEXT           "1/5",IDC_AUDIO_LATENCY_DISP,132,138,20,11,
717                    SS_CENTERIMAGE
718    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
719    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
720                    0,0,HIDC_USE_DEFAULT
721END
722
723IDD_PROP_ADVANCED DIALOGEX 0, 0, 220, 240
724STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
725CAPTION "Advanced"
726FONT 8, "MS Shell Dlg", 0, 0, 0x1
727BEGIN
728    ICON            IDI_DISPLAY,IDC_STATIC,20,10,20,20
729    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
730                    SS_NOPREFIX
731    CONTROL         "Triple buffering",IDC_TRIPLE_BUFFER,"Button",
732                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,93,10,0,
733                    HIDC_TRIPLE_BUFFER
734    CONTROL         "Sync to monitor refresh",IDC_SYNCREFRESH,"Button",
735                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,93,10,0,
736                    HIDC_SYNCREFRESH
737    CONTROL         "Wait for vertical sync",IDC_WAITVSYNC,"Button",
738                    BS_AUTOCHECKBOX | WS_TABSTOP,10,64,93,10,0,
739                    HIDC_WAITVSYNC
740    CONTROL         "Refresh speed",IDC_REFRESHSPEED,"Button",
741                    BS_AUTOCHECKBOX | WS_TABSTOP,10,76,93,10,0,
742                    HIDC_REFRESHSPEED
743    GROUPBOX        "Frame skipping",IDC_STATIC,4,88,103,42
744    CONTROL         "Automatic",IDC_AUTOFRAMESKIP,"Button",BS_AUTOCHECKBOX |
745                    WS_TABSTOP,10,98,77,10,0,HIDC_AUTOFRAMESKIP
746    COMBOBOX        IDC_FRAMESKIP,10,111,91,88,CBS_DROPDOWNLIST | WS_VSCROLL |
747                    WS_TABSTOP,0,HIDC_FRAMESKIP
748    GROUPBOX        "Full screen gamma",IDC_FSGAMMATEXT,113,40,102,24
749    CONTROL         "Slider1",IDC_FSGAMMA,"msctls_trackbar32",TBS_BOTH |
750                    TBS_NOTICKS | WS_TABSTOP,119,50,71,10,0,HIDC_FSGAMMA
751    RTEXT           "2.00",IDC_FSGAMMADISP,193,49,16,10,SS_CENTERIMAGE | NOT
752                    WS_GROUP
753    GROUPBOX        "Full screen brightness",IDC_FSBRIGHTNESSTEXT,113,67,102,
754                    24
755    CONTROL         "Slider1",IDC_FSBRIGHTNESS,"msctls_trackbar32",TBS_BOTH |
756                    TBS_NOTICKS | WS_TABSTOP,119,77,71,10,0,
757                    HIDC_FSBRIGHTNESS
758    RTEXT           "2.00",IDC_FSBRIGHTNESSDISP,193,76,16,10,SS_CENTERIMAGE |
759                    NOT WS_GROUP
760    GROUPBOX        "Full screen contrast",IDC_FSCONTRASTTEXT,113,94,102,24
761    CONTROL         "Slider1",IDC_FSCONTRAST,"msctls_trackbar32",TBS_BOTH |
762                    TBS_NOTICKS | WS_TABSTOP,119,104,71,10,0,HIDC_FSCONTRAST
763    RTEXT           "2.00",IDC_FSCONTRASTDISP,193,103,16,11,SS_CENTERIMAGE |
764                    NOT WS_GROUP
765    GROUPBOX        "Emulation speed",IDC_SPEEDTEXT,4,133,211,24
766    CONTROL         "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH |
767                    TBS_NOTICKS | WS_TABSTOP,10,143,180,10,0,HIDC_SPEED
768    RTEXT           "1.00",IDC_SPEEDDISP,189,142,20,11,SS_CENTERIMAGE | NOT
769                    WS_GROUP
770    GROUPBOX        "Effect",IDC_STATIC,4,160,211,50
771    EDITTEXT        IDC_EFFECT,10,170,200,14,ES_AUTOHSCROLL | WS_DISABLED
772    PUSHBUTTON      "Select Effect",IDC_SELECT_EFFECT,10,189,60,14,0,0,
773                    HIDC_SELECT_EFFECT
774    PUSHBUTTON      "Reset Effect",IDC_RESET_EFFECT,150,189,60,14,0,0,
775                    HIDC_RESET_EFFECT
776    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
777    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
778                    0,0,HIDC_USE_DEFAULT
779END
780
781IDD_PROP_INPUT DIALOGEX 0, 0, 220, 240
782STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
783CAPTION "Controllers"
784FONT 8, "MS Shell Dlg", 0, 0, 0x1
785BEGIN
786    ICON            IDI_JOYSTICK,IDC_STATIC,20,10,20,20
787    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
788                    SS_NOPREFIX
789    CONTROL         "Enable mouse input",IDC_USE_MOUSE,"Button",
790                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,86,10,0,
791                    HIDC_USE_MOUSE
792    CONTROL         "Enable steadykey support",IDC_STEADYKEY,"Button",
793                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,95,10,0,
794                    HIDC_STEADYKEY
795    GROUPBOX        "",IDC_STATIC,4,64,103,74
796    CONTROL         "Enable joystick input",IDC_JOYSTICK,"Button",
797                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,64,78,10,0,
798                    HIDC_JOYSTICK
799    GROUPBOX        "Joystick deadzone",IDC_JDZTEXT,10,76,91,28
800    CONTROL         "IntensitySlider",IDC_JDZ,"msctls_trackbar32",TBS_BOTH |
801                    TBS_NOTICKS | WS_TABSTOP,15,88,60,10,0,HIDC_JDZ
802    RTEXT           "0.3",IDC_JDZDISP,76,87,16,11,SS_CENTERIMAGE | NOT
803                    WS_GROUP
804    GROUPBOX        "Default input layout",IDC_STATIC,113,40,102,28
805    COMBOBOX        IDC_DEFAULT_INPUT,119,50,90,53,CBS_DROPDOWNLIST |
806                    WS_VSCROLL | WS_TABSTOP,0,HIDC_DEFAULT_INPUT
807    GROUPBOX        "",IDC_STATIC,113,71,102,66
808    CONTROL         "Enable lightgun input",IDC_LIGHTGUN,"Button",
809                    BS_AUTOCHECKBOX | WS_TABSTOP,119,71,80,10,0,
810                    HIDC_LIGHTGUN
811    CONTROL         "Offscreen shots reload",IDC_RELOAD,"Button",
812                    BS_AUTOCHECKBOX | WS_TABSTOP,119,83,86,10,0,HIDC_RELOAD
813    CONTROL         "Dual lightguns",IDC_DUAL_LIGHTGUN,"Button",
814                    BS_AUTOCHECKBOX | WS_TABSTOP,119,96,86,10,0,
815                    HIDC_DUAL_LIGHTGUN
816    CONTROL         "Multiple keyboards",IDC_MULTIKEYBOARD,"Button",
817                    BS_AUTOCHECKBOX | WS_TABSTOP,119,109,75,10,0,
818                    HIDC_MULTIKEYBOARD
819    CONTROL         "Multiple mice",IDC_MULTIMOUSE,"Button",BS_AUTOCHECKBOX |
820                    WS_TABSTOP,119,122,56,10,0,HIDC_MULTIMOUSE
821    GROUPBOX        "Joystick saturation",IDC_JSATTEXT,10,106,91,28
822    CONTROL         "IntensitySlider",IDC_JSAT,"msctls_trackbar32",TBS_BOTH |
823                    TBS_NOTICKS | WS_TABSTOP,16,118,60,10,0,HIDC_JSAT
824    RTEXT           "0.85",IDC_JSATDISP,76,116,16,11,SS_CENTERIMAGE | NOT
825                    WS_GROUP
826    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
827    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
828                    0,0,HIDC_USE_DEFAULT
829END
830
831IDD_PROP_MISC DIALOGEX 0, 0, 220, 240
832STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
833CAPTION "Miscellaneous"
834FONT 8, "MS Shell Dlg", 0, 0, 0x1
835BEGIN
836    ICON            IDI_MAME32_ICON,IDC_STATIC,20,10,20,20
837    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
838                    SS_NOPREFIX
839#ifdef MESS
840    CONTROL         "Enable system cheats",IDC_CHEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,40,86,10,0,HIDC_CHEAT
841#else
842    CONTROL         "Enable game cheats",IDC_CHEAT,"Button",BS_AUTOCHECKBOX |
843                    WS_TABSTOP,10,40,86,10,0,HIDC_CHEAT
844#endif
845    CONTROL         "Error log (for developers)",IDC_LOG,"Button",
846                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,96,10,0,HIDC_LOG
847    CONTROL         "Sleep when possible",IDC_SLEEP,"Button",BS_AUTOCHECKBOX |
848                    WS_TABSTOP,10,64,86,10,0,HIDC_SLEEP
849    CONTROL         "Enable game debugger",IDC_DEBUG,"Button",
850                    BS_AUTOCHECKBOX | WS_TABSTOP,10,76,86,10,0,HIDC_DEBUG
851#ifdef MESS
852    CONTROL         "Skip system info",IDC_SKIP_GAME_INFO,"Button",
853                    BS_AUTOCHECKBOX | WS_TABSTOP,10,88,96,10,0,
854                    HIDC_SKIP_GAME_INFO
855#else
856    CONTROL         "Skip game info",IDC_SKIP_GAME_INFO,"Button",
857                    BS_AUTOCHECKBOX | WS_TABSTOP,10,88,96,10,0,
858                    HIDC_SKIP_GAME_INFO
859#endif
860    CONTROL         "Save game state on exit",IDC_ENABLE_AUTOSAVE,"Button",
861                    BS_AUTOCHECKBOX | WS_TABSTOP,10,100,96,10,0,
862                    HIDC_ENABLE_AUTOSAVE
863    CONTROL         "Multi-threaded rendering",IDC_MULTITHREAD_RENDERING,
864                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,112,96,10,0,
865                    HIDC_MULTITHREAD_RENDERING
866    GROUPBOX        "Thread Priority",IDC_HIGH_PRIORITY_TEXT,4,124,103,34
867    CONTROL         "Slider1",IDC_HIGH_PRIORITY,"msctls_trackbar32",TBS_BOTH |
868                    TBS_NOTICKS | WS_TABSTOP,10,135,75,10,0,
869                    HIDC_HIGH_PRIORITY
870    LTEXT           "idle",IDC_STATIC,13,144,12,8
871    RTEXT           "-15",IDC_HIGH_PRIORITYTXT,84,134,14,10,SS_CENTERIMAGE
872    RTEXT           "real-time",IDC_STATIC,53,144,28,8
873    GROUPBOX        "Artwork options",IDC_STATIC,113,40,102,61
874    CONTROL         "Backdrops",IDC_BACKDROPS,"Button",BS_AUTOCHECKBOX |
875                    WS_TABSTOP,119,50,86,10,0,HIDC_BACKDROPS
876    CONTROL         "Bezels",IDC_BEZELS,"Button",BS_AUTOCHECKBOX |
877                    WS_TABSTOP,119,62,86,10,0,HIDC_BEZELS
878    CONTROL         "Overlays",IDC_OVERLAYS,"Button",BS_AUTOCHECKBOX |
879                    WS_TABSTOP,119,74,84,10,0,HIDC_OVERLAYS
880    CONTROL         "Crop artwork",IDC_ARTWORK_CROP,"Button",BS_AUTOCHECKBOX |
881                    WS_TABSTOP,119,86,53,10,0,HIDC_ARTWORK_CROP
882    GROUPBOX        "BIOS",IDC_STATIC,113,104,102,28
883    COMBOBOX        IDC_BIOS,119,114,90,60,CBS_DROPDOWNLIST | WS_VSCROLL |
884                    WS_TABSTOP,0,HIDC_BIOS
885    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
886    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
887                    0,0,HIDC_USE_DEFAULT
888#ifdef MESS
889    CONTROL         "Skip warnings",IDC_SKIP_WARNINGS,"Button",
890                    BS_AUTOCHECKBOX | WS_TABSTOP,10,180,86,10,0
891    CONTROL         "Use New UI",IDC_USE_NEW_UI,"Button",
892                    BS_AUTOCHECKBOX | WS_TABSTOP,10,192,86,10,0
893#endif
894END
895
896IDD_PROP_VECTOR DIALOGEX 0, 0, 220, 240
897STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
898CAPTION "Vector"
899FONT 8, "MS Shell Dlg", 0, 0, 0x1
900BEGIN
901    ICON            IDI_MAME32_ICON,IDC_STATIC,20,10,20,20
902    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
903                    SS_NOPREFIX
904    CONTROL         "Draw antialiased vectors",IDC_ANTIALIAS,"Button",
905                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,92,10,0,
906                    HIDC_ANTIALIAS
907    GROUPBOX        "Beam width",IDC_BEAMTEXT,60,53,100,28
908    CONTROL         "BeamSlider",IDC_BEAM,"msctls_trackbar32",TBS_BOTH |
909                    TBS_NOTICKS | WS_TABSTOP,66,65,64,10,0,HIDC_BEAM
910    RTEXT           "16.00",IDC_BEAMDISP,132,64,20,11,SS_CENTERIMAGE
911    GROUPBOX        "Flicker",IDC_FLICKERTEXT,60,84,100,28
912    CONTROL         "FlickerSlider",IDC_FLICKER,"msctls_trackbar32",TBS_BOTH |
913                    TBS_NOTICKS | WS_TABSTOP,66,96,64,10,0,HIDC_FLICKER
914    RTEXT           "100.00",IDC_FLICKERDISP,128,95,24,11,SS_CENTERIMAGE |
915                    NOT WS_GROUP
916    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
917    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
918                    0,0,HIDC_USE_DEFAULT
919END
920
921
922#ifdef MESS
923IDD_MAIN DIALOGEX 0, 0, 364, 206
924#else
925IDD_MAIN DIALOGEX 0, 0, 304, 206
926#endif
927STYLE DS_SETFONT | DS_3DLOOK | DS_NOFAILCREATE | WS_MINIMIZEBOX |
928    WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
929EXSTYLE WS_EX_CONTROLPARENT
930CAPTION "MAME32 - overwritten at runtime"
931CLASS "MainClass"
932FONT 8, "MS Shell Dlg", 0, 0, 0x1
933BEGIN
934    CONTROL         "",IDC_DIVIDER,"Static",SS_ETCHEDHORZ,0,5,304,1
935    CONTROL         "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
936                    TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS |
937                    TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER |
938                    WS_TABSTOP,5,28,48,172
939    CONTROL         "List1",IDC_LIST,"SysListView32",LVS_REPORT |
940                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
941                    LVS_OWNERDRAWFIXED | WS_BORDER | WS_TABSTOP,65,28,42,172
942    GROUPBOX        "",IDC_SPLITTER,55,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
943    GROUPBOX        "",IDC_SPLITTER2,109,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
944#ifdef MESS
945    CONTROL         "",IDC_SSTAB,"SysTabControl32",TCS_HOTTRACK,121,0,181,18
946    CONTROL         "",IDC_SWTAB,"SysTabControl32",TCS_HOTTRACK,119,0,200,100
947    CONTROL         "List2",IDC_SWLIST,"SysListView32",LVS_REPORT |
948                    LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED | WS_BORDER |
949               WS_TABSTOP,119,60,42,140
950   CONTROL         "",IDC_SWDEVVIEW,"MessSoftwareDevView",WS_VISIBLE,119,0,200,100
951    GROUPBOX        "",IDC_SPLITTER3,163,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
952    CONTROL         "",IDC_SSFRAME,"Static",SS_ETCHEDFRAME,175,11,181,194
953    CONTROL         "",IDC_SSPICTURE,"Static",SS_BITMAP | SS_NOTIFY |
954                    SS_CENTERIMAGE | NOT WS_VISIBLE,195,18,141,127
955    EDITTEXT        IDC_HISTORY,183,150,167,49,ES_MULTILINE | ES_READONLY |
956                    WS_VSCROLL,WS_EX_STATICEDGE,HIDC_HISTORY
957#else
958    CONTROL         "",IDC_SSFRAME,"Static",SS_ETCHEDFRAME | SS_NOTIFY,121,
959                    11,181,194
960    CONTROL         "",IDC_SSTAB,"SysTabControl32",TCS_HOTTRACK,121,0,181,18
961    CONTROL         "",IDC_SSPICTURE,"Static",SS_BITMAP | NOT WS_VISIBLE,141,
962                    18,141,127
963    EDITTEXT        IDC_HISTORY,129,150,167,49,ES_MULTILINE | ES_READONLY |
964                    NOT WS_BORDER | WS_VSCROLL | NOT WS_TABSTOP,0,
965                    HIDC_HISTORY
966#endif
967END
968
969IDD_FILTERS DIALOGEX 0, 0, 190, 182
970STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
971    WS_SYSMENU
972EXSTYLE WS_EX_CONTEXTHELP
973#ifdef MESS
974CAPTION "System Filters"
975#else
976CAPTION "Game Filters"
977#endif
978FONT 8, "MS Shell Dlg", 0, 0, 0x1
979BEGIN
980#ifdef MESS
981    GROUPBOX        "System filters",IDC_STATIC,6,4,178,85
982#else
983    GROUPBOX        "Game filters",IDC_STATIC,6,4,178,85
984#endif
985    CONTROL         "&Vector Graphics",IDC_FILTER_VECTOR,"Button",
986                    BS_AUTOCHECKBOX | WS_TABSTOP,14,16,70,10,0,
987                    HIDC_FILTER_VECTOR
988    CONTROL         "C&lones",IDC_FILTER_CLONES,"Button",BS_AUTOCHECKBOX |
989                    WS_TABSTOP,14,30,41,10,0,HIDC_FILTER_CLONES
990    CONTROL         "Non-Wor&king",IDC_FILTER_NONWORKING,"Button",
991                    BS_AUTOCHECKBOX | WS_TABSTOP,14,44,61,10,0,
992                    HIDC_FILTER_NONWORKING
993    CONTROL         "&Horizontal",IDC_FILTER_HORIZONTAL,"Button",
994                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,57,10,0,
995                    HIDC_FILTER_HORIZONTAL
996    CONTROL         "&Unavailable",IDC_FILTER_UNAVAILABLE,"Button",
997                    BS_AUTOCHECKBOX | WS_TABSTOP,14,72,57,10,0,
998                    HIDC_FILTER_UNAVAILABLE
999#ifdef MESS
1000    CONTROL         "&Computers",IDC_FILTER_COMPUTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,72,57,10,0,HIDC_FILTER_UNAVAILABLE
1001    CONTROL         "C&onsoles",IDC_FILTER_CONSOLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,58,57,10,0,HIDC_FILTER_UNAVAILABLE
1002#endif
1003    CONTROL         "&Raster Graphics",IDC_FILTER_RASTER,"Button",
1004                    BS_AUTOCHECKBOX | WS_TABSTOP,100,16,70,10,0,
1005                    HIDC_FILTER_RASTER
1006    CONTROL         "Ori&ginals",IDC_FILTER_ORIGINALS,"Button",
1007                    BS_AUTOCHECKBOX | WS_TABSTOP,100,30,47,10,0,
1008                    HIDC_FILTER_ORIGINALS
1009    CONTROL         "&Working",IDC_FILTER_WORKING,"Button",BS_AUTOCHECKBOX |
1010                    WS_TABSTOP,100,44,47,10,0,HIDC_FILTER_WORKING
1011    CONTROL         "&Vertical",IDC_FILTER_VERTICAL,"Button",BS_AUTOCHECKBOX |
1012                    WS_TABSTOP,100,58,47,10,0,HIDC_FILTER_VERTICAL
1013    LTEXT           "(*) = inherited from parent folder",IDC_INHERITED,14,72,
1014                    99,10
1015#ifdef MESS
1016    CTEXT           "System filters allow customizing the systems that are displayed in each folder by hiding games that match the filters applied.",IDC_STATIC,6,94,178,27
1017#else
1018    CTEXT           "Game filters allow customizing the games that are displayed in each folder by hiding games that match the filters applied.",
1019                    IDC_STATIC,6,94,178,27
1020#endif
1021    GROUPBOX        "&Description filter",IDC_STATIC,6,122,178,33
1022    EDITTEXT        IDC_FILTER_EDIT,14,134,162,13,ES_AUTOHSCROLL,0,
1023                    HIDC_FILTER_EDIT
1024    DEFPUSHBUTTON   "&OK",IDOK,42,161,50,14
1025    PUSHBUTTON      "&Cancel",IDCANCEL,98,161,50,14
1026END
1027
1028IDD_RESET DIALOGEX 0, 0, 190, 122
1029STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
1030    WS_SYSMENU
1031EXSTYLE WS_EX_CONTEXTHELP
1032CAPTION "Reset Options"
1033FONT 8, "MS Shell Dlg", 0, 0, 0x1
1034BEGIN
1035    GROUPBOX        "Categories",IDC_STATIC,6,4,178,70
1036    CONTROL         "&User Interface (Fonts, Colors, Sizes)",IDC_RESET_UI,
1037                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,146,10,0,
1038                    HIDC_RESET_UI
1039#ifdef MESS
1040    CONTROL         "&Default system options",IDC_RESET_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,146,10,0,HIDC_RESET_DEFAULT
1041    CONTROL         "&All systems to use default options",IDC_RESET_GAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,146,10,0,HIDC_RESET_GAMES
1042#else
1043    CONTROL         "&Default game options",IDC_RESET_DEFAULT,"Button",
1044                    BS_AUTOCHECKBOX | WS_TABSTOP,14,30,146,10,0,
1045                    HIDC_RESET_DEFAULT
1046    CONTROL         "&All games to use default options",IDC_RESET_GAMES,
1047                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,146,10,0,
1048                    HIDC_RESET_GAMES
1049#endif
1050    CONTROL         "&Folder 'filters'",IDC_RESET_FILTERS,"Button",
1051                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,146,10,0,
1052                    HIDC_RESET_FILTERS
1053    CTEXT           "Select the options to be restored to the default settings.",
1054                    IDC_STATIC,6,79,178,20
1055    DEFPUSHBUTTON   "&OK",IDOK,42,101,50,14
1056    PUSHBUTTON      "&Cancel",IDCANCEL,98,101,50,14
1057END
1058
1059IDD_LOAD_PROGRESS DIALOGEX 0, 0, 260, 187
1060STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
1061    WS_SYSMENU
1062EXSTYLE WS_EX_CONTROLPARENT
1063FONT 8, "MS Shell Dlg", 0, 0, 0x1
1064BEGIN
1065    CONTROL         "Progress1",IDC_LOAD_PROGRESS,"msctls_progress32",
1066                    WS_BORDER | 0x1,6,7,248,12
1067    CTEXT           "",IDC_LOAD_ROMNAME,6,21,248,10,SS_CENTERIMAGE | NOT
1068                    WS_GROUP
1069    EDITTEXT        IDC_LOAD_STATUS,6,32,248,116,ES_MULTILINE | ES_READONLY |
1070                    WS_VSCROLL
1071    CTEXT           "",IDC_ERROR_TEXT,6,150,248,13,SS_NOPREFIX |
1072                    SS_CENTERIMAGE
1073    PUSHBUTTON      "&OK",IDOK,77,166,50,14,WS_DISABLED
1074    PUSHBUTTON      "&Cancel",IDCANCEL,133,166,50,14
1075END
1076
1077IDD_INTERFACE_OPTIONS DIALOGEX 0, 0, 378, 225
1078STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
1079    WS_SYSMENU
1080EXSTYLE WS_EX_CONTEXTHELP
1081CAPTION "Interface Options"
1082FONT 8, "MS Shell Dlg", 0, 0, 0x1
1083BEGIN
1084#ifdef MESS
1085    GROUPBOX        "System Selection",IDC_STATIC,6,4,189,194
1086    CONTROL         "&Search for new systems on start",IDC_START_GAME_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,112,10,0,HIDC_START_GAME_CHECK
1087    CONTROL         "Allow system selection by a &joystick (requires restart)",IDC_JOY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,178,10,0,HIDC_JOY_GUI
1088    CONTROL         "Allow system selection by custom &key sequences",IDC_KEY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,166,10
1089#else
1090    GROUPBOX        "Game Selection",IDC_STATIC,6,4,189,194
1091    CONTROL         "&Search for new games on start",IDC_START_GAME_CHECK,
1092                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,111,10,0,
1093                    HIDC_START_GAME_CHECK
1094    CONTROL         "Allow game selection by a &joystick (requires restart)",
1095                    IDC_JOY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,
1096                    174,10,0,HIDC_JOY_GUI
1097    CONTROL         "Allow game selection by custom &key sequences",
1098                    IDC_KEY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,
1099                    166,10
1100#endif
1101    CONTROL         "Select &random background image",IDC_RANDOM_BG,"Button",
1102                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,122,10,0,
1103                    HIDC_RANDOM_BG
1104    CONTROL         "&Broadcast selected game to all windows",IDC_BROADCAST,
1105                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,72,141,10,0,
1106                    HIDC_BROADCAST
1107    CONTROL         "Hide &mouse cursor (requires restart)",IDC_HIDE_MOUSE,
1108                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,86,126,10,0,
1109                    HIDC_HIDE_MOUSE
1110    CONTROL         "Inheritable Filters",IDC_FILTER_INHERIT,"Button",
1111                    BS_AUTOCHECKBOX | WS_TABSTOP,14,100,68,10
1112    CONTROL         "No offset for clones missing parent in view",
1113                    IDC_NOOFFSET_CLONES,"Button",BS_AUTOCHECKBOX |
1114                    WS_TABSTOP,14,114,148,10
1115    GROUPBOX        "Show History on Tab",IDC_STATIC,14,128,173,28
1116    COMBOBOX        IDC_HISTORY_TAB,57,138,88,50,CBS_DROPDOWNLIST |
1117                    WS_VSCROLL | WS_TABSTOP
1118    GROUPBOX        "Emulation",IDC_STATIC,202,4,170,28
1119#ifdef MESS
1120    CONTROL         "Show System Ca&ption",IDC_GAME_CAPTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,16,81,10
1121#else
1122    CONTROL         "Show Game Ca&ption",IDC_GAME_CAPTION,"Button",
1123                    BS_AUTOCHECKBOX | WS_TABSTOP,210,16,80,10,0,
1124                    HIDC_GAME_CAPTION
1125#endif
1126    GROUPBOX        "Bookkeeping",IDC_STATIC,202,36,170,43
1127    CONTROL         "Reset all Playcounts",IDC_RESET_PLAYCOUNT,"Button",
1128                    BS_AUTOCHECKBOX | WS_TABSTOP,210,48,80,10
1129    CONTROL         "Reset all Play Times",IDC_RESET_PLAYTIME,"Button",
1130                    BS_AUTOCHECKBOX | WS_TABSTOP,210,62,79,10
1131    GROUPBOX        "Screenshot Area",IDC_STATIC,202,83,170,115
1132    CONTROL         "S&tretch screenshot larger than natural size",
1133                    IDC_STRETCH_SCREENSHOT_LARGER,"Button",BS_AUTOCHECKBOX |
1134                    WS_TABSTOP,210,95,148,10,0,
1135                    HIDC_STRETCH_SCREENSHOT_LARGER
1136    GROUPBOX        "Screenshot Cycletime in Seconds",IDC_STATIC,210,109,154,
1137                    28
1138    CONTROL         "Slider1",IDC_CYCLETIMESEC,"msctls_trackbar32",TBS_BOTH |
1139                    TBS_NOTICKS | WS_TABSTOP,218,121,120,10,0,
1140                    HIDC_CYCLETIMESEC
1141    RTEXT           "60",IDC_CYCLETIMESECTXT,340,120,13,10,SS_CENTERIMAGE
1142    GROUPBOX        "Screenshot Bordersize",IDC_STATIC,210,141,154,28
1143    CONTROL         "Slider1",IDC_SCREENSHOT_BORDERSIZE,"msctls_trackbar32",
1144                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,218,153,120,10
1145    RTEXT           "100",IDC_SCREENSHOT_BORDERSIZETXT,340,152,13,10,
1146                    SS_CENTERIMAGE
1147    PUSHBUTTON      "Set Screenshot Border Color",IDC_SCREENSHOT_BORDERCOLOR,
1148                    210,176,154,14
1149    DEFPUSHBUTTON   "&OK",IDOK,136,204,50,14
1150    PUSHBUTTON      "&Cancel",IDCANCEL,192,204,50,14
1151END
1152
1153IDD_LANGUAGE DIALOGEX 0, 0, 190, 66
1154STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION |
1155    WS_SYSMENU
1156EXSTYLE WS_EX_CONTEXTHELP
1157CAPTION "Language"
1158FONT 8, "MS Shell Dlg", 0, 0, 0x1
1159BEGIN
1160    GROUPBOX        "",IDC_STATIC,6,4,178,34
1161    CONTROL         "Use language file",IDC_LANGUAGECHECK,"Button",
1162                    BS_AUTOCHECKBOX | WS_TABSTOP,12,4,66,10,0,
1163                    HIDC_LANGUAGECHECK
1164    EDITTEXT        IDC_LANGUAGEEDIT,14,17,142,13,ES_AUTOHSCROLL,0,
1165                    HIDC_LANGUAGEEDIT
1166    PUSHBUTTON      "...",IDC_LANGUAGEBROWSE,162,17,14,13
1167    DEFPUSHBUTTON   "OK",IDOK,42,45,50,14
1168    PUSHBUTTON      "Cancel",IDCANCEL,98,45,50,14
1169END
1170
1171IDD_CUSTOM_FILE DIALOG  0, 0, 190, 135
1172STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
1173CAPTION "Add Game To Custom Folder"
1174FONT 8, "MS Shell Dlg"
1175BEGIN
1176    LTEXT           "",IDC_CUSTOMFILE_GAME,6,6,175,10,SS_NOPREFIX |
1177                    SS_CENTERIMAGE
1178    CONTROL         "CustomTree",IDC_CUSTOM_TREE,"SysTreeView32",
1179                    TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
1180                    TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS |
1181                    TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,6,18,178,90
1182    DEFPUSHBUTTON   "OK",IDOK,42,114,50,14
1183    PUSHBUTTON      "Cancel",IDCANCEL,98,114,50,14
1184END
1185
1186
1187/////////////////////////////////////////////////////////////////////////////
1188//
1189// Accelerator
1190//
1191
1192IDA_TAB_KEYS ACCELERATORS
1193BEGIN
1194    "1",            ID_VIEW_TAB_SCREENSHOT, VIRTKEY, ALT, NOINVERT
1195    "2",            ID_VIEW_TAB_FLYER,      VIRTKEY, ALT, NOINVERT
1196    "3",            ID_VIEW_TAB_CABINET,    VIRTKEY, ALT, NOINVERT
1197    "4",            ID_VIEW_TAB_MARQUEE,    VIRTKEY, ALT, NOINVERT
1198    "5",            ID_VIEW_TAB_TITLE,      VIRTKEY, ALT, NOINVERT
1199    "6",            ID_VIEW_TAB_CONTROL_PANEL, VIRTKEY, ALT, NOINVERT
1200    "7",            ID_VIEW_TAB_PCB,        VIRTKEY, ALT, NOINVERT
1201    "8",            ID_VIEW_TAB_HISTORY,    VIRTKEY, ALT, NOINVERT
1202    "A",            ID_GAME_AUDIT,          VIRTKEY, ALT, NOINVERT
1203    "B",            ID_VIEW_PAGETAB,        VIRTKEY, ALT, NOINVERT
1204    "D",            ID_VIEW_FOLDERS,        VIRTKEY, ALT, NOINVERT
1205    "F",            ID_CONTEXT_FILTERS,     VIRTKEY, CONTROL, NOINVERT
1206    "U",            ID_FOLDER_AUDIT,        VIRTKEY, ALT, NOINVERT
1207    "P",            ID_VIEW_PICTURE_AREA,   VIRTKEY, ALT, NOINVERT
1208    "R",            ID_CONTEXT_SELECT_RANDOM, VIRTKEY, CONTROL, NOINVERT
1209    "S",            ID_VIEW_STATUS,         VIRTKEY, ALT, NOINVERT
1210    "T",            ID_VIEW_TOOLBARS,       VIRTKEY, ALT, NOINVERT
1211    VK_F1,          ID_HELP_CONTENTS,       VIRTKEY, NOINVERT
1212    VK_F11,         ID_VIEW_FULLSCREEN,     VIRTKEY, NOINVERT
1213    VK_F5,          ID_UPDATE_GAMELIST,     VIRTKEY, NOINVERT
1214    VK_NEXT,        ID_UI_HISTORY_DOWN,     VIRTKEY, CONTROL, NOINVERT
1215    VK_PRIOR,       ID_UI_HISTORY_UP,       VIRTKEY, CONTROL, NOINVERT
1216    VK_RETURN,      ID_GAME_PROPERTIES,     VIRTKEY, ALT, NOINVERT
1217END
1218
1219
1220/////////////////////////////////////////////////////////////////////////////
1221//
1222// DESIGNINFO
1223//
1224
1225#ifdef APSTUDIO_INVOKED
1226GUIDELINES DESIGNINFO
1227BEGIN
1228    IDD_ABOUT, DIALOG
1229    BEGIN
1230        LEFTMARGIN, 7
1231        RIGHTMARGIN, 289
1232        TOPMARGIN, 7
1233        BOTTOMMARGIN, 123
1234    END
1235
1236    IDD_DIRECTX, DIALOG
1237    BEGIN
1238        LEFTMARGIN, 7
1239        RIGHTMARGIN, 229
1240        TOPMARGIN, 7
1241        BOTTOMMARGIN, 62
1242    END
1243
1244    IDD_AUDIT, DIALOG
1245    BEGIN
1246        LEFTMARGIN, 7
1247        RIGHTMARGIN, 280
1248        TOPMARGIN, 7
1249        BOTTOMMARGIN, 187
1250        HORZGUIDE, 19
1251    END
1252
1253    IDD_DIRECTORIES, DIALOG
1254    BEGIN
1255        LEFTMARGIN, 7
1256        RIGHTMARGIN, 224
1257        TOPMARGIN, 7
1258        BOTTOMMARGIN, 98
1259    END
1260
1261    IDD_COLUMNS, DIALOG
1262    BEGIN
1263        LEFTMARGIN, 7
1264        RIGHTMARGIN, 301
1265        TOPMARGIN, 7
1266        BOTTOMMARGIN, 143
1267    END
1268
1269    IDD_PROP_CONTROLLER, DIALOG
1270    BEGIN
1271        RIGHTMARGIN, 210
1272        BOTTOMMARGIN, 154
1273    END
1274
1275    IDD_PROP_SCREEN, DIALOG
1276    BEGIN
1277        LEFTMARGIN, 4
1278        VERTGUIDE, 7
1279        VERTGUIDE, 123
1280        BOTTOMMARGIN, 199
1281        HORZGUIDE, 179
1282    END
1283
1284    IDD_PROP_GAME, DIALOG
1285    BEGIN
1286        LEFTMARGIN, 7
1287        RIGHTMARGIN, 213
1288        VERTGUIDE, 19
1289        VERTGUIDE, 66
1290        VERTGUIDE, 74
1291        VERTGUIDE, 201
1292        BOTTOMMARGIN, 232
1293    END
1294
1295    IDD_PROP_AUDIT, DIALOG
1296    BEGIN
1297        LEFTMARGIN, 7
1298        RIGHTMARGIN, 213
1299        VERTGUIDE, 12
1300        VERTGUIDE, 208
1301        BOTTOMMARGIN, 198
1302        HORZGUIDE, 38
1303    END
1304
1305    IDD_PROP_DISPLAY, DIALOG
1306    BEGIN
1307        LEFTMARGIN, 4
1308        VERTGUIDE, 7
1309        VERTGUIDE, 123
1310        HORZGUIDE, 179
1311    END
1312
1313    IDD_PROP_SOUND, DIALOG
1314    BEGIN
1315        LEFTMARGIN, 7
1316        RIGHTMARGIN, 213
1317        VERTGUIDE, 50
1318        BOTTOMMARGIN, 198
1319    END
1320
1321    IDD_PROP_ADVANCED, DIALOG
1322    BEGIN
1323        LEFTMARGIN, 10
1324        BOTTOMMARGIN, 211
1325    END
1326
1327    IDD_PROP_INPUT, DIALOG
1328    BEGIN
1329        LEFTMARGIN, 4
1330        RIGHTMARGIN, 215
1331        VERTGUIDE, 50
1332        VERTGUIDE, 170
1333    END
1334
1335    IDD_PROP_MISC, DIALOG
1336    BEGIN
1337        LEFTMARGIN, 7
1338        RIGHTMARGIN, 213
1339        VERTGUIDE, 25
1340        VERTGUIDE, 40
1341        VERTGUIDE, 104
1342        VERTGUIDE, 114
1343        VERTGUIDE, 204
1344        BOTTOMMARGIN, 183
1345    END
1346
1347    IDD_PROP_VECTOR, DIALOG
1348    BEGIN
1349        LEFTMARGIN, 7
1350        RIGHTMARGIN, 213
1351        VERTGUIDE, 50
1352        BOTTOMMARGIN, 198
1353    END
1354
1355    IDD_FILTERS, DIALOG
1356    BEGIN
1357        LEFTMARGIN, 7
1358        TOPMARGIN, 7
1359        BOTTOMMARGIN, 178
1360    END
1361
1362    IDD_RESET, DIALOG
1363    BEGIN
1364        LEFTMARGIN, 7
1365        RIGHTMARGIN, 175
1366        VERTGUIDE, 18
1367        VERTGUIDE, 164
1368        TOPMARGIN, 7
1369    END
1370
1371    IDD_LANGUAGE, DIALOG
1372    BEGIN
1373        LEFTMARGIN, 7
1374        RIGHTMARGIN, 179
1375        TOPMARGIN, 7
1376        BOTTOMMARGIN, 59
1377    END
1378END
1379#endif    // APSTUDIO_INVOKED
1380
1381
1382/////////////////////////////////////////////////////////////////////////////
1383//
1384// Bitmap
1385//
1386
1387#ifdef MESS
1388IDB_ABOUT               BITMAP      "res\\about_mess.bmp"
1389#else
1390IDB_ABOUT               BITMAP                  "res\\about.bmp"
1391#endif
1392IDB_TOOLBAR             BITMAP                  "res\\toolbar.bmp"
1393
1394/////////////////////////////////////////////////////////////////////////////
1395//
1396// Cursor
1397//
1398
1399IDC_CURSOR_HSPLIT       CURSOR                  "Res\\Splith.cur"
1400
1401/////////////////////////////////////////////////////////////////////////////
1402//
1403// RT_MANIFEST
1404//
1405
14061                       RT_MANIFEST             "res\\mame32.manifest"
1407
1408/////////////////////////////////////////////////////////////////////////////
1409//
1410// String Table
1411//
1412
1413STRINGTABLE
1414BEGIN
1415    IDS_UI_FILE             "Contains commands for working with the selected items"
1416    IDS_UI_VIEW             "Contains commands for manupulating the view"
1417    IDS_UI_OPTIONS          "Contains commands for user interface options"
1418END
1419
1420STRINGTABLE
1421BEGIN
1422    IDS_UI_HELP             "Contains commands for displaying help"
1423    IDS_VIEW_TOOLBAR        "Show or hide the toolbar"
1424    IDS_VIEW_STATUSBAR      "Show or hide the status bar"
1425    IDS_VIEW_FOLDERLIST     "Show or hide the folder list"
1426    IDS_VIEW_SCREENSHOT     "Show or hide the screen shot"
1427    IDS_VIEW_PICTURETABS    "Show or hide tabs in the picture area"
1428    IDS_VIEW_SPACER1        "Spacer"
1429    IDS_VIEW_FULLSCREEN     "Toggle full screen mode"
1430    IDS_VIEW_SPACER2        "Spacer"
1431    IDS_VIEW_SHOWPICTURES   "Contains commands to select tabs shown in the picture area"
1432    IDS_VIEW_SPACER3        "Spacer"
1433END
1434
1435STRINGTABLE
1436BEGIN
1437    IDS_VIEW_LARGEICONS     "Display items by using large icons."
1438    IDS_VIEW_SMALLICONS     "Display items by using small icons."
1439    IDS_VIEW_LIST           "Displays items in a list."
1440    IDS_VIEW_DETAILS        "Displays detailed information about each item in the window."
1441    IDS_VIEW_GROUPED        "Displays items grouped by parent game"
1442    IDS_VIEW_SPACER4        "Spacer"
1443    IDS_VIEW_ARRANGE        "Contains commands for sorting by various columns"
1444    IDS_VIEW_LINEUPICONS    "Arranges icons in a grid"
1445    IDS_VIEW_SPACER5        "Spacer"
1446    IDS_VIEW_REFRESH        "Refresh game list"
1447    IDS_VIEW_CONTEXTFILTERS "Allows filtering out games from a folder"
1448    IDS_VIEW_CUSTOMIZEFIELDS
1449                            "Customize which columns are used in the game list"
1450END
1451
1452STRINGTABLE
1453BEGIN
1454    ID_FILE_EXIT            "Exit the application"
1455#ifdef MESS
1456    ID_FILE_PLAY            "Play currently selected system"
1457#else
1458    ID_FILE_PLAY            "Play currently selected game"
1459#endif
1460    ID_HELP_ABOUT           "Displays program and copyright information"
1461    ID_VIEW_LARGE_ICON      "Display items by using large icons."
1462    ID_VIEW_SMALL_ICON      "Display items by using small icons."
1463    ID_VIEW_LIST_MENU       "Displays items in a list."
1464    ID_VIEW_DETAIL          "Displays detailed information about each item in the window."
1465#ifdef MESS
1466    ID_OPTIONS_FONT         "Set system list and folder list font"
1467    ID_OPTIONS_DIR          "Set directory configuration"
1468    ID_OPTIONS_DEFAULTS     "Set default system options"
1469#else
1470    ID_VIEW_GROUPED         "Show items grouped by parent game"
1471    ID_OPTIONS_FONT         "Set game list and folder list font"
1472    ID_OPTIONS_CLONE_COLOR  "Set the clone font color"
1473    ID_OPTIONS_DIR          "Set directory configuration"
1474    ID_OPTIONS_DEFAULTS     "Set default game options"
1475#endif
1476END
1477
1478STRINGTABLE
1479BEGIN
1480    ID_OPTIONS_RESET_DEFAULTS "Allow restoring options to 'sane' values."
1481    ID_OPTIONS_INTERFACE    "Customize interface options."
1482    ID_FILE_AUDIT           "Audit ROM and samples sets"
1483#ifdef MESS
1484    ID_FILE_PLAY_RECORD     "Record a system for later playback"
1485    ID_FILE_PLAY_BACK       "Playback a recorded system"
1486    ID_FILE_PLAY_RECORD_WAVE "Record the sound output of a system"
1487#else
1488    ID_FILE_PLAY_RECORD     "Record a game for later playback"
1489    ID_FILE_PLAY_BACK       "Playback a recorded game"
1490    ID_FILE_PLAY_RECORD_WAVE "Record the audio output of a game"
1491    ID_FILE_PLAY_RECORD_MNG "Record the video output of a game"
1492#endif
1493    ID_VIEW_PICTURE_AREA    "Show or hide the picture area"
1494    ID_HELP_CONTENTS        "Display help contents"
1495#ifdef MESS
1496    ID_HELP_WHATS_NEW32     "Recent changes"
1497    ID_HELP_TROUBLE         "Troubleshooting Documentation"
1498    ID_HELP_RELEASE         "MESS release notes"
1499    ID_HELP_WHATS_NEW       "What's new in MESS"
1500    ID_HELP_CHEATS          "How cheats work"
1501#else
1502    ID_HELP_WHATS_NEW32     "New game changes"
1503    ID_HELP_TROUBLE         "Troubleshooting Documentation"
1504    ID_HELP_RELEASE         "MAME release notes"
1505    ID_HELP_WHATS_NEW       "What's new in MAME"
1506    ID_HELP_CHEATS          "How cheats work"
1507#endif
1508END
1509
1510STRINGTABLE
1511BEGIN
1512    ID_CONTEXT_RESET_PLAYTIME "Reset time played for selected item"
1513    ID_CONTEXT_RESET_PLAYCOUNT "Reset number of plays for selected item"
1514    ID_FOLDER_PROPERTIES    "Display folder properties"
1515    ID_FOLDER_AUDIT         "Audit itmes in this folder"
1516#ifdef MESS
1517    ID_FILE_LOADSTATE       "Run a system starting with the given savestate"
1518#else
1519    ID_FILE_LOADSTATE       "Play a game starting with the given savestate"
1520#endif
1521END
1522
1523STRINGTABLE
1524BEGIN
1525    ID_VIEW_TAB_CABINET     "Select Cabinet tab"
1526    ID_VIEW_TAB_MARQUEE     "Select Marquee tab"
1527    ID_VIEW_TAB_TITLE       "Select Title tab"
1528    ID_VIEW_TAB_CONTROL_PANEL "Select Control panel tab"
1529    ID_VIEW_TAB_HISTORY     "Select History tab"
1530    ID_OPTIONS_BG           "Set the bacground image"
1531    ID_TOGGLE_TAB_SCREENSHOT "Enable the screenshot tab"
1532    ID_TOGGLE_TAB_FLYER     "Enable the flyer tab"
1533    ID_TOGGLE_TAB_CABINET   "Enable the cabinet tab"
1534    ID_TOGGLE_TAB_MARQUEE   "Enable the marquee tab"
1535    ID_TOGGLE_TAB_TITLE     "Enable the title tab"
1536    ID_TOGGLE_TAB_CONTROL_PANEL "Enable the control panel tab"
1537    ID_TOGGLE_TAB_PCB       "Enable the PCB tab"
1538    ID_TOGGLE_TAB_HISTORY   "Enable the history tab"
1539    ID_VIEW_FULLSCREEN      "Toggle Fullscreen mode"
1540END
1541
1542STRINGTABLE
1543BEGIN
1544#ifdef MESS
1545    ID_CUSTOMIZE_FIELDS     "Customize which columns are used in the system list"
1546#else
1547    ID_CUSTOMIZE_FIELDS     "Customize which columns are used in the game list"
1548#endif
1549    ID_GAME_PROPERTIES      "Display the properties of the selected item"
1550    ID_VIEW_PAGETAB         "Show or hide the tabs in the picture area"
1551    ID_VIEW_FOLDERS         "Show or hide the folder list"
1552    ID_VIEW_TOOLBARS        "Show or hide the toolbar"
1553    ID_VIEW_STATUS          "Show or hide the status bar"
1554#ifdef MESS
1555    ID_CONTEXT_FILTERS      "Allows filtering out systems from a folder"
1556    ID_CONTEXT_RENAME_CUSTOM "Rename this folder"
1557    ID_CONTEXT_ADD_CUSTOM   "Add selected item to custom folder"
1558    ID_CONTEXT_REMOVE_CUSTOM "Remove selected item from this folder"
1559    ID_GAME_AUDIT           "Audit the selected item"
1560    ID_CONTEXT_SELECT_RANDOM "Randomly select a system."
1561#else
1562    ID_CONTEXT_FILTERS      "Allows filtering out games from a folder"
1563    ID_CONTEXT_RENAME_CUSTOM "Rename this folder"
1564    ID_CONTEXT_ADD_CUSTOM   "Add selected item to custom folder"
1565    ID_CONTEXT_REMOVE_CUSTOM "Remove selected item from this folder"
1566    ID_GAME_AUDIT           "Audit the selected item"
1567    ID_CONTEXT_SELECT_RANDOM "Randomly select a game."
1568#endif
1569    ID_VIEW_TAB_SCREENSHOT  "Select Screenshot tab"
1570    ID_VIEW_TAB_FLYER       "Select Flyer tab"
1571END
1572
1573STRINGTABLE
1574BEGIN
1575#ifdef MESS
1576    ID_VIEW_BYGAME          "Sort items by system"
1577#else
1578    ID_VIEW_BYGAME          "Sort items by game"
1579#endif
1580    ID_VIEW_BYDIRECTORY     "Sort items by directories"
1581    ID_VIEW_BYMANUFACTURER  "Sort items by manufacturer"
1582    ID_VIEW_BYYEAR          "Sort items by year"
1583    ID_VIEW_BYTYPE          "Sort items by type"
1584    ID_VIEW_BYTIMESPLAYED   "Sort by number of plays"
1585    ID_VIEW_LINEUPICONS     "Arranges icons in a grid"
1586#ifdef MESS
1587    ID_UPDATE_GAMELIST      "Refresh system list"
1588#else
1589    ID_UPDATE_GAMELIST      "Refresh game list"
1590#endif
1591    ID_SORT_ASCENDING       "Sort column in ascending (A-Z) order"
1592    ID_SORT_DESCENDING      "Sort column in descending (Z-A) order"
1593END
1594
1595STRINGTABLE
1596BEGIN
1597    ID_FOLDER_SOURCEPROPERTIES
1598                            "Display properties for all games in this source file"
1599    ID_FOLDER_VECTORPROPERTIES "Display properties for all vector based games"
1600END
1601
1602#endif    // English (U.S.) resources
1603/////////////////////////////////////////////////////////////////////////////
1604
1605
1606
1607#ifndef APSTUDIO_INVOKED
1608/////////////////////////////////////////////////////////////////////////////
1609//
1610// Generated from the TEXTINCLUDE 3 resource.
1611//
1612#include "mamevers.rc" // Version block
1613
1614
1615/////////////////////////////////////////////////////////////////////////////
1616#endif    // not APSTUDIO_INVOKED
1617
src/osd/winui/verinfo.c
r1367r1368
1#include <stdio.h>
2#include <ctype.h>
3
4static int read_version_integer(const char *s, int *position)
5{
6   int value = 0;
7
8   if (isdigit(s[*position]))
9   {
10      while(isdigit(s[*position]))
11      {
12         value *= 10;
13         value += s[(*position)++] - '0';
14      }
15
16      if ((s[*position] == '.') || (s[*position] == 'u'))
17         (*position)++;
18   }
19   return value;
20}
21
22
23
24int main(int argc, char *argv[])
25{
26   extern char build_version[];
27   int version_major;
28   int version_minor;
29   int version_build;
30   int version_subbuild;
31   int year = 2006;
32   const char *author;
33   const char *comments;
34   const char *company_name;
35   const char *file_description;
36   const char *internal_name;
37   const char *product_name;
38   const char *legal_trademarks;
39   const char *original_filename;
40   char legal_copyright[256];
41   int position = 0;
42
43   version_major      = read_version_integer(build_version, &position);
44   version_minor      = read_version_integer(build_version, &position);
45   version_build      = read_version_integer(build_version, &position);
46   version_subbuild   = read_version_integer(build_version, &position);
47
48#ifdef MESS
49   file_description = "Multiple Emulation Super System for Win32";
50   company_name = "MESS Team";
51   product_name = "MESS";
52   sprintf(legal_copyright, "Copyright 1997-%d Nicola Salmoria and the MAME team", year);
53   original_filename = "MESS.exe";
54#else
55   file_description = "Multiple Arcade Machine Emulator for Win32";
56   company_name = "MAME Team";
57   product_name = "MAME32";
58   sprintf(legal_copyright, "Copyright 1997-%d Nicola Salmoria and the MAME team", year);
59   original_filename = "MAME32.exe";
60#endif
61   author = "Christopher Kirmse and Michael Soderstrom";
62   comments = file_description;
63   internal_name = product_name;
64   legal_trademarks = "";
65   
66   printf("VS_VERSION_INFO VERSIONINFO\n");
67   printf(" FILEVERSION %d,%d,%d,%d\n", version_major, version_minor, version_build, version_subbuild);
68   printf(" PRODUCTVERSION %d,%d,%d,%d\n", version_major, version_minor, version_build, version_subbuild);
69   printf(" FILEFLAGSMASK 0x3fL\n");
70   printf("#ifdef _DEBUG\n");
71   printf(" FILEFLAGS 0x1L\n");
72   printf("#else\n");
73   printf(" FILEFLAGS 0x0L\n");
74   printf("#endif\n");
75   printf(" FILEOS 0x40004L\n");
76   printf(" FILETYPE 0x1L\n");
77   printf(" FILESUBTYPE 0x0L\n");
78   printf("BEGIN\n");
79   printf("    BLOCK \"StringFileInfo\"\n");
80   printf("    BEGIN\n");
81   printf("        BLOCK \"040904b0\"\n");
82   printf("        BEGIN\n");
83   printf("            VALUE \"Author\", \"%s\\0\"\n", author);
84   printf("            VALUE \"Comments\", \"%s\\0\"\n", comments);
85   printf("            VALUE \"CompanyName\", \"%s\\0\"\n", company_name);
86   printf("            VALUE \"FileDescription\", \"%s\\0\"\n", file_description);
87   printf("            VALUE \"FileVersion\", \"%d, %d, %d, %d\\0\"\n", version_major, version_minor, version_build, version_subbuild);
88   printf("            VALUE \"InternalName\", \"%s\\0\"\n", internal_name);
89   printf("            VALUE \"LegalCopyright\", \"%s\\0\"\n", legal_copyright);
90   printf("            VALUE \"LegalTrademarks\", \"%s\\0\"\n", legal_trademarks);
91   printf("            VALUE \"OriginalFilename\", \"%s\\0\"\n", original_filename);
92   printf("            VALUE \"ProductName\", \"%s\\0\"\n", product_name);
93   printf("            VALUE \"ProductVersion\", \"%d, %d, %d, %d\\0\"\n", version_major, version_minor, version_build, version_subbuild);
94   printf("        END\n");
95   printf("    END\n");
96   printf("    BLOCK \"VarFileInfo\"\n");
97   printf("    BEGIN\n");
98   printf("        VALUE \"Translation\", 0x409, 1200\n");
99   printf("    END\n");
100   printf("END\n");
101
102   return 0;
103}
src/osd/winui/m32main.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11***************************************************************************/
12
13#define WINUI
14
15// import the main() from MAME, but rename it so we can call it indirectly
16#undef main
17#define main mame_main
18#include "windows/main.c"
19#undef main
20
21#include "screenshot.h"
22#include "win32ui.h"
23
24
25int WINAPI WinMain(HINSTANCE    hInstance,
26                   HINSTANCE    hPrevInstance,
27                   LPSTR        lpCmdLine,
28                   int          nCmdShow)
29{
30   return Mame32Main(hInstance, lpCmdLine, nCmdShow);
31}
src/osd/winui/m32opts.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13 /***************************************************************************
14
15  m32opts.c
16
17  Stores global options and per-game options;
18
19***************************************************************************/
20
21#define WIN32_LEAN_AND_MEAN
22
23#include <windows.h>
24#include <windowsx.h>
25#include <winreg.h>
26#include <commctrl.h>
27#include <assert.h>
28#include <stdio.h>
29#include <sys/stat.h>
30#include <math.h>
31#include <direct.h>
32#include <driver.h>
33#include <stddef.h>
34#include <tchar.h>
35
36#include "screenshot.h"
37#include "bitmask.h"
38#include "mame32.h"
39#include "m32util.h"
40#include "resource.h"
41#include "treeview.h"
42#include "file.h"
43#include "splitters.h"
44#include "dijoystick.h"
45#include "audit.h"
46#include "m32opts.h"
47#include "picker.h"
48#include "winmain.h"
49#include "windows/winutf8.h"
50#include "windows/strconv.h"
51#include "astring.h"
52
53#ifdef MESS
54#include "optionsms.h"
55#endif // MESS
56
57#ifdef _MSC_VER
58#define snprintf _snprintf
59#endif
60
61/***************************************************************************
62    Internal function prototypes
63 ***************************************************************************/
64
65// static void LoadFolderFilter(int folder_index,int filters);
66
67static file_error LoadSettingsFile(core_options *opts, const char *filename);
68static file_error SaveSettingsFile(core_options *opts, core_options *baseopts, const char *filename);
69
70static void LoadOptionsAndSettings(void);
71
72static void  CusColorEncodeString(const COLORREF *value, char* str);
73static void  CusColorDecodeString(const char* str, COLORREF *value);
74
75static void  SplitterEncodeString(const int *value, char* str);
76static void  SplitterDecodeString(const char *str, int *value);
77
78static void  FontEncodeString(const LOGFONT *f, char *str);
79static void  FontDecodeString(const char* str, LOGFONT *f);
80
81static void TabFlagsEncodeString(int data, char *str);
82static void TabFlagsDecodeString(const char *str, int *data);
83
84static DWORD DecodeFolderFlags(const char *buf);
85static const char * EncodeFolderFlags(DWORD value);
86
87static void ResetToDefaults(core_options *opts, int priority);
88
89static void ui_parse_ini_file(core_options *opts, const char *name);
90static void remove_all_source_options(void);
91
92
93#ifdef _MSC_VER
94#define snprintf _snprintf
95#endif
96
97/***************************************************************************
98    Internal defines
99 ***************************************************************************/
100
101#define UI_INI_FILENAME MAME32NAME "ui.ini"
102#define DEFAULT_OPTIONS_INI_FILENAME CONFIGNAME ".ini"
103
104#define M32OPTION_LIST_MODE                  "list_mode"
105#define M32OPTION_CHECK_GAME               "check_game"
106#define M32OPTION_JOYSTICK_IN_INTERFACE         "joystick_in_interface"
107#define M32OPTION_KEYBOARD_IN_INTERFACE         "keyboard_in_interface"
108#define M32OPTION_CYCLE_SCREENSHOT            "cycle_screenshot"
109#define M32OPTION_STRETCH_SCREENSHOT_LARGER      "stretch_screenshot_larger"
110#define M32OPTION_SCREENSHOT_BORDER_SIZE      "screenshot_bordersize"
111#define M32OPTION_SCREENSHOT_BORDER_COLOR      "screenshot_bordercolor"
112#define M32OPTION_INHERIT_FILTER            "inherit_filter"
113#define M32OPTION_OFFSET_CLONES               "offset_clones"
114#define M32OPTION_GAME_CAPTION               "game_caption"
115#define M32OPTION_BROADCAST_GAME_NAME         "broadcast_game_name"
116#define M32OPTION_RANDOM_BACKGROUND            "random_background"
117#define M32OPTION_DEFAULT_FOLDER_ID            "default_folder_id"
118#define M32OPTION_SHOW_IMAGE_SECTION         "show_image_section"
119#define M32OPTION_SHOW_FOLDER_SECTION         "show_folder_section"
120#define M32OPTION_HIDE_FOLDERS               "hide_folders"
121#define M32OPTION_SHOW_STATUS_BAR            "show_status_bar"
122#define M32OPTION_SHOW_TABS                  "show_tabs"
123#define M32OPTION_SHOW_TOOLBAR               "show_tool_bar"
124#define M32OPTION_CURRENT_TAB               "current_tab"
125#define M32OPTION_WINDOW_X                  "window_x"
126#define M32OPTION_WINDOW_Y                  "window_y"
127#define M32OPTION_WINDOW_WIDTH               "window_width"
128#define M32OPTION_WINDOW_HEIGHT               "window_height"
129#define M32OPTION_WINDOW_STATE               "window_state"
130#define M32OPTION_CUSTOM_COLOR               "custom_color"
131#define M32OPTION_LIST_FONT                  "list_font"
132#define M32OPTION_TEXT_COLOR               "text_color"
133#define M32OPTION_CLONE_COLOR               "clone_color"
134#define M32OPTION_HIDE_TABS                  "hide_tabs"
135#define M32OPTION_HISTORY_TAB               "history_tab"
136#define M32OPTION_COLUMN_WIDTHS               "column_widths"
137#define M32OPTION_COLUMN_ORDER               "column_order"
138#define M32OPTION_COLUMN_SHOWN               "column_shown"
139#define M32OPTION_SPLITTERS                  "splitters"
140#define M32OPTION_SORT_COLUMN               "sort_column"
141#define M32OPTION_SORT_REVERSED               "sort_reversed"
142#define M32OPTION_LANGUAGE                  "language"
143#define M32OPTION_FLYER_DIRECTORY            "flyer_directory"
144#define M32OPTION_CABINET_DIRECTORY            "cabinet_directory"
145#define M32OPTION_MARQUEE_DIRECTORY            "marquee_directory"
146#define M32OPTION_TITLE_DIRECTORY            "title_directory"
147#define M32OPTION_CPANEL_DIRECTORY            "cpanel_directory"
148#define M32OPTION_PCB_DIRECTORY                "pcb_directory"
149#define M32OPTION_ICONS_DIRECTORY            "icons_directory"
150#define M32OPTION_BACKGROUND_DIRECTORY         "background_directory"
151#define M32OPTION_FOLDER_DIRECTORY            "folder_directory"
152#define M32OPTION_UI_KEY_UP                  "ui_key_up"
153#define M32OPTION_UI_KEY_DOWN               "ui_key_down"
154#define M32OPTION_UI_KEY_LEFT               "ui_key_left"
155#define M32OPTION_UI_KEY_RIGHT               "ui_key_right"
156#define M32OPTION_UI_KEY_START               "ui_key_start"
157#define M32OPTION_UI_KEY_PGUP               "ui_key_pgup"
158#define M32OPTION_UI_KEY_PGDWN               "ui_key_pgdwn"
159#define M32OPTION_UI_KEY_HOME               "ui_key_home"
160#define M32OPTION_UI_KEY_END               "ui_key_end"
161#define M32OPTION_UI_KEY_SS_CHANGE            "ui_key_ss_change"
162#define M32OPTION_UI_KEY_HISTORY_UP            "ui_key_history_up"
163#define M32OPTION_UI_KEY_HISTORY_DOWN         "ui_key_history_down"
164#define M32OPTION_UI_KEY_CONTEXT_FILTERS      "ui_key_context_filters"
165#define M32OPTION_UI_KEY_SELECT_RANDOM         "ui_key_select_random"
166#define M32OPTION_UI_KEY_GAME_AUDIT            "ui_key_game_audit"
167#define M32OPTION_UI_KEY_GAME_PROPERTIES      "ui_key_game_properties"
168#define M32OPTION_UI_KEY_HELP_CONTENTS         "ui_key_help_contents"
169#define M32OPTION_UI_KEY_UPDATE_GAMELIST      "ui_key_update_gamelist"
170#define M32OPTION_UI_KEY_VIEW_FOLDERS         "ui_key_view_folders"
171#define M32OPTION_UI_KEY_VIEW_FULLSCREEN      "ui_key_view_fullscreen"
172#define M32OPTION_UI_KEY_VIEW_PAGETAB         "ui_key_view_pagetab"
173#define M32OPTION_UI_KEY_VIEW_PICTURE_AREA      "ui_key_view_picture_area"
174#define M32OPTION_UI_KEY_VIEW_STATUS         "ui_key_view_status"
175#define M32OPTION_UI_KEY_VIEW_TOOLBARS         "ui_key_view_toolbars"
176#define M32OPTION_UI_KEY_VIEW_TAB_CABINET      "ui_key_view_tab_cabinet"
177#define M32OPTION_UI_KEY_VIEW_TAB_CPANEL      "ui_key_view_tab_cpanel"
178#define M32OPTION_UI_KEY_VIEW_TAB_FLYER         "ui_key_view_tab_flyer"
179#define M32OPTION_UI_KEY_VIEW_TAB_HISTORY      "ui_key_view_tab_history"
180#define M32OPTION_UI_KEY_VIEW_TAB_MARQUEE      "ui_key_view_tab_marquee"
181#define M32OPTION_UI_KEY_VIEW_TAB_SCREENSHOT   "ui_key_view_tab_screenshot"
182#define M32OPTION_UI_KEY_VIEW_TAB_TITLE         "ui_key_view_tab_title"
183#define M32OPTION_UI_KEY_VIEW_TAB_PCB         "ui_key_view_tab_pcb"
184#define M32OPTION_UI_KEY_QUIT               "ui_key_quit"
185#define M32OPTION_UI_JOY_UP                  "ui_joy_up"
186#define M32OPTION_UI_JOY_DOWN               "ui_joy_down"
187#define M32OPTION_UI_JOY_LEFT               "ui_joy_left"
188#define M32OPTION_UI_JOY_RIGHT               "ui_joy_right"
189#define M32OPTION_UI_JOY_START               "ui_joy_start"
190#define M32OPTION_UI_JOY_PGUP               "ui_joy_pgup"
191#define M32OPTION_UI_JOY_PGDWN               "ui_joy_pgdwn"
192#define M32OPTION_UI_JOY_HOME               "ui_joy_home"
193#define M32OPTION_UI_JOY_END               "ui_joy_end"
194#define M32OPTION_UI_JOY_SS_CHANGE            "ui_joy_ss_change"
195#define M32OPTION_UI_JOY_HISTORY_UP            "ui_joy_history_up"
196#define M32OPTION_UI_JOY_HISTORY_DOWN         "ui_joy_history_down"
197#define M32OPTION_UI_JOY_EXEC               "ui_joy_exec"
198#define M32OPTION_EXEC_COMMAND               "exec_command"
199#define M32OPTION_EXEC_WAIT                  "exec_wait"
200#define M32OPTION_HIDE_MOUSE               "hide_mouse"
201#define M32OPTION_FULL_SCREEN               "full_screen"
202
203#ifdef MESS
204// Options names
205#define M32OPTION_DEFAULT_GAME               "default_system"
206#define M32OPTION_HISTORY_FILE               "sysinfo_file"
207#define M32OPTION_MAMEINFO_FILE               "messinfo_file"
208// Option values
209#define M32DEFAULT_SELECTION               "nes"
210#define M32DEFAULT_SPLITTERS               "152,310,468"
211#define M32HISTORY_FILE                     "sysinfo.dat"
212#define M32MAMEINFO_FILE                  "messinfo.dat"
213#else
214// Options names
215#define M32OPTION_DEFAULT_GAME               "default_game"
216#define M32OPTION_HISTORY_FILE               "history_file"
217#define M32OPTION_MAMEINFO_FILE               "mameinfo_file"
218// Options values
219#define M32DEFAULT_SELECTION               "puckman"
220#define M32DEFAULT_SPLITTERS               "152,362"
221#define M32HISTORY_FILE                     "history.dat"
222#define M32MAMEINFO_FILE                  "mameinfo.dat"
223#endif
224
225
226
227/***************************************************************************
228    Internal structures
229 ***************************************************************************/
230
231#if 0
232typedef struct
233{
234   int folder_index;
235   int filters;
236} folder_filter_type;
237#endif
238
239/***************************************************************************
240    Internal variables
241 ***************************************************************************/
242
243static object_pool *options_memory_pool;
244
245static core_options *settings;
246
247static core_options *global = NULL;         // Global 'default' options
248
249// UI options in mame32ui.ini
250static const options_entry regSettings[] =
251{
252   // UI options
253   { NULL,                           NULL,       OPTION_HEADER,     "DISPLAY STATE OPTIONS" },
254   { M32OPTION_DEFAULT_GAME,            M32DEFAULT_SELECTION, 0,       NULL },
255   { M32OPTION_DEFAULT_GAME,            "puckman",  0,                 NULL },
256   { M32OPTION_DEFAULT_FOLDER_ID,         "0",        0,                 NULL },
257   { M32OPTION_SHOW_IMAGE_SECTION,         "1",        OPTION_BOOLEAN,    NULL },
258   { M32OPTION_FULL_SCREEN,            "0",        OPTION_BOOLEAN,    NULL },
259   { M32OPTION_CURRENT_TAB,            "0",        0,                 NULL },
260   { M32OPTION_SHOW_TOOLBAR,            "1",        OPTION_BOOLEAN,    NULL },
261   { M32OPTION_SHOW_STATUS_BAR,         "1",        OPTION_BOOLEAN,    NULL },
262   { M32OPTION_HIDE_FOLDERS,            "",         0,                 NULL },
263#ifdef MESS
264   { M32OPTION_SHOW_FOLDER_SECTION,      "0",        OPTION_BOOLEAN,    NULL },
265   { M32OPTION_SHOW_TABS,               "0",        OPTION_BOOLEAN,    NULL },
266   { M32OPTION_HIDE_TABS,               "flyer, cabinet, marquee, title, cpanel, pcb", 0, NULL },
267   { M32OPTION_HISTORY_TAB,            "1",        0,                 NULL },
268#else
269   { M32OPTION_SHOW_FOLDER_SECTION,      "1",        OPTION_BOOLEAN,    NULL },
270   { M32OPTION_SHOW_TABS,               "1",        OPTION_BOOLEAN,    NULL },
271   { M32OPTION_HIDE_TABS,               "marquee, title, cpanel, pcb, history", 0, NULL },
272   { M32OPTION_HISTORY_TAB,            "0",        0,                 NULL },
273#endif
274
275   { M32OPTION_SORT_COLUMN,            "0",        0,                 NULL },
276   { M32OPTION_SORT_REVERSED,            "0",        OPTION_BOOLEAN,    NULL },
277   { M32OPTION_WINDOW_X,               "0",        0,                 NULL },
278   { M32OPTION_WINDOW_Y,               "0",        0,                 NULL },
279   { M32OPTION_WINDOW_WIDTH,            "640",      0,                 NULL },
280   { M32OPTION_WINDOW_HEIGHT,            "400",      0,                 NULL },
281   { M32OPTION_WINDOW_STATE,            "1",        0,                 NULL },
282
283   { M32OPTION_TEXT_COLOR,               "-1",       0,                 NULL },
284   { M32OPTION_CLONE_COLOR,            "-1",       0,                 NULL },
285   { M32OPTION_CUSTOM_COLOR,            "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", 0, NULL },
286   /* ListMode needs to be before ColumnWidths settings */
287   { M32OPTION_LIST_MODE,               "5",        0,                 NULL },
288   { M32OPTION_SPLITTERS,               M32DEFAULT_SPLITTERS, 0,       NULL },
289   { M32OPTION_LIST_FONT,               "-8,0,0,0,400,0,0,0,0,0,0,0,0,MS Sans Serif", 0, NULL },
290   { M32OPTION_COLUMN_WIDTHS,            "185,78,84,84,64,88,74,108,60,144,84,60", 0, NULL },
291   { M32OPTION_COLUMN_ORDER,            "0,2,3,4,5,6,7,8,9,1,10,11", 0, NULL },
292   { M32OPTION_COLUMN_SHOWN,            "1,0,1,1,1,1,1,1,1,1,0,0", 0,  NULL },
293
294   { NULL,                           NULL,       OPTION_HEADER,     "INTERFACE OPTIONS" },
295   { M32OPTION_LANGUAGE,               "english",  0,                 NULL },
296   { M32OPTION_CHECK_GAME,               "1",        OPTION_BOOLEAN,    NULL },
297   { M32OPTION_JOYSTICK_IN_INTERFACE,      "0",        OPTION_BOOLEAN,    NULL },
298   { M32OPTION_KEYBOARD_IN_INTERFACE,      "0",        OPTION_BOOLEAN,    NULL },
299   { M32OPTION_RANDOM_BACKGROUND,         "0",        OPTION_BOOLEAN,    NULL },
300   { M32OPTION_BROADCAST_GAME_NAME,      "0",        OPTION_BOOLEAN,    NULL },
301   { M32OPTION_HIDE_MOUSE,               "0",        OPTION_BOOLEAN,    NULL },
302   { M32OPTION_INHERIT_FILTER,            "0",        OPTION_BOOLEAN,    NULL },
303   { M32OPTION_OFFSET_CLONES,            "0",        OPTION_BOOLEAN,    NULL },
304   { M32OPTION_GAME_CAPTION,            "1",        OPTION_BOOLEAN,    NULL },
305   { M32OPTION_STRETCH_SCREENSHOT_LARGER,   "0",        OPTION_BOOLEAN,    NULL },
306   { M32OPTION_CYCLE_SCREENSHOT,         "0",        0,                 NULL },
307    { M32OPTION_SCREENSHOT_BORDER_SIZE,      "11",       0,                 NULL },
308    { M32OPTION_SCREENSHOT_BORDER_COLOR,   "-1",       0,                 NULL },
309   { M32OPTION_EXEC_COMMAND,            "",         0,                 NULL },
310   { M32OPTION_EXEC_WAIT,               "0",        0,                 NULL },
311
312   { NULL,                           NULL,       OPTION_HEADER,     "SEARCH PATH OPTIONS" },
313   { M32OPTION_FLYER_DIRECTORY,         "flyers",   0,                 NULL },
314   { M32OPTION_CABINET_DIRECTORY,         "cabinets", 0,                 NULL },
315   { M32OPTION_MARQUEE_DIRECTORY,         "marquees", 0,                 NULL },
316   { M32OPTION_TITLE_DIRECTORY,         "titles",   0,                 NULL },
317   { M32OPTION_CPANEL_DIRECTORY,         "cpanel",   0,                 NULL },
318   { M32OPTION_PCB_DIRECTORY,             "pcb",      0,                 NULL },
319   { M32OPTION_BACKGROUND_DIRECTORY,      "bkground", 0,                 NULL },
320   { M32OPTION_FOLDER_DIRECTORY,         "folders",  0,                 NULL },
321   { M32OPTION_ICONS_DIRECTORY,         "icons",    0,                 NULL },
322
323
324   { NULL,                           NULL,       OPTION_HEADER,     "FILENAME OPTIONS" },
325   { M32OPTION_HISTORY_FILE,            M32HISTORY_FILE, 0,              NULL },
326   { M32OPTION_MAMEINFO_FILE,            M32MAMEINFO_FILE, 0,             NULL },
327
328   { NULL,                           NULL,       OPTION_HEADER,     "NAVIGATION KEY CODES" },
329   { M32OPTION_UI_KEY_UP,               "KEYCODE_UP", 0,               NULL },
330   { M32OPTION_UI_KEY_DOWN,            "KEYCODE_DOWN", 0,             NULL },
331   { M32OPTION_UI_KEY_LEFT,            "KEYCODE_LEFT", 0,             NULL },
332   { M32OPTION_UI_KEY_RIGHT,            "KEYCODE_RIGHT", 0,            NULL },
333   { M32OPTION_UI_KEY_START,            "KEYCODE_ENTER NOT KEYCODE_LALT", 0, NULL },
334   { M32OPTION_UI_KEY_PGUP,            "KEYCODE_PGUP", 0,             NULL },
335   { M32OPTION_UI_KEY_PGDWN,            "KEYCODE_PGDN", 0,             NULL },
336   { M32OPTION_UI_KEY_HOME,            "KEYCODE_HOME", 0,             NULL },
337   { M32OPTION_UI_KEY_END,               "KEYCODE_END", 0,              NULL },
338   { M32OPTION_UI_KEY_SS_CHANGE,         "KEYCODE_INSERT", 0,           NULL },
339   { M32OPTION_UI_KEY_HISTORY_UP,         "KEYCODE_DEL", 0,              NULL },
340   { M32OPTION_UI_KEY_HISTORY_DOWN,      "KEYCODE_LALT KEYCODE_0", 0,   NULL },
341
342   { M32OPTION_UI_KEY_CONTEXT_FILTERS,      "KEYCODE_LCONTROL KEYCODE_F", 0, NULL },
343   { M32OPTION_UI_KEY_SELECT_RANDOM,      "KEYCODE_LCONTROL KEYCODE_R", 0, NULL },
344   { M32OPTION_UI_KEY_GAME_AUDIT,         "KEYCODE_LALT KEYCODE_A",     0, NULL },
345   { M32OPTION_UI_KEY_GAME_PROPERTIES,      "KEYCODE_LALT KEYCODE_ENTER", 0, NULL },
346   { M32OPTION_UI_KEY_HELP_CONTENTS,      "KEYCODE_F1",                 0, NULL },
347   { M32OPTION_UI_KEY_UPDATE_GAMELIST,      "KEYCODE_F5",                 0, NULL },
348   { M32OPTION_UI_KEY_VIEW_FOLDERS,      "KEYCODE_LALT KEYCODE_D",     0, NULL },
349   { M32OPTION_UI_KEY_VIEW_FULLSCREEN,      "KEYCODE_F11",                0, NULL },
350   { M32OPTION_UI_KEY_VIEW_PAGETAB,      "KEYCODE_LALT KEYCODE_B",     0, NULL },
351   { M32OPTION_UI_KEY_VIEW_PICTURE_AREA,   "KEYCODE_LALT KEYCODE_P",     0, NULL },
352   { M32OPTION_UI_KEY_VIEW_STATUS,         "KEYCODE_LALT KEYCODE_S",     0, NULL },
353    { M32OPTION_UI_KEY_VIEW_TOOLBARS,      "KEYCODE_LALT KEYCODE_T",     0, NULL },
354
355   { M32OPTION_UI_KEY_VIEW_TAB_CABINET,   "KEYCODE_LALT KEYCODE_3",     0, NULL },
356    { M32OPTION_UI_KEY_VIEW_TAB_CPANEL,      "KEYCODE_LALT KEYCODE_6",     0, NULL },
357    { M32OPTION_UI_KEY_VIEW_TAB_FLYER,      "KEYCODE_LALT KEYCODE_2",     0, NULL },
358    { M32OPTION_UI_KEY_VIEW_TAB_HISTORY,   "KEYCODE_LALT KEYCODE_8",     0, NULL },
359    { M32OPTION_UI_KEY_VIEW_TAB_MARQUEE,   "KEYCODE_LALT KEYCODE_4",     0, NULL },
360    { M32OPTION_UI_KEY_VIEW_TAB_SCREENSHOT,   "KEYCODE_LALT KEYCODE_1",     0, NULL },
361    { M32OPTION_UI_KEY_VIEW_TAB_TITLE,      "KEYCODE_LALT KEYCODE_5",     0, NULL },
362    { M32OPTION_UI_KEY_VIEW_TAB_PCB,      "KEYCODE_LALT KEYCODE_7",     0, NULL },
363    { M32OPTION_UI_KEY_QUIT,            "KEYCODE_LALT KEYCODE_Q",     0, NULL },
364
365   { NULL,                           NULL,       OPTION_HEADER,     "NAVIGATION JOYSTICK CODES" },
366   { M32OPTION_UI_JOY_UP,               "",         0,                 NULL },
367   { M32OPTION_UI_JOY_DOWN,            "",         0,                 NULL },
368   { M32OPTION_UI_JOY_LEFT,            "",         0,                 NULL },
369   { M32OPTION_UI_JOY_RIGHT,            "",         0,                 NULL },
370   { M32OPTION_UI_JOY_START,            "",         0,                 NULL },
371   { M32OPTION_UI_JOY_PGUP,            "",         0,                 NULL },
372   { M32OPTION_UI_JOY_PGDWN,            "",         0,                 NULL },
373   { M32OPTION_UI_JOY_HOME,            "0,0,0,0",  0,                 NULL },
374   { M32OPTION_UI_JOY_END,               "0,0,0,0",  0,                 NULL },
375   { M32OPTION_UI_JOY_SS_CHANGE,         "",         0,                 NULL },
376   { M32OPTION_UI_JOY_HISTORY_UP,         "",         0,                 NULL },
377   { M32OPTION_UI_JOY_HISTORY_DOWN,      "",         0,                 NULL },
378   { M32OPTION_UI_JOY_EXEC,            "0,0,0,0",  0,                 NULL },
379
380#ifndef MESS
381   { NULL,                           NULL,       OPTION_HEADER,     "GAME STATISTICS" },
382#endif
383   { NULL }
384};
385
386static const options_entry perGameOptions[] =
387{
388   // per game options
389   { "_play_count",             "0",        0,                 NULL },
390   { "_play_time",              "0",        0,                 NULL },
391   { "_rom_audit",              "-1",       0,                 NULL },
392   { "_samples_audit",          "-1",       0,                 NULL },
393#ifdef MESS
394   { "_extra_software",         "",         0,                 NULL },
395#endif
396   { NULL }
397};
398
399static const options_entry filterOptions[] =
400{
401   // filters
402   { "_filters",                "0",        0,                 NULL },
403   { NULL }
404};
405
406
407
408// Screen shot Page tab control text
409// these must match the order of the options flags in options.h
410// (TAB_...)
411const char* image_tabs_long_name[MAX_TAB_TYPES] =
412{
413   "Snapshot ",
414   "Flyer ",
415   "Cabinet ",
416   "Marquee",
417   "Title",
418   "Control Panel",
419   "PCB",
420   "History ",
421};
422
423const char* image_tabs_short_name[MAX_TAB_TYPES] =
424{
425   "snapshot",
426   "flyer",
427   "cabinet",
428   "marquee",
429   "title",
430   "cpanel",
431   "pcb",
432   "history"
433};
434
435
436static BOOL save_gui_settings = TRUE;
437static BOOL save_default_options = TRUE;
438
439#if 0
440folder_filter_type *folder_filters;
441int size_folder_filters;
442int num_folder_filters;
443#endif
444
445/***************************************************************************
446    External functions
447 ***************************************************************************/
448
449static void memory_error(const char *message)
450{
451   win_message_box_utf8(NULL, message, NULL, MB_OK);
452   exit(-1);
453}
454
455
456
457void AddOptions(core_options *opts, const options_entry *entrylist, BOOL is_global)
458{
459   static const char *blacklist[] =
460   {
461      WINOPTION_SCREEN,
462      WINOPTION_ASPECT,
463      WINOPTION_RESOLUTION,
464      WINOPTION_VIEW
465   };
466   options_entry entries[2];
467   BOOL good_option;
468   int i;
469
470   for ( ; entrylist->name != NULL || (entrylist->flags & OPTION_HEADER); entrylist++)
471   {
472      good_option = TRUE;
473
474      // check blacklist
475      if (entrylist->name != NULL)
476      {
477         for (i = 0; i < ARRAY_LENGTH(blacklist); i++)
478         {
479            if (!strcmp(entrylist->name, blacklist[i]))
480            {
481               good_option = FALSE;
482               break;
483            }
484         }
485      }
486
487      // if is_global is FALSE, blacklist global options
488      if (entrylist->name && !is_global && IsGlobalOption(entrylist->name))
489         good_option = FALSE;
490
491      if (good_option)
492      {
493         memcpy(entries, entrylist, sizeof(options_entry));
494         memset(&entries[1], 0, sizeof(entries[1]));
495         options_add_entries(opts, entries);
496      }
497   }
498}
499
500
501
502core_options *CreateGameOptions(int driver_index)
503{
504   core_options *opts;
505   BOOL is_global = (driver_index == OPTIONS_TYPE_GLOBAL);
506   extern const options_entry mame_win_options[];
507
508   // create the options
509   opts = options_create(memory_error);
510
511   // add the options
512   AddOptions(opts, mame_core_options, is_global);
513   AddOptions(opts, mame_win_options, is_global);
514
515   // customize certain options
516   if (is_global)
517      options_set_option_default_value(opts, OPTION_INIPATH, "ini");
518
519#ifdef MESS
520   MessSetupGameOptions(opts, driver_index);
521#endif // MESS
522
523   return opts;
524}
525
526
527
528BOOL OptionsInit()
529{
530   // create a memory pool for our data
531   options_memory_pool = pool_alloc(memory_error);
532   if (!options_memory_pool)
533      return FALSE;
534
535   // set up the MAME32 settings (these get placed in MAME32ui.ini
536   settings = options_create(memory_error);
537   options_add_entries(settings, regSettings);
538#ifdef MESS
539   MessSetupSettings(settings);
540#endif
541
542   // set up per game options
543   {
544      char buffer[128];
545      int i, j;
546      int game_option_count = 0;
547      options_entry *driver_per_game_options;
548      options_entry *ent;
549
550      while(perGameOptions[game_option_count].name)
551         game_option_count++;
552
553      driver_per_game_options = (options_entry *) pool_malloc(options_memory_pool,
554         (game_option_count * driver_list_get_count(drivers) + 1) * sizeof(*driver_per_game_options));
555
556      for (i = 0; i < driver_list_get_count(drivers); i++)
557      {
558         for (j = 0; j < game_option_count; j++)
559         {
560            ent = &driver_per_game_options[i * game_option_count + j];
561
562            snprintf(buffer, ARRAY_LENGTH(buffer), "%s%s", drivers[i]->name, perGameOptions[j].name);
563
564            memset(ent, 0, sizeof(*ent));
565            ent->name = pool_strdup(options_memory_pool, buffer);
566            ent->defvalue = perGameOptions[j].defvalue;
567            ent->flags = perGameOptions[j].flags;
568            ent->description = perGameOptions[j].description;
569         }
570      }
571      ent = &driver_per_game_options[driver_list_get_count(drivers) * game_option_count];
572      memset(ent, 0, sizeof(*ent));
573      options_add_entries(settings, driver_per_game_options);
574   }
575
576   // set up global options
577   global = CreateGameOptions(OPTIONS_TYPE_GLOBAL);
578#if 0
579   // set up folders
580   size_folder_filters = 1;
581   num_folder_filters = 0;
582   folder_filters = (folder_filter_type *) pool_malloc(options_memory_pool, size_folder_filters * sizeof(*folder_filters));
583#endif
584   // now load the options and settings
585   LoadOptionsAndSettings();
586
587   return TRUE;
588
589}
590
591void OptionsExit(void)
592{
593   // free global options
594   options_free(global);
595   global = NULL;
596
597   // free settings
598   options_free(settings);
599   settings = NULL;
600
601   // free the memory pool
602   pool_free(options_memory_pool);
603   options_memory_pool = NULL;
604}
605
606core_options * Mame32Settings(void)
607{
608   return settings;
609}
610
611core_options * Mame32Global(void)
612{
613   return global;
614}
615
616#if 0
617static void LoadFolderFilter(int folder_index,int filters)
618{
619   //dprintf("loaded folder filter %i %i",folder_index,filters);
620
621   if (num_folder_filters == size_folder_filters)
622   {
623      size_folder_filters *= 2;
624      folder_filters = (folder_filter_type *)realloc(
625         folder_filters,size_folder_filters * sizeof(folder_filter_type));
626   }
627   folder_filters[num_folder_filters].folder_index = folder_index;
628   folder_filters[num_folder_filters].filters = filters;
629
630   num_folder_filters++;
631}
632#endif
633
634// Restore ui settings to factory
635void ResetGUI(void)
636{
637   ResetToDefaults(settings, OPTION_PRIORITY_NORMAL);
638   // Save the new MAME32ui.ini
639   SaveOptions();
640   save_gui_settings = FALSE;
641}
642
643const char * GetImageTabLongName(int tab_index)
644{
645   assert(tab_index >= 0);
646   assert(tab_index < ARRAY_LENGTH(image_tabs_long_name));
647   return image_tabs_long_name[tab_index];
648}
649
650const char * GetImageTabShortName(int tab_index)
651{
652   assert(tab_index >= 0);
653   assert(tab_index < ARRAY_LENGTH(image_tabs_short_name));
654   return image_tabs_short_name[tab_index];
655}
656
657//============================================================
658//  OPTIONS WRAPPERS
659//============================================================
660
661static COLORREF options_get_color(core_options *opts, const char *name)
662{
663   const char *value_str;
664   unsigned int r, g, b;
665   COLORREF value;
666
667   value_str = options_get_string(opts, name);
668
669   if (sscanf(value_str, "%u,%u,%u", &r, &g, &b) == 3)
670      value = RGB(r,g,b);
671   else
672      value = (COLORREF) - 1;
673   return value;
674}
675
676static void options_set_color(core_options *opts, const char *name, COLORREF value)
677{
678   char value_str[32];
679
680   if (value == (COLORREF) -1)
681   {
682      snprintf(value_str, ARRAY_LENGTH(value_str), "%d", (int) value);
683   }
684   else
685   {
686      snprintf(value_str, ARRAY_LENGTH(value_str), "%d,%d,%d",
687         (((int) value) >>  0) & 0xFF,
688         (((int) value) >>  8) & 0xFF,
689         (((int) value) >> 16) & 0xFF);
690   }
691   options_set_string(opts, name, value_str, OPTION_PRIORITY_CMDLINE);
692}
693
694static COLORREF options_get_color_default(core_options *opts, const char *name, int default_color)
695{
696   COLORREF value = options_get_color(opts, name);
697   if (value == (COLORREF) -1)
698      value = GetSysColor(default_color);
699   return value;
700}
701
702static void options_set_color_default(core_options *opts, const char *name, COLORREF value, int default_color)
703{
704   if (value == GetSysColor(default_color))
705      options_set_color(settings, name, (COLORREF) -1);
706   else
707      options_set_color(settings, name, value);
708}
709
710static input_seq *options_get_input_seq(core_options *opts, const char *name)
711{
712   static input_seq seq;
713   const char *seq_string;
714
715   seq_string = options_get_string(opts, name);
716   input_seq_from_tokens(seq_string, &seq);
717   return &seq;
718}
719
720
721
722//============================================================
723//  OPTIONS CALLS
724//============================================================
725
726void SetViewMode(int val)
727{
728   options_set_int(settings, M32OPTION_LIST_MODE, val, OPTION_PRIORITY_CMDLINE);
729}
730
731int GetViewMode(void)
732{
733   return options_get_int(settings, M32OPTION_LIST_MODE);
734}
735
736void SetGameCheck(BOOL game_check)
737{
738   options_set_bool(settings, M32OPTION_CHECK_GAME, game_check, OPTION_PRIORITY_CMDLINE);
739}
740
741BOOL GetGameCheck(void)
742{
743   return options_get_bool(settings,M32OPTION_CHECK_GAME);
744}
745
746void SetJoyGUI(BOOL use_joygui)
747{
748   options_set_bool(settings, M32OPTION_JOYSTICK_IN_INTERFACE, use_joygui, OPTION_PRIORITY_CMDLINE);
749}
750
751BOOL GetJoyGUI(void)
752{
753   return options_get_bool(settings, M32OPTION_JOYSTICK_IN_INTERFACE);
754}
755
756void SetKeyGUI(BOOL use_keygui)
757{
758   options_set_bool(settings, M32OPTION_KEYBOARD_IN_INTERFACE, use_keygui, OPTION_PRIORITY_CMDLINE);
759}
760
761BOOL GetKeyGUI(void)
762{
763   return options_get_bool(settings, M32OPTION_KEYBOARD_IN_INTERFACE);
764}
765
766void SetCycleScreenshot(int cycle_screenshot)
767{
768   options_set_int(settings, M32OPTION_CYCLE_SCREENSHOT, cycle_screenshot, OPTION_PRIORITY_CMDLINE);
769}
770
771int GetCycleScreenshot(void)
772{
773   return options_get_int(settings, M32OPTION_CYCLE_SCREENSHOT);
774}
775
776void SetStretchScreenShotLarger(BOOL stretch)
777{
778   options_set_bool(settings, M32OPTION_STRETCH_SCREENSHOT_LARGER, stretch, OPTION_PRIORITY_CMDLINE);
779}
780
781BOOL GetStretchScreenShotLarger(void)
782{
783   return options_get_bool(settings, M32OPTION_STRETCH_SCREENSHOT_LARGER);
784}
785
786void SetScreenshotBorderSize(int size)
787{
788   options_set_int(settings, M32OPTION_SCREENSHOT_BORDER_SIZE, size, OPTION_PRIORITY_CMDLINE);
789}
790
791int GetScreenshotBorderSize(void)
792{
793   return options_get_int(settings, M32OPTION_SCREENSHOT_BORDER_SIZE);
794}
795
796void SetScreenshotBorderColor(COLORREF uColor)
797{
798   options_set_color_default(settings, M32OPTION_SCREENSHOT_BORDER_COLOR, uColor, COLOR_3DFACE);
799}
800
801COLORREF GetScreenshotBorderColor(void)
802{
803   return options_get_color_default(settings, M32OPTION_SCREENSHOT_BORDER_COLOR, COLOR_3DFACE);
804}
805
806void SetFilterInherit(BOOL inherit)
807{
808   options_set_bool(settings, M32OPTION_INHERIT_FILTER, inherit, OPTION_PRIORITY_CMDLINE);
809}
810
811BOOL GetFilterInherit(void)
812{
813   return options_get_bool(settings, M32OPTION_INHERIT_FILTER);
814}
815
816void SetOffsetClones(BOOL offset)
817{
818   options_set_bool(settings, M32OPTION_OFFSET_CLONES, offset, OPTION_PRIORITY_CMDLINE);
819}
820
821BOOL GetOffsetClones(void)
822{
823   return options_get_bool(settings, M32OPTION_OFFSET_CLONES);
824}
825
826void SetGameCaption(BOOL caption)
827{
828   options_set_bool(settings, M32OPTION_GAME_CAPTION, caption, OPTION_PRIORITY_CMDLINE);
829}
830
831BOOL GetGameCaption(void)
832{
833   return options_get_bool(settings, M32OPTION_GAME_CAPTION);
834}
835
836void SetBroadcast(BOOL broadcast)
837{
838   options_set_bool(settings, M32OPTION_BROADCAST_GAME_NAME, broadcast, OPTION_PRIORITY_CMDLINE);
839}
840
841BOOL GetBroadcast(void)
842{
843   return options_get_bool(settings, M32OPTION_BROADCAST_GAME_NAME);
844}
845
846void SetRandomBackground(BOOL random_bg)
847{
848   options_set_bool(settings, M32OPTION_RANDOM_BACKGROUND, random_bg, OPTION_PRIORITY_CMDLINE);
849}
850
851BOOL GetRandomBackground(void)
852{
853   return options_get_bool(settings, M32OPTION_RANDOM_BACKGROUND);
854}
855
856void SetSavedFolderID(UINT val)
857{
858   options_set_int(settings, M32OPTION_DEFAULT_FOLDER_ID, (int) val, OPTION_PRIORITY_CMDLINE);
859}
860
861UINT GetSavedFolderID(void)
862{
863   return (UINT) options_get_int(settings, M32OPTION_DEFAULT_FOLDER_ID);
864}
865
866void SetShowScreenShot(BOOL val)
867{
868   options_set_bool(settings, M32OPTION_SHOW_IMAGE_SECTION, val, OPTION_PRIORITY_CMDLINE);
869}
870
871BOOL GetShowScreenShot(void)
872{
873   return options_get_bool(settings, M32OPTION_SHOW_IMAGE_SECTION);
874}
875
876void SetShowFolderList(BOOL val)
877{
878   options_set_bool(settings, M32OPTION_SHOW_FOLDER_SECTION, val, OPTION_PRIORITY_CMDLINE);
879}
880
881BOOL GetShowFolderList(void)
882{
883   return options_get_bool(settings, M32OPTION_SHOW_FOLDER_SECTION);
884}
885
886static void GetsShowFolderFlags(LPBITS bits)
887{
888   char s[2000];
889   extern FOLDERDATA g_folderData[];
890   char *token;
891
892   snprintf(s, ARRAY_LENGTH(s), "%s", options_get_string(settings, M32OPTION_HIDE_FOLDERS));
893
894   SetAllBits(bits, TRUE);
895
896   token = strtok(s,", \t");
897   while (token != NULL)
898   {
899      int j;
900
901      for (j=0;g_folderData[j].m_lpTitle != NULL;j++)
902      {
903         if (strcmp(g_folderData[j].short_name,token) == 0)
904         {
905            ClearBit(bits, g_folderData[j].m_nFolderId);
906            break;
907         }
908      }
909      token = strtok(NULL,", \t");
910   }
911}
912
913BOOL GetShowFolder(int folder)
914{
915   BOOL result;
916   LPBITS show_folder_flags = NewBits(MAX_FOLDERS);
917   GetsShowFolderFlags(show_folder_flags);
918   result = TestBit(show_folder_flags, folder);
919   DeleteBits(show_folder_flags);
920   return result;
921}
922
923void SetShowFolder(int folder,BOOL show)
924{
925   LPBITS show_folder_flags = NewBits(MAX_FOLDERS);
926   int i;
927   int num_saved = 0;
928   char str[10000];
929   extern FOLDERDATA g_folderData[];
930
931   GetsShowFolderFlags(show_folder_flags);
932
933   if (show)
934      SetBit(show_folder_flags, folder);
935   else
936      ClearBit(show_folder_flags, folder);
937
938   strcpy(str, "");
939
940   // we save the ones that are NOT displayed, so we can add new ones
941   // and upgraders will see them
942   for (i=0;i<MAX_FOLDERS;i++)
943   {
944      if (TestBit(show_folder_flags, i) == FALSE)
945      {
946         int j;
947
948         if (num_saved != 0)
949            strcat(str,", ");
950
951         for (j=0;g_folderData[j].m_lpTitle != NULL;j++)
952         {
953            if (g_folderData[j].m_nFolderId == i)
954            {
955               strcat(str,g_folderData[j].short_name);
956               num_saved++;
957               break;
958            }
959         }
960      }
961   }
962   options_set_string(settings, M32OPTION_HIDE_FOLDERS, str, OPTION_PRIORITY_CMDLINE);
963   DeleteBits(show_folder_flags);
964}
965
966void SetShowStatusBar(BOOL val)
967{
968   options_set_bool(settings, M32OPTION_SHOW_STATUS_BAR, val, OPTION_PRIORITY_CMDLINE);
969}
970
971BOOL GetShowStatusBar(void)
972{
973   return options_get_bool(settings, M32OPTION_SHOW_STATUS_BAR);
974}
975
976void SetShowTabCtrl (BOOL val)
977{
978   options_set_bool(settings, M32OPTION_SHOW_TABS, val, OPTION_PRIORITY_CMDLINE);
979}
980
981BOOL GetShowTabCtrl (void)
982{
983   return options_get_bool(settings, M32OPTION_SHOW_TABS);
984}
985
986void SetShowToolBar(BOOL val)
987{
988   options_set_bool(settings, M32OPTION_SHOW_TOOLBAR, val, OPTION_PRIORITY_CMDLINE);
989}
990
991BOOL GetShowToolBar(void)
992{
993   return options_get_bool(settings, M32OPTION_SHOW_TOOLBAR);
994}
995
996void SetCurrentTab(const char *shortname)
997{
998   options_set_string(settings, M32OPTION_CURRENT_TAB, shortname, OPTION_PRIORITY_CMDLINE);
999}
1000
1001const char *GetCurrentTab(void)
1002{
1003   return options_get_string(settings, M32OPTION_CURRENT_TAB);
1004}
1005
1006void SetDefaultGame(const char *name)
1007{
1008   options_set_string(settings, M32OPTION_DEFAULT_GAME, name, OPTION_PRIORITY_CMDLINE);
1009}
1010
1011const char *GetDefaultGame(void)
1012{
1013   return options_get_string(settings, M32OPTION_DEFAULT_GAME);
1014}
1015
1016void SetWindowArea(const AREA *area)
1017{
1018   options_set_int(settings, M32OPTION_WINDOW_X,      area->x, OPTION_PRIORITY_CMDLINE);
1019   options_set_int(settings, M32OPTION_WINDOW_Y,      area->y, OPTION_PRIORITY_CMDLINE);
1020   options_set_int(settings, M32OPTION_WINDOW_WIDTH,   area->width, OPTION_PRIORITY_CMDLINE);
1021   options_set_int(settings, M32OPTION_WINDOW_HEIGHT,   area->height, OPTION_PRIORITY_CMDLINE);
1022}
1023
1024void GetWindowArea(AREA *area)
1025{
1026   area->x      = options_get_int(settings, M32OPTION_WINDOW_X);
1027   area->y      = options_get_int(settings, M32OPTION_WINDOW_Y);
1028   area->width  = options_get_int(settings, M32OPTION_WINDOW_WIDTH);
1029   area->height = options_get_int(settings, M32OPTION_WINDOW_HEIGHT);
1030}
1031
1032void SetWindowState(UINT state)
1033{
1034   options_set_int(settings, M32OPTION_WINDOW_STATE, state, OPTION_PRIORITY_CMDLINE);
1035}
1036
1037UINT GetWindowState(void)
1038{
1039   return options_get_int(settings, M32OPTION_WINDOW_STATE);
1040}
1041
1042void SetCustomColor(int iIndex, COLORREF uColor)
1043{
1044   const char *custom_color_string;
1045   COLORREF custom_color[256];
1046   char buffer[10000];
1047
1048   custom_color_string = options_get_string(settings, M32OPTION_CUSTOM_COLOR);
1049   CusColorDecodeString(custom_color_string, custom_color);
1050
1051   custom_color[iIndex] = uColor;
1052
1053   CusColorEncodeString(custom_color, buffer);
1054   options_set_string(settings, M32OPTION_CUSTOM_COLOR, buffer, OPTION_PRIORITY_CMDLINE);
1055}
1056
1057COLORREF GetCustomColor(int iIndex)
1058{
1059   const char *custom_color_string;
1060   COLORREF custom_color[256];
1061
1062   custom_color_string = options_get_string(settings, M32OPTION_CUSTOM_COLOR);
1063   CusColorDecodeString(custom_color_string, custom_color);
1064
1065   if (custom_color[iIndex] == (COLORREF)-1)
1066      return (COLORREF)RGB(0,0,0);
1067
1068   return custom_color[iIndex];
1069}
1070
1071void SetListFont(const LOGFONT *font)
1072{
1073   char font_string[10000];
1074   FontEncodeString(font, font_string);
1075   options_set_string(settings, M32OPTION_LIST_FONT, font_string, OPTION_PRIORITY_CMDLINE);
1076}
1077
1078void GetListFont(LOGFONT *font)
1079{
1080   const char *font_string = options_get_string(settings, M32OPTION_LIST_FONT);
1081   FontDecodeString(font_string, font);
1082}
1083
1084void SetListFontColor(COLORREF uColor)
1085{
1086   options_set_color_default(settings, M32OPTION_TEXT_COLOR, uColor, COLOR_WINDOWTEXT);
1087}
1088
1089COLORREF GetListFontColor(void)
1090{
1091   return options_get_color_default(settings, M32OPTION_TEXT_COLOR, COLOR_WINDOWTEXT);
1092}
1093
1094void SetListCloneColor(COLORREF uColor)
1095{
1096   options_set_color_default(settings, M32OPTION_CLONE_COLOR, uColor, COLOR_WINDOWTEXT);
1097}
1098
1099COLORREF GetListCloneColor(void)
1100{
1101   return options_get_color_default(settings, M32OPTION_CLONE_COLOR, COLOR_WINDOWTEXT);
1102}
1103
1104int GetShowTab(int tab)
1105{
1106   const char *show_tabs_string;
1107   int show_tab_flags;
1108
1109   show_tabs_string = options_get_string(settings, M32OPTION_HIDE_TABS);
1110   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1111   return (show_tab_flags & (1 << tab)) != 0;
1112}
1113
1114void SetShowTab(int tab,BOOL show)
1115{
1116   const char *show_tabs_string;
1117   int show_tab_flags;
1118   char buffer[10000];
1119
1120   show_tabs_string = options_get_string(settings, M32OPTION_HIDE_TABS);
1121   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1122
1123   if (show)
1124      show_tab_flags |= 1 << tab;
1125   else
1126      show_tab_flags &= ~(1 << tab);
1127
1128   TabFlagsEncodeString(show_tab_flags, buffer);
1129   options_set_string(settings, M32OPTION_HIDE_TABS, buffer, OPTION_PRIORITY_CMDLINE);
1130}
1131
1132// don't delete the last one
1133BOOL AllowedToSetShowTab(int tab,BOOL show)
1134{
1135   const char *show_tabs_string;
1136   int show_tab_flags;
1137
1138   if (show == TRUE)
1139      return TRUE;
1140
1141   show_tabs_string = options_get_string(settings, M32OPTION_HIDE_TABS);
1142   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1143
1144   show_tab_flags &= ~(1 << tab);
1145   return show_tab_flags != 0;
1146}
1147
1148int GetHistoryTab(void)
1149{
1150   return options_get_int(settings, M32OPTION_HISTORY_TAB);
1151}
1152
1153void SetHistoryTab(int tab, BOOL show)
1154{
1155   if (show)
1156      options_set_int(settings, M32OPTION_HISTORY_TAB, tab, OPTION_PRIORITY_CMDLINE);
1157   else
1158      options_set_int(settings, M32OPTION_HISTORY_TAB, TAB_NONE, OPTION_PRIORITY_CMDLINE);
1159}
1160
1161void SetColumnWidths(int width[])
1162{
1163   char column_width_string[10000];
1164   ColumnEncodeStringWithCount(width, column_width_string, COLUMN_MAX);
1165   options_set_string(settings, M32OPTION_COLUMN_WIDTHS, column_width_string, OPTION_PRIORITY_CMDLINE);
1166}
1167
1168void GetColumnWidths(int width[])
1169{
1170   const char *column_width_string;
1171   column_width_string = options_get_string(settings, M32OPTION_COLUMN_WIDTHS);
1172   ColumnDecodeStringWithCount(column_width_string, width, COLUMN_MAX);
1173}
1174
1175void SetSplitterPos(int splitterId, int pos)
1176{
1177   const char *splitter_string;
1178   int *splitter;
1179   char buffer[10000];
1180
1181   if (splitterId < GetSplitterCount())
1182   {
1183      splitter_string = options_get_string(settings, M32OPTION_SPLITTERS);
1184      splitter = (int *) alloca(GetSplitterCount() * sizeof(*splitter));
1185      SplitterDecodeString(splitter_string, splitter);
1186
1187      splitter[splitterId] = pos;
1188
1189      SplitterEncodeString(splitter, buffer);
1190      options_set_string(settings, M32OPTION_SPLITTERS, buffer, OPTION_PRIORITY_CMDLINE);
1191   }
1192}
1193
1194int  GetSplitterPos(int splitterId)
1195{
1196   const char *splitter_string;
1197   int *splitter;
1198
1199   splitter_string = options_get_string(settings, M32OPTION_SPLITTERS);
1200   splitter = (int *) alloca(GetSplitterCount() * sizeof(*splitter));
1201   SplitterDecodeString(splitter_string, splitter);
1202
1203   if (splitterId < GetSplitterCount())
1204      return splitter[splitterId];
1205
1206   return -1; /* Error */
1207}
1208
1209void SetColumnOrder(int order[])
1210{
1211   char column_order_string[10000];
1212   ColumnEncodeStringWithCount(order, column_order_string, COLUMN_MAX);
1213   options_set_string(settings, M32OPTION_COLUMN_ORDER, column_order_string, OPTION_PRIORITY_CMDLINE);
1214}
1215
1216void GetColumnOrder(int order[])
1217{
1218   const char *column_order_string;
1219   column_order_string = options_get_string(settings, M32OPTION_COLUMN_ORDER);
1220   ColumnDecodeStringWithCount(column_order_string, order, COLUMN_MAX);
1221}
1222
1223void SetColumnShown(int shown[])
1224{
1225   char column_shown_string[10000];
1226   ColumnEncodeStringWithCount(shown, column_shown_string, COLUMN_MAX);
1227   options_set_string(settings, M32OPTION_COLUMN_SHOWN, column_shown_string, OPTION_PRIORITY_CMDLINE);
1228}
1229
1230void GetColumnShown(int shown[])
1231{
1232   const char *column_shown_string;
1233   column_shown_string = options_get_string(settings, M32OPTION_COLUMN_SHOWN);
1234   ColumnDecodeStringWithCount(column_shown_string, shown, COLUMN_MAX);
1235}
1236
1237void SetSortColumn(int column)
1238{
1239   options_set_int(settings, M32OPTION_SORT_COLUMN, column, OPTION_PRIORITY_CMDLINE);
1240}
1241
1242int GetSortColumn(void)
1243{
1244   return options_get_int(settings, M32OPTION_SORT_COLUMN);
1245}
1246
1247void SetSortReverse(BOOL reverse)
1248{
1249   options_set_bool(settings, M32OPTION_SORT_REVERSED, reverse, OPTION_PRIORITY_CMDLINE);
1250}
1251
1252BOOL GetSortReverse(void)
1253{
1254   return options_get_bool(settings, M32OPTION_SORT_REVERSED);
1255}
1256
1257const char* GetLanguage(void)
1258{
1259   return options_get_string(settings, M32OPTION_LANGUAGE);
1260}
1261
1262void SetLanguage(const char* lang)
1263{
1264   options_set_string(settings, M32OPTION_LANGUAGE, lang, OPTION_PRIORITY_CMDLINE);
1265}
1266
1267const char* GetRomDirs(void)
1268{
1269   return options_get_string(global, OPTION_ROMPATH);
1270}
1271
1272void SetRomDirs(const char* paths)
1273{
1274   options_set_string(global, OPTION_ROMPATH, paths, OPTION_PRIORITY_CMDLINE);
1275}
1276
1277const char* GetSampleDirs(void)
1278{
1279   return options_get_string(global, OPTION_SAMPLEPATH);
1280}
1281
1282void SetSampleDirs(const char* paths)
1283{
1284   options_set_string(global, OPTION_SAMPLEPATH, paths, OPTION_PRIORITY_CMDLINE);
1285}
1286
1287const char * GetIniDir(void)
1288{
1289   const char *ini_dir;
1290   const char *s;
1291
1292   ini_dir = options_get_string(global, OPTION_INIPATH);
1293   while((s = strchr(ini_dir, ';')) != NULL)
1294   {
1295      ini_dir = s + 1;
1296   }
1297   return ini_dir;
1298
1299}
1300
1301void SetIniDir(const char *path)
1302{
1303   options_set_string(global, OPTION_INIPATH, path, OPTION_PRIORITY_CMDLINE);
1304}
1305
1306const char* GetCtrlrDir(void)
1307{
1308   return options_get_string(global, OPTION_CTRLRPATH);
1309}
1310
1311void SetCtrlrDir(const char* path)
1312{
1313   options_set_string(global, OPTION_CTRLRPATH, path, OPTION_PRIORITY_CMDLINE);
1314}
1315
1316const char* GetCommentDir(void)
1317{
1318   return options_get_string(global, OPTION_COMMENT_DIRECTORY);
1319}
1320
1321void SetCommentDir(const char* path)
1322{
1323   options_set_string(global, OPTION_COMMENT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1324}
1325
1326const char* GetCfgDir(void)
1327{
1328   return options_get_string(global, OPTION_CFG_DIRECTORY);
1329}
1330
1331void SetCfgDir(const char* path)
1332{
1333   options_set_string(global, OPTION_CFG_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1334}
1335
1336const char* GetNvramDir(void)
1337{
1338   return options_get_string(global, OPTION_NVRAM_DIRECTORY);
1339}
1340
1341void SetNvramDir(const char* path)
1342{
1343   options_set_string(global, OPTION_NVRAM_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1344}
1345
1346const char* GetInpDir(void)
1347{
1348   return options_get_string(global, OPTION_INPUT_DIRECTORY);
1349}
1350
1351void SetInpDir(const char* path)
1352{
1353   options_set_string(global, OPTION_INPUT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1354}
1355
1356const char* GetImgDir(void)
1357{
1358   return options_get_string(global, OPTION_SNAPSHOT_DIRECTORY);
1359}
1360
1361void SetImgDir(const char* path)
1362{
1363   options_set_string(global, OPTION_SNAPSHOT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1364}
1365
1366const char* GetStateDir(void)
1367{
1368   return options_get_string(global, OPTION_STATE_DIRECTORY);
1369}
1370
1371void SetStateDir(const char* path)
1372{
1373   options_set_string(global, OPTION_STATE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1374}
1375
1376const char* GetArtDir(void)
1377{
1378   return options_get_string(global, OPTION_ARTPATH);
1379}
1380
1381void SetArtDir(const char* path)
1382{
1383   options_set_string(global, OPTION_ARTPATH, path, OPTION_PRIORITY_CMDLINE);
1384}
1385
1386const char* GetMemcardDir(void)
1387{
1388   return options_get_string(global, OPTION_MEMCARD_DIRECTORY);
1389}
1390
1391void SetMemcardDir(const char* path)
1392{
1393   options_set_string(global, OPTION_MEMCARD_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1394}
1395
1396const char* GetFlyerDir(void)
1397{
1398   return options_get_string(settings, M32OPTION_FLYER_DIRECTORY);
1399}
1400
1401void SetFlyerDir(const char* path)
1402{
1403   options_set_string(settings, M32OPTION_FLYER_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1404}
1405
1406const char* GetCabinetDir(void)
1407{
1408   return options_get_string(settings, M32OPTION_CABINET_DIRECTORY);
1409}
1410
1411void SetCabinetDir(const char* path)
1412{
1413   options_set_string(settings, M32OPTION_CABINET_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1414}
1415
1416const char* GetMarqueeDir(void)
1417{
1418   return options_get_string(settings, M32OPTION_MARQUEE_DIRECTORY);
1419}
1420
1421void SetMarqueeDir(const char* path)
1422{
1423   options_set_string(settings, M32OPTION_MARQUEE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1424}
1425
1426const char* GetTitlesDir(void)
1427{
1428   return options_get_string(settings, M32OPTION_TITLE_DIRECTORY);
1429}
1430
1431void SetTitlesDir(const char* path)
1432{
1433   options_set_string(settings, M32OPTION_TITLE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1434}
1435
1436const char * GetControlPanelDir(void)
1437{
1438   return options_get_string(settings, M32OPTION_CPANEL_DIRECTORY);
1439}
1440
1441void SetControlPanelDir(const char *path)
1442{
1443   options_set_string(settings, M32OPTION_CPANEL_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1444}
1445
1446const char * GetPcbDir(void)
1447{
1448   return options_get_string(settings, M32OPTION_PCB_DIRECTORY);
1449}
1450
1451void SetPcbDir(const char *path)
1452{
1453   options_set_string(settings, M32OPTION_PCB_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1454}
1455
1456const char * GetDiffDir(void)
1457{
1458   return options_get_string(global, OPTION_DIFF_DIRECTORY);
1459}
1460
1461void SetDiffDir(const char* path)
1462{
1463   options_set_string(global, OPTION_DIFF_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1464}
1465
1466const char* GetIconsDir(void)
1467{
1468   return options_get_string(settings, M32OPTION_ICONS_DIRECTORY);
1469}
1470
1471void SetIconsDir(const char* path)
1472{
1473   options_set_string(settings, M32OPTION_ICONS_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1474}
1475
1476const char* GetBgDir (void)
1477{
1478   return options_get_string(settings, M32OPTION_BACKGROUND_DIRECTORY);
1479}
1480
1481void SetBgDir (const char* path)
1482{
1483   options_set_string(settings, M32OPTION_BACKGROUND_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1484}
1485
1486const char* GetFolderDir(void)
1487{
1488   return options_get_string(settings, M32OPTION_FOLDER_DIRECTORY);
1489}
1490
1491void SetFolderDir(const char* path)
1492{
1493   options_set_string(settings, M32OPTION_FOLDER_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1494}
1495
1496const char* GetCheatFileName(void)
1497{
1498   return options_get_string(global, OPTION_CHEAT_FILE);
1499}
1500
1501void SetCheatFileName(const char* path)
1502{
1503   options_set_string(global, OPTION_CHEAT_FILE, path, OPTION_PRIORITY_CMDLINE);
1504}
1505
1506const char* GetHistoryFileName(void)
1507{
1508   return options_get_string(settings, M32OPTION_HISTORY_FILE);
1509}
1510
1511void SetHistoryFileName(const char* path)
1512{
1513   options_set_string(settings, M32OPTION_HISTORY_FILE, path, OPTION_PRIORITY_CMDLINE);
1514}
1515
1516
1517const char* GetMAMEInfoFileName(void)
1518{
1519   return options_get_string(settings, M32OPTION_MAMEINFO_FILE);
1520}
1521
1522void SetMAMEInfoFileName(const char* path)
1523{
1524   options_set_string(settings, M32OPTION_MAMEINFO_FILE, path, OPTION_PRIORITY_CMDLINE);
1525}
1526
1527void ResetGameOptions(int driver_index)
1528{
1529   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1530
1531   save_options(OPTIONS_GAME, NULL, driver_index);
1532}
1533
1534void ResetGameDefaults(void)
1535{
1536   // Walk the global settings and reset everything to defaults;
1537   ResetToDefaults(global, OPTION_PRIORITY_CMDLINE);
1538   save_options(OPTIONS_GLOBAL, global, 1);
1539   save_default_options = FALSE;
1540}
1541
1542/*
1543 * Reset all game, vector and source options to defaults.
1544 * No reason to reboot if this is done.
1545 */
1546void ResetAllGameOptions(void)
1547{
1548   int i;
1549
1550   for (i = 0; i < driver_list_get_count(drivers); i++)
1551   {
1552      ResetGameOptions(i);
1553   }
1554
1555   /* Walk the ini/source folder deleting all ini's. */
1556   remove_all_source_options();
1557
1558   /* finally vector.ini */
1559   save_options(OPTIONS_VECTOR, NULL, 0);
1560}
1561
1562static void GetDriverOptionName(int driver_index, const char *option_name, char *buffer, size_t buffer_len)
1563{
1564   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1565   snprintf(buffer, buffer_len, "%s_%s", drivers[driver_index]->name, option_name);
1566}
1567
1568int GetRomAuditResults(int driver_index)
1569{
1570   char buffer[128];
1571   GetDriverOptionName(driver_index, "rom_audit", buffer, ARRAY_LENGTH(buffer));
1572   return options_get_int(settings, buffer);
1573}
1574
1575void SetRomAuditResults(int driver_index, int audit_results)
1576{
1577   char buffer[128];
1578   GetDriverOptionName(driver_index, "rom_audit", buffer, ARRAY_LENGTH(buffer));
1579   options_set_int(settings, buffer, audit_results, OPTION_PRIORITY_CMDLINE);
1580}
1581
1582int  GetSampleAuditResults(int driver_index)
1583{
1584   char buffer[128];
1585   GetDriverOptionName(driver_index, "samples_audit", buffer, ARRAY_LENGTH(buffer));
1586   return options_get_int(settings, buffer);
1587}
1588
1589void SetSampleAuditResults(int driver_index, int audit_results)
1590{
1591   char buffer[128];
1592   GetDriverOptionName(driver_index, "samples_audit", buffer, ARRAY_LENGTH(buffer));
1593   options_set_int(settings, buffer, audit_results, OPTION_PRIORITY_CMDLINE);
1594}
1595
1596static void IncrementPlayVariable(int driver_index, const char *play_variable, int increment)
1597{
1598   char buffer[128];
1599   int count;
1600
1601   GetDriverOptionName(driver_index, play_variable, buffer, ARRAY_LENGTH(buffer));
1602   count = options_get_int(settings, buffer);
1603   options_set_int(settings, buffer, count + increment, OPTION_PRIORITY_CMDLINE);
1604}
1605
1606void IncrementPlayCount(int driver_index)
1607{
1608   IncrementPlayVariable(driver_index, "play_count", 1);
1609}
1610
1611int GetPlayCount(int driver_index)
1612{
1613   char buffer[128];
1614   GetDriverOptionName(driver_index, "play_count", buffer, ARRAY_LENGTH(buffer));
1615   return options_get_int(settings, buffer);
1616}
1617
1618static void ResetPlayVariable(int driver_index, const char *play_variable)
1619{
1620   int i;
1621   if (driver_index < 0)
1622   {
1623      /* all games */
1624      for (i = 0; i< driver_list_get_count(drivers); i++)
1625      {
1626         /* 20070808 MSH - Was passing in driver_index instead of i. Doh! */
1627         ResetPlayVariable(i, play_variable);
1628      }
1629   }
1630   else
1631   {
1632      char buffer[128];
1633      GetDriverOptionName(driver_index, play_variable, buffer, ARRAY_LENGTH(buffer));
1634      options_set_int(settings, buffer, 0, OPTION_PRIORITY_CMDLINE);
1635   }
1636}
1637
1638void ResetPlayCount(int driver_index)
1639{
1640   ResetPlayVariable(driver_index, "play_count");
1641}
1642
1643void ResetPlayTime(int driver_index)
1644{
1645   ResetPlayVariable(driver_index, "play_time");
1646}
1647
1648int GetPlayTime(int driver_index)
1649{
1650   char buffer[128];
1651   GetDriverOptionName(driver_index, "play_time", buffer, ARRAY_LENGTH(buffer));
1652   return options_get_int(settings, buffer);
1653}
1654
1655void IncrementPlayTime(int driver_index,int playtime)
1656{
1657   IncrementPlayVariable(driver_index, "play_time", playtime);
1658}
1659
1660void GetTextPlayTime(int driver_index,char *buf)
1661{
1662   int hour, minute, second;
1663   int temp = GetPlayTime(driver_index);
1664
1665   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1666
1667   hour = temp / 3600;
1668   temp = temp - 3600*hour;
1669   minute = temp / 60; //Calc Minutes
1670   second = temp - 60*minute;
1671
1672   if (hour == 0)
1673      sprintf(buf, "%d:%02d", minute, second );
1674   else
1675      sprintf(buf, "%d:%02d:%02d", hour, minute, second );
1676}
1677
1678input_seq* Get_ui_key_up(void)
1679{
1680   return options_get_input_seq(settings, M32OPTION_UI_KEY_UP);
1681}
1682input_seq* Get_ui_key_down(void)
1683{
1684   return options_get_input_seq(settings, M32OPTION_UI_KEY_DOWN);
1685}
1686input_seq* Get_ui_key_left(void)
1687{
1688   return options_get_input_seq(settings, M32OPTION_UI_KEY_LEFT);
1689}
1690input_seq* Get_ui_key_right(void)
1691{
1692   return options_get_input_seq(settings, M32OPTION_UI_KEY_RIGHT);
1693}
1694input_seq* Get_ui_key_start(void)
1695{
1696   return options_get_input_seq(settings, M32OPTION_UI_KEY_START);
1697}
1698input_seq* Get_ui_key_pgup(void)
1699{
1700   return options_get_input_seq(settings, M32OPTION_UI_KEY_PGUP);
1701}
1702input_seq* Get_ui_key_pgdwn(void)
1703{
1704   return options_get_input_seq(settings, M32OPTION_UI_KEY_PGDWN);
1705}
1706input_seq* Get_ui_key_home(void)
1707{
1708   return options_get_input_seq(settings, M32OPTION_UI_KEY_HOME);
1709}
1710input_seq* Get_ui_key_end(void)
1711{
1712   return options_get_input_seq(settings, M32OPTION_UI_KEY_END);
1713}
1714input_seq* Get_ui_key_ss_change(void)
1715{
1716   return options_get_input_seq(settings, M32OPTION_UI_KEY_SS_CHANGE);
1717}
1718input_seq* Get_ui_key_history_up(void)
1719{
1720   return options_get_input_seq(settings, M32OPTION_UI_KEY_HISTORY_UP);
1721}
1722input_seq* Get_ui_key_history_down(void)
1723{
1724   return options_get_input_seq(settings, M32OPTION_UI_KEY_HISTORY_DOWN);
1725}
1726
1727
1728input_seq* Get_ui_key_context_filters(void)
1729{
1730   return options_get_input_seq(settings, M32OPTION_UI_KEY_CONTEXT_FILTERS);
1731}
1732input_seq* Get_ui_key_select_random(void)
1733{
1734   return options_get_input_seq(settings, M32OPTION_UI_KEY_SELECT_RANDOM);
1735}
1736input_seq* Get_ui_key_game_audit(void)
1737{
1738   return options_get_input_seq(settings, M32OPTION_UI_KEY_GAME_AUDIT);
1739}
1740input_seq* Get_ui_key_game_properties(void)
1741{
1742   return options_get_input_seq(settings, M32OPTION_UI_KEY_GAME_PROPERTIES);
1743}
1744input_seq* Get_ui_key_help_contents(void)
1745{
1746   return options_get_input_seq(settings, M32OPTION_UI_KEY_HELP_CONTENTS);
1747}
1748input_seq* Get_ui_key_update_gamelist(void)
1749{
1750   return options_get_input_seq(settings, M32OPTION_UI_KEY_UPDATE_GAMELIST);
1751}
1752input_seq* Get_ui_key_view_folders(void)
1753{
1754   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_FOLDERS);
1755}
1756input_seq* Get_ui_key_view_fullscreen(void)
1757{
1758   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_FULLSCREEN);
1759}
1760input_seq* Get_ui_key_view_pagetab(void)
1761{
1762   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_PAGETAB);
1763}
1764input_seq* Get_ui_key_view_picture_area(void)
1765{
1766   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_PICTURE_AREA);
1767}
1768input_seq* Get_ui_key_view_status(void)
1769{
1770   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_STATUS);
1771}
1772input_seq* Get_ui_key_view_toolbars(void)
1773{
1774   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TOOLBARS);
1775}
1776
1777input_seq* Get_ui_key_view_tab_cabinet(void)
1778{
1779   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_CABINET);
1780}
1781input_seq* Get_ui_key_view_tab_cpanel(void)
1782{
1783   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_CPANEL);
1784}
1785input_seq* Get_ui_key_view_tab_flyer(void)
1786{
1787   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_FLYER);
1788}
1789input_seq* Get_ui_key_view_tab_history(void)
1790{
1791   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_HISTORY);
1792}
1793input_seq* Get_ui_key_view_tab_marquee(void)
1794{
1795   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_MARQUEE);
1796}
1797input_seq* Get_ui_key_view_tab_screenshot(void)
1798{
1799   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_SCREENSHOT);
1800}
1801input_seq* Get_ui_key_view_tab_title(void)
1802{
1803   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_TITLE);
1804}
1805input_seq* Get_ui_key_view_tab_pcb(void)
1806{
1807   return options_get_input_seq(settings, M32OPTION_UI_KEY_VIEW_TAB_PCB);
1808}
1809input_seq* Get_ui_key_quit(void)
1810{
1811   return options_get_input_seq(settings, M32OPTION_UI_KEY_QUIT);
1812}
1813
1814
1815
1816static int GetUIJoy(const char *option_name, int joycodeIndex)
1817{
1818   const char *joycodes_string;
1819   int joycodes[4];
1820
1821   assert(0 <= joycodeIndex && joycodeIndex < 4);
1822   joycodes_string = options_get_string(settings, option_name);
1823   ColumnDecodeStringWithCount(joycodes_string, joycodes, ARRAY_LENGTH(joycodes));
1824   return joycodes[joycodeIndex];
1825}
1826
1827static void SetUIJoy(const char *option_name, int joycodeIndex, int val)
1828{
1829   const char *joycodes_string;
1830   int joycodes[4];
1831   char buffer[1024];
1832
1833   assert(0 <= joycodeIndex && joycodeIndex < 4);
1834   joycodes_string = options_get_string(settings, option_name);
1835   ColumnDecodeStringWithCount(joycodes_string, joycodes, ARRAY_LENGTH(joycodes));
1836
1837   joycodes[joycodeIndex] = val;
1838   ColumnEncodeStringWithCount(joycodes, buffer, ARRAY_LENGTH(joycodes));
1839   options_set_string(settings, option_name, buffer, OPTION_PRIORITY_CMDLINE);
1840
1841
1842}
1843
1844int GetUIJoyUp(int joycodeIndex)
1845{
1846   return GetUIJoy(M32OPTION_UI_JOY_UP, joycodeIndex);
1847}
1848
1849void SetUIJoyUp(int joycodeIndex, int val)
1850{
1851   SetUIJoy(M32OPTION_UI_JOY_UP, joycodeIndex, val);
1852}
1853
1854int GetUIJoyDown(int joycodeIndex)
1855{
1856   return GetUIJoy(M32OPTION_UI_JOY_DOWN, joycodeIndex);
1857}
1858
1859void SetUIJoyDown(int joycodeIndex, int val)
1860{
1861   SetUIJoy(M32OPTION_UI_JOY_DOWN, joycodeIndex, val);
1862}
1863
1864int GetUIJoyLeft(int joycodeIndex)
1865{
1866   return GetUIJoy(M32OPTION_UI_JOY_LEFT, joycodeIndex);
1867}
1868
1869void SetUIJoyLeft(int joycodeIndex, int val)
1870{
1871   SetUIJoy(M32OPTION_UI_JOY_LEFT, joycodeIndex, val);
1872}
1873
1874int GetUIJoyRight(int joycodeIndex)
1875{
1876   return GetUIJoy(M32OPTION_UI_JOY_RIGHT, joycodeIndex);
1877}
1878
1879void SetUIJoyRight(int joycodeIndex, int val)
1880{
1881   SetUIJoy(M32OPTION_UI_JOY_RIGHT, joycodeIndex, val);
1882}
1883
1884int GetUIJoyStart(int joycodeIndex)
1885{
1886   return GetUIJoy(M32OPTION_UI_JOY_START, joycodeIndex);
1887}
1888
1889void SetUIJoyStart(int joycodeIndex, int val)
1890{
1891   SetUIJoy(M32OPTION_UI_JOY_START, joycodeIndex, val);
1892}
1893
1894int GetUIJoyPageUp(int joycodeIndex)
1895{
1896   return GetUIJoy(M32OPTION_UI_JOY_PGUP, joycodeIndex);
1897}
1898
1899void SetUIJoyPageUp(int joycodeIndex, int val)
1900{
1901   SetUIJoy(M32OPTION_UI_JOY_PGUP, joycodeIndex, val);
1902}
1903
1904int GetUIJoyPageDown(int joycodeIndex)
1905{
1906   return GetUIJoy(M32OPTION_UI_JOY_PGDWN, joycodeIndex);
1907}
1908
1909void SetUIJoyPageDown(int joycodeIndex, int val)
1910{
1911   SetUIJoy(M32OPTION_UI_JOY_PGDWN, joycodeIndex, val);
1912}
1913
1914int GetUIJoyHome(int joycodeIndex)
1915{
1916   return GetUIJoy(M32OPTION_UI_JOY_HOME, joycodeIndex);
1917}
1918
1919void SetUIJoyHome(int joycodeIndex, int val)
1920{
1921   SetUIJoy(M32OPTION_UI_JOY_HOME, joycodeIndex, val);
1922}
1923
1924int GetUIJoyEnd(int joycodeIndex)
1925{
1926   return GetUIJoy(M32OPTION_UI_JOY_END, joycodeIndex);
1927}
1928
1929void SetUIJoyEnd(int joycodeIndex, int val)
1930{
1931   SetUIJoy(M32OPTION_UI_JOY_END, joycodeIndex, val);
1932}
1933
1934int GetUIJoySSChange(int joycodeIndex)
1935{
1936   return GetUIJoy(M32OPTION_UI_JOY_SS_CHANGE, joycodeIndex);
1937}
1938
1939void SetUIJoySSChange(int joycodeIndex, int val)
1940{
1941   SetUIJoy(M32OPTION_UI_JOY_SS_CHANGE, joycodeIndex, val);
1942}
1943
1944int GetUIJoyHistoryUp(int joycodeIndex)
1945{
1946   return GetUIJoy(M32OPTION_UI_JOY_HISTORY_UP, joycodeIndex);
1947}
1948
1949void SetUIJoyHistoryUp(int joycodeIndex, int val)
1950{
1951   SetUIJoy(M32OPTION_UI_JOY_HISTORY_UP, joycodeIndex, val);
1952}
1953
1954int GetUIJoyHistoryDown(int joycodeIndex)
1955{
1956   return GetUIJoy(M32OPTION_UI_JOY_HISTORY_DOWN, joycodeIndex);
1957}
1958
1959void SetUIJoyHistoryDown(int joycodeIndex, int val)
1960{
1961   SetUIJoy(M32OPTION_UI_JOY_HISTORY_DOWN, joycodeIndex, val);
1962}
1963
1964void SetUIJoyExec(int joycodeIndex, int val)
1965{
1966   SetUIJoy(M32OPTION_UI_JOY_EXEC, joycodeIndex, val);
1967}
1968
1969int GetUIJoyExec(int joycodeIndex)
1970{
1971   return GetUIJoy(M32OPTION_UI_JOY_EXEC, joycodeIndex);
1972}
1973
1974const char * GetExecCommand(void)
1975{
1976   return options_get_string(settings, M32OPTION_EXEC_COMMAND);
1977}
1978
1979void SetExecCommand(char *cmd)
1980{
1981   options_set_string(settings, M32OPTION_EXEC_COMMAND, cmd, OPTION_PRIORITY_CMDLINE);
1982}
1983
1984int GetExecWait(void)
1985{
1986   return options_get_int(settings, M32OPTION_EXEC_WAIT);
1987}
1988
1989void SetExecWait(int wait)
1990{
1991   options_set_int(settings, M32OPTION_EXEC_WAIT, wait, OPTION_PRIORITY_CMDLINE);
1992}
1993
1994BOOL GetHideMouseOnStartup(void)
1995{
1996   return options_get_bool(settings, M32OPTION_HIDE_MOUSE);
1997}
1998
1999void SetHideMouseOnStartup(BOOL hide)
2000{
2001   options_set_bool(settings, M32OPTION_HIDE_MOUSE, hide, OPTION_PRIORITY_CMDLINE);
2002}
2003
2004BOOL GetRunFullScreen(void)
2005{
2006   return options_get_bool(settings, M32OPTION_FULL_SCREEN);
2007}
2008
2009void SetRunFullScreen(BOOL fullScreen)
2010{
2011   options_set_bool(settings, M32OPTION_FULL_SCREEN, fullScreen, OPTION_PRIORITY_CMDLINE);
2012}
2013
2014/***************************************************************************
2015    Internal functions
2016 ***************************************************************************/
2017
2018static void  CusColorEncodeString(const COLORREF *value, char* str)
2019{
2020   int  i;
2021   char tmpStr[256];
2022
2023   sprintf(tmpStr, "%u", (int) value[0]);
2024
2025   strcpy(str, tmpStr);
2026
2027   for (i = 1; i < 16; i++)
2028   {
2029      sprintf(tmpStr, ",%u", (unsigned) value[i]);
2030      strcat(str, tmpStr);
2031   }
2032}
2033
2034static void CusColorDecodeString(const char* str, COLORREF *value)
2035{
2036   int  i;
2037   char *s, *p;
2038   char tmpStr[256];
2039
2040   strcpy(tmpStr, str);
2041   p = tmpStr;
2042
2043   for (i = 0; p && i < 16; i++)
2044   {
2045      s = p;
2046
2047      if ((p = strchr(s,',')) != NULL && *p == ',')
2048      {
2049         *p = '\0';
2050         p++;
2051      }
2052      value[i] = atoi(s);
2053   }
2054}
2055
2056
2057void ColumnEncodeStringWithCount(const int *value, char *str, int count)
2058{
2059   int  i;
2060   char buffer[100];
2061
2062   snprintf(buffer,sizeof(buffer),"%d",value[0]);
2063
2064   strcpy(str,buffer);
2065
2066    for (i = 1; i < count; i++)
2067   {
2068      snprintf(buffer,sizeof(buffer),",%d",value[i]);
2069      strcat(str,buffer);
2070   }
2071}
2072
2073void ColumnDecodeStringWithCount(const char* str, int *value, int count)
2074{
2075   int  i;
2076   char *s, *p;
2077   char tmpStr[100];
2078
2079   if (str == NULL)
2080      return;
2081
2082   strcpy(tmpStr, str);
2083   p = tmpStr;
2084
2085    for (i = 0; p && i < count; i++)
2086   {
2087      s = p;
2088
2089      if ((p = strchr(s,',')) != NULL && *p == ',')
2090      {
2091         *p = '\0';
2092         p++;
2093      }
2094      value[i] = atoi(s);
2095    }
2096   }
2097
2098static void SplitterEncodeString(const int *value, char* str)
2099{
2100   int  i;
2101   char tmpStr[100];
2102
2103   sprintf(tmpStr, "%d", value[0]);
2104
2105   strcpy(str, tmpStr);
2106
2107   for (i = 1; i < GetSplitterCount(); i++)
2108   {
2109      sprintf(tmpStr, ",%d", value[i]);
2110      strcat(str, tmpStr);
2111   }
2112}
2113
2114static void SplitterDecodeString(const char *str, int *value)
2115{
2116   int  i;
2117   char *s, *p;
2118   char tmpStr[100];
2119
2120   strcpy(tmpStr, str);
2121   p = tmpStr;
2122
2123   for (i = 0; p && i < GetSplitterCount(); i++)
2124   {
2125      s = p;
2126
2127      if ((p = strchr(s,',')) != NULL && *p == ',')
2128      {
2129         *p = '\0';
2130         p++;
2131      }
2132      value[i] = atoi(s);
2133   }
2134}
2135
2136/* Parse the given comma-delimited string into a LOGFONT structure */
2137static void FontDecodeString(const char* str, LOGFONT *f)
2138{
2139   char*    ptr;
2140   TCHAR*     t_ptr;
2141
2142   sscanf(str, "%li,%li,%li,%li,%li,%i,%i,%i,%i,%i,%i,%i,%i",
2143         &f->lfHeight,
2144         &f->lfWidth,
2145         &f->lfEscapement,
2146         &f->lfOrientation,
2147         &f->lfWeight,
2148         (int*)&f->lfItalic,
2149         (int*)&f->lfUnderline,
2150         (int*)&f->lfStrikeOut,
2151         (int*)&f->lfCharSet,
2152         (int*)&f->lfOutPrecision,
2153         (int*)&f->lfClipPrecision,
2154         (int*)&f->lfQuality,
2155         (int*)&f->lfPitchAndFamily);
2156   ptr = strrchr(str, ',');
2157   if (ptr != NULL) {
2158      t_ptr = tstring_from_utf8(ptr + 1);
2159      if( !t_ptr )
2160         return;
2161      _tcscpy(f->lfFaceName, t_ptr);
2162      free(t_ptr);
2163   }
2164}
2165
2166/* Encode the given LOGFONT structure into a comma-delimited string */
2167static void FontEncodeString(const LOGFONT *f, char *str)
2168{
2169   char* utf8_FaceName = utf8_from_tstring(f->lfFaceName);
2170   if( !utf8_FaceName )
2171      return;
2172
2173   sprintf(str, "%li,%li,%li,%li,%li,%i,%i,%i,%i,%i,%i,%i,%i,%s",
2174         f->lfHeight,
2175         f->lfWidth,
2176         f->lfEscapement,
2177         f->lfOrientation,
2178         f->lfWeight,
2179         f->lfItalic,
2180         f->lfUnderline,
2181         f->lfStrikeOut,
2182         f->lfCharSet,
2183         f->lfOutPrecision,
2184         f->lfClipPrecision,
2185         f->lfQuality,
2186         f->lfPitchAndFamily,
2187         utf8_FaceName);
2188
2189   free(utf8_FaceName);
2190}
2191
2192static void TabFlagsEncodeString(int data, char *str)
2193{
2194   int i;
2195   int num_saved = 0;
2196
2197   strcpy(str,"");
2198
2199   // we save the ones that are NOT displayed, so we can add new ones
2200   // and upgraders will see them
2201   for (i=0;i<MAX_TAB_TYPES;i++)
2202   {
2203      if (((data & (1 << i)) == 0) && GetImageTabShortName(i))
2204      {
2205         if (num_saved != 0)
2206            strcat(str, ", ");
2207
2208         strcat(str,GetImageTabShortName(i));
2209         num_saved++;
2210      }
2211   }
2212}
2213
2214static void TabFlagsDecodeString(const char *str, int *data)
2215{
2216   char s[2000];
2217   char *token;
2218
2219   snprintf(s, ARRAY_LENGTH(s), "%s", str);
2220
2221   // simple way to set all tab bits "on"
2222   *data = (1 << MAX_TAB_TYPES) - 1;
2223
2224   token = strtok(s,", \t");
2225   while (token != NULL)
2226   {
2227      int j;
2228
2229      for (j=0;j<MAX_TAB_TYPES;j++)
2230      {
2231         if (!GetImageTabShortName(j) || (strcmp(GetImageTabShortName(j), token) == 0))
2232         {
2233            // turn off this bit
2234            *data &= ~(1 << j);
2235            break;
2236         }
2237      }
2238      token = strtok(NULL,", \t");
2239   }
2240
2241   if (*data == 0)
2242   {
2243      // not allowed to hide all tabs, because then why even show the area?
2244      *data = (1 << TAB_SCREENSHOT);
2245   }
2246}
2247
2248static file_error LoadSettingsFile(core_options *opts, const char *filename)
2249{
2250   core_file *file;
2251   file_error filerr;
2252
2253   filerr = core_fopen(filename, OPEN_FLAG_READ, &file);
2254   if (filerr == FILERR_NONE)
2255   {
2256      options_parse_ini_file(opts, file, OPTION_PRIORITY_CMDLINE);
2257      core_fclose(file);
2258   }
2259   return filerr;
2260}
2261
2262
2263static file_error SaveSettingsFile(core_options *opts, core_options *baseopts, const char *filename)
2264{
2265   core_file *file;
2266   file_error filerr;
2267
2268   if ((opts != NULL) && ((baseopts == NULL) || !options_equal(opts, baseopts)))
2269   {
2270      filerr = core_fopen(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
2271      if (filerr == FILERR_NONE)
2272      {
2273         options_output_diff_ini_file(opts, baseopts, file);
2274         core_fclose(file);
2275      }
2276   }
2277   else
2278   {
2279      filerr = osd_rmfile(filename);
2280   }
2281
2282   return filerr;
2283}
2284
2285
2286
2287static void GetGlobalOptionsFileName(char *filename, size_t filename_size)
2288{
2289   // copy INI directory
2290   snprintf(filename, filename_size, "%s\\%s.ini", GetIniDir(), CONFIGNAME);
2291}
2292
2293/* Register access functions below */
2294static void LoadOptionsAndSettings(void)
2295{
2296   char buffer[MAX_PATH];
2297
2298   // parse MAME32ui.ini - always in the current directory.
2299   LoadSettingsFile(settings, UI_INI_FILENAME);
2300
2301   // parse global options ini/mame32.ini
2302   GetGlobalOptionsFileName(buffer, ARRAY_LENGTH(buffer));
2303   LoadSettingsFile(global, buffer);
2304}
2305
2306const char * GetFolderNameByID(UINT nID)
2307{
2308   UINT i;
2309   extern FOLDERDATA g_folderData[];
2310   extern LPEXFOLDERDATA ExtraFolderData[];
2311
2312   for (i = 0; i < MAX_EXTRA_FOLDERS * MAX_EXTRA_SUBFOLDERS; i++)
2313   {
2314      if( ExtraFolderData[i] )
2315      {
2316         if (ExtraFolderData[i]->m_nFolderId == nID)
2317         {
2318            return ExtraFolderData[i]->m_szTitle;
2319         }
2320      }
2321   }
2322   for( i = 0; i < MAX_FOLDERS; i++)
2323   {
2324      if (g_folderData[i].m_nFolderId == nID)
2325      {
2326
2327         return g_folderData[i].m_lpTitle;
2328      }
2329   }
2330   return NULL;
2331}
2332
2333
2334DWORD GetFolderFlags(int folder_index)
2335{
2336   LPTREEFOLDER lpFolder = GetFolder(folder_index);
2337
2338   if (lpFolder)
2339      return lpFolder->m_dwFlags & F_MASK;
2340
2341   return 0;
2342#if 0
2343   int i;
2344
2345   for (i=0;i<num_folder_filters;i++)
2346   {
2347      if (folder_filters[i].folder_index == folder_index)
2348      {
2349         //dprintf("found folder filter %i %i",folder_index,folder_filters[i].filters);
2350         return folder_filters[i].filters;
2351      }
2352   }
2353   return 0;
2354#endif
2355}
2356
2357
2358/* Decode the flags into a DWORD */
2359static DWORD DecodeFolderFlags(const char *buf)
2360{
2361   DWORD flags = 0;
2362   int shift = 0;
2363   const char *ptr = buf;
2364
2365   while (*ptr && (1 << shift) & F_MASK)
2366   {
2367      if (*ptr++ == '1')
2368      {
2369         flags |= (1 << shift);
2370      }
2371      shift++;
2372   }
2373   return flags;
2374}
2375
2376/* Encode the flags into a string */
2377static const char * EncodeFolderFlags(DWORD value)
2378{
2379   static char buf[40];
2380   int shift = 0;
2381
2382   memset(buf,'\0', sizeof(buf));
2383
2384   while ((1 << shift) & F_MASK) {
2385      buf[shift] = (value & (1 << shift)) ? '1' : '0';
2386      shift++;
2387   }
2388
2389   return buf;
2390}
2391
2392/* MSH 20080813
2393 * Read the folder filters from MAME32ui.ini.  This must only
2394 * be called AFTER the folders have all been created.
2395 */
2396void LoadFolderFlags(void)
2397{
2398   core_options *opts;
2399   int numFolders;
2400   LPTREEFOLDER lpFolder;
2401   int i;
2402   options_entry entries[2];
2403
2404   memcpy(entries, filterOptions, sizeof(filterOptions));
2405
2406   opts = options_create(memory_error);
2407
2408   if (NULL == opts)
2409   {
2410      return;
2411   }
2412
2413   numFolders = GetNumFolders();
2414
2415   for (i = 0; i < numFolders; i++)
2416   {
2417      lpFolder = GetFolder(i);
2418
2419      if (lpFolder)
2420      {
2421         char folder_name[80];
2422         char *ptr;
2423         astring *option_name;
2424
2425         // Convert spaces to underscores
2426         strcpy(folder_name, lpFolder->m_lpTitle);
2427         ptr = folder_name;
2428         while (*ptr && *ptr != '\0')
2429         {
2430            if (*ptr == ' ')
2431            {
2432               *ptr = '_';
2433            }
2434            ptr++;
2435         }
2436
2437         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters");
2438         // create entry
2439         entries[0].name = astring_c(option_name);
2440         options_add_entries(opts, entries);
2441         astring_free(option_name);
2442      }
2443   }
2444
2445   // These are overlayed at the end of our UI ini
2446   // The normal read will skip them.
2447    LoadSettingsFile(opts, UI_INI_FILENAME);
2448
2449   // retrive the stored values
2450   for (i = 0; i < numFolders; i++)
2451   {
2452      lpFolder = GetFolder(i);
2453
2454      if (lpFolder)
2455      {
2456         char folder_name[80];
2457         char *ptr;
2458         astring *option_name;
2459         const char *value;
2460
2461         // Convert spaces to underscores
2462         strcpy(folder_name, lpFolder->m_lpTitle);
2463         ptr = folder_name;
2464         while (*ptr && *ptr != '\0')
2465         {
2466            if (*ptr == ' ')
2467            {
2468               *ptr = '_';
2469            }
2470            ptr++;
2471         }
2472         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters" );
2473         // get entry and decode it
2474         value = options_get_string(opts, astring_c(option_name));
2475         astring_free(option_name);
2476
2477         if (value)
2478         {
2479            lpFolder->m_dwFlags |= DecodeFolderFlags(value) & F_MASK;
2480         }
2481      }
2482   }
2483   // fee the options
2484   options_free(opts);
2485}
2486
2487
2488
2489// Copy options, if entry doesn't exist in the dest, create it.
2490static void copy_options_ex(core_options *pDestOpts, core_options *pSourceOpts)
2491{
2492   options_enumerator *enumerator;
2493   const char *option_name;
2494   const char *option_value;
2495   options_entry entries[2];
2496
2497   memcpy(entries, filterOptions, sizeof(filterOptions));
2498
2499   enumerator = options_enumerator_begin(pSourceOpts);
2500
2501   if (enumerator != NULL)
2502   {
2503      while((option_name = options_enumerator_next(enumerator)) != NULL)
2504      {
2505         option_value = options_get_string(pSourceOpts, option_name);
2506         {
2507            const char *existing = options_get_string(pDestOpts, option_name);
2508            if (NULL == existing || *existing == '\0')
2509            {
2510               entries[0].name = option_name;
2511               // create entry
2512               options_add_entries(pDestOpts, entries);
2513            }
2514            if (strcmp(option_value, existing) != 0)
2515               options_set_string(pDestOpts, option_name, option_value, OPTION_PRIORITY_CMDLINE);
2516         }
2517      }
2518      options_enumerator_free(enumerator);
2519   }
2520}
2521
2522// Adds our folder flags to a temporarty core_options, for saving.
2523static core_options * AddFolderFlags(core_options *settings)
2524{
2525   core_options *opts;
2526   int numFolders;
2527   int i;
2528   LPTREEFOLDER lpFolder;
2529   int num_entries = 0;
2530   options_entry entries[2];
2531
2532   opts = options_create(memory_error);
2533
2534   if (NULL == opts)
2535   {
2536      return NULL;
2537   }
2538
2539   options_add_entries(opts, regSettings);
2540   copy_options_ex(opts, settings);
2541
2542   memcpy(entries, filterOptions, sizeof(filterOptions));
2543   entries[0].name = NULL;
2544   entries[0].defvalue = NULL;
2545   entries[0].flags = OPTION_HEADER;
2546   entries[0].description = "FOLDER FILTERS";
2547   options_add_entries(opts, entries);
2548
2549   memcpy(entries, filterOptions, sizeof(filterOptions));
2550
2551   numFolders = GetNumFolders();
2552
2553   for (i = 0; i < numFolders; i++)
2554   {
2555      lpFolder = GetFolder(i);
2556      if (lpFolder && (lpFolder->m_dwFlags & F_MASK) != 0)
2557      {
2558         char folder_name[80];
2559         char *ptr;
2560         astring *option_name;
2561
2562         // Convert spaces to underscores
2563         strcpy(folder_name, lpFolder->m_lpTitle);
2564         ptr = folder_name;
2565         while (*ptr && *ptr != '\0')
2566         {
2567            if (*ptr == ' ')
2568            {
2569               *ptr = '_';
2570            }
2571            ptr++;
2572         }
2573
2574         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters" );
2575
2576         // create entry
2577         entries[0].name = astring_c(option_name);
2578         options_add_entries(opts, entries);
2579
2580         // store entry
2581            options_set_string(opts, astring_c(option_name), EncodeFolderFlags(lpFolder->m_dwFlags), OPTION_PRIORITY_CMDLINE);
2582         astring_free(option_name);
2583
2584         // increment counter
2585         num_entries++;
2586      }
2587   }
2588   if (num_entries == 0) {
2589      options_free(opts);
2590      opts = NULL;
2591   }
2592   return opts;
2593}
2594
2595// Save the UI ini
2596void SaveOptions(void)
2597{
2598   if (save_gui_settings)
2599   {
2600      // Add the folder flag to settings.
2601      core_options *opts = AddFolderFlags(settings);
2602      // Save opts if it is non-null, else save settings.
2603      // It will be null if there are no filters set.
2604      SaveSettingsFile((opts == NULL) ? settings : opts, NULL, UI_INI_FILENAME);
2605      // Free up the opts allocated by AddFolderFlags.
2606      if (opts)
2607      {
2608         options_free(opts);
2609      }
2610   }
2611}
2612
2613
2614void SaveDefaultOptions(void)
2615{
2616   char buffer[MAX_PATH];
2617   GetGlobalOptionsFileName(buffer, ARRAY_LENGTH(buffer));
2618   SaveSettingsFile(global, NULL, buffer);
2619}
2620
2621char * GetVersionString(void)
2622{
2623   return build_version;
2624}
2625
2626
2627BOOL IsGlobalOption(const char *option_name)
2628{
2629   static const char *global_options[] =
2630   {
2631      OPTION_ROMPATH,
2632#ifdef MESS
2633      OPTION_HASHPATH,
2634#endif // MESS
2635      OPTION_SAMPLEPATH,
2636      OPTION_ARTPATH,
2637      OPTION_CTRLRPATH,
2638      OPTION_INIPATH,
2639      OPTION_FONTPATH,
2640      OPTION_CFG_DIRECTORY,
2641      OPTION_NVRAM_DIRECTORY,
2642      OPTION_MEMCARD_DIRECTORY,
2643      OPTION_INPUT_DIRECTORY,
2644      OPTION_STATE_DIRECTORY,
2645      OPTION_SNAPSHOT_DIRECTORY,
2646      OPTION_DIFF_DIRECTORY,
2647      OPTION_COMMENT_DIRECTORY
2648   };
2649   int i;
2650   char command_name[128];
2651   char *s;
2652
2653   // determine command name
2654   snprintf(command_name, ARRAY_LENGTH(command_name), "%s", option_name);
2655   s = strchr(command_name, ';');
2656   if (s)
2657      *s = '\0';
2658
2659   for (i = 0; i < ARRAY_LENGTH(global_options); i++)
2660   {
2661      if (!strcmp(command_name, global_options[i]))
2662         return TRUE;
2663   }
2664   return FALSE;
2665}
2666
2667
2668/* ui_parse_ini_file - parse a single INI file */
2669static void ui_parse_ini_file(core_options *opts, const char *name)
2670{
2671   astring *fname;
2672
2673   /* open the file; if we fail, that's ok */
2674   fname = astring_assemble_4(astring_alloc(), GetIniDir(), PATH_SEPARATOR, name, ".ini");
2675   LoadSettingsFile(opts, astring_c(fname));
2676   astring_free(fname);
2677}
2678
2679
2680/*  get options, based on passed in option level. */
2681core_options * load_options(OPTIONS_TYPE opt_type, int game_num)
2682{
2683   core_options *opts;
2684   const game_driver *driver = NULL;
2685
2686   opts = CreateGameOptions(game_num);
2687
2688   if (opts == NULL)
2689   {
2690      return NULL;
2691   }
2692
2693   /* Copy over the defaults */
2694   options_copy(opts, global);
2695
2696   if (opt_type == OPTIONS_GLOBAL)
2697   {
2698      return opts;
2699   }
2700
2701   /* debug builds: parse "debug.ini" as well */
2702#ifdef MAME_DEBUG
2703   ui_parse_ini_file(opts, "debug");
2704#endif
2705   if (game_num >= 0)
2706   {
2707      driver = drivers[game_num];
2708   }
2709
2710   /* if we have a valid game driver, parse game-specific INI files */
2711   if (driver != NULL)
2712   {
2713      const game_driver *parent = driver_get_clone(driver);
2714      const game_driver *gparent = (parent != NULL) ? driver_get_clone(parent) : NULL;
2715      astring *basename;
2716      astring *srcname;
2717      machine_config drv;
2718
2719      /* expand the machine driver to look at the info */
2720      expand_machine_driver(driver->drv, &drv);
2721
2722      /* parse "vector.ini" for vector games */
2723      if (drv.video_attributes & VIDEO_TYPE_VECTOR)
2724         ui_parse_ini_file(opts, "vector");
2725
2726      if (opt_type == OPTIONS_VECTOR)
2727      {
2728         return opts;
2729      }
2730
2731      /* then parse "<sourcefile>.ini" */
2732      basename = core_filename_extract_base(astring_alloc(), driver->source_file, TRUE);
2733      srcname = astring_assemble_3(astring_alloc(), "source", PATH_SEPARATOR, astring_c(basename));
2734      ui_parse_ini_file(opts, astring_c(srcname));
2735      astring_free(srcname);
2736      astring_free(basename);
2737
2738      if (opt_type == OPTIONS_SOURCE)
2739      {
2740         return opts;
2741      }
2742
2743      /* then parent the grandparent, parent, and game-specific INIs */
2744      if (gparent != NULL)
2745         ui_parse_ini_file(opts, gparent->name);
2746      if (parent != NULL)
2747         ui_parse_ini_file(opts, parent->name);
2748
2749      if (opt_type == OPTIONS_PARENT)
2750      {
2751         return opts;
2752      }
2753
2754      ui_parse_ini_file(opts, driver->name);
2755
2756      if (opt_type == OPTIONS_GAME)
2757      {
2758         return opts;
2759      }
2760   }
2761   options_free(opts);
2762   return NULL;
2763}
2764
2765
2766
2767/*
2768 * Save ini file based on game_num and passed in opt_type.  If opts are
2769 * NULL, the ini wiil be removed.
2770 *
2771 * game_num must be valid or the driver cannot be expanded and anything
2772 * with a higher priority than OPTIONS_VECTOR will not be saved.
2773 */
2774void save_options(OPTIONS_TYPE opt_type, core_options *opts, int game_num)
2775{
2776   core_options *baseopts = NULL;
2777   const game_driver *driver = NULL;
2778   astring *filename = NULL;
2779
2780   if (OPTIONS_GLOBAL != opt_type && NULL != opts && !options_equal(opts, global))
2781   {
2782      baseopts = load_options(opt_type - 1, game_num);
2783   }
2784
2785   if (game_num >= 0)
2786   {
2787      driver = drivers[game_num];
2788   }
2789
2790   if (opt_type == OPTIONS_GLOBAL)
2791   {
2792      /* Don't try to save a null global options file,  or it will be erased. */
2793      if (NULL == opts)
2794         return;
2795      options_copy(global, opts);
2796      filename = astring_cpyc(astring_alloc(), CONFIGNAME);
2797   } else if (opt_type == OPTIONS_VECTOR)
2798   {
2799      filename = astring_cpyc(astring_alloc(), "vector");
2800   } else if (driver != NULL)
2801   {
2802      astring *basename, *srcname;
2803      machine_config drv;
2804
2805      /* expand the machine driver to look at the info */
2806      expand_machine_driver(driver->drv, &drv);
2807
2808      switch (opt_type)
2809      {
2810      case OPTIONS_SOURCE:
2811         /* determine the <sourcefile> */
2812         basename = core_filename_extract_base(astring_alloc(), driver->source_file, TRUE);
2813         srcname = astring_assemble_3(astring_alloc(), "source", PATH_SEPARATOR, astring_c(basename));
2814         filename = astring_cpyc(astring_alloc(),astring_c(srcname));
2815         astring_free(srcname);
2816         astring_free(basename);
2817         break;
2818      case OPTIONS_GAME:
2819         filename = astring_cpyc(astring_alloc(), driver->name);
2820         break;
2821      default:
2822         break;
2823      }
2824   }
2825   if (filename != NULL)
2826   {
2827      astring *filepath = NULL;
2828      filepath = astring_assemble_4(astring_alloc(), GetIniDir(), PATH_SEPARATOR, astring_c(filename), ".ini");
2829      astring_free(filename);
2830
2831      SaveSettingsFile(opts, baseopts, astring_c(filepath));
2832      astring_free(filepath);
2833   }
2834   if (baseopts != NULL)
2835   {
2836      options_free(baseopts);
2837   }
2838}
2839
2840/* Remove all the srcname.ini files from inipath/source directory. */
2841static void remove_all_source_options(void) {
2842   WIN32_FIND_DATA findFileData;
2843   HANDLE hFindFile;
2844   astring *pathname, *match;
2845   char* utf8_filename;
2846
2847   /*
2848    * Easiest to just open the ini/source folder if it exists,
2849    * then remove all the files in it that end in ini.
2850    */
2851   pathname = astring_assemble_3(astring_alloc(), GetIniDir(), PATH_SEPARATOR, "source");
2852   match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, "*.ini");
2853   if ((hFindFile = win_find_first_file_utf8(astring_c(match), &findFileData)) != INVALID_HANDLE_VALUE)
2854   {
2855      astring_free(match);
2856      utf8_filename = utf8_from_tstring(findFileData.cFileName);
2857      match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename );
2858      free(utf8_filename);
2859      osd_rmfile(astring_c(match));
2860      astring_free(match);
2861
2862      while (0 != FindNextFile(hFindFile, &findFileData))
2863      {
2864         utf8_filename = utf8_from_tstring(findFileData.cFileName);
2865         match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename );
2866         free(utf8_filename);
2867         osd_rmfile(astring_c(match));
2868         astring_free(match);
2869      }
2870
2871      FindClose(hFindFile);
2872
2873   }
2874   else
2875   {
2876      astring_free(match);
2877   }
2878   astring_free(pathname);
2879
2880}
2881
2882// Reset the given core_options to their default settings.
2883static void ResetToDefaults(core_options *opts, int priority)
2884{
2885   // iterate through the options setting each one back to the default value.
2886   options_revert(opts, priority);
2887}
2888
2889
2890
src/osd/winui/audit32.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12 
13 /***************************************************************************
14
15  audit32.c
16
17  Audit dialog
18
19***************************************************************************/
20
21#define WIN32_LEAN_AND_MEAN
22#include <windows.h>
23#include <windowsx.h>
24#include <commctrl.h>
25#include <stdio.h>
26#include <richedit.h>
27#include <tchar.h>
28
29#include "screenshot.h"
30#include "win32ui.h"
31#include "winutf8.h"
32
33#include <audit.h>
34#include <unzip.h>
35
36#include "resource.h"
37
38#include "bitmask.h"
39#include "m32opts.h"
40#include "m32util.h"
41#include "audit32.h"
42#include "properties.h"
43#include "emuopts.h"
44#include "winmain.h"
45#include "strconv.h"
46
47#ifdef _MSC_VER
48#define vsnprintf _vsnprintf
49#endif
50
51/***************************************************************************
52    function prototypes
53 ***************************************************************************/
54
55static DWORD WINAPI AuditThreadProc(LPVOID hDlg);
56static INT_PTR CALLBACK AuditWindowProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
57static void ProcessNextRom(void);
58static void ProcessNextSample(void);
59static void CLIB_DECL DetailsPrintf(const char *fmt, ...);
60static const char * StatusString(int iStatus);
61
62/***************************************************************************
63    Internal variables
64 ***************************************************************************/
65
66#define SAMPLES_NOT_USED    3
67#define MAX_AUDITBOX_TEXT   0x7FFFFFFE
68
69HWND hAudit;
70static int rom_index;
71static int roms_correct;
72static int roms_incorrect;
73static int sample_index;
74static int samples_correct;
75static int samples_incorrect;
76
77static BOOL bPaused = FALSE;
78static BOOL bCancel = FALSE;
79
80/***************************************************************************
81    External functions 
82 ***************************************************************************/
83
84void AuditDialog(HWND hParent)
85{
86   HMODULE hModule = NULL;
87   rom_index         = 0;
88   roms_correct      = 0;
89   roms_incorrect    = 0;
90   sample_index      = 0;
91   samples_correct   = 0;
92   samples_incorrect = 0;
93
94   //RS use Riched32.dll
95   hModule = LoadLibrary(TEXT("Riched32.dll"));
96   if( hModule )
97   {
98      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_AUDIT),hParent,AuditWindowProc);
99      FreeLibrary( hModule );
100      hModule = NULL;
101   }
102   else
103   {
104       MessageBox(GetMainWindow(),TEXT("Unable to Load Riched32.dll"),TEXT("Error"),
105               MB_OK | MB_ICONERROR);
106   }
107}
108
109void InitGameAudit(int gameIndex)
110{
111   rom_index = gameIndex;
112}
113
114const char * GetAuditString(int audit_result)
115{
116   switch (audit_result)
117   {
118   case CORRECT :
119   case BEST_AVAILABLE :
120      return "Yes";
121
122   case NOTFOUND :
123   case INCORRECT :
124      return "No";
125      break;
126
127   case UNKNOWN :
128      return "?";
129
130   default:
131      dprintf("unknown audit value %i",audit_result);
132   }
133
134   return "?";
135}
136
137BOOL IsAuditResultKnown(int audit_result)
138{
139   return audit_result != UNKNOWN;
140}
141
142BOOL IsAuditResultYes(int audit_result)
143{
144   return audit_result == CORRECT || audit_result == BEST_AVAILABLE;
145}
146
147BOOL IsAuditResultNo(int audit_result)
148{
149   return audit_result == NOTFOUND || audit_result == INCORRECT;
150}
151
152
153/***************************************************************************
154    Internal functions
155 ***************************************************************************/
156
157static void Mame32Output(void *param, const char *format, va_list argptr)
158{
159   char buffer[512];
160   vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), format, argptr);
161   DetailsPrintf("%s", buffer);
162}
163
164static int ProcessAuditResults(int game, audit_record *audit, int audit_records)
165{
166   output_callback prevcb;
167   void *prevparam;
168   int res;
169
170   mame_set_output_channel(OUTPUT_CHANNEL_INFO, Mame32Output, NULL, &prevcb, &prevparam);
171   res = audit_summary(drivers[game], audit_records, audit, TRUE);
172   mame_set_output_channel(OUTPUT_CHANNEL_INFO, prevcb ? prevcb : mame_null_output_callback, prevparam, NULL, NULL);
173
174   return res;
175}
176
177// Verifies the ROM set while calling SetRomAuditResults   
178int Mame32VerifyRomSet(int game)
179{
180   audit_record *audit;
181   int audit_records;
182   int res;
183
184   // perform the audit
185   audit_records = audit_images(Mame32Global(), drivers[game], AUDIT_VALIDATE_FAST, &audit);
186   res = ProcessAuditResults(game, audit, audit_records);
187   if (audit_records > 0)
188      free(audit);
189
190   SetRomAuditResults(game, res);
191   return res;
192}
193
194// Verifies the Sample set while calling SetSampleAuditResults   
195int Mame32VerifySampleSet(int game)
196{
197   audit_record *audit;
198   int audit_records;
199   int res;
200
201   // perform the audit
202   audit_records = audit_samples(Mame32Global(), drivers[game], &audit);
203   res = ProcessAuditResults(game, audit, audit_records);
204   if (audit_records > 0)
205      free(audit);
206
207   SetSampleAuditResults(game, res);
208   return res;
209}
210
211static DWORD WINAPI AuditThreadProc(LPVOID hDlg)
212{
213   char buffer[200];
214
215   while (!bCancel)
216   {
217      if (!bPaused)
218      {
219         if (rom_index != -1)
220         {
221            sprintf(buffer, "Checking Game %s - %s",
222               drivers[rom_index]->name, drivers[rom_index]->description);
223            win_set_window_text_utf8(hDlg, buffer);
224            ProcessNextRom();
225         }
226         else
227         {
228            if (sample_index != -1)
229            {
230               sprintf(buffer, "Checking Game %s - %s",
231                  drivers[sample_index]->name, drivers[sample_index]->description);
232               win_set_window_text_utf8(hDlg, buffer);
233               ProcessNextSample();
234            }
235            else
236            {
237               win_set_window_text_utf8(hDlg, "File Audit");
238               EnableWindow(GetDlgItem(hDlg, IDPAUSE), FALSE);
239               ExitThread(1);
240            }
241         }
242      }
243   }
244   return 0;
245}
246
247static INT_PTR CALLBACK AuditWindowProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
248{
249   static HANDLE hThread;
250   static DWORD dwThreadID;
251   DWORD dwExitCode;
252   HWND hEdit;
253
254   switch (Msg)
255   {
256   case WM_INITDIALOG:
257      hAudit = hDlg;
258      //RS 20030613 Set Bkg of RichEdit Ctrl
259      hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS);
260      if (hEdit != NULL)
261      {
262         SendMessage( hEdit, EM_SETBKGNDCOLOR, FALSE, GetSysColor(COLOR_BTNFACE) );
263         // MSH - Set to max
264         SendMessage( hEdit, EM_SETLIMITTEXT, MAX_AUDITBOX_TEXT, 0 );
265
266      }
267      SendDlgItemMessage(hDlg, IDC_ROMS_PROGRESS,    PBM_SETRANGE, 0, MAKELPARAM(0, driver_list_get_count(drivers)));
268      SendDlgItemMessage(hDlg, IDC_SAMPLES_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, driver_list_get_count(drivers)));
269      bPaused = FALSE;
270      bCancel = FALSE;
271      rom_index = 0;
272      hThread = CreateThread(NULL, 0, AuditThreadProc, hDlg, 0, &dwThreadID);
273      return 1;
274
275   case WM_COMMAND:
276      switch (LOWORD(wParam))
277      {
278      case IDCANCEL:
279            bPaused = FALSE;
280         if (hThread)
281         {
282            bCancel = TRUE;
283            if (GetExitCodeThread(hThread, &dwExitCode) && dwExitCode == STILL_ACTIVE)
284            {
285               PostMessage(hDlg, WM_COMMAND, wParam, lParam);
286               return 1;
287            }
288            CloseHandle(hThread);
289         }
290         EndDialog(hDlg,0);
291         break;
292
293      case IDPAUSE:
294         if (bPaused)
295         {
296            SendDlgItemMessage(hAudit, IDPAUSE, WM_SETTEXT, 0, (LPARAM)TEXT("Pause"));
297            bPaused = FALSE;
298         }
299         else
300         {
301            SendDlgItemMessage(hAudit, IDPAUSE, WM_SETTEXT, 0, (LPARAM)TEXT("Continue"));
302            bPaused = TRUE;
303         }
304         break;
305      }
306      return 1;
307   }
308   return 0;
309}
310
311/* Callback for the Audit property sheet */
312INT_PTR CALLBACK GameAuditDialogProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam)
313{
314   switch (Msg)
315   {
316   case WM_INITDIALOG:
317      FlushFileCaches();
318      hAudit = hDlg;
319      win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_TITLE), GameInfoTitle(OPTIONS_GAME, rom_index));
320      SetTimer(hDlg, 0, 1, NULL);
321      return 1;
322
323   case WM_TIMER:
324      KillTimer(hDlg, 0);
325      {
326         int iStatus;
327         LPCSTR lpStatus;
328
329         iStatus = Mame32VerifyRomSet(rom_index);
330         lpStatus = DriverUsesRoms(rom_index) ? StatusString(iStatus) : "None required";
331         win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_ROMS), lpStatus);
332
333         iStatus = Mame32VerifySampleSet(rom_index);
334         lpStatus = DriverUsesSamples(rom_index) ? StatusString(iStatus) : "None required";
335         win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_SAMPLES), lpStatus);
336      }
337      ShowWindow(hDlg, SW_SHOW);
338      break;
339   }
340   return 0;
341}
342
343static void ProcessNextRom()
344{
345   int retval;
346   TCHAR buffer[200];
347
348   retval = Mame32VerifyRomSet(rom_index);
349   switch (retval)
350   {
351   case BEST_AVAILABLE: /* correct, incorrect or separate count? */
352   case CORRECT:
353      roms_correct++;
354      _stprintf(buffer, TEXT("%i"), roms_correct);
355      SendDlgItemMessage(hAudit, IDC_ROMS_CORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
356      _stprintf(buffer, TEXT("%i"), roms_correct + roms_incorrect);
357      SendDlgItemMessage(hAudit, IDC_ROMS_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
358      break;
359
360   case NOTFOUND:
361      break;
362
363   case INCORRECT:
364      roms_incorrect++;
365      _stprintf(buffer, TEXT("%i"), roms_incorrect);
366      SendDlgItemMessage(hAudit, IDC_ROMS_INCORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
367      _stprintf(buffer, TEXT("%i"), roms_correct + roms_incorrect);
368      SendDlgItemMessage(hAudit, IDC_ROMS_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
369      break;
370   }
371
372   rom_index++;
373   SendDlgItemMessage(hAudit, IDC_ROMS_PROGRESS, PBM_SETPOS, rom_index, 0);
374
375   if (rom_index == driver_list_get_count(drivers))
376   {
377      sample_index = 0;
378      rom_index = -1;
379   }
380}
381
382static void ProcessNextSample()
383{
384   int  retval;
385   TCHAR buffer[200];
386   
387   retval = Mame32VerifySampleSet(sample_index);
388   
389   switch (retval)
390   {
391   case CORRECT:
392      if (DriverUsesSamples(sample_index))
393      {
394         samples_correct++;
395         _stprintf(buffer, TEXT("%i"), samples_correct);
396         SendDlgItemMessage(hAudit, IDC_SAMPLES_CORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
397         _stprintf(buffer, TEXT("%i"), samples_correct + samples_incorrect);
398         SendDlgItemMessage(hAudit, IDC_SAMPLES_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
399         break;
400      }
401
402   case NOTFOUND:
403      break;
404         
405   case INCORRECT:
406      samples_incorrect++;
407      _stprintf(buffer, TEXT("%i"), samples_incorrect);
408      SendDlgItemMessage(hAudit, IDC_SAMPLES_INCORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
409      _stprintf(buffer, TEXT("%i"), samples_correct + samples_incorrect);
410      SendDlgItemMessage(hAudit, IDC_SAMPLES_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
411     
412      break;
413   }
414
415   sample_index++;
416   SendDlgItemMessage(hAudit, IDC_SAMPLES_PROGRESS, PBM_SETPOS, sample_index, 0);
417   
418   if (sample_index == driver_list_get_count(drivers))
419   {
420      DetailsPrintf("Audit complete.\n");
421      SendDlgItemMessage(hAudit, IDCANCEL, WM_SETTEXT, 0, (LPARAM)TEXT("Close"));
422      sample_index = -1;
423   }
424}
425
426static void CLIB_DECL DetailsPrintf(const char *fmt, ...)
427{
428   HWND   hEdit;
429   va_list marker;
430   char   buffer[2000];
431   TCHAR*  t_s;
432   int      textLength;
433
434   //RS 20030613 Different Ids for Property Page and Dialog
435   // so see which one's currently instantiated
436   hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS);
437   if (hEdit ==  NULL)
438      hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS_PROP);
439   
440   if (hEdit == NULL)
441   {
442      dprintf("audit detailsprintf() can't find any audit control");
443      return;
444   }
445
446   va_start(marker, fmt);
447   
448   vsprintf(buffer, fmt, marker);
449   
450   va_end(marker);
451
452   t_s = tstring_from_utf8(ConvertToWindowsNewlines(buffer));
453   if( !t_s || _tcscmp(TEXT(""), t_s) == 0)
454      return;
455
456   textLength = Edit_GetTextLength(hEdit);
457   Edit_SetSel(hEdit, textLength, textLength);
458   SendMessage( hEdit, EM_REPLACESEL, FALSE, (WPARAM)(LPCTSTR)win_tstring_strdup(t_s) );
459   
460   free(t_s);
461}
462
463static const char * StatusString(int iStatus)
464{
465   static const char *ptr;
466
467   ptr = "Unknown";
468
469   switch (iStatus)
470   {
471   case CORRECT:
472      ptr = "Passed";
473      break;
474     
475   case BEST_AVAILABLE:
476      ptr = "Best available";
477      break;
478     
479   case NOTFOUND:
480      ptr = "Not found";
481      break;
482     
483   case INCORRECT:
484      ptr = "Failed";
485      break;
486   }
487
488   return ptr;
489}
src/osd/winui/m32opts.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13#ifndef M32OPTS_H
14#define M32OPTS_H
15
16#include "osdcomm.h"
17#include "osd_cpu.h"
18#include "bitmask.h"
19#include "options.h"
20#include "inputseq.h" /* for input_seq definition */
21#include <video.h> /* for MAX_SCREENS Definition*/
22
23#ifdef MESS
24#include "optionsms.h"
25#endif
26
27// Various levels of ini's we can edit.
28typedef enum {
29   OPTIONS_GLOBAL = 0,
30   OPTIONS_VECTOR,
31   OPTIONS_SOURCE,
32   OPTIONS_PARENT,
33   OPTIONS_GAME,
34   OPTIONS_MAX
35} OPTIONS_TYPE;
36
37
38enum
39{
40   COLUMN_GAMES = 0,
41   COLUMN_ORIENTATION,
42   //COLUMN_ROMS,
43   COLUMN_SAMPLES,
44   COLUMN_DIRECTORY,
45   COLUMN_TYPE,
46   COLUMN_TRACKBALL,
47   COLUMN_PLAYED,
48   COLUMN_MANUFACTURER,
49   COLUMN_YEAR,
50   COLUMN_CLONE,
51   COLUMN_SRCDRIVERS,
52   COLUMN_PLAYTIME,
53   COLUMN_MAX
54};
55
56
57// can't be the same as the VerifyRomSet() results, listed in audit.h
58enum
59{
60   UNKNOWN   = -1
61};
62
63/* Default input */
64enum
65{
66   INPUT_LAYOUT_STD,
67   INPUT_LAYOUT_HR,
68   INPUT_LAYOUT_HRSE
69};
70
71// clean stretch types
72enum
73{
74   // these must match array of strings clean_stretch_long_name in options.c
75   CLEAN_STRETCH_NONE = 0,
76   CLEAN_STRETCH_AUTO = 1,
77
78   MAX_CLEAN_STRETCH = 5,
79};
80
81#define FOLDER_OPTIONS   -2
82#define GLOBAL_OPTIONS   -1
83
84// d3d effect types
85enum
86{
87   // these must match array of strings d3d_effects_long_name in options.c
88   D3D_EFFECT_NONE = 0,
89   D3D_EFFECT_AUTO = 1,
90
91   MAX_D3D_EFFECTS = 17,
92};
93
94// d3d prescale types
95enum
96{
97   D3D_PRESCALE_NONE = 0,
98   D3D_PRESCALE_AUTO = 1,
99   MAX_D3D_PRESCALE = 10,
100};
101
102typedef struct
103{
104   int x, y, width, height;
105} AREA;
106
107typedef struct
108{
109   char* screen;
110   char* aspect;
111   char* resolution;
112   char* view;
113} ScreenParams;
114
115
116
117// List of artwork types to display in the screen shot area
118enum
119{
120   // these must match array of strings image_tabs_long_name in options.c
121   // if you add new Tabs, be sure to also add them to the ComboBox init in dialogs.c
122   TAB_SCREENSHOT = 0,
123   TAB_FLYER,
124   TAB_CABINET,
125   TAB_MARQUEE,
126   TAB_TITLE,
127   TAB_CONTROL_PANEL,
128   TAB_PCB,
129   TAB_HISTORY,
130
131   MAX_TAB_TYPES,
132   BACKGROUND,
133   TAB_ALL,
134   TAB_NONE
135};
136// Because we have added the Options after MAX_TAB_TYPES, we have to subtract 3 here
137// (that's how many options we have after MAX_TAB_TYPES)
138#define TAB_SUBTRACT 3
139
140BOOL OptionsInit(void);
141void OptionsExit(void);
142
143#define OPTIONS_TYPE_GLOBAL      -1
144#define OPTIONS_TYPE_FOLDER      -2
145
146core_options * load_options(OPTIONS_TYPE opt_type, int game_num);
147void save_options(OPTIONS_TYPE opt_type, core_options *opts, int game_num);
148
149void AddOptions(core_options *opts, const options_entry *entrylist, BOOL is_global);
150core_options * CreateGameOptions(int driver_index);
151
152core_options * Mame32Settings(void);
153core_options * Mame32Global(void);
154
155void LoadFolderFlags(void);
156const char* GetFolderNameByID(UINT nID);
157
158void SaveOptions(void);
159
160void ResetGUI(void);
161void ResetGameDefaults(void);
162void ResetAllGameOptions(void);
163
164const char * GetImageTabLongName(int tab_index);
165const char * GetImageTabShortName(int tab_index);
166
167void SetViewMode(int val);
168int  GetViewMode(void);
169
170void SetGameCheck(BOOL game_check);
171BOOL GetGameCheck(void);
172
173void SetVersionCheck(BOOL version_check);
174BOOL GetVersionCheck(void);
175
176void SetJoyGUI(BOOL use_joygui);
177BOOL GetJoyGUI(void);
178
179void SetKeyGUI(BOOL use_keygui);
180BOOL GetKeyGUI(void);
181
182void SetCycleScreenshot(int cycle_screenshot);
183int GetCycleScreenshot(void);
184
185void SetStretchScreenShotLarger(BOOL stretch);
186BOOL GetStretchScreenShotLarger(void);
187
188void SetScreenshotBorderSize(int size);
189int GetScreenshotBorderSize(void);
190
191void SetScreenshotBorderColor(COLORREF uColor);
192COLORREF GetScreenshotBorderColor(void);
193
194void SetFilterInherit(BOOL inherit);
195BOOL GetFilterInherit(void);
196
197void SetOffsetClones(BOOL offset);
198BOOL GetOffsetClones(void);
199
200void SetGameCaption(BOOL caption);
201BOOL GetGameCaption(void);
202
203void SetBroadcast(BOOL broadcast);
204BOOL GetBroadcast(void);
205
206void SetRandomBackground(BOOL random_bg);
207BOOL GetRandomBackground(void);
208
209void SetSavedFolderID(UINT val);
210UINT GetSavedFolderID(void);
211
212void SetShowScreenShot(BOOL val);
213BOOL GetShowScreenShot(void);
214
215void SetShowFolderList(BOOL val);
216BOOL GetShowFolderList(void);
217
218BOOL GetShowFolder(int folder);
219void SetShowFolder(int folder,BOOL show);
220
221
222void SetShowStatusBar(BOOL val);
223BOOL GetShowStatusBar(void);
224
225void SetShowToolBar(BOOL val);
226BOOL GetShowToolBar(void);
227
228void SetShowTabCtrl(BOOL val);
229BOOL GetShowTabCtrl(void);
230
231void SetCurrentTab(const char *shortname);
232const char *GetCurrentTab(void);
233
234void SetDefaultGame(const char *name);
235const char *GetDefaultGame(void);
236
237void SetWindowArea(const AREA *area);
238void GetWindowArea(AREA *area);
239
240void SetWindowState(UINT state);
241UINT GetWindowState(void);
242
243void SetColumnWidths(int widths[]);
244void GetColumnWidths(int widths[]);
245
246void SetColumnOrder(int order[]);
247void GetColumnOrder(int order[]);
248
249void SetColumnShown(int shown[]);
250void GetColumnShown(int shown[]);
251
252void SetSplitterPos(int splitterId, int pos);
253int  GetSplitterPos(int splitterId);
254
255void SetCustomColor(int iIndex, COLORREF uColor);
256COLORREF GetCustomColor(int iIndex);
257
258void SetListFont(const LOGFONT *font);
259void GetListFont(LOGFONT *font);
260
261DWORD GetFolderFlags(int folder_index);
262
263void SetListFontColor(COLORREF uColor);
264COLORREF GetListFontColor(void);
265
266void SetListCloneColor(COLORREF uColor);
267COLORREF GetListCloneColor(void);
268
269int GetHistoryTab(void);
270void SetHistoryTab(int tab,BOOL show);
271
272int GetShowTab(int tab);
273void SetShowTab(int tab,BOOL show);
274BOOL AllowedToSetShowTab(int tab,BOOL show);
275
276void SetSortColumn(int column);
277int  GetSortColumn(void);
278
279void SetSortReverse(BOOL reverse);
280BOOL GetSortReverse(void);
281
282const char* GetLanguage(void);
283void SetLanguage(const char* lang);
284
285const char* GetRomDirs(void);
286void SetRomDirs(const char* paths);
287
288const char* GetSampleDirs(void);
289void  SetSampleDirs(const char* paths);
290
291const char * GetIniDir(void);
292void SetIniDir(const char *path);
293
294const char* GetCfgDir(void);
295void SetCfgDir(const char* path);
296
297const char* GetNvramDir(void);
298void SetNvramDir(const char* path);
299
300const char* GetInpDir(void);
301void SetInpDir(const char* path);
302
303const char* GetImgDir(void);
304void SetImgDir(const char* path);
305
306const char* GetStateDir(void);
307void SetStateDir(const char* path);
308
309const char* GetArtDir(void);
310void SetArtDir(const char* path);
311
312const char* GetMemcardDir(void);
313void SetMemcardDir(const char* path);
314
315const char* GetFlyerDir(void);
316void SetFlyerDir(const char* path);
317
318const char* GetCabinetDir(void);
319void SetCabinetDir(const char* path);
320
321const char* GetMarqueeDir(void);
322void SetMarqueeDir(const char* path);
323
324const char* GetTitlesDir(void);
325void SetTitlesDir(const char* path);
326
327const char * GetControlPanelDir(void);
328void SetControlPanelDir(const char *path);
329
330const char * GetPcbDir(void);
331void SetPcbDir(const char *path);
332
333const char* GetDiffDir(void);
334void SetDiffDir(const char* path);
335
336const char* GetIconsDir(void);
337void SetIconsDir(const char* path);
338
339const char *GetBgDir(void);
340void SetBgDir(const char *path);
341
342const char* GetCtrlrDir(void);
343void SetCtrlrDir(const char* path);
344
345const char* GetCommentDir(void);
346void SetCommentDir(const char* path);
347
348const char* GetFolderDir(void);
349void SetFolderDir(const char* path);
350
351const char* GetCheatFileName(void);
352void SetCheatFileName(const char* path);
353
354const char* GetHistoryFileName(void);
355void SetHistoryFileName(const char* path);
356
357const char* GetMAMEInfoFileName(void);
358void SetMAMEInfoFileName(const char* path);
359
360void ResetGameOptions(int driver_index);
361
362int GetRomAuditResults(int driver_index);
363void SetRomAuditResults(int driver_index, int audit_results);
364
365int GetSampleAuditResults(int driver_index);
366void SetSampleAuditResults(int driver_index, int audit_results);
367
368void IncrementPlayCount(int driver_index);
369int GetPlayCount(int driver_index);
370void ResetPlayCount(int driver_index);
371
372void IncrementPlayTime(int driver_index,int playtime);
373int GetPlayTime(int driver_index);
374void GetTextPlayTime(int driver_index,char *buf);
375void ResetPlayTime(int driver_index);
376
377char * GetVersionString(void);
378
379void SaveDefaultOptions(void);
380
381BOOL IsGlobalOption(const char *option_name);
382
383
384
385// Keyboard control of ui
386input_seq* Get_ui_key_up(void);
387input_seq* Get_ui_key_down(void);
388input_seq* Get_ui_key_left(void);
389input_seq* Get_ui_key_right(void);
390input_seq* Get_ui_key_start(void);
391input_seq* Get_ui_key_pgup(void);
392input_seq* Get_ui_key_pgdwn(void);
393input_seq* Get_ui_key_home(void);
394input_seq* Get_ui_key_end(void);
395input_seq* Get_ui_key_ss_change(void);
396input_seq* Get_ui_key_history_up(void);
397input_seq* Get_ui_key_history_down(void);
398
399input_seq* Get_ui_key_context_filters(void);
400input_seq* Get_ui_key_select_random(void);
401input_seq* Get_ui_key_game_audit(void);
402input_seq* Get_ui_key_game_properties(void);
403input_seq* Get_ui_key_help_contents(void);
404input_seq* Get_ui_key_update_gamelist(void);
405input_seq* Get_ui_key_view_folders(void);
406input_seq* Get_ui_key_view_fullscreen(void);
407input_seq* Get_ui_key_view_pagetab(void);
408input_seq* Get_ui_key_view_picture_area(void);
409input_seq* Get_ui_key_view_status(void);
410input_seq* Get_ui_key_view_toolbars(void);
411
412input_seq* Get_ui_key_view_tab_cabinet(void);
413input_seq* Get_ui_key_view_tab_cpanel(void);
414input_seq* Get_ui_key_view_tab_flyer(void);
415input_seq* Get_ui_key_view_tab_history(void);
416input_seq* Get_ui_key_view_tab_marquee(void);
417input_seq* Get_ui_key_view_tab_screenshot(void);
418input_seq* Get_ui_key_view_tab_title(void);
419input_seq* Get_ui_key_view_tab_pcb(void);
420input_seq* Get_ui_key_quit(void);
421
422
423int GetUIJoyUp(int joycodeIndex);
424void SetUIJoyUp(int joycodeIndex, int val);
425
426int GetUIJoyDown(int joycodeIndex);
427void SetUIJoyDown(int joycodeIndex, int val);
428
429int GetUIJoyLeft(int joycodeIndex);
430void SetUIJoyLeft(int joycodeIndex, int val);
431
432int GetUIJoyRight(int joycodeIndex);
433void SetUIJoyRight(int joycodeIndex, int val);
434
435int GetUIJoyStart(int joycodeIndex);
436void SetUIJoyStart(int joycodeIndex, int val);
437
438int GetUIJoyPageUp(int joycodeIndex);
439void SetUIJoyPageUp(int joycodeIndex, int val);
440
441int GetUIJoyPageDown(int joycodeIndex);
442void SetUIJoyPageDown(int joycodeIndex, int val);
443
444int GetUIJoyHome(int joycodeIndex);
445void SetUIJoyHome(int joycodeIndex, int val);
446
447int GetUIJoyEnd(int joycodeIndex);
448void SetUIJoyEnd(int joycodeIndex, int val);
449
450int GetUIJoySSChange(int joycodeIndex);
451void SetUIJoySSChange(int joycodeIndex, int val);
452
453int GetUIJoyHistoryUp(int joycodeIndex);
454void SetUIJoyHistoryUp(int joycodeIndex, int val);
455
456int GetUIJoyHistoryDown(int joycodeIndex);
457void SetUIJoyHistoryDown(int joycodeIndex, int val);
458
459int GetUIJoyExec(int joycodeIndex);
460void SetUIJoyExec(int joycodeIndex, int val);
461
462const char* GetExecCommand(void);
463void SetExecCommand(char* cmd);
464
465int GetExecWait(void);
466void SetExecWait(int wait);
467
468BOOL GetHideMouseOnStartup(void);
469void SetHideMouseOnStartup(BOOL hide);
470
471BOOL GetRunFullScreen(void);
472void SetRunFullScreen(BOOL fullScreen);
473
474void ColumnEncodeStringWithCount(const int *value, char *str, int count);
475void ColumnDecodeStringWithCount(const char* str, int *value, int count);
476
477#endif
src/osd/winui/audit32.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13#ifndef AUDIT32_H
14#define AUDIT32_H
15
16void AuditDialog(HWND hParent);
17
18// For property sheet Game Audit tab
19void InitGameAudit(int gameIndex);
20INT_PTR CALLBACK GameAuditDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
21
22int Mame32VerifyRomSet(int game);
23int Mame32VerifySampleSet(int game);
24
25const char * GetAuditString(int audit_result);
26BOOL IsAuditResultKnown(int audit_result);
27BOOL IsAuditResultYes(int audit_result);
28BOOL IsAuditResultNo(int audit_result);
29
30#endif
src/osd/winui/mame32.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5
6  This file is part of MAME32, and may only be used, modified and
7  distributed under the terms of the MAME license, in "readme.txt".
8  By continuing to use, modify or distribute this file you indicate
9  that you have read the license and understand and accept it fully.
10
11 ***************************************************************************/
12
13#ifndef MAME32_H
14#define MAME32_H
15
16#include "win32ui.h"
17
18#ifndef MESS
19#define MAME32NAME   "MAME32"
20#define MAMENAME   "MAME"
21#else
22#define MAME32NAME   "MESS"
23#define MAMENAME   "MESS"
24#endif
25
26#endif
src/osd/winui/treeview.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/winui.h
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14#ifndef WINUI_H
15#define WINUI_H
16
17#define WIN32_LEAN_AND_MEAN
18#include <commctrl.h>
19#include <commdlg.h>
20#include <driver.h>
21#include "pool.h"
22#include "screenshot.h"
23
24
25#ifndef MESS
26#ifdef PTR64
27#define MAMEUINAME   "MAMEUI64"
28#else
29#define MAMEUINAME   "MAMEUI32"
30#endif
31#define MAMENAME   "MAME"
32#else
33#define MAMEUINAME   "MESS"
34#define MAMENAME   "MESS"
35#endif
36
37#define SEARCH_PROMPT ""
38
39enum
40{
41   TAB_PICKER = 0,
42   TAB_DISPLAY,
43   TAB_MISC,
44   NUM_TABS
45};
46
47enum
48{
49   FILETYPE_INPUT_FILES = 1,
50   FILETYPE_SAVESTATE_FILES = 2,
51   FILETYPE_WAVE_FILES = 3,
52   FILETYPE_MNG_FILES = 5,
53   FILETYPE_EFFECT_FILES = 6
54};
55
56
57typedef struct
58{
59   INT resource;
60   const char *icon_name;
61} ICONDATA;
62
63extern TCHAR last_directory[MAX_PATH];
64
65typedef BOOL (WINAPI *common_file_dialog_proc)(LPOPENFILENAME lpofn);
66BOOL CommonFileDialog(common_file_dialog_proc cfd,char *filename, int filetype);
67
68HWND GetMainWindow(void);
69HWND GetTreeView(void);
70HIMAGELIST GetLargeImageList(void);
71HIMAGELIST GetSmallImageList(void);
72int GetNumOptionFolders(void);
73void SetNumOptionFolders(int count);
74void GetRealColumnOrder(int order[]);
75HICON LoadIconFromFile(const char *iconname);
76void UpdateScreenShot(void);
77void ResizePickerControls(HWND hWnd);
78void MamePlayGame(void);
79int FindIconIndex(int nIconResource);
80int FindIconIndexByName(const char *icon_name);
81int GetSelectedPick(void);
82object_pool *GetMameUIMemoryPool(void);
83
84void UpdateListView(void);
85
86// Move The in "The Title (notes)" to "Title, The (notes)"
87char * ModifyThe(const char *str);
88
89// Convert Ampersand so it can display in a static control
90char * ConvertAmpersandString(const char *s);
91
92// globalized for painting tree control
93HBITMAP GetBackgroundBitmap(void);
94HPALETTE GetBackgroundPalette(void);
95MYBITMAPINFO* GetBackgroundInfo(void);
96BOOL GetUseOldControl(void);
97BOOL GetUseXPControl(void);
98
99int GetMinimumScreenShotWindowWidth(void);
100
101// we maintain an array of drivers sorted by name, useful all around
102int GetDriverIndex(const game_driver *driver);
103int GetParentIndex(const game_driver *driver);
104int GetParentRomSetIndex(const game_driver *driver);
105int GetGameNameIndex(const char *name);
106int GetIndexFromSortedIndex(int sorted_index);
107
108// sets text in part of the status bar on the main window
109void SetStatusBarText(int part_index, const char *message);
110void SetStatusBarTextF(int part_index, const char *fmt, ...);
111
112int MameUIMain(HINSTANCE   hInstance,
113                   LPSTR    lpCmdLine,
114                   int      nCmdShow);
115
116BOOL MouseHasBeenMoved(void);
117
118const char * GetSearchText(void);
119
120#endif
src/osd/winui/history.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213 
1314/***************************************************************************
1415
r1367r1368
1718    history functions.
1819
1920***************************************************************************/
20
21// standard windows headers
2122#define WIN32_LEAN_AND_MEAN
2223#include <windows.h>
2324#include <stdio.h>
2425
25#include <driver.h>
26#include "m32util.h"
27
26// MAME/MAMEUI headers
27#include "driver.h"
28#include "mui_util.h"
2829#include "datafile.h"
2930#include "history.h"
3031
src/osd/winui/properties.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1415#define PROPERTIES_H
1516
1617/* Get title string to display in the top of the property page,
17 * Called also in Audit32.c
18 * Called also in ui_audit.c
1819 */
1920char * GameInfoTitle(OPTIONS_TYPE opt_type, UINT nIndex);
2021
21/* Called in win32ui.c to create the property page */
22/* Called in winui.c to create the property page */
2223void   InitPropertyPage(HINSTANCE hInst, HWND hWnd, HICON hIcon, OPTIONS_TYPE opt_type, int folder_id, int game_num);
2324
2425#define PROPERTIES_PAGE 0
src/osd/winui/tabview.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14// standard windows headers
1315#define WIN32_LEAN_AND_MEAN
1416#include <windows.h>
1517#include <windowsx.h>
1618#include <shellapi.h>
17#include <stdio.h>
18#include <ctype.h>
19#include <io.h>
20#include <fcntl.h>
2119#include <commctrl.h>
2220#include <commdlg.h>
23#include <string.h>
24#include <sys/stat.h>
2521#include <wingdi.h>
26#include <time.h>
27#include <assert.h>
28#include <tchar.h>
29#include <stdlib.h>
3022
23// MAME/MAMEUI headers
3124#include "tabview.h"
32#include "m32util.h"
25#include "mui_util.h"
3326#include "strconv.h"
3427
3528
src/osd/winui/columnedit.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213 
1314/***************************************************************************
1415
15  ColumnEdit.c
16  columnedit.c
1617
1718  Column Edit dialog
1819
1920***************************************************************************/
2021
22// standard windows headers
2123#define WIN32_LEAN_AND_MEAN
2224#include <windows.h>
2325#include <windowsx.h>
r1367r1368
2527#include <commctrl.h>
2628#include <commdlg.h>
2729
30// MAME/MAMEUI headers
2831#include "resource.h"
29#include "bitmask.h"
30#include "m32opts.h"
31#include "screenshot.h"
32#include "win32ui.h"
32#include "mui_opts.h"
33#include "winui.h"
3334
3435// Returns TRUE if successful
3536int DoExchangeItem(HWND hFrom, HWND hTo, int nMinItem)
src/osd/winui/ui.mak
r1367r1368
2323#-------------------------------------------------
2424
2525WINUIOBJS += \
26   $(WINUIOBJ)/m32util.o \
26   $(WINUIOBJ)/mui_util.o \
2727   $(WINUIOBJ)/directinput.o \
2828   $(WINUIOBJ)/dijoystick.o \
2929   $(WINUIOBJ)/directdraw.o \
3030   $(WINUIOBJ)/directories.o \
31   $(WINUIOBJ)/audit32.o \
31   $(WINUIOBJ)/mui_audit.o \
3232   $(WINUIOBJ)/columnedit.o \
3333   $(WINUIOBJ)/screenshot.o \
3434   $(WINUIOBJ)/treeview.o \
r1367r1368
4444   $(WINUIOBJ)/dialogs.o \
4545   $(WINUIOBJ)/dirwatch.o   \
4646   $(WINUIOBJ)/datafile.o   \
47   $(WINUIOBJ)/m32opts.o \
48   $(WINUIOBJ)/win32ui.o \
47   $(WINUIOBJ)/mui_opts.o \
48   $(WINUIOBJ)/winui.o \
4949   $(WINUIOBJ)/helpids.o \
50   $(MESS_WINUIOBJ)/mess32ui.o \
50   $(MESS_WINUIOBJ)/messui.o \
5151   $(MESS_WINUIOBJ)/optionsms.o \
5252    $(MESS_WINUIOBJ)/layoutms.o \
53   $(MESS_WINUIOBJ)/ms32util.o \
53   $(MESS_WINUIOBJ)/msuiutil.o \
5454   $(MESS_WINUIOBJ)/propertiesms.o \
5555   $(MESS_WINUIOBJ)/softwarepicker.o \
5656   $(MESS_WINUIOBJ)/devview.o
5757
5858
5959# add resource file
60GUIRESFILE = $(MESS_WINUIOBJ)/mess32.res
60GUIRESFILE = $(MESS_WINUIOBJ)/messui.res
6161
6262$(LIBOSD): $(WINUIOBJS)
6363
r1367r1368
6666# rules for creating helpids.c
6767#-------------------------------------------------
6868
69$(WINUISRC)/helpids.c : $(WINUIOBJ)/mkhelp$(EXE) $(WINUISRC)/resource.h $(WINUISRC)/resource.hm $(WINUISRC)/mame32.rc
70   $(WINUIOBJ)/mkhelp$(EXE) $(WINUISRC)/mame32.rc >$@
69$(WINUISRC)/helpids.c : $(WINUIOBJ)/mkhelp$(EXE) $(WINUISRC)/resource.h $(WINUISRC)/resource.hm $(WINUISRC)/mameui.rc
70   $(WINUIOBJ)/mkhelp$(EXE) $(WINUISRC)/mameui.rc >$@
7171
7272# rule to build the generator
7373$(WINUIOBJ)/mkhelp$(EXE): $(WINUIOBJ)/mkhelp.o $(LIBOCORE)
r1367r1368
117117#####################################################################
118118
119119
120$(MESS_WINUIOBJ)/mess32.res:   $(WINUISRC)/mame32.rc $(MESS_WINUISRC)/mess32.rc $(WINUISRC)/resource.h $(MESS_WINUISRC)/resourcems.h $(WINUIOBJ)/mamevers.rc
120$(MESS_WINUIOBJ)/messui.res:   $(WINUISRC)/mameui.rc $(MESS_WINUISRC)/messui.rc $(WINUISRC)/resource.h $(MESS_WINUISRC)/resourcems.h $(WINUIOBJ)/mamevers.rc
121121   @echo Compiling resources $<...
122   $(RC) $(RCDEFS) $(RCFLAGS) --include-dir $(WINUISRC) --include-dir $(MESS_WINUISRC) --include-dir $(WINUIOBJ) -o $@ -i $(MESS_WINUISRC)/mess32.rc
122   $(RC) $(RCDEFS) $(RCFLAGS) --include-dir $(WINUISRC) --include-dir $(MESS_WINUISRC) --include-dir $(WINUIOBJ) -o $@ -i $(MESS_WINUISRC)/messui.rc
123123
124124$(WINUIOBJ)/mamevers.rc: $(WINOBJ)/verinfo$(EXE) $(SRC)/version.c
125125   @echo Emitting $@...
src/osd/winui/history.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/tabview.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/datamap.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
114//============================================================
215//
316//  datamap.c - Win32 dialog and options bridge code
r1367r1368
1730#include <assert.h>
1831#include <math.h>
1932
20// MAME/MAME32 headers
33// MAME/MAMEUI headers
2134#include "corestr.h"
2235#include "strconv.h"
2336#include "datamap.h"
src/osd/winui/columnedit.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/datafile.c
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
114/****************************************************************************
215 *      datafile.c
316 *      History database engine
r1367r1368
619 *      Modifications and higher-level functions by John Butler
720 ****************************************************************************/
821
22// standard windows headers
23#include <windows.h>
24
25// standard C headers
926#include <assert.h>
1027#include <ctype.h>
11#include <windows.h>
28
29// MAME/MAMEUI headers
1230#include "osdcomm.h"
1331#include "osd_cpu.h"
1432#include "driver.h"
1533#include "datafile.h"
16#include "m32opts.h"
34#include "mui_opts.h" // For MameUIGlobal()
1735
1836/****************************************************************************
1937 *      token parsing constants
r1367r1368
324342{
325343        /* Open file up in binary mode */
326344
327        mame_fopen_options(Mame32Global(), NULL, pszFilename, OPEN_FLAG_READ, &fp);
345        mame_fopen_options(MameUIGlobal(), NULL, pszFilename, OPEN_FLAG_READ, &fp);
328346
329347        /* If this is NULL, return FALSE. We can't open it */
330348
src/osd/winui/resource.hm
r1367r1368
11// Microsoft Visual C++ generated Help ID include file.
2// Used by mame32.rc
2// Used by mameui.rc
33//
44#define HIDC_ADSTICK                    0x80b904b9    // IDD_PROP_CONTROLLER
55#define HIDC_ANTIALIAS                  0x809f0405    // IDD_PROP_VECTOR
src/osd/winui/directories.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1213
1314/***************************************************************************
1415
15  Directories.c
16  directories.c
1617
1718***************************************************************************/
1819
20// standard windows headers
1921#define COBJMACROS
2022#define WIN32_LEAN_AND_MEAN
2123#include <windows.h>
2224#include <windowsx.h>
2325#include <shlobj.h>
26
27// standard C headers
2428#include <sys/stat.h>
2529#include <assert.h>
2630#include <tchar.h>
2731
28#include "screenshot.h"
29#include "mame32.h"
32// MAME/MAMEUI headers
33#include "winui.h"
3034#include "directories.h"
3135#include "resource.h"
3236#include "strconv.h"
33#include "m32util.h"
37#include "mui_util.h"
3438
3539#define MAX_DIRS 20
3640
r1367r1368
601605      }
602606      else
603607      {
604         if (MessageBox(NULL, TEXT("Directory does not exist, continue anyway?"), TEXT(MAME32NAME), MB_OKCANCEL) == IDOK)
608         if (MessageBox(NULL, TEXT("Directory does not exist, continue anyway?"), TEXT(MAMEUINAME), MB_OKCANCEL) == IDOK)
605609            bResult = TRUE;
606610      }
607611   }
src/osd/winui/datamap.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
114//============================================================
215//
316//  datamap.c - Win32 dialog and options bridge code
src/osd/winui/dijoystick.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1213
1314/***************************************************************************
1415
15  DIJoystick.c
16  dijoystick.c
1617
1718 ***************************************************************************/
1819
20// standard windows headers
1921#define WIN32_LEAN_AND_MEAN
2022#include <windows.h>
23
24// standard C headers
2125#include <assert.h>
2226#include <stdio.h>
2327#include <math.h>
2428#include <tchar.h>
25#include "screenshot.h"
26#include "mame32.h"
29
30// MAMEUI headers
31#include "winui.h"
2732#include "directinput.h"
2833#include "dijoystick.h"
29#include "m32util.h"
30#include "dxdecode.h"
34#include "mui_util.h" // For ErrorMsg
35#include "dxdecode.h" // for DirectXDecodeError
3136
3237/***************************************************************************
3338    function prototypes
src/osd/winui/picker.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14// standard windows headers
1315#define WIN32_LEAN_AND_MEAN
1416#define _WIN32_IE 0x0500
1517#include <windows.h>
1618#include <windowsx.h>
1719#include <shellapi.h>
20#include <commctrl.h>
21#include <commdlg.h>
22#include <wingdi.h>
23
24// standard C headers
1825#include <stdio.h>
1926#include <ctype.h>
20#include <commctrl.h>
21#include <commdlg.h>
2227#include <string.h>
2328#include <sys/stat.h>
24#include <wingdi.h>
2529#include <time.h>
2630#include <tchar.h>
2731
32// MAME/MAMEUI headers
2833#include "picker.h"
29#include "resource.h"
30#include "screenshot.h"
31#include "win32ui.h"
32#include "bitmask.h"
33#include "m32util.h"
34#include "m32opts.h"
34#include "winui.h"
35#include "mui_util.h" // For dprintf
36#include "mui_opts.h"
3537
3638
3739// fix warning: cast does not match function type
src/osd/winui/screenshot.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
10   
11***************************************************************************/
1211
12 ***************************************************************************/
13
1314/***************************************************************************
1415
1516  Screenshot.c
r1367r1368
2021     
2122***************************************************************************/
2223
24// standard windows headers
2325#define WIN32_LEAN_AND_MEAN
2426#include <windows.h>
25#include <stdlib.h>
26#include <io.h>
27#include <fcntl.h>
28#include <driver.h>
29#include <png.h>
30#include <osdepend.h>
31#include <tchar.h>
3227
33#include "screenshot.h"
34#include "file.h"
35#include "bitmask.h"
36#include "m32opts.h"
37#include "m32util.h"
38#include "win32ui.h"
28// MAME/MAMEUI headers
29#include "driver.h"
30#include "png.h"
31#include "osdepend.h"
3932#include "unzip.h"
40#include "strconv.h"
4133
34#include "mui_opts.h"
35#include "mui_util.h"
36#include "winui.h"
37
38
4239/***************************************************************************
4340    function prototypes
4441***************************************************************************/
r1367r1368
134131      }
135132   }
136133
134#ifndef MESS
135   /* MSH 20071029 - If driver is broken and no images exists, look for nonworking.png */
136   if (!loaded && DriverIsBroken(nGame))
137   {
138      loaded = LoadDIB("nonworking", &m_hDIB, &m_hPal, nType);
139   }
140#endif
141
137142   if (loaded)
138143   {
139144      HDC hdc = GetDC(GetMainWindow());
src/osd/winui/datafile.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
114#ifndef DATAFILE_H
215#define DATAFILE_H
316
src/osd/winui/mui_audit.c
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13 
14 /***************************************************************************
15
16  mui_audit.c
17
18  Audit dialog
19
20***************************************************************************/
21
22// standard windows headers
23#define WIN32_LEAN_AND_MEAN
24#include <windows.h>
25#include <windowsx.h>
26#include <commctrl.h>
27#include <richedit.h>
28
29// standard C headers
30#include <stdio.h>
31#include <tchar.h>
32
33// MAME/MAMEUI headers
34#include "winui.h"
35#include "winutf8.h"
36#include "strconv.h"
37#include "audit.h"
38#include "resource.h"
39#include "mui_opts.h"
40#include "mui_util.h"
41#include "properties.h"
42
43
44#ifdef _MSC_VER
45#define vsnprintf _vsnprintf
46#endif
47
48/***************************************************************************
49    function prototypes
50 ***************************************************************************/
51
52static DWORD WINAPI AuditThreadProc(LPVOID hDlg);
53static INT_PTR CALLBACK AuditWindowProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
54static void ProcessNextRom(void);
55static void ProcessNextSample(void);
56static void CLIB_DECL DetailsPrintf(const char *fmt, ...);
57static const char * StatusString(int iStatus);
58
59/***************************************************************************
60    Internal variables
61 ***************************************************************************/
62
63#define SAMPLES_NOT_USED    3
64#define MAX_AUDITBOX_TEXT   0x7FFFFFFE
65
66HWND hAudit;
67static int rom_index;
68static int roms_correct;
69static int roms_incorrect;
70static int sample_index;
71static int samples_correct;
72static int samples_incorrect;
73
74static BOOL bPaused = FALSE;
75static BOOL bCancel = FALSE;
76
77/***************************************************************************
78    External functions 
79 ***************************************************************************/
80
81void AuditDialog(HWND hParent)
82{
83   HMODULE hModule = NULL;
84   rom_index         = 0;
85   roms_correct      = 0;
86   roms_incorrect    = 0;
87   sample_index      = 0;
88   samples_correct   = 0;
89   samples_incorrect = 0;
90
91   //RS use Riched32.dll
92   hModule = LoadLibrary(TEXT("Riched32.dll"));
93   if( hModule )
94   {
95      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_AUDIT),hParent,AuditWindowProc);
96      FreeLibrary( hModule );
97      hModule = NULL;
98   }
99   else
100   {
101       MessageBox(GetMainWindow(),TEXT("Unable to Load Riched32.dll"),TEXT("Error"),
102               MB_OK | MB_ICONERROR);
103   }
104}
105
106void InitGameAudit(int gameIndex)
107{
108   rom_index = gameIndex;
109}
110
111const char * GetAuditString(int audit_result)
112{
113   switch (audit_result)
114   {
115   case CORRECT :
116   case BEST_AVAILABLE :
117      return "Yes";
118
119   case NOTFOUND :
120   case INCORRECT :
121      return "No";
122      break;
123
124   case UNKNOWN :
125      return "?";
126
127   default:
128      dprintf("unknown audit value %i",audit_result);
129   }
130
131   return "?";
132}
133
134BOOL IsAuditResultKnown(int audit_result)
135{
136   return audit_result != UNKNOWN;
137}
138
139BOOL IsAuditResultYes(int audit_result)
140{
141   return audit_result == CORRECT || audit_result == BEST_AVAILABLE;
142}
143
144BOOL IsAuditResultNo(int audit_result)
145{
146   return audit_result == NOTFOUND || audit_result == INCORRECT;
147}
148
149
150/***************************************************************************
151    Internal functions
152 ***************************************************************************/
153
154static void MameUIOutput(void *param, const char *format, va_list argptr)
155{
156   char buffer[512];
157   vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), format, argptr);
158   DetailsPrintf("%s", buffer);
159}
160
161static int ProcessAuditResults(int game, audit_record *audit, int audit_records)
162{
163   output_callback prevcb;
164   void *prevparam;
165   int res;
166
167   mame_set_output_channel(OUTPUT_CHANNEL_INFO, MameUIOutput, NULL, &prevcb, &prevparam);
168   res = audit_summary(drivers[game], audit_records, audit, TRUE);
169   mame_set_output_channel(OUTPUT_CHANNEL_INFO, prevcb ? prevcb : mame_null_output_callback, prevparam, NULL, NULL);
170
171   return res;
172}
173
174// Verifies the ROM set while calling SetRomAuditResults   
175int MameUIVerifyRomSet(int game)
176{
177   audit_record *audit;
178   int audit_records;
179   int res;
180
181   // perform the audit
182   audit_records = audit_images(MameUIGlobal(), drivers[game], AUDIT_VALIDATE_FAST, &audit);
183   res = ProcessAuditResults(game, audit, audit_records);
184   if (audit_records > 0)
185      free(audit);
186
187   SetRomAuditResults(game, res);
188   return res;
189}
190
191// Verifies the Sample set while calling SetSampleAuditResults   
192int MameUIVerifySampleSet(int game)
193{
194   audit_record *audit;
195   int audit_records;
196   int res;
197
198   // perform the audit
199   audit_records = audit_samples(MameUIGlobal(), drivers[game], &audit);
200   res = ProcessAuditResults(game, audit, audit_records);
201   if (audit_records > 0)
202      free(audit);
203
204   SetSampleAuditResults(game, res);
205   return res;
206}
207
208static DWORD WINAPI AuditThreadProc(LPVOID hDlg)
209{
210   char buffer[200];
211
212   while (!bCancel)
213   {
214      if (!bPaused)
215      {
216         if (rom_index != -1)
217         {
218            sprintf(buffer, "Checking Game %s - %s",
219               drivers[rom_index]->name, drivers[rom_index]->description);
220            win_set_window_text_utf8(hDlg, buffer);
221            ProcessNextRom();
222         }
223         else
224         {
225            if (sample_index != -1)
226            {
227               sprintf(buffer, "Checking Game %s - %s",
228                  drivers[sample_index]->name, drivers[sample_index]->description);
229               win_set_window_text_utf8(hDlg, buffer);
230               ProcessNextSample();
231            }
232            else
233            {
234               win_set_window_text_utf8(hDlg, "File Audit");
235               EnableWindow(GetDlgItem(hDlg, IDPAUSE), FALSE);
236               ExitThread(1);
237            }
238         }
239      }
240   }
241   return 0;
242}
243
244static INT_PTR CALLBACK AuditWindowProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
245{
246   static HANDLE hThread;
247   static DWORD dwThreadID;
248   DWORD dwExitCode;
249   HWND hEdit;
250
251   switch (Msg)
252   {
253   case WM_INITDIALOG:
254      hAudit = hDlg;
255      //RS 20030613 Set Bkg of RichEdit Ctrl
256      hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS);
257      if (hEdit != NULL)
258      {
259         SendMessage( hEdit, EM_SETBKGNDCOLOR, FALSE, GetSysColor(COLOR_BTNFACE) );
260         // MSH - Set to max
261         SendMessage( hEdit, EM_SETLIMITTEXT, MAX_AUDITBOX_TEXT, 0 );
262
263      }
264      SendDlgItemMessage(hDlg, IDC_ROMS_PROGRESS,    PBM_SETRANGE, 0, MAKELPARAM(0, driver_list_get_count(drivers)));
265      SendDlgItemMessage(hDlg, IDC_SAMPLES_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, driver_list_get_count(drivers)));
266      bPaused = FALSE;
267      bCancel = FALSE;
268      rom_index = 0;
269      hThread = CreateThread(NULL, 0, AuditThreadProc, hDlg, 0, &dwThreadID);
270      return 1;
271
272   case WM_COMMAND:
273      switch (LOWORD(wParam))
274      {
275      case IDCANCEL:
276            bPaused = FALSE;
277         if (hThread)
278         {
279            bCancel = TRUE;
280            if (GetExitCodeThread(hThread, &dwExitCode) && dwExitCode == STILL_ACTIVE)
281            {
282               PostMessage(hDlg, WM_COMMAND, wParam, lParam);
283               return 1;
284            }
285            CloseHandle(hThread);
286         }
287         EndDialog(hDlg,0);
288         break;
289
290      case IDPAUSE:
291         if (bPaused)
292         {
293            SendDlgItemMessage(hAudit, IDPAUSE, WM_SETTEXT, 0, (LPARAM)TEXT("Pause"));
294            bPaused = FALSE;
295         }
296         else
297         {
298            SendDlgItemMessage(hAudit, IDPAUSE, WM_SETTEXT, 0, (LPARAM)TEXT("Continue"));
299            bPaused = TRUE;
300         }
301         break;
302      }
303      return 1;
304   }
305   return 0;
306}
307
308/* Callback for the Audit property sheet */
309INT_PTR CALLBACK GameAuditDialogProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam)
310{
311   switch (Msg)
312   {
313   case WM_INITDIALOG:
314      FlushFileCaches();
315      hAudit = hDlg;
316      win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_TITLE), GameInfoTitle(OPTIONS_GAME, rom_index));
317      SetTimer(hDlg, 0, 1, NULL);
318      return 1;
319
320   case WM_TIMER:
321      KillTimer(hDlg, 0);
322      {
323         int iStatus;
324         LPCSTR lpStatus;
325
326         iStatus = MameUIVerifyRomSet(rom_index);
327         lpStatus = DriverUsesRoms(rom_index) ? StatusString(iStatus) : "None required";
328         win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_ROMS), lpStatus);
329
330         iStatus = MameUIVerifySampleSet(rom_index);
331         lpStatus = DriverUsesSamples(rom_index) ? StatusString(iStatus) : "None required";
332         win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_SAMPLES), lpStatus);
333      }
334      ShowWindow(hDlg, SW_SHOW);
335      break;
336   }
337   return 0;
338}
339
340static void ProcessNextRom()
341{
342   int retval;
343   TCHAR buffer[200];
344
345   retval = MameUIVerifyRomSet(rom_index);
346   switch (retval)
347   {
348   case BEST_AVAILABLE: /* correct, incorrect or separate count? */
349   case CORRECT:
350      roms_correct++;
351      _stprintf(buffer, TEXT("%i"), roms_correct);
352      SendDlgItemMessage(hAudit, IDC_ROMS_CORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
353      _stprintf(buffer, TEXT("%i"), roms_correct + roms_incorrect);
354      SendDlgItemMessage(hAudit, IDC_ROMS_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
355      break;
356
357   case NOTFOUND:
358      break;
359
360   case INCORRECT:
361      roms_incorrect++;
362      _stprintf(buffer, TEXT("%i"), roms_incorrect);
363      SendDlgItemMessage(hAudit, IDC_ROMS_INCORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
364      _stprintf(buffer, TEXT("%i"), roms_correct + roms_incorrect);
365      SendDlgItemMessage(hAudit, IDC_ROMS_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
366      break;
367   }
368
369   rom_index++;
370   SendDlgItemMessage(hAudit, IDC_ROMS_PROGRESS, PBM_SETPOS, rom_index, 0);
371
372   if (rom_index == driver_list_get_count(drivers))
373   {
374      sample_index = 0;
375      rom_index = -1;
376   }
377}
378
379static void ProcessNextSample()
380{
381   int  retval;
382   TCHAR buffer[200];
383   
384   retval = MameUIVerifySampleSet(sample_index);
385   
386   switch (retval)
387   {
388   case CORRECT:
389      if (DriverUsesSamples(sample_index))
390      {
391         samples_correct++;
392         _stprintf(buffer, TEXT("%i"), samples_correct);
393         SendDlgItemMessage(hAudit, IDC_SAMPLES_CORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
394         _stprintf(buffer, TEXT("%i"), samples_correct + samples_incorrect);
395         SendDlgItemMessage(hAudit, IDC_SAMPLES_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
396         break;
397      }
398
399   case NOTFOUND:
400      break;
401         
402   case INCORRECT:
403      samples_incorrect++;
404      _stprintf(buffer, TEXT("%i"), samples_incorrect);
405      SendDlgItemMessage(hAudit, IDC_SAMPLES_INCORRECT, WM_SETTEXT, 0, (LPARAM)buffer);
406      _stprintf(buffer, TEXT("%i"), samples_correct + samples_incorrect);
407      SendDlgItemMessage(hAudit, IDC_SAMPLES_TOTAL, WM_SETTEXT, 0, (LPARAM)buffer);
408     
409      break;
410   }
411
412   sample_index++;
413   SendDlgItemMessage(hAudit, IDC_SAMPLES_PROGRESS, PBM_SETPOS, sample_index, 0);
414   
415   if (sample_index == driver_list_get_count(drivers))
416   {
417      DetailsPrintf("Audit complete.\n");
418      SendDlgItemMessage(hAudit, IDCANCEL, WM_SETTEXT, 0, (LPARAM)TEXT("Close"));
419      sample_index = -1;
420   }
421}
422
423static void CLIB_DECL DetailsPrintf(const char *fmt, ...)
424{
425   HWND   hEdit;
426   va_list marker;
427   char   buffer[2000];
428   TCHAR*  t_s;
429   int      textLength;
430
431   //RS 20030613 Different Ids for Property Page and Dialog
432   // so see which one's currently instantiated
433   hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS);
434   if (hEdit ==  NULL)
435      hEdit = GetDlgItem(hAudit, IDC_AUDIT_DETAILS_PROP);
436   
437   if (hEdit == NULL)
438   {
439      dprintf("audit detailsprintf() can't find any audit control");
440      return;
441   }
442
443   va_start(marker, fmt);
444   
445   vsprintf(buffer, fmt, marker);
446   
447   va_end(marker);
448
449   t_s = tstring_from_utf8(ConvertToWindowsNewlines(buffer));
450   if( !t_s || _tcscmp(TEXT(""), t_s) == 0)
451      return;
452
453   textLength = Edit_GetTextLength(hEdit);
454   Edit_SetSel(hEdit, textLength, textLength);
455   SendMessage( hEdit, EM_REPLACESEL, FALSE, (WPARAM)(LPCTSTR)win_tstring_strdup(t_s) );
456   
457   free(t_s);
458}
459
460static const char * StatusString(int iStatus)
461{
462   static const char *ptr;
463
464   ptr = "Unknown";
465
466   switch (iStatus)
467   {
468   case CORRECT:
469      ptr = "Passed";
470      break;
471     
472   case BEST_AVAILABLE:
473      ptr = "Best available";
474      break;
475     
476   case NOTFOUND:
477      ptr = "Not found";
478      break;
479     
480   case INCORRECT:
481      ptr = "Failed";
482      break;
483   }
484
485   return ptr;
486}
src/osd/winui/directories.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/dijoystick.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/picker.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/screenshot.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/mui_audit.h
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14#ifndef MUI_AUDIT_H
15#define MUI_AUDIT_H
16
17void AuditDialog(HWND hParent);
18
19// For property sheet Game Audit tab
20void InitGameAudit(int gameIndex);
21INT_PTR CALLBACK GameAuditDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
22
23int MameUIVerifyRomSet(int game);
24int MameUIVerifySampleSet(int game);
25
26const char * GetAuditString(int audit_result);
27BOOL IsAuditResultKnown(int audit_result);
28BOOL IsAuditResultYes(int audit_result);
29BOOL IsAuditResultNo(int audit_result);
30
31#endif
src/osd/winui/splitters.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Splitter code Copyright (C) 1997-98 Mike Haaland
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1213 
1314 /***************************************************************************
1415
15  Splitters.c
16  splitters.c
1617
17  Splitter GUI code.
18  Splitter GUI code. - Tree, spliiter, list, splitter, pict
1819
1920  Created 12/03/98 (C) by Mike Haaland (mhaaland@hypertech.com)
2021
2122***************************************************************************/
2223
23/*
2424
25  Tree, spliiter, list, splitter, pict
26
27*/
28 
29
25// standard windows headers
3026#define WIN32_LEAN_AND_MEAN
3127#include <windows.h>
3228#include <windowsx.h>
3329#include <commctrl.h>
3430
31// MAME/MAMEUI headers
3532#include "splitters.h"
36#include "bitmask.h"
37#include "m32opts.h"
33#include "mui_opts.h"
3834#include "resource.h"
39#include "screenshot.h"
40#include "win32ui.h"
35#include "winui.h"
4136
4237/* Local Variables */
4338static BOOL         bTracking = 0;
src/osd/winui/bitmask.c
r1367r1368
1/* Bitmask.c - Bitmask support routines - MSH 11/19/1998 */
1/***************************************************************************
22
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14/* bitmask.c - Bitmask support routines - MSH 11/19/1998 */
15
16// standard windows headers
317#define WIN32_LEAN_AND_MEAN
418#include <windows.h>
519
6#include "bitmask.h"
20// standard C headers
721#include <stdlib.h> /* For malloc and free */
822
23// MAME/MAMEUI headers
24#include "bitmask.h"
25
926/* Bit routines */
1027static UCHAR maskTable[8] = {
1128   0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
src/osd/winui/directinput.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1718  Direct Input routines.
1819 
1920 ***************************************************************************/
20
21// standard windows headers
2122#define WIN32_LEAN_AND_MEAN
2223#include <windows.h>
24
25// MAME/MAMEUI headers
2326#include "directinput.h"
24#include "m32util.h"
27#include "mui_util.h" // For ErrorMsg
2528
2629/***************************************************************************
2730   function prototypes
src/osd/winui/resource.h
r1367r1368
11//{{NO_DEPENDENCIES}}
22// Microsoft Visual C++ generated include file.
3// Used by mame32.rc
3// Used by mameui.rc
44//
55#define IDPAUSE                         3
66#define IDAPPLY                         4
r1367r1368
3333#define ID_TOOLBAR_EDIT                 92
3434#define IDD_MAIN                        101
3535#define IDA_TAB_KEYS                    106
36#define IDI_MAME32_ICON                 107
36#define IDI_MAMEUI_ICON                 107
3737#define IDD_ABOUT                       108
3838#define IDR_MAIN_MENU                   109
3939#define IDR_UI_MENU                     110
r1367r1368
357357#define ID_FILE_PLAY_RECORD_MNG         40022
358358#define ID_VIEW_PICTURE_AREA            40023
359359#define ID_HELP_CONTENTS                40025
360#define ID_HELP_WHATS_NEW32             40026
360#define ID_HELP_WHATS_NEWUI             40026
361361#define ID_HELP_TROUBLE                 40027
362362#define ID_HELP_RELEASE                 40028
363363#define ID_HELP_WHATS_NEW               40029
src/osd/winui/mui_main.c
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14#define WINUI
15
16// import the main() from MAME, but rename it so we can call it indirectly
17#undef main
18#define main mame_main
19#include "windows/main.c"
20#undef main
21
22#include "winui.h"
23
24
25int WINAPI WinMain(HINSTANCE    hInstance,
26                   HINSTANCE    hPrevInstance,
27                   LPSTR        lpCmdLine,
28                   int          nCmdShow)
29{
30   return MameUIMain(hInstance, lpCmdLine, nCmdShow);
31}
src/osd/winui/splitters.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Splitter Code (C) 1998 Mike Haaland <mhaaland@hypertech.com>
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/mameui.rc
r0r1368
1// Microsoft Visual C++ generated resource script.
2//
3#include "resource.h"
4
5#ifdef MESS
6#include "resourcems.h"
7#endif
8
9// Generated Help ID header file
10#define APSTUDIO_HIDDEN_SYMBOLS
11#include "resource.hm"
12#undef APSTUDIO_HIDDEN_SYMBOLS
13
14#define APSTUDIO_READONLY_SYMBOLS
15/////////////////////////////////////////////////////////////////////////////
16//
17// Generated from the TEXTINCLUDE 2 resource.
18//
19#define NOWINRES
20#include "windows.h"
21#include "commctrl.h"
22
23/////////////////////////////////////////////////////////////////////////////
24#undef APSTUDIO_READONLY_SYMBOLS
25
26/////////////////////////////////////////////////////////////////////////////
27// English (U.S.) resources
28
29#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
30#ifdef _WIN32
31LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
32#pragma code_page(1252)
33#endif //_WIN32
34
35/////////////////////////////////////////////////////////////////////////////
36//
37// Menu
38//
39
40IDR_MAIN_MENU MENU
41BEGIN
42    POPUP "&File"
43    BEGIN
44        MENUITEM "&Exit",                       ID_FILE_EXIT
45    END
46    POPUP "&Help"
47    BEGIN
48#ifdef MESS
49        MENUITEM "&About MESS",               ID_ABOUT
50#else
51        MENUITEM "&About MAMEUI",               ID_ABOUT
52#endif
53    END
54END
55
56IDR_UI_MENU MENU
57BEGIN
58    POPUP "&File"
59    BEGIN
60        MENUITEM "&Play",                       ID_FILE_PLAY
61        MENUITEM SEPARATOR
62        MENUITEM "Play and &Record Input...",   ID_FILE_PLAY_RECORD
63        MENUITEM "P&layback Input...",          ID_FILE_PLAY_BACK
64        MENUITEM SEPARATOR
65        MENUITEM "Play and Record &Wave Output...", ID_FILE_PLAY_RECORD_WAVE
66        MENUITEM SEPARATOR
67        MENUITEM "Play and Record &MNG Output...", ID_FILE_PLAY_RECORD_MNG
68        MENUITEM SEPARATOR
69        MENUITEM "Loa&d Savestate...",          ID_FILE_LOADSTATE
70        MENUITEM SEPARATOR
71#ifdef MESS
72        MENUITEM "&Select Random System",       ID_CONTEXT_SELECT_RANDOM
73        MENUITEM SEPARATOR
74        MENUITEM "Op&en Other Software...",     ID_MESS_OPEN_SOFTWARE
75        MENUITEM "&Create Image...",         ID_MESS_CREATE_SOFTWARE
76#ifdef MAME_DEBUG
77        MENUITEM SEPARATOR
78        MENUITEM "Run Tests",               ID_MESS_RUN_TESTS
79#endif
80#else /* !MESS */
81        MENUITEM "&Select Random Game",         ID_CONTEXT_SELECT_RANDOM
82#endif
83        MENUITEM SEPARATOR
84        MENUITEM "Pr&operties",                 ID_GAME_PROPERTIES
85        MENUITEM SEPARATOR
86#ifdef MESS
87        MENUITEM "&Audit all systems",          ID_FILE_AUDIT
88#else
89        MENUITEM "&Audit all games",            ID_FILE_AUDIT
90#endif
91        MENUITEM SEPARATOR
92        MENUITEM "E&xit",                       ID_FILE_EXIT
93    END
94    POPUP "&View"
95    BEGIN
96        MENUITEM "&Toolbar\tAlt+T",             ID_VIEW_TOOLBARS
97        MENUITEM "&Status bar\tAlt+S",          ID_VIEW_STATUS
98        MENUITEM "Fold&er List\tAlt+D",         ID_VIEW_FOLDERS
99        MENUITEM "&Picture Area\tAlt+P",        ID_VIEW_PICTURE_AREA
100        MENUITEM "Screenshot Ta&b\tAlt+B",      ID_VIEW_PAGETAB
101        MENUITEM SEPARATOR
102        MENUITEM "&Fullscreen\tF11",            ID_VIEW_FULLSCREEN
103        MENUITEM SEPARATOR
104        POPUP "S&how Pictures"
105        BEGIN
106            MENUITEM "&Snapshot",                   ID_TOGGLE_TAB_SCREENSHOT
107            MENUITEM "&Flyer",                      ID_TOGGLE_TAB_FLYER
108            MENUITEM "&Cabinet",                    ID_TOGGLE_TAB_CABINET
109            MENUITEM "&Marquee",                    ID_TOGGLE_TAB_MARQUEE
110            MENUITEM "&Title",                      ID_TOGGLE_TAB_TITLE
111            MENUITEM "Control &Panel",              ID_TOGGLE_TAB_CONTROL_PANEL
112            MENUITEM "PC&B",                        ID_TOGGLE_TAB_PCB
113
114            MENUITEM "&History",                    ID_TOGGLE_TAB_HISTORY
115        END
116        MENUITEM SEPARATOR
117        MENUITEM "L&arge Icons",                ID_VIEW_LARGE_ICON
118        MENUITEM "S&mall Icons",                ID_VIEW_SMALL_ICON
119        MENUITEM "&List",                       ID_VIEW_LIST_MENU
120        MENUITEM "&Details",                    ID_VIEW_DETAIL
121        MENUITEM "&Grouped",                    ID_VIEW_GROUPED
122        MENUITEM SEPARATOR
123        POPUP "Arrange &Icons"
124        BEGIN
125            MENUITEM "by &Name",                    ID_VIEW_BYGAME
126            MENUITEM "by D&irectory",               ID_VIEW_BYDIRECTORY
127            MENUITEM "by &Manufacturer",            ID_VIEW_BYMANUFACTURER
128            MENUITEM "by Times &Played",            ID_VIEW_BYTIMESPLAYED
129            MENUITEM "by &Type",                    ID_VIEW_BYTYPE
130            MENUITEM "by &Date",                    ID_VIEW_BYYEAR
131        END
132        MENUITEM "Line &Up Icons",              ID_VIEW_LINEUPICONS
133        MENUITEM SEPARATOR
134        MENUITEM "&Refresh\tF5",                ID_UPDATE_GAMELIST
135        MENUITEM "&Custom Filters...\tCtrl+F",  ID_CONTEXT_FILTERS
136        MENUITEM "Customi&ze Fields...",        ID_CUSTOMIZE_FIELDS
137    END
138    POPUP "&Options"
139    BEGIN
140#ifdef MESS
141        MENUITEM "System List &Font...",          ID_OPTIONS_FONT
142        MENUITEM "System List &Clone Color...",   ID_OPTIONS_CLONE_COLOR
143        MENUITEM "&Directories...",             ID_OPTIONS_DIR
144        MENUITEM "Default System &Options...",    ID_OPTIONS_DEFAULTS
145#else
146        MENUITEM "Game List &Font...",          ID_OPTIONS_FONT
147        MENUITEM "Game List &Clone Color...",   ID_OPTIONS_CLONE_COLOR
148        MENUITEM "&Directories...",             ID_OPTIONS_DIR
149        MENUITEM "Default Game &Options...",    ID_OPTIONS_DEFAULTS
150#endif
151        MENUITEM "&Reset to Default...",        ID_OPTIONS_RESET_DEFAULTS
152        MENUITEM "&Interface Options...",       ID_OPTIONS_INTERFACE
153        MENUITEM "&Background Image...",        ID_OPTIONS_BG
154    END
155    POPUP "&Help"
156    BEGIN
157#ifdef MESS
158        MENUITEM "&Mess Release Notes",         ID_HELP_RELEASE
159        MENUITEM "&New Mess Features",          ID_HELP_WHATS_NEW
160#else
161        MENUITEM "&Contents\tF1",               ID_HELP_CONTENTS
162        MENUITEM "&Troubleshooting",            ID_HELP_TROUBLE
163        MENUITEM SEPARATOR
164        MENUITEM "&New Game Changes",           ID_HELP_WHATS_NEWUI
165        MENUITEM "&Mame Release Notes",         ID_HELP_WHATS_NEW
166#endif
167        MENUITEM SEPARATOR
168        MENUITEM "&About",                      ID_HELP_ABOUT
169    END
170END
171
172IDR_CONTEXT_MENU MENU
173BEGIN
174    POPUP "Context Menu"
175    BEGIN
176        MENUITEM "&Play",                       ID_FILE_PLAY
177        MENUITEM SEPARATOR
178        MENUITEM "Play and &Record Input...",   ID_FILE_PLAY_RECORD
179        MENUITEM SEPARATOR
180        MENUITEM "&Add to Custom Folder...",    ID_CONTEXT_ADD_CUSTOM
181        MENUITEM "R&emove From This Folder",    ID_CONTEXT_REMOVE_CUSTOM
182        MENUITEM "&Custom Filters...",          ID_CONTEXT_FILTERS
183        MENUITEM SEPARATOR
184#ifdef MESS
185        MENUITEM "&Select Random System",         ID_CONTEXT_SELECT_RANDOM
186#else
187        MENUITEM "&Select Random Game",         ID_CONTEXT_SELECT_RANDOM
188#endif
189        MENUITEM SEPARATOR
190        MENUITEM "Rese&t Playcount",            ID_CONTEXT_RESET_PLAYCOUNT
191        MENUITEM "Reset Pla&y Time",            ID_CONTEXT_RESET_PLAYTIME
192        MENUITEM SEPARATOR
193        MENUITEM "A&udit",                      ID_GAME_AUDIT
194        MENUITEM SEPARATOR
195        MENUITEM "Pr&operties",                 ID_GAME_PROPERTIES
196        MENUITEM "Source propert&ies",          ID_FOLDER_SOURCEPROPERTIES
197        MENUITEM "&Vector properties",          ID_FOLDER_VECTORPROPERTIES
198    END
199END
200
201IDR_CONTEXT_HEADER MENU
202BEGIN
203    POPUP "Header Context Menu"
204    BEGIN
205        MENUITEM "Sort &Ascending",             ID_SORT_ASCENDING
206        MENUITEM "Sort &Descending",            ID_SORT_DESCENDING
207        MENUITEM SEPARATOR
208        MENUITEM "Customi&ze Fields...",        ID_CUSTOMIZE_FIELDS
209    END
210END
211
212IDR_CONTEXT_TREE MENU
213BEGIN
214    POPUP "Context Menu Tree"
215    BEGIN
216        MENUITEM "&Rename",                     ID_CONTEXT_RENAME_CUSTOM
217        MENUITEM "&Custom Filters...",          ID_CONTEXT_FILTERS
218        MENUITEM SEPARATOR
219        POPUP "&Show Folders"
220        BEGIN
221            MENUITEM "overridden by code",          ID_CONTEXT_SHOW_FOLDER_START
222
223        END
224        MENUITEM SEPARATOR
225        MENUITEM "&Audit",                      ID_FOLDER_AUDIT
226        MENUITEM SEPARATOR
227        MENUITEM "&Properties",                 ID_FOLDER_PROPERTIES
228    END
229END
230
231IDR_CONTEXT_SCREENSHOT MENU
232BEGIN
233    POPUP "Context Screen Shot"
234    BEGIN
235        MENUITEM "Show Tab &Control",           ID_VIEW_PAGETAB
236        MENUITEM SEPARATOR
237        POPUP "S&how Pictures"
238        BEGIN
239            MENUITEM "&Snapshot",                   ID_TOGGLE_TAB_SCREENSHOT
240            MENUITEM "&Flyer",                      ID_TOGGLE_TAB_FLYER
241            MENUITEM "&Cabinet",                    ID_TOGGLE_TAB_CABINET
242            MENUITEM "&Marquee",                    ID_TOGGLE_TAB_MARQUEE
243            MENUITEM "&Title",                      ID_TOGGLE_TAB_TITLE
244            MENUITEM "Control &Panel",              ID_TOGGLE_TAB_CONTROL_PANEL
245            MENUITEM "PC&B",                        ID_TOGGLE_TAB_PCB
246
247            MENUITEM "&History",                    ID_TOGGLE_TAB_HISTORY
248        END
249        MENUITEM SEPARATOR
250        MENUITEM "&Snapshot",                   ID_VIEW_TAB_SCREENSHOT
251        MENUITEM "&Flyer",                      ID_VIEW_TAB_FLYER
252        MENUITEM "&Cabinet",                    ID_VIEW_TAB_CABINET
253        MENUITEM "&Marquee",                    ID_VIEW_TAB_MARQUEE
254        MENUITEM "&Title",                      ID_VIEW_TAB_TITLE
255        MENUITEM "Control &Panel",              ID_VIEW_TAB_CONTROL_PANEL
256        MENUITEM "PC&B",                        ID_VIEW_TAB_PCB
257        MENUITEM "&History",                    ID_VIEW_TAB_HISTORY
258    END
259END
260
261
262#ifdef APSTUDIO_INVOKED
263/////////////////////////////////////////////////////////////////////////////
264//
265// TEXTINCLUDE
266//
267
2681 TEXTINCLUDE
269BEGIN
270    "resource.h\0"
271END
272
2732 TEXTINCLUDE
274BEGIN
275    "#define NOWINRES\r\n"
276    "#include ""windows.h""\r\n"
277    "#include ""commctrl.h""\r\n"
278    "\0"
279END
280
2813 TEXTINCLUDE
282BEGIN
283    "#include ""mamevers.rc"" // Version block\r\n"
284    "\r\n"
285    "\0"
286END
287
288#endif    // APSTUDIO_INVOKED
289
290
291/////////////////////////////////////////////////////////////////////////////
292//
293// Icon
294//
295
296// Icon with lowest ID value placed first to ensure application icon
297// remains consistent on all systems.
298#ifdef MESS
299IDI_MAME32_ICON         ICON                    "res/mess.ico"
300#else
301IDI_MAMEUI_ICON         ICON                    "res\\mameui.ico"
302#endif
303IDI_WIN_ROMS            ICON                    "res\\win_roms.ico"
304IDI_WIN_NOROMS          ICON                    "res\\win_noro.ico"
305IDI_WIN_UNKNOWN         ICON                    "res\\win_unkn.ico"
306IDI_WIN_CLONE           ICON                    "res\\win_clone.ico"
307IDI_WIN_REDX            ICON                    "res\\win_redx.ico"
308IDI_FOLDER_AVAILABLE    ICON                    "res\\foldavail.ico"
309IDI_FOLDER              ICON                    "res\\folder.ico"
310IDI_FOLDER_MANUFACTURER ICON                    "res\\foldmanu.ico"
311IDI_FOLDER_OPEN         ICON                    "res\\foldopen.ico"
312IDI_FOLDER_UNAVAILABLE  ICON                    "res\\foldunav.ico"
313IDI_FOLDER_HORIZONTAL   ICON                    "res\\horz.ico"
314IDI_FOLDER_VERTICAL     ICON                    "res\\vert.ico"
315IDI_MANUFACTURER        ICON                    "res\\manufact.ico"
316IDI_FOLDER_YEAR         ICON                    "res\\foldyear.ico"
317IDI_FOLDER_SOURCE       ICON                    "res\\foldsrc.ico"
318IDI_WORKING             ICON                    "res\\working.ico"
319IDI_NONWORKING          ICON                    "res\\nonwork.ico"
320IDI_YEAR                ICON                    "res\\year.ico"
321IDI_KEYBOARD            ICON                    "res\\keyboard.ico"
322IDI_JOYSTICK            ICON                    "res\\joystick.ico"
323IDI_CPU                 ICON                    "res\\cpu.ico"
324IDI_SOUND               ICON                    "res\\samples.ico"
325IDI_SOUNDTAB            ICON                    "res\\sound.ico"
326IDI_SOURCE              ICON                    "res\\source.ico"
327IDI_HARDDISK            ICON                    "res\\harddisk.ico"
328IDI_DISPLAY             ICON                    "res\\display.ico"
329IDI_CHECKMARK           ICON                    "res\\checkmark.ico"
330IDI_HEADER_UP           ICON                    "res\\header_up.ico"
331IDI_HEADER_DOWN         ICON                    "res\\header_down.ico"
332
333#ifdef MESS
334IDI_WIN_NOROMSNEEDED    ICON                    "res/win_nrnd.ico"
335IDI_WIN_MISSINGOPTROM   ICON                  "res/win_noor.ico"
336IDI_WIN_FLOP            ICON                 "res/win_flop.ico"
337IDI_WIN_CASS            ICON                 "res/win_cass.ico"
338IDI_WIN_SERL            ICON                   "res/win_serl.ico"
339IDI_WIN_SNAP            ICON                 "res/win_snap.ico"
340IDI_WIN_PRIN            ICON                 "res/win_prin.ico"
341IDI_WIN_HARD            ICON                 "res/win_hard.ico"
342IDI_WIN_CYLN            ICON                 "res/win_cyln.ico"
343IDI_WIN_PTAP            ICON                 "res/win_ptap.ico"
344IDI_WIN_PCRD            ICON                 "res/win_pcrd.ico"
345#endif
346
347/////////////////////////////////////////////////////////////////////////////
348//
349// Dialog
350//
351
352IDD_ABOUT DIALOG  0, 0, 296, 129
353STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
354#ifdef MESS
355CAPTION "About MESS"
356#else
357CAPTION "About MAMEUI"
358#endif
359FONT 8, "MS Shell Dlg"
360BEGIN
361    DEFPUSHBUTTON   "&OK",IDOK,200,109,50,14,WS_GROUP
362#ifdef MESS
363    CTEXT           "Multi Emulator Super System",IDC_STATIC,147,7,142,
364                    11,NOT WS_GROUP
365    CTEXT           "Version 0",IDC_VERSION,147,18,142,11,NOT WS_GROUP
366    CTEXT           "Copyright (C) 1998-2005 The MESS Team",IDC_STATIC,147,
367                    29,142,10,NOT WS_GROUP
368    CTEXT           "MESS UI based on MAMEUI version by",IDC_STATIC,147,51,142,10,NOT
369                    WS_GROUP
370#else
371    CTEXT           "Multiple Arcade Machine Emulator",IDC_STATIC,147,7,142,
372                    11,NOT WS_GROUP
373    CTEXT           "Version 0",IDC_VERSION,147,18,142,11,NOT WS_GROUP
374    CTEXT           "Copyright (C) 1997-2007 The MAME Team",IDC_STATIC,147,
375                    29,142,10,NOT WS_GROUP
376    CTEXT           "MAMEUI version by",IDC_STATIC,147,51,142,10,NOT
377                    WS_GROUP
378#endif
379    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,147,44,142,1
380    CTEXT           "Christopher Kirmse and the MAMEUI team",IDC_STATIC,
381                    147,62,142,9,NOT WS_GROUP
382    CTEXT           "Additional MAMEUI code by",IDC_STATIC,147,74,142,9
383    CTEXT           "Mike Haaland, Andrew Kirmse, Jeff Miller",IDC_STATIC,
384                    147,85,142,9
385    CTEXT           "John Hardy IV and Michael Soderstrom",IDC_STATIC,147,96,142,9
386    CONTROL         "",IDC_ABOUT,"Static",SS_BITMAP | SS_SUNKEN,7,7,16,14
387END
388
389IDD_DIRECTX DIALOG  0, 0, 236, 69
390STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
391#ifdef MESS
392CAPTION "MESS"
393#else
394CAPTION "MAMEUI"
395#endif
396FONT 8, "MS Shell Dlg"
397BEGIN
398    DEFPUSHBUTTON   "Go to Microsoft's DirectX Web Page",IDB_WEB_PAGE,48,52,
399                    140,14
400    EDITTEXT        IDC_DIRECTX_HELP,7,0,222,48,ES_MULTILINE |
401                    ES_AUTOHSCROLL | ES_READONLY
402END
403
404IDD_AUDIT DIALOG  0, 0, 283, 188
405STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
406CAPTION "File Audit"
407FONT 8, "MS Shell Dlg"
408BEGIN
409    PUSHBUTTON      "&Pause",IDPAUSE,98,168,40,14
410    PUSHBUTTON      "&Cancel",IDCANCEL,144,168,40,14
411    GROUPBOX        "ROMs",IDC_STATIC,6,4,132,65
412    LTEXT           "Correct:",IDC_STATIC,51,28,32,8
413    CONTROL         "Progress1",IDC_ROMS_PROGRESS,"msctls_progress32",
414                    WS_BORDER | 0x1,14,16,116,8
415    LTEXT           "Incorrect:",IDC_STATIC,51,42,32,8
416    LTEXT           "Total:",IDC_STATIC,51,56,32,8
417    LTEXT           "0",IDC_ROMS_CORRECT,87,28,20,8
418    LTEXT           "0",IDC_ROMS_INCORRECT,87,42,20,8
419    LTEXT           "0",IDC_ROMS_TOTAL,87,56,20,8
420    GROUPBOX        "Samples",IDC_STATIC,145,4,132,65
421    CONTROL         "Progress1",IDC_SAMPLES_PROGRESS,"msctls_progress32",
422                    WS_BORDER | 0x1,153,16,116,8
423    LTEXT           "Correct:",IDC_STATIC,191,28,33,8
424    LTEXT           "Incorrect:",IDC_STATIC,191,42,33,8
425    LTEXT           "Total:",IDC_STATIC,191,56,33,8
426    LTEXT           "0",IDC_SAMPLES_CORRECT,227,28,20,8
427    LTEXT           "0",IDC_SAMPLES_INCORRECT,227,42,20,8
428    LTEXT           "0",IDC_SAMPLES_TOTAL,227,56,20,8
429    GROUPBOX        "Details",IDC_STATIC,6,72,271,90
430    EDITTEXT        IDC_AUDIT_DETAILS,12,82,259,74,ES_MULTILINE |
431                    ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL |
432                    NOT WS_TABSTOP
433END
434
435IDD_DIRECTORIES DIALOG  0, 0, 230, 107
436STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
437CAPTION "Directories"
438FONT 8, "MS Shell Dlg"
439BEGIN
440    LTEXT           "Show directories for:",IDC_STATIC,6,6,67,10
441    COMBOBOX        IDC_DIR_COMBO,6,18,160,79,CBS_DROPDOWNLIST | CBS_SORT |
442                    WS_VSCROLL | WS_TABSTOP
443    LTEXT           "Directories:",IDC_STATIC,6,38,38,10
444    CONTROL         "List1",IDC_DIR_LIST,"SysListView32",LVS_REPORT |
445                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS |
446                    LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER |
447                    WS_TABSTOP,6,50,160,51
448    DEFPUSHBUTTON   "OK",IDOK,173,8,50,14
449    PUSHBUTTON      "Cancel",IDCANCEL,173,26,50,14
450    PUSHBUTTON      "Browse...",IDC_DIR_BROWSE,173,50,50,14
451    PUSHBUTTON      "Insert",IDC_DIR_INSERT,173,68,50,14
452    PUSHBUTTON      "Delete",IDC_DIR_DELETE,173,87,50,14
453END
454
455IDD_COLUMNS DIALOG  0, 0, 302, 145
456STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
457CAPTION "Customize Fields"
458FONT 8, "MS Shell Dlg"
459BEGIN
460    LTEXT           "Available fields:",IDC_STATIC,6,6,80,10,SS_CENTERIMAGE
461    CONTROL         "List1",IDC_LISTAVAILABLECOLUMNS,"SysListView32",
462                    LVS_LIST | LVS_SINGLESEL | LVS_NOCOLUMNHEADER |
463                    LVS_NOSORTHEADER | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,
464                    18,90,100
465    PUSHBUTTON      "Add ->",IDC_BUTTONADD,102,18,46,14,WS_DISABLED
466    PUSHBUTTON      "<- Remove",IDC_BUTTONREMOVE,102,36,46,14,WS_DISABLED
467    LTEXT           "Show these fields in this order:",IDC_STATIC,154,6,96,
468                    10,SS_CENTERIMAGE
469    CONTROL         "List1",IDC_LISTSHOWCOLUMNS,"SysListView32",LVS_LIST |
470                    LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |
471                    WS_BORDER | WS_HSCROLL | WS_TABSTOP,154,18,90,100
472    PUSHBUTTON      "Move Up",IDC_BUTTONMOVEUP,250,18,46,14,WS_DISABLED
473    PUSHBUTTON      "Move Down",IDC_BUTTONMOVEDOWN,250,36,46,14,WS_DISABLED
474    DEFPUSHBUTTON   "OK",IDOK,105,124,44,14
475    PUSHBUTTON      "Cancel",IDCANCEL,155,124,44,14
476END
477
478IDD_PROP_CONTROLLER DIALOGEX 0, 0, 220, 240
479STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
480CAPTION "Controller Mapping"
481FONT 8, "MS Shell Dlg", 0, 0, 0x1
482BEGIN
483    ICON            IDI_JOYSTICK,IDC_STATIC,20,10,20,20
484    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
485                    SS_NOPREFIX
486    GROUPBOX        "Paddle device",IDC_STATIC,4,40,102,28
487    COMBOBOX        IDC_PADDLE,10,50,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
488                    WS_TABSTOP,0,HIDC_PADDLE
489    GROUPBOX        "ADStick device",IDC_STATIC,4,71,102,28
490    COMBOBOX        IDC_ADSTICK,10,80,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
491                    WS_TABSTOP,0,HIDC_ADSTICK
492    GROUPBOX        "Pedal device",IDC_STATIC,4,102,102,28
493    COMBOBOX        IDC_PEDAL,10,112,91,62,CBS_DROPDOWNLIST | WS_VSCROLL |
494                    WS_TABSTOP,0,HIDC_PEDAL
495    GROUPBOX        "Mouse device",IDC_STATIC,4,133,102,28
496    COMBOBOX        IDC_MOUSE,10,142,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
497                    WS_TABSTOP,0,HIDC_MOUSE
498    GROUPBOX        "Dial device",IDC_STATIC,113,40,102,28
499    COMBOBOX        IDC_DIAL,119,50,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
500                    WS_TABSTOP,0,HIDC_DIAL
501    GROUPBOX        "Trackball device",IDC_STATIC,113,71,102,28
502    COMBOBOX        IDC_TRACKBALL,119,80,90,62,CBS_DROPDOWNLIST | WS_VSCROLL |
503                    WS_TABSTOP,0,HIDC_TRACKBALL
504    GROUPBOX        "Lightgun device",IDC_STATIC,113,102,102,28
505    COMBOBOX        IDC_LIGHTGUNDEVICE,119,112,90,62,CBS_DROPDOWNLIST |
506                    WS_VSCROLL | WS_TABSTOP,0,HIDC_LIGHTGUNDEVICE
507    GROUPBOX        "Positional device",IDC_STATIC,113,133,102,28
508    COMBOBOX        IDC_POSITIONAL,119,142,90,62,CBS_DROPDOWNLIST |
509                    WS_VSCROLL | WS_TABSTOP,0,HIDC_POSITIONAL
510    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
511    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
512                    0,0,HIDC_USE_DEFAULT
513END
514
515IDD_PROP_SCREEN DIALOGEX 0, 0, 220, 240
516STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
517CAPTION "Screen"
518FONT 8, "MS Shell Dlg", 0, 0, 0x1
519BEGIN
520    ICON            IDI_DISPLAY,IDC_STATIC,20,10,21,20
521    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
522                    SS_NOPREFIX
523    GROUPBOX        "Number of screens",IDC_STATIC,4,40,103,24
524    CONTROL         "GammaSlider",IDC_NUMSCREENS,"msctls_trackbar32",
525                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,10,50,75,10,0,
526                    HIDC_NUMSCREENS
527    RTEXT           "1",IDC_NUMSCREENSDISP,84,49,14,10,SS_CENTERIMAGE | NOT
528                    WS_GROUP
529    GROUPBOX        "Screen",IDC_STATIC,4,66,103,29
530    COMBOBOX        IDC_SCREEN,10,76,91,64,CBS_DROPDOWNLIST | WS_VSCROLL |
531                    WS_TABSTOP,0,HIDC_SCREEN
532    GROUPBOX        "",IDC_STATIC,4,97,103,28
533    CONTROL         "Autoselect aspect",IDC_ASPECT,"Button",BS_AUTOCHECKBOX |
534                    WS_TABSTOP,10,97,73,10,0,HIDC_ASPECT
535    LTEXT           "Aspect ratio",IDC_ASPECTRATIOTEXT,17,108,40,11,
536                    SS_CENTERIMAGE | NOT WS_GROUP
537    EDITTEXT        IDC_ASPECTRATION,60,108,14,12,ES_RIGHT | ES_AUTOHSCROLL |
538                    ES_NUMBER,0,HIDC_ASPECTRATION
539    LTEXT           ":",IDC_STATIC,76,108,8,10,SS_CENTERIMAGE | NOT WS_GROUP
540    EDITTEXT        IDC_ASPECTRATIOD,80,108,14,12,ES_RIGHT | ES_AUTOHSCROLL |
541                    ES_NUMBER,0,HIDC_ASPECTRATIOD
542    GROUPBOX        "View",IDC_STATIC,4,128,103,28
543    COMBOBOX        IDC_VIEW,10,137,91,64,CBS_DROPDOWNLIST | WS_VSCROLL |
544                    WS_TABSTOP,0,HIDC_VIEW
545    GROUPBOX        "Screennumber",IDC_SCREENSELECTTEXT,113,40,102,28
546    COMBOBOX        IDC_SCREENSELECT,119,50,90,64,CBS_DROPDOWNLIST |
547                    WS_VSCROLL | WS_TABSTOP,0,HIDC_SCREENSELECT
548    GROUPBOX        "Resolution",IDC_STATIC,113,71,102,76,WS_GROUP
549    GROUPBOX        "Size",IDC_STATIC,119,81,90,28,WS_GROUP
550    COMBOBOX        IDC_SIZES,126,91,77,70,CBS_DROPDOWNLIST | WS_VSCROLL |
551                    WS_TABSTOP,0,HIDC_SIZES
552    GROUPBOX        "Refresh",IDC_REFRESHTEXT,119,112,90,28,WS_GROUP
553    COMBOBOX        IDC_REFRESH,126,121,77,76,CBS_DROPDOWNLIST | WS_VSCROLL |
554                    WS_TABSTOP,0,HIDC_REFRESH
555    CONTROL         "Switch resolutions to fit",IDC_SWITCHRES,"Button",
556                    BS_AUTOCHECKBOX | WS_TABSTOP,119,151,93,10,0,
557                    HIDC_SWITCHRES
558    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
559    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
560                    0,0,HIDC_USE_DEFAULT
561END
562
563IDD_PROP_GAME DIALOG  0, 0, 220, 240
564STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
565CAPTION "General"
566FONT 8, "MS Shell Dlg"
567BEGIN
568    ICON            IDI_MAMEUI_ICON,IDC_GAME_ICON,20,10,20,20
569    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
570                    SS_NOPREFIX
571    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
572    LTEXT           "Manufactured:",IDC_STATIC,18,45,47,8
573    LTEXT           "Static",IDC_PROP_MANUFACTURED,75,45,139,9,SS_NOPREFIX
574    LTEXT           "Status:",IDC_STATIC,18,55,47,8
575    LTEXT           "Static",IDC_PROP_STATUS,75,55,139,30
576    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,85,178,1
577    LTEXT           "CPU:",IDC_STATIC,18,90,47,8
578    LTEXT           "Static\nStatic\nStatic\nStatic\nStatic",IDC_PROP_CPU,75,
579                    90,139,40
580    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,130,178,1
581    LTEXT           "Sound:",IDC_STATIC,18,135,47,8
582    LTEXT           "Static\nStatic\nStatic\nStatic\nStatic",IDC_PROP_SOUND,
583                    75,135,139,45
584    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,181,178,1
585    LTEXT           "Screen:",IDC_STATIC,18,188,47,8
586    LTEXT           "Static",IDC_PROP_SCREEN,75,188,139,8
587    LTEXT           "Colors:",IDC_STATIC,18,198,47,8
588    LTEXT           "Static",IDC_PROP_COLORS,75,198,139,8
589    LTEXT           "Clone of:",IDC_PROP_CLONEOF_TEXT,18,218,50,8
590    LTEXT           "Static",IDC_PROP_CLONEOF,75,218,130,18
591    LTEXT           "Source:",IDC_STATIC,18,208,47,8
592    LTEXT           "Static",IDC_PROP_SOURCE,75,208,139,8
593END
594
595IDD_PROP_AUDIT DIALOG  0, 0, 220, 240
596STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
597CAPTION "Audit"
598FONT 8, "MS Shell Dlg"
599BEGIN
600    ICON            IDI_CHECKMARK,IDC_STATIC,20,10,20,20
601    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
602                    SS_NOPREFIX
603    LTEXT           "ROM check:",IDC_STATIC,10,40,50,8
604    LTEXT           "Checking...",IDC_PROP_ROMS,66,40,139,8
605    LTEXT           "Sample check:",IDC_STATIC,10,52,50,8
606    LTEXT           "Checking...",IDC_PROP_SAMPLES,66,52,139,8
607    GROUPBOX        "Details",IDC_STATIC,4,64,211,171
608    EDITTEXT        IDC_AUDIT_DETAILS_PROP,10,74,199,155,ES_MULTILINE |
609                    ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL |
610                    NOT WS_TABSTOP
611END
612
613IDD_PROP_DISPLAY DIALOGEX 0, 0, 220, 240
614STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
615CAPTION "Display"
616FONT 8, "MS Shell Dlg", 0, 0, 0x1
617BEGIN
618    ICON            IDI_DISPLAY,IDC_STATIC,20,10,20,20
619    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,169,25,
620                    SS_NOPREFIX
621    CONTROL         "Run in a window",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX |
622                    WS_TABSTOP,10,40,69,10,0,HIDC_WINDOWED
623    CONTROL         "Start out maximized",IDC_MAXIMIZE,"Button",
624                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,74,10,0,HIDC_MAXIMIZE
625    CONTROL         "Enforce aspect ratio",IDC_KEEPASPECT,"Button",
626                    BS_AUTOCHECKBOX | WS_TABSTOP,10,64,77,10,0,
627                    HIDC_KEEPASPECT
628    CONTROL         "Throttle",IDC_THROTTLE,"Button",BS_AUTOCHECKBOX |
629                    WS_TABSTOP,10,76,39,10,0,HIDC_THROTTLE
630    GROUPBOX        "Bitmap prescaling",IDC_STATIC,4,89,103,24
631    CONTROL         "GammaSlider",IDC_PRESCALE,"msctls_trackbar32",TBS_BOTH |
632                    TBS_NOTICKS | WS_TABSTOP,10,99,71,10,0,HIDC_PRESCALE
633    RTEXT           "1.00",IDC_PRESCALEDISP,84,98,14,11,SS_CENTERIMAGE | NOT
634                    WS_GROUP
635    GROUPBOX        "Gamma Correction",IDC_STATIC,4,115,103,24
636    CONTROL         "GammaSlider",IDC_GAMMA,"msctls_trackbar32",TBS_BOTH |
637                    TBS_NOTICKS | WS_TABSTOP,10,125,71,10,0,HIDC_GAMMA
638    RTEXT           "2.00",IDC_GAMMADISP,84,124,14,10,SS_CENTERIMAGE | NOT
639                    WS_GROUP
640    GROUPBOX        "Brightness Correction",IDC_STATIC,4,141,103,24
641    CONTROL         "GammaSlider",IDC_BRIGHTCORRECT,"msctls_trackbar32",
642                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,10,151,71,10,0,
643                    HIDC_BRIGHTCORRECT
644    RTEXT           "1.00",IDC_BRIGHTCORRECTDISP,84,150,14,10,SS_CENTERIMAGE |
645                    NOT WS_GROUP
646    GROUPBOX        "Contrast Correction",IDC_STATIC,4,167,103,24
647    CONTROL         "GammaSlider",IDC_CONTRAST,"msctls_trackbar32",TBS_BOTH |
648                    TBS_NOTICKS | WS_TABSTOP,10,176,71,10,0,HIDC_CONTRAST
649    RTEXT           "1.00",IDC_CONTRASTDISP,84,175,14,11,SS_CENTERIMAGE |
650                    NOT WS_GROUP
651    GROUPBOX        "Pause Brightness",IDC_STATIC,4,193,103,24
652    CONTROL         "Slider1",IDC_PAUSEBRIGHT,"msctls_trackbar32",TBS_BOTH |
653                    TBS_NOTICKS | WS_TABSTOP,10,203,71,10,0,HIDC_PAUSEBRIGHT
654    RTEXT           "0.65",IDC_PAUSEBRIGHTDISP,84,202,14,11,SS_CENTERIMAGE |
655                    NOT WS_GROUP
656    GROUPBOX        "Videomode",IDC_STATIC,113,40,102,28
657    COMBOBOX        IDC_VIDEO_MODE,119,50,90,50,CBS_DROPDOWNLIST | CBS_SORT |
658                    WS_VSCROLL | WS_TABSTOP,0,HIDC_VIDEO_MODE
659    GROUPBOX        "Rotation",IDC_STATIC,113,71,102,55
660    COMBOBOX        IDC_ROTATE,119,81,90,57,CBS_DROPDOWNLIST | WS_VSCROLL |
661                    WS_TABSTOP,0,HIDC_ROTATE
662    CONTROL         "Flip screen upside-down",IDC_FLIPY,"Button",
663                    BS_AUTOCHECKBOX | WS_TABSTOP,119,98,91,10,0,HIDC_FLIPY
664    CONTROL         "Flip screen left-right",IDC_FLIPX,"Button",
665                    BS_AUTOCHECKBOX | WS_TABSTOP,119,110,77,10,0,HIDC_FLIPX
666    GROUPBOX        "Direct3D",IDC_STATIC,113,128,102,57
667    CONTROL         "Use Bilinear filtering",IDC_D3D_FILTER,"Button",
668                    BS_AUTOCHECKBOX | WS_TABSTOP,119,138,85,10,0,
669                    HIDC_D3D_FILTER
670    GROUPBOX        "Version",IDC_STATIC,119,150,90,28
671    COMBOBOX        IDC_D3D_VERSION,125,160,78,95,CBS_DROPDOWNLIST |
672                    WS_VSCROLL | WS_TABSTOP,0,HIDC_D3D_VERSION
673    GROUPBOX        "DirectDraw",IDC_STATIC,113,187,102,26
674    CONTROL         "Stretch using hardware",IDC_HWSTRETCH,"Button",
675                    BS_AUTOCHECKBOX | WS_TABSTOP,119,197,85,10,0,
676                    HIDC_HWSTRETCH
677    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
678    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
679                    0,0,HIDC_USE_DEFAULT
680END
681
682IDD_PROP_SOUND DIALOGEX 0, 0, 220, 240
683STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
684CAPTION "Sound"
685FONT 8, "MS Shell Dlg", 0, 0, 0x1
686BEGIN
687    ICON            IDI_SOUNDTAB,IDC_STATIC,20,10,20,20
688    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
689                    SS_NOPREFIX
690    GROUPBOX        "",IDC_STATIC,4,40,211,122
691    CONTROL         "Enable sound and sound CPUs",IDC_USE_SOUND,"Button",
692                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,112,10,0,
693                    HIDC_USE_SOUND
694    CONTROL         "Use samples",IDC_SAMPLES,"Button",BS_AUTOCHECKBOX |
695                    WS_TABSTOP,10,52,55,10,0,HIDC_SAMPLES
696    GROUPBOX        "Sample rate",IDC_RATETEXT,60,65,100,28
697    COMBOBOX        IDC_SAMPLERATE,66,75,88,60,CBS_DROPDOWNLIST | WS_VSCROLL |
698                    WS_TABSTOP,0,HIDC_SAMPLERATE
699    GROUPBOX        "Volume attenuation",IDC_STATIC,60,96,100,28
700    CONTROL         "Slider1",IDC_VOLUME,"msctls_trackbar32",TBS_BOTH |
701                    TBS_NOTICKS | WS_TABSTOP,66,108,68,10,0,HIDC_VOLUME
702    RTEXT           "0dB",IDC_VOLUMEDISP,132,107,20,11,SS_CENTERIMAGE
703    GROUPBOX        "Audio latency",IDC_AUDIO_LATENCY_TEXT,60,127,100,28
704    CONTROL         "Slider1",IDC_AUDIO_LATENCY,"msctls_trackbar32",TBS_BOTH |
705                    TBS_NOTICKS | WS_TABSTOP,66,139,68,10,0,
706                    HIDC_AUDIO_LATENCY
707    RTEXT           "1/5",IDC_AUDIO_LATENCY_DISP,132,138,20,11,
708                    SS_CENTERIMAGE
709    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
710    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
711                    0,0,HIDC_USE_DEFAULT
712END
713
714IDD_PROP_ADVANCED DIALOGEX 0, 0, 220, 240
715STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
716CAPTION "Advanced"
717FONT 8, "MS Shell Dlg", 0, 0, 0x1
718BEGIN
719    ICON            IDI_DISPLAY,IDC_STATIC,20,10,20,20
720    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
721                    SS_NOPREFIX
722    CONTROL         "Triple buffering",IDC_TRIPLE_BUFFER,"Button",
723                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,93,10,0,
724                    HIDC_TRIPLE_BUFFER
725    CONTROL         "Sync to monitor refresh",IDC_SYNCREFRESH,"Button",
726                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,93,10,0,
727                    HIDC_SYNCREFRESH
728    CONTROL         "Wait for vertical sync",IDC_WAITVSYNC,"Button",
729                    BS_AUTOCHECKBOX | WS_TABSTOP,10,64,93,10,0,
730                    HIDC_WAITVSYNC
731    CONTROL         "Refresh speed",IDC_REFRESHSPEED,"Button",
732                    BS_AUTOCHECKBOX | WS_TABSTOP,10,76,93,10,0,
733                    HIDC_REFRESHSPEED
734    GROUPBOX        "Frame skipping",IDC_STATIC,4,88,103,42
735    CONTROL         "Automatic",IDC_AUTOFRAMESKIP,"Button",BS_AUTOCHECKBOX |
736                    WS_TABSTOP,10,98,77,10,0,HIDC_AUTOFRAMESKIP
737    COMBOBOX        IDC_FRAMESKIP,10,111,91,88,CBS_DROPDOWNLIST | WS_VSCROLL |
738                    WS_TABSTOP,0,HIDC_FRAMESKIP
739    GROUPBOX        "Full screen gamma",IDC_FSGAMMATEXT,113,40,102,24
740    CONTROL         "Slider1",IDC_FSGAMMA,"msctls_trackbar32",TBS_BOTH |
741                    TBS_NOTICKS | WS_TABSTOP,119,50,71,10,0,HIDC_FSGAMMA
742    RTEXT           "2.00",IDC_FSGAMMADISP,193,49,16,10,SS_CENTERIMAGE | NOT
743                    WS_GROUP
744    GROUPBOX        "Full screen brightness",IDC_FSBRIGHTNESSTEXT,113,67,102,
745                    24
746    CONTROL         "Slider1",IDC_FSBRIGHTNESS,"msctls_trackbar32",TBS_BOTH |
747                    TBS_NOTICKS | WS_TABSTOP,119,77,71,10,0,
748                    HIDC_FSBRIGHTNESS
749    RTEXT           "2.00",IDC_FSBRIGHTNESSDISP,193,76,16,10,SS_CENTERIMAGE |
750                    NOT WS_GROUP
751    GROUPBOX        "Full screen contrast",IDC_FSCONTRASTTEXT,113,94,102,24
752    CONTROL         "Slider1",IDC_FSCONTRAST,"msctls_trackbar32",TBS_BOTH |
753                    TBS_NOTICKS | WS_TABSTOP,119,104,71,10,0,HIDC_FSCONTRAST
754    RTEXT           "2.00",IDC_FSCONTRASTDISP,193,103,16,11,SS_CENTERIMAGE |
755                    NOT WS_GROUP
756    GROUPBOX        "Emulation speed",IDC_SPEEDTEXT,4,133,211,24
757    CONTROL         "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH |
758                    TBS_NOTICKS | WS_TABSTOP,10,143,180,10,0,HIDC_SPEED
759    RTEXT           "1.00",IDC_SPEEDDISP,189,142,20,11,SS_CENTERIMAGE | NOT
760                    WS_GROUP
761    GROUPBOX        "Effect",IDC_STATIC,4,160,211,50
762    EDITTEXT        IDC_EFFECT,10,170,200,14,ES_AUTOHSCROLL | WS_DISABLED
763    PUSHBUTTON      "Select Effect",IDC_SELECT_EFFECT,10,189,60,14,0,0,
764                    HIDC_SELECT_EFFECT
765    PUSHBUTTON      "Reset Effect",IDC_RESET_EFFECT,150,189,60,14,0,0,
766                    HIDC_RESET_EFFECT
767    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
768    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
769                    0,0,HIDC_USE_DEFAULT
770END
771
772IDD_PROP_INPUT DIALOGEX 0, 0, 220, 240
773STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
774CAPTION "Controllers"
775FONT 8, "MS Shell Dlg", 0, 0, 0x1
776BEGIN
777    ICON            IDI_JOYSTICK,IDC_STATIC,20,10,20,20
778    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
779                    SS_NOPREFIX
780    CONTROL         "Enable mouse input",IDC_USE_MOUSE,"Button",
781                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,86,10,0,
782                    HIDC_USE_MOUSE
783    CONTROL         "Enable steadykey support",IDC_STEADYKEY,"Button",
784                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,95,10,0,
785                    HIDC_STEADYKEY
786    GROUPBOX        "",IDC_STATIC,4,64,103,74
787    CONTROL         "Enable joystick input",IDC_JOYSTICK,"Button",
788                    BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,64,78,10,0,
789                    HIDC_JOYSTICK
790    GROUPBOX        "Joystick deadzone",IDC_JDZTEXT,10,76,91,28
791    CONTROL         "IntensitySlider",IDC_JDZ,"msctls_trackbar32",TBS_BOTH |
792                    TBS_NOTICKS | WS_TABSTOP,15,88,60,10,0,HIDC_JDZ
793    RTEXT           "0.3",IDC_JDZDISP,76,87,16,11,SS_CENTERIMAGE | NOT
794                    WS_GROUP
795    GROUPBOX        "Default input layout",IDC_STATIC,113,40,102,28
796    COMBOBOX        IDC_DEFAULT_INPUT,119,50,90,53,CBS_DROPDOWNLIST |
797                    WS_VSCROLL | WS_TABSTOP,0,HIDC_DEFAULT_INPUT
798    GROUPBOX        "",IDC_STATIC,113,71,102,66
799    CONTROL         "Enable lightgun input",IDC_LIGHTGUN,"Button",
800                    BS_AUTOCHECKBOX | WS_TABSTOP,119,71,80,10,0,
801                    HIDC_LIGHTGUN
802    CONTROL         "Offscreen shots reload",IDC_RELOAD,"Button",
803                    BS_AUTOCHECKBOX | WS_TABSTOP,119,83,86,10,0,HIDC_RELOAD
804    CONTROL         "Dual lightguns",IDC_DUAL_LIGHTGUN,"Button",
805                    BS_AUTOCHECKBOX | WS_TABSTOP,119,96,86,10,0,
806                    HIDC_DUAL_LIGHTGUN
807    CONTROL         "Multiple keyboards",IDC_MULTIKEYBOARD,"Button",
808                    BS_AUTOCHECKBOX | WS_TABSTOP,119,109,75,10,0,
809                    HIDC_MULTIKEYBOARD
810    CONTROL         "Multiple mice",IDC_MULTIMOUSE,"Button",BS_AUTOCHECKBOX |
811                    WS_TABSTOP,119,122,56,10,0,HIDC_MULTIMOUSE
812    GROUPBOX        "Joystick saturation",IDC_JSATTEXT,10,106,91,28
813    CONTROL         "IntensitySlider",IDC_JSAT,"msctls_trackbar32",TBS_BOTH |
814                    TBS_NOTICKS | WS_TABSTOP,16,118,60,10,0,HIDC_JSAT
815    RTEXT           "0.85",IDC_JSATDISP,76,116,16,11,SS_CENTERIMAGE | NOT
816                    WS_GROUP
817    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
818    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
819                    0,0,HIDC_USE_DEFAULT
820END
821
822IDD_PROP_MISC DIALOGEX 0, 0, 220, 240
823STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION
824CAPTION "Miscellaneous"
825FONT 8, "MS Shell Dlg", 0, 0, 0x1
826BEGIN
827    ICON            IDI_MAMEUI_ICON,IDC_STATIC,20,10,20,20
828    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
829                    SS_NOPREFIX
830#ifdef MESS
831    CONTROL         "Enable system cheats",IDC_CHEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,40,86,10,0,HIDC_CHEAT
832#else
833    CONTROL         "Enable game cheats",IDC_CHEAT,"Button",BS_AUTOCHECKBOX |
834                    WS_TABSTOP,10,40,86,10,0,HIDC_CHEAT
835#endif
836    CONTROL         "Error log (for developers)",IDC_LOG,"Button",
837                    BS_AUTOCHECKBOX | WS_TABSTOP,10,52,96,10,0,HIDC_LOG
838    CONTROL         "Sleep when possible",IDC_SLEEP,"Button",BS_AUTOCHECKBOX |
839                    WS_TABSTOP,10,64,86,10,0,HIDC_SLEEP
840    CONTROL         "Enable game debugger",IDC_DEBUG,"Button",
841                    BS_AUTOCHECKBOX | WS_TABSTOP,10,76,86,10,0,HIDC_DEBUG
842#ifdef MESS
843    CONTROL         "Skip system info",IDC_SKIP_GAME_INFO,"Button",
844                    BS_AUTOCHECKBOX | WS_TABSTOP,10,88,96,10,0,
845                    HIDC_SKIP_GAME_INFO
846#else
847    CONTROL         "Skip game info",IDC_SKIP_GAME_INFO,"Button",
848                    BS_AUTOCHECKBOX | WS_TABSTOP,10,88,96,10,0,
849                    HIDC_SKIP_GAME_INFO
850#endif
851    CONTROL         "Save game state on exit",IDC_ENABLE_AUTOSAVE,"Button",
852                    BS_AUTOCHECKBOX | WS_TABSTOP,10,100,96,10,0,
853                    HIDC_ENABLE_AUTOSAVE
854    CONTROL         "Multi-threaded rendering",IDC_MULTITHREAD_RENDERING,
855                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,112,96,10,0,
856                    HIDC_MULTITHREAD_RENDERING
857    GROUPBOX        "Thread Priority",IDC_HIGH_PRIORITY_TEXT,4,124,103,34
858    CONTROL         "Slider1",IDC_HIGH_PRIORITY,"msctls_trackbar32",TBS_BOTH |
859                    TBS_NOTICKS | WS_TABSTOP,10,135,75,10,0,
860                    HIDC_HIGH_PRIORITY
861    LTEXT           "idle",IDC_STATIC,13,144,12,8
862    RTEXT           "-15",IDC_HIGH_PRIORITYTXT,84,134,14,10,SS_CENTERIMAGE
863    RTEXT           "real-time",IDC_STATIC,53,144,28,8
864    GROUPBOX        "Artwork options",IDC_STATIC,113,40,102,61
865    CONTROL         "Backdrops",IDC_BACKDROPS,"Button",BS_AUTOCHECKBOX |
866                    WS_TABSTOP,119,50,86,10,0,HIDC_BACKDROPS
867    CONTROL         "Bezels",IDC_BEZELS,"Button",BS_AUTOCHECKBOX |
868                    WS_TABSTOP,119,62,86,10,0,HIDC_BEZELS
869    CONTROL         "Overlays",IDC_OVERLAYS,"Button",BS_AUTOCHECKBOX |
870                    WS_TABSTOP,119,74,84,10,0,HIDC_OVERLAYS
871    CONTROL         "Crop artwork",IDC_ARTWORK_CROP,"Button",BS_AUTOCHECKBOX |
872                    WS_TABSTOP,119,86,53,10,0,HIDC_ARTWORK_CROP
873    GROUPBOX        "BIOS",IDC_STATIC,113,104,102,28
874    COMBOBOX        IDC_BIOS,119,114,90,60,CBS_DROPDOWNLIST | WS_VSCROLL |
875                    WS_TABSTOP,0,HIDC_BIOS
876    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
877    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
878                    0,0,HIDC_USE_DEFAULT
879#ifdef MESS
880    CONTROL         "Skip warnings",IDC_SKIP_WARNINGS,"Button",
881                    BS_AUTOCHECKBOX | WS_TABSTOP,10,180,86,10,0
882    CONTROL         "Use New UI",IDC_USE_NEW_UI,"Button",
883                    BS_AUTOCHECKBOX | WS_TABSTOP,10,192,86,10,0
884#endif
885END
886
887IDD_PROP_VECTOR DIALOGEX 0, 0, 220, 240
888STYLE DS_SETFONT | WS_CHILD | WS_CAPTION
889CAPTION "Vector"
890FONT 8, "MS Shell Dlg", 0, 0, 0x1
891BEGIN
892    ICON            IDI_MAMEUI_ICON,IDC_STATIC,20,10,20,20
893    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
894                    SS_NOPREFIX
895    CONTROL         "Draw antialiased vectors",IDC_ANTIALIAS,"Button",
896                    BS_AUTOCHECKBOX | WS_TABSTOP,10,40,92,10,0,
897                    HIDC_ANTIALIAS
898    GROUPBOX        "Beam width",IDC_BEAMTEXT,60,53,100,28
899    CONTROL         "BeamSlider",IDC_BEAM,"msctls_trackbar32",TBS_BOTH |
900                    TBS_NOTICKS | WS_TABSTOP,66,65,64,10,0,HIDC_BEAM
901    RTEXT           "16.00",IDC_BEAMDISP,132,64,20,11,SS_CENTERIMAGE
902    GROUPBOX        "Flicker",IDC_FLICKERTEXT,60,84,100,28
903    CONTROL         "FlickerSlider",IDC_FLICKER,"msctls_trackbar32",TBS_BOTH |
904                    TBS_NOTICKS | WS_TABSTOP,66,96,64,10,0,HIDC_FLICKER
905    RTEXT           "100.00",IDC_FLICKERDISP,128,95,24,11,SS_CENTERIMAGE |
906                    NOT WS_GROUP
907    PUSHBUTTON      "Reset",IDC_PROP_RESET,4,222,97,14,0,0,HIDC_PROP_RESET
908    PUSHBUTTON      "Restore Default Settings",IDC_USE_DEFAULT,118,222,97,14,
909                    0,0,HIDC_USE_DEFAULT
910END
911
912#ifdef MESS
913IDD_MAIN DIALOGEX 0, 0, 364, 206
914#else
915IDD_MAIN DIALOGEX 0, 0, 304, 206
916#endif
917STYLE DS_SETFONT | DS_3DLOOK | DS_NOFAILCREATE | WS_MINIMIZEBOX |
918    WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
919EXSTYLE WS_EX_CONTROLPARENT
920CAPTION "MAMEUI - overwritten at runtime"
921CLASS "MainClass"
922FONT 8, "MS Shell Dlg", 0, 0, 0x1
923BEGIN
924    CONTROL         "",IDC_DIVIDER,"Static",SS_ETCHEDHORZ,0,5,304,1
925    CONTROL         "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
926                    TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS |
927                    TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER |
928                    WS_TABSTOP,5,28,48,172
929    CONTROL         "List1",IDC_LIST,"SysListView32",LVS_REPORT |
930                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
931                    LVS_OWNERDRAWFIXED | WS_BORDER | WS_TABSTOP,65,28,42,172
932    GROUPBOX        "",IDC_SPLITTER,55,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
933    GROUPBOX        "",IDC_SPLITTER2,109,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
934#ifdef MESS
935    CONTROL         "",IDC_SSTAB,"SysTabControl32",TCS_HOTTRACK,121,0,181,18
936    CONTROL         "",IDC_SWTAB,"SysTabControl32",TCS_HOTTRACK,119,0,200,100
937    CONTROL         "List2",IDC_SWLIST,"SysListView32",LVS_REPORT |
938                    LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED | WS_BORDER |
939               WS_TABSTOP,119,60,42,140
940   CONTROL         "",IDC_SWDEVVIEW,"MessSoftwareDevView",WS_VISIBLE,119,0,200,100
941    GROUPBOX        "",IDC_SPLITTER3,163,28,8,172,BS_NOTIFY | NOT WS_VISIBLE
942    CONTROL         "",IDC_SSFRAME,"Static",SS_ETCHEDFRAME,175,11,181,194
943    CONTROL         "",IDC_SSPICTURE,"Static",SS_BITMAP | SS_NOTIFY |
944                    SS_CENTERIMAGE | NOT WS_VISIBLE,195,18,141,127
945    EDITTEXT        IDC_HISTORY,183,150,167,49,ES_MULTILINE | ES_READONLY |
946                    WS_VSCROLL,WS_EX_STATICEDGE,HIDC_HISTORY
947#else
948    CONTROL         "",IDC_SSFRAME,"Static",SS_ETCHEDFRAME | SS_NOTIFY,121,
949                    11,181,194
950    CONTROL         "",IDC_SSTAB,"SysTabControl32",TCS_HOTTRACK,121,0,181,18
951    CONTROL         "",IDC_SSPICTURE,"Static",SS_BITMAP | NOT WS_VISIBLE,141,
952                    18,141,127
953    EDITTEXT        IDC_HISTORY,129,150,167,49,ES_MULTILINE | ES_READONLY |
954                    NOT WS_BORDER | WS_VSCROLL | NOT WS_TABSTOP,0,
955                    HIDC_HISTORY
956#endif
957END
958
959IDD_FILTERS DIALOGEX 0, 0, 190, 182
960STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
961    WS_SYSMENU
962EXSTYLE WS_EX_CONTEXTHELP
963#ifdef MESS
964CAPTION "System Filters"
965#else
966CAPTION "Game Filters"
967#endif
968FONT 8, "MS Shell Dlg", 0, 0, 0x1
969BEGIN
970#ifdef MESS
971    GROUPBOX        "System filters",IDC_STATIC,6,4,178,85
972#else
973    GROUPBOX        "Game filters",IDC_STATIC,6,4,178,85
974#endif
975    CONTROL         "&Vector Graphics",IDC_FILTER_VECTOR,"Button",
976                    BS_AUTOCHECKBOX | WS_TABSTOP,14,16,70,10,0,
977                    HIDC_FILTER_VECTOR
978    CONTROL         "C&lones",IDC_FILTER_CLONES,"Button",BS_AUTOCHECKBOX |
979                    WS_TABSTOP,14,30,41,10,0,HIDC_FILTER_CLONES
980    CONTROL         "Non-Wor&king",IDC_FILTER_NONWORKING,"Button",
981                    BS_AUTOCHECKBOX | WS_TABSTOP,14,44,61,10,0,
982                    HIDC_FILTER_NONWORKING
983    CONTROL         "&Horizontal",IDC_FILTER_HORIZONTAL,"Button",
984                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,57,10,0,
985                    HIDC_FILTER_HORIZONTAL
986    CONTROL         "&Unavailable",IDC_FILTER_UNAVAILABLE,"Button",
987                    BS_AUTOCHECKBOX | WS_TABSTOP,14,72,57,10,0,
988                    HIDC_FILTER_UNAVAILABLE
989#ifdef MESS
990    CONTROL         "&Computers",IDC_FILTER_COMPUTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,72,57,10,0,HIDC_FILTER_UNAVAILABLE
991    CONTROL         "C&onsoles",IDC_FILTER_CONSOLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,58,57,10,0,HIDC_FILTER_UNAVAILABLE
992#endif
993    CONTROL         "&Raster Graphics",IDC_FILTER_RASTER,"Button",
994                    BS_AUTOCHECKBOX | WS_TABSTOP,100,16,70,10,0,
995                    HIDC_FILTER_RASTER
996    CONTROL         "Ori&ginals",IDC_FILTER_ORIGINALS,"Button",
997                    BS_AUTOCHECKBOX | WS_TABSTOP,100,30,47,10,0,
998                    HIDC_FILTER_ORIGINALS
999    CONTROL         "&Working",IDC_FILTER_WORKING,"Button",BS_AUTOCHECKBOX |
1000                    WS_TABSTOP,100,44,47,10,0,HIDC_FILTER_WORKING
1001    CONTROL         "&Vertical",IDC_FILTER_VERTICAL,"Button",BS_AUTOCHECKBOX |
1002                    WS_TABSTOP,100,58,47,10,0,HIDC_FILTER_VERTICAL
1003    LTEXT           "(*) = inherited from parent folder",IDC_INHERITED,14,72,
1004                    99,10
1005#ifdef MESS
1006    CTEXT           "System filters allow customizing the systems that are displayed in each folder by hiding games that match the filters applied.",IDC_STATIC,6,94,178,27
1007#else
1008    CTEXT           "Game filters allow customizing the games that are displayed in each folder by hiding games that match the filters applied.",
1009                    IDC_STATIC,6,94,178,27
1010#endif
1011    GROUPBOX        "&Description filter",IDC_STATIC,6,122,178,33
1012    EDITTEXT        IDC_FILTER_EDIT,14,134,162,13,ES_AUTOHSCROLL,0,
1013                    HIDC_FILTER_EDIT
1014    DEFPUSHBUTTON   "&OK",IDOK,42,161,50,14
1015    PUSHBUTTON      "&Cancel",IDCANCEL,98,161,50,14
1016END
1017
1018IDD_RESET DIALOGEX 0, 0, 190, 122
1019STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
1020    WS_SYSMENU
1021EXSTYLE WS_EX_CONTEXTHELP
1022CAPTION "Reset Options"
1023FONT 8, "MS Shell Dlg", 0, 0, 0x1
1024BEGIN
1025    GROUPBOX        "Categories",IDC_STATIC,6,4,178,70
1026    CONTROL         "&User Interface (Fonts, Colors, Sizes)",IDC_RESET_UI,
1027                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,146,10,0,
1028                    HIDC_RESET_UI
1029#ifdef MESS
1030    CONTROL         "&Default system options",IDC_RESET_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,146,10,0,HIDC_RESET_DEFAULT
1031    CONTROL         "&All systems to use default options",IDC_RESET_GAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,146,10,0,HIDC_RESET_GAMES
1032#else
1033    CONTROL         "&Default game options",IDC_RESET_DEFAULT,"Button",
1034                    BS_AUTOCHECKBOX | WS_TABSTOP,14,30,146,10,0,
1035                    HIDC_RESET_DEFAULT
1036    CONTROL         "&All games to use default options",IDC_RESET_GAMES,
1037                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,146,10,0,
1038                    HIDC_RESET_GAMES
1039#endif
1040    CONTROL         "&Folder 'filters'",IDC_RESET_FILTERS,"Button",
1041                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,146,10,0,
1042                    HIDC_RESET_FILTERS
1043    CTEXT           "Select the options to be restored to the default settings.",
1044                    IDC_STATIC,6,79,178,20
1045    DEFPUSHBUTTON   "&OK",IDOK,42,101,50,14
1046    PUSHBUTTON      "&Cancel",IDCANCEL,98,101,50,14
1047END
1048
1049IDD_LOAD_PROGRESS DIALOGEX 0, 0, 260, 187
1050STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
1051    WS_SYSMENU
1052EXSTYLE WS_EX_CONTROLPARENT
1053FONT 8, "MS Shell Dlg", 0, 0, 0x1
1054BEGIN
1055    CONTROL         "Progress1",IDC_LOAD_PROGRESS,"msctls_progress32",
1056                    WS_BORDER | 0x1,6,7,248,12
1057    CTEXT           "",IDC_LOAD_ROMNAME,6,21,248,10,SS_CENTERIMAGE | NOT
1058                    WS_GROUP
1059    EDITTEXT        IDC_LOAD_STATUS,6,32,248,116,ES_MULTILINE | ES_READONLY |
1060                    WS_VSCROLL
1061    CTEXT           "",IDC_ERROR_TEXT,6,150,248,13,SS_NOPREFIX |
1062                    SS_CENTERIMAGE
1063    PUSHBUTTON      "&OK",IDOK,77,166,50,14,WS_DISABLED
1064    PUSHBUTTON      "&Cancel",IDCANCEL,133,166,50,14
1065END
1066
1067IDD_INTERFACE_OPTIONS DIALOGEX 0, 0, 378, 225
1068STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION |
1069    WS_SYSMENU
1070EXSTYLE WS_EX_CONTEXTHELP
1071CAPTION "Interface Options"
1072FONT 8, "MS Shell Dlg", 0, 0, 0x1
1073BEGIN
1074#ifdef MESS
1075    GROUPBOX        "System Selection",IDC_STATIC,6,4,189,194
1076    CONTROL         "&Search for new systems on start",IDC_START_GAME_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,112,10,0,HIDC_START_GAME_CHECK
1077    CONTROL         "Allow system selection by a &joystick (requires restart)",IDC_JOY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,178,10,0,HIDC_JOY_GUI
1078    CONTROL         "Allow system selection by custom &key sequences",IDC_KEY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,166,10
1079#else
1080    GROUPBOX        "Game Selection",IDC_STATIC,6,4,189,194
1081    CONTROL         "&Search for new games on start",IDC_START_GAME_CHECK,
1082                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,16,111,10,0,
1083                    HIDC_START_GAME_CHECK
1084    CONTROL         "Allow game selection by a &joystick (requires restart)",
1085                    IDC_JOY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,30,
1086                    174,10,0,HIDC_JOY_GUI
1087    CONTROL         "Allow game selection by custom &key sequences",
1088                    IDC_KEY_GUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,44,
1089                    166,10
1090#endif
1091    CONTROL         "Select &random background image",IDC_RANDOM_BG,"Button",
1092                    BS_AUTOCHECKBOX | WS_TABSTOP,14,58,122,10,0,
1093                    HIDC_RANDOM_BG
1094    CONTROL         "&Broadcast selected game to all windows",IDC_BROADCAST,
1095                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,72,141,10,0,
1096                    HIDC_BROADCAST
1097    CONTROL         "Hide &mouse cursor (requires restart)",IDC_HIDE_MOUSE,
1098                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,86,126,10,0,
1099                    HIDC_HIDE_MOUSE
1100    CONTROL         "Inheritable Filters",IDC_FILTER_INHERIT,"Button",
1101                    BS_AUTOCHECKBOX | WS_TABSTOP,14,100,68,10
1102    CONTROL         "No offset for clones missing parent in view",
1103                    IDC_NOOFFSET_CLONES,"Button",BS_AUTOCHECKBOX |
1104                    WS_TABSTOP,14,114,148,10
1105    GROUPBOX        "Show History on Tab",IDC_STATIC,14,128,173,28
1106    COMBOBOX        IDC_HISTORY_TAB,57,138,88,50,CBS_DROPDOWNLIST |
1107                    WS_VSCROLL | WS_TABSTOP
1108    GROUPBOX        "Emulation",IDC_STATIC,202,4,170,28
1109#ifdef MESS
1110    CONTROL         "Show System Ca&ption",IDC_GAME_CAPTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,16,81,10
1111#else
1112    CONTROL         "Show Game Ca&ption",IDC_GAME_CAPTION,"Button",
1113                    BS_AUTOCHECKBOX | WS_TABSTOP,210,16,80,10,0,
1114                    HIDC_GAME_CAPTION
1115#endif
1116    GROUPBOX        "Bookkeeping",IDC_STATIC,202,36,170,43
1117    CONTROL         "Reset all Playcounts",IDC_RESET_PLAYCOUNT,"Button",
1118                    BS_AUTOCHECKBOX | WS_TABSTOP,210,48,80,10
1119    CONTROL         "Reset all Play Times",IDC_RESET_PLAYTIME,"Button",
1120                    BS_AUTOCHECKBOX | WS_TABSTOP,210,62,79,10
1121    GROUPBOX        "Screenshot Area",IDC_STATIC,202,83,170,115
1122    CONTROL         "S&tretch screenshot larger than natural size",
1123                    IDC_STRETCH_SCREENSHOT_LARGER,"Button",BS_AUTOCHECKBOX |
1124                    WS_TABSTOP,210,95,148,10,0,
1125                    HIDC_STRETCH_SCREENSHOT_LARGER
1126    GROUPBOX        "Screenshot Cycletime in Seconds",IDC_STATIC,210,109,154,
1127                    28
1128    CONTROL         "Slider1",IDC_CYCLETIMESEC,"msctls_trackbar32",TBS_BOTH |
1129                    TBS_NOTICKS | WS_TABSTOP,218,121,120,10,0,
1130                    HIDC_CYCLETIMESEC
1131    RTEXT           "60",IDC_CYCLETIMESECTXT,340,120,13,10,SS_CENTERIMAGE
1132    GROUPBOX        "Screenshot Bordersize",IDC_STATIC,210,141,154,28
1133    CONTROL         "Slider1",IDC_SCREENSHOT_BORDERSIZE,"msctls_trackbar32",
1134                    TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,218,153,120,10
1135    RTEXT           "100",IDC_SCREENSHOT_BORDERSIZETXT,340,152,13,10,
1136                    SS_CENTERIMAGE
1137    PUSHBUTTON      "Set Screenshot Border Color",IDC_SCREENSHOT_BORDERCOLOR,
1138                    210,176,154,14
1139    DEFPUSHBUTTON   "&OK",IDOK,136,204,50,14
1140    PUSHBUTTON      "&Cancel",IDCANCEL,192,204,50,14
1141END
1142
1143IDD_LANGUAGE DIALOGEX 0, 0, 190, 66
1144STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION |
1145    WS_SYSMENU
1146EXSTYLE WS_EX_CONTEXTHELP
1147CAPTION "Language"
1148FONT 8, "MS Shell Dlg", 0, 0, 0x1
1149BEGIN
1150    GROUPBOX        "",IDC_STATIC,6,4,178,34
1151    CONTROL         "Use language file",IDC_LANGUAGECHECK,"Button",
1152                    BS_AUTOCHECKBOX | WS_TABSTOP,12,4,66,10,0,
1153                    HIDC_LANGUAGECHECK
1154    EDITTEXT        IDC_LANGUAGEEDIT,14,17,142,13,ES_AUTOHSCROLL,0,
1155                    HIDC_LANGUAGEEDIT
1156    PUSHBUTTON      "...",IDC_LANGUAGEBROWSE,162,17,14,13
1157    DEFPUSHBUTTON   "OK",IDOK,42,45,50,14
1158    PUSHBUTTON      "Cancel",IDCANCEL,98,45,50,14
1159END
1160
1161IDD_CUSTOM_FILE DIALOG  0, 0, 190, 135
1162STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
1163CAPTION "Add Game To Custom Folder"
1164FONT 8, "MS Shell Dlg"
1165BEGIN
1166    LTEXT           "",IDC_CUSTOMFILE_GAME,6,6,175,10,SS_NOPREFIX |
1167                    SS_CENTERIMAGE
1168    CONTROL         "CustomTree",IDC_CUSTOM_TREE,"SysTreeView32",
1169                    TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
1170                    TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS |
1171                    TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,6,18,178,90
1172    DEFPUSHBUTTON   "OK",IDOK,42,114,50,14
1173    PUSHBUTTON      "Cancel",IDCANCEL,98,114,50,14
1174END
1175
1176
1177/////////////////////////////////////////////////////////////////////////////
1178//
1179// Accelerator
1180//
1181
1182IDA_TAB_KEYS ACCELERATORS
1183BEGIN
1184    "1",            ID_VIEW_TAB_SCREENSHOT, VIRTKEY, ALT, NOINVERT
1185    "2",            ID_VIEW_TAB_FLYER,      VIRTKEY, ALT, NOINVERT
1186    "3",            ID_VIEW_TAB_CABINET,    VIRTKEY, ALT, NOINVERT
1187    "4",            ID_VIEW_TAB_MARQUEE,    VIRTKEY, ALT, NOINVERT
1188    "5",            ID_VIEW_TAB_TITLE,      VIRTKEY, ALT, NOINVERT
1189    "6",            ID_VIEW_TAB_CONTROL_PANEL, VIRTKEY, ALT, NOINVERT
1190    "7",            ID_VIEW_TAB_PCB,        VIRTKEY, ALT, NOINVERT
1191    "8",            ID_VIEW_TAB_HISTORY,    VIRTKEY, ALT, NOINVERT
1192    "A",            ID_GAME_AUDIT,          VIRTKEY, ALT, NOINVERT
1193    "B",            ID_VIEW_PAGETAB,        VIRTKEY, ALT, NOINVERT
1194    "D",            ID_VIEW_FOLDERS,        VIRTKEY, ALT, NOINVERT
1195    "F",            ID_CONTEXT_FILTERS,     VIRTKEY, CONTROL, NOINVERT
1196    "U",            ID_FOLDER_AUDIT,        VIRTKEY, ALT, NOINVERT
1197    "P",            ID_VIEW_PICTURE_AREA,   VIRTKEY, ALT, NOINVERT
1198    "R",            ID_CONTEXT_SELECT_RANDOM, VIRTKEY, CONTROL, NOINVERT
1199    "S",            ID_VIEW_STATUS,         VIRTKEY, ALT, NOINVERT
1200    "T",            ID_VIEW_TOOLBARS,       VIRTKEY, ALT, NOINVERT
1201    VK_F1,          ID_HELP_CONTENTS,       VIRTKEY, NOINVERT
1202    VK_F11,         ID_VIEW_FULLSCREEN,     VIRTKEY, NOINVERT
1203    VK_F5,          ID_UPDATE_GAMELIST,     VIRTKEY, NOINVERT
1204    VK_NEXT,        ID_UI_HISTORY_DOWN,     VIRTKEY, CONTROL, NOINVERT
1205    VK_PRIOR,       ID_UI_HISTORY_UP,       VIRTKEY, CONTROL, NOINVERT
1206    VK_RETURN,      ID_GAME_PROPERTIES,     VIRTKEY, ALT, NOINVERT
1207END
1208
1209
1210/////////////////////////////////////////////////////////////////////////////
1211//
1212// DESIGNINFO
1213//
1214
1215#ifdef APSTUDIO_INVOKED
1216GUIDELINES DESIGNINFO
1217BEGIN
1218    IDD_ABOUT, DIALOG
1219    BEGIN
1220        LEFTMARGIN, 7
1221        RIGHTMARGIN, 289
1222        TOPMARGIN, 7
1223        BOTTOMMARGIN, 123
1224    END
1225
1226    IDD_DIRECTX, DIALOG
1227    BEGIN
1228        LEFTMARGIN, 7
1229        RIGHTMARGIN, 229
1230        TOPMARGIN, 7
1231        BOTTOMMARGIN, 62
1232    END
1233
1234    IDD_AUDIT, DIALOG
1235    BEGIN
1236        LEFTMARGIN, 7
1237        RIGHTMARGIN, 280
1238        TOPMARGIN, 7
1239        BOTTOMMARGIN, 187
1240        HORZGUIDE, 19
1241    END
1242
1243    IDD_DIRECTORIES, DIALOG
1244    BEGIN
1245        LEFTMARGIN, 7
1246        RIGHTMARGIN, 224
1247        TOPMARGIN, 7
1248        BOTTOMMARGIN, 98
1249    END
1250
1251    IDD_COLUMNS, DIALOG
1252    BEGIN
1253        LEFTMARGIN, 7
1254        RIGHTMARGIN, 301
1255        TOPMARGIN, 7
1256        BOTTOMMARGIN, 143
1257    END
1258
1259    IDD_PROP_CONTROLLER, DIALOG
1260    BEGIN
1261        RIGHTMARGIN, 210
1262        BOTTOMMARGIN, 154
1263    END
1264
1265    IDD_PROP_SCREEN, DIALOG
1266    BEGIN
1267        LEFTMARGIN, 4
1268        VERTGUIDE, 7
1269        VERTGUIDE, 123
1270        BOTTOMMARGIN, 199
1271        HORZGUIDE, 179
1272    END
1273
1274    IDD_PROP_GAME, DIALOG
1275    BEGIN
1276        LEFTMARGIN, 7
1277        RIGHTMARGIN, 213
1278        VERTGUIDE, 19
1279        VERTGUIDE, 66
1280        VERTGUIDE, 74
1281        VERTGUIDE, 201
1282        BOTTOMMARGIN, 232
1283    END
1284
1285    IDD_PROP_AUDIT, DIALOG
1286    BEGIN
1287        LEFTMARGIN, 7
1288        RIGHTMARGIN, 213
1289        VERTGUIDE, 12
1290        VERTGUIDE, 208
1291        BOTTOMMARGIN, 198
1292        HORZGUIDE, 38
1293    END
1294
1295    IDD_PROP_DISPLAY, DIALOG
1296    BEGIN
1297        LEFTMARGIN, 4
1298        VERTGUIDE, 7
1299        VERTGUIDE, 123
1300        HORZGUIDE, 179
1301    END
1302
1303    IDD_PROP_SOUND, DIALOG
1304    BEGIN
1305        LEFTMARGIN, 7
1306        RIGHTMARGIN, 213
1307        VERTGUIDE, 50
1308        BOTTOMMARGIN, 198
1309    END
1310
1311    IDD_PROP_ADVANCED, DIALOG
1312    BEGIN
1313        LEFTMARGIN, 10
1314        BOTTOMMARGIN, 211
1315    END
1316
1317    IDD_PROP_INPUT, DIALOG
1318    BEGIN
1319        LEFTMARGIN, 4
1320        RIGHTMARGIN, 215
1321        VERTGUIDE, 50
1322        VERTGUIDE, 170
1323    END
1324
1325    IDD_PROP_MISC, DIALOG
1326    BEGIN
1327        LEFTMARGIN, 7
1328        RIGHTMARGIN, 213
1329        VERTGUIDE, 25
1330        VERTGUIDE, 40
1331        VERTGUIDE, 104
1332        VERTGUIDE, 114
1333        VERTGUIDE, 204
1334        BOTTOMMARGIN, 183
1335    END
1336
1337    IDD_PROP_VECTOR, DIALOG
1338    BEGIN
1339        LEFTMARGIN, 7
1340        RIGHTMARGIN, 213
1341        VERTGUIDE, 50
1342        BOTTOMMARGIN, 198
1343    END
1344
1345    IDD_FILTERS, DIALOG
1346    BEGIN
1347        LEFTMARGIN, 7
1348        TOPMARGIN, 7
1349        BOTTOMMARGIN, 178
1350    END
1351
1352    IDD_RESET, DIALOG
1353    BEGIN
1354        LEFTMARGIN, 7
1355        RIGHTMARGIN, 175
1356        VERTGUIDE, 18
1357        VERTGUIDE, 164
1358        TOPMARGIN, 7
1359    END
1360
1361    IDD_LANGUAGE, DIALOG
1362    BEGIN
1363        LEFTMARGIN, 7
1364        RIGHTMARGIN, 179
1365        TOPMARGIN, 7
1366        BOTTOMMARGIN, 59
1367    END
1368END
1369#endif    // APSTUDIO_INVOKED
1370
1371
1372/////////////////////////////////////////////////////////////////////////////
1373//
1374// Bitmap
1375//
1376
1377#ifdef MESS
1378IDB_ABOUT               BITMAP      "res\\about_mess.bmp"
1379#else
1380IDB_ABOUT               BITMAP                  "res\\about.bmp"
1381#endif
1382IDB_TOOLBAR             BITMAP                  "res\\toolbar.bmp"
1383
1384/////////////////////////////////////////////////////////////////////////////
1385//
1386// Cursor
1387//
1388
1389IDC_CURSOR_HSPLIT       CURSOR                  "res\\splith.cur"
1390
1391/////////////////////////////////////////////////////////////////////////////
1392//
1393// RT_MANIFEST
1394//
1395
13961                       RT_MANIFEST             "res\\mameui.manifest"
1397
1398/////////////////////////////////////////////////////////////////////////////
1399//
1400// String Table
1401//
1402
1403STRINGTABLE
1404BEGIN
1405    IDS_UI_FILE             "Contains commands for working with the selected items"
1406    IDS_UI_VIEW             "Contains commands for manupulating the view"
1407    IDS_UI_OPTIONS          "Contains commands for user interface options"
1408END
1409
1410STRINGTABLE
1411BEGIN
1412    IDS_UI_HELP             "Contains commands for displaying help"
1413    IDS_VIEW_TOOLBAR        "Show or hide the toolbar"
1414    IDS_VIEW_STATUSBAR      "Show or hide the status bar"
1415    IDS_VIEW_FOLDERLIST     "Show or hide the folder list"
1416    IDS_VIEW_SCREENSHOT     "Show or hide the screen shot"
1417    IDS_VIEW_PICTURETABS    "Show or hide tabs in the picture area"
1418    IDS_VIEW_SPACER1        "Spacer"
1419    IDS_VIEW_FULLSCREEN     "Toggle full screen mode"
1420    IDS_VIEW_SPACER2        "Spacer"
1421    IDS_VIEW_SHOWPICTURES   "Contains commands to select tabs shown in the picture area"
1422    IDS_VIEW_SPACER3        "Spacer"
1423END
1424
1425STRINGTABLE
1426BEGIN
1427    IDS_VIEW_LARGEICONS     "Display items by using large icons."
1428    IDS_VIEW_SMALLICONS     "Display items by using small icons."
1429    IDS_VIEW_LIST           "Displays items in a list."
1430    IDS_VIEW_DETAILS        "Displays detailed information about each item in the window."
1431    IDS_VIEW_GROUPED        "Displays items grouped by parent game"
1432    IDS_VIEW_SPACER4        "Spacer"
1433    IDS_VIEW_ARRANGE        "Contains commands for sorting by various columns"
1434    IDS_VIEW_LINEUPICONS    "Arranges icons in a grid"
1435    IDS_VIEW_SPACER5        "Spacer"
1436    IDS_VIEW_REFRESH        "Refresh game list"
1437    IDS_VIEW_CONTEXTFILTERS "Allows filtering out games from a folder"
1438    IDS_VIEW_CUSTOMIZEFIELDS
1439                            "Customize which columns are used in the game list"
1440END
1441
1442STRINGTABLE
1443BEGIN
1444    ID_FILE_EXIT            "Exit the application"
1445#ifdef MESS
1446    ID_FILE_PLAY            "Play currently selected system"
1447#else
1448    ID_FILE_PLAY            "Play currently selected game"
1449#endif
1450    ID_HELP_ABOUT           "Displays program and copyright information"
1451    ID_VIEW_LARGE_ICON      "Display items by using large icons."
1452    ID_VIEW_SMALL_ICON      "Display items by using small icons."
1453    ID_VIEW_LIST_MENU       "Displays items in a list."
1454    ID_VIEW_DETAIL          "Displays detailed information about each item in the window."
1455#ifdef MESS
1456    ID_OPTIONS_FONT         "Set system list and folder list font"
1457    ID_OPTIONS_DIR          "Set directory configuration"
1458    ID_OPTIONS_DEFAULTS     "Set default system options"
1459#else
1460    ID_VIEW_GROUPED         "Show items grouped by parent game"
1461    ID_OPTIONS_FONT         "Set game list and folder list font"
1462    ID_OPTIONS_CLONE_COLOR  "Set the clone font color"
1463    ID_OPTIONS_DIR          "Set directory configuration"
1464    ID_OPTIONS_DEFAULTS     "Set default game options"
1465#endif
1466END
1467
1468STRINGTABLE
1469BEGIN
1470    ID_OPTIONS_RESET_DEFAULTS "Allow restoring options to 'sane' values."
1471    ID_OPTIONS_INTERFACE    "Customize interface options."
1472    ID_FILE_AUDIT           "Audit ROM and samples sets"
1473#ifdef MESS
1474    ID_FILE_PLAY_RECORD     "Record a system for later playback"
1475    ID_FILE_PLAY_BACK       "Playback a recorded system"
1476    ID_FILE_PLAY_RECORD_WAVE "Record the sound output of a system"
1477#else
1478    ID_FILE_PLAY_RECORD     "Record a game for later playback"
1479    ID_FILE_PLAY_BACK       "Playback a recorded game"
1480    ID_FILE_PLAY_RECORD_WAVE "Record the audio output of a game"
1481    ID_FILE_PLAY_RECORD_MNG "Record the video output of a game"
1482#endif
1483    ID_VIEW_PICTURE_AREA    "Show or hide the picture area"
1484    ID_HELP_CONTENTS        "Display help contents"
1485#ifdef MESS
1486    ID_HELP_WHATS_NEWUI     "Recent changes"
1487    ID_HELP_TROUBLE         "Troubleshooting Documentation"
1488    ID_HELP_RELEASE         "MESS release notes"
1489    ID_HELP_WHATS_NEW       "What's new in MESS"
1490    ID_HELP_CHEATS          "How cheats work"
1491#else
1492    ID_HELP_WHATS_NEWUI     "New game changes"
1493    ID_HELP_TROUBLE         "Troubleshooting Documentation"
1494    ID_HELP_RELEASE         "MAME release notes"
1495    ID_HELP_WHATS_NEW       "What's new in MAME"
1496    ID_HELP_CHEATS          "How cheats work"
1497#endif
1498END
1499
1500STRINGTABLE
1501BEGIN
1502    ID_CONTEXT_RESET_PLAYTIME "Reset time played for selected item"
1503    ID_CONTEXT_RESET_PLAYCOUNT "Reset number of plays for selected item"
1504    ID_FOLDER_PROPERTIES    "Display folder properties"
1505    ID_FOLDER_AUDIT         "Audit itmes in this folder"
1506#ifdef MESS
1507    ID_FILE_LOADSTATE       "Run a system starting with the given savestate"
1508#else
1509    ID_FILE_LOADSTATE       "Play a game starting with the given savestate"
1510#endif
1511END
1512
1513STRINGTABLE
1514BEGIN
1515    ID_VIEW_TAB_CABINET     "Select Cabinet tab"
1516    ID_VIEW_TAB_MARQUEE     "Select Marquee tab"
1517    ID_VIEW_TAB_TITLE       "Select Title tab"
1518    ID_VIEW_TAB_CONTROL_PANEL "Select Control panel tab"
1519    ID_VIEW_TAB_HISTORY     "Select History tab"
1520    ID_OPTIONS_BG           "Set the bacground image"
1521    ID_TOGGLE_TAB_SCREENSHOT "Enable the screenshot tab"
1522    ID_TOGGLE_TAB_FLYER     "Enable the flyer tab"
1523    ID_TOGGLE_TAB_CABINET   "Enable the cabinet tab"
1524    ID_TOGGLE_TAB_MARQUEE   "Enable the marquee tab"
1525    ID_TOGGLE_TAB_TITLE     "Enable the title tab"
1526    ID_TOGGLE_TAB_CONTROL_PANEL "Enable the control panel tab"
1527    ID_TOGGLE_TAB_PCB       "Enable the PCB tab"
1528    ID_TOGGLE_TAB_HISTORY   "Enable the history tab"
1529    ID_VIEW_FULLSCREEN      "Toggle Fullscreen mode"
1530END
1531
1532STRINGTABLE
1533BEGIN
1534#ifdef MESS
1535    ID_CUSTOMIZE_FIELDS     "Customize which columns are used in the system list"
1536#else
1537    ID_CUSTOMIZE_FIELDS     "Customize which columns are used in the game list"
1538#endif
1539    ID_GAME_PROPERTIES      "Display the properties of the selected item"
1540    ID_VIEW_PAGETAB         "Show or hide the tabs in the picture area"
1541    ID_VIEW_FOLDERS         "Show or hide the folder list"
1542    ID_VIEW_TOOLBARS        "Show or hide the toolbar"
1543    ID_VIEW_STATUS          "Show or hide the status bar"
1544#ifdef MESS
1545    ID_CONTEXT_FILTERS      "Allows filtering out systems from a folder"
1546    ID_CONTEXT_RENAME_CUSTOM "Rename this folder"
1547    ID_CONTEXT_ADD_CUSTOM   "Add selected item to custom folder"
1548    ID_CONTEXT_REMOVE_CUSTOM "Remove selected item from this folder"
1549    ID_GAME_AUDIT           "Audit the selected item"
1550    ID_CONTEXT_SELECT_RANDOM "Randomly select a system."
1551#else
1552    ID_CONTEXT_FILTERS      "Allows filtering out games from a folder"
1553    ID_CONTEXT_RENAME_CUSTOM "Rename this folder"
1554    ID_CONTEXT_ADD_CUSTOM   "Add selected item to custom folder"
1555    ID_CONTEXT_REMOVE_CUSTOM "Remove selected item from this folder"
1556    ID_GAME_AUDIT           "Audit the selected item"
1557    ID_CONTEXT_SELECT_RANDOM "Randomly select a game."
1558#endif
1559    ID_VIEW_TAB_SCREENSHOT  "Select Screenshot tab"
1560    ID_VIEW_TAB_FLYER       "Select Flyer tab"
1561END
1562
1563STRINGTABLE
1564BEGIN
1565#ifdef MESS
1566    ID_VIEW_BYGAME          "Sort items by system"
1567#else
1568    ID_VIEW_BYGAME          "Sort items by game"
1569#endif
1570    ID_VIEW_BYDIRECTORY     "Sort items by directories"
1571    ID_VIEW_BYMANUFACTURER  "Sort items by manufacturer"
1572    ID_VIEW_BYYEAR          "Sort items by year"
1573    ID_VIEW_BYTYPE          "Sort items by type"
1574    ID_VIEW_BYTIMESPLAYED   "Sort by number of plays"
1575    ID_VIEW_LINEUPICONS     "Arranges icons in a grid"
1576#ifdef MESS
1577    ID_UPDATE_GAMELIST      "Refresh system list"
1578#else
1579    ID_UPDATE_GAMELIST      "Refresh game list"
1580#endif
1581    ID_SORT_ASCENDING       "Sort column in ascending (A-Z) order"
1582    ID_SORT_DESCENDING      "Sort column in descending (Z-A) order"
1583END
1584
1585STRINGTABLE
1586BEGIN
1587    ID_FOLDER_SOURCEPROPERTIES
1588                            "Display properties for all games in this source file"
1589    ID_FOLDER_VECTORPROPERTIES "Display properties for all vector based games"
1590END
1591
1592#endif    // English (U.S.) resources
1593/////////////////////////////////////////////////////////////////////////////
1594
1595
1596
1597#ifndef APSTUDIO_INVOKED
1598/////////////////////////////////////////////////////////////////////////////
1599//
1600// Generated from the TEXTINCLUDE 3 resource.
1601//
1602#include "mamevers.rc" // Version block
1603
1604
1605/////////////////////////////////////////////////////////////////////////////
1606#endif    // not APSTUDIO_INVOKED
1607
src/osd/winui/bitmask.h
r1367r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
114#ifndef BITMASK_H
215#define BITMASK_H
316
src/osd/winui/directinput.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
5 
6  This file is part of MAME32, and may only be used, modified and
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14
1315#ifndef DIRECTINPUT_H
1416#define DIRECTINPUT_H
1517
16#ifndef DIRECTINPUT_VERSION
18#undef WINNT
19#ifdef DIRECTINPUT_VERSION
20#undef DIRECTINPUT_VERSION
21#endif
1722#define DIRECTINPUT_VERSION 0x0700
18#endif
19
2023#include <dinput.h>
2124
2225extern BOOL DirectInputInitialize(void);
src/osd/winui/mui_opts.c
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14 /***************************************************************************
15
16  mui_opts.c
17
18  Stores global options and per-game options;
19
20***************************************************************************/
21
22// standard windows headers
23#define WIN32_LEAN_AND_MEAN
24#include <windows.h>
25#include <windowsx.h>
26#include <winreg.h>
27#include <commctrl.h>
28
29// standard C headers
30#include <assert.h>
31#include <stdio.h>
32#include <sys/stat.h>
33#include <math.h>
34#include <direct.h>
35#include <driver.h>
36#include <stddef.h>
37#include <tchar.h>
38
39// MAME/MAMEUI headers
40#include "bitmask.h"
41#include "winui.h"
42#include "mui_util.h"
43#include "treeview.h"
44#include "splitters.h"
45#include "mui_opts.h"
46#include "winmain.h"
47#include "winutf8.h"
48#include "strconv.h"
49
50#ifdef MESS
51#include "optionsms.h"
52#endif // MESS
53
54#ifdef _MSC_VER
55#define snprintf _snprintf
56#endif
57
58/***************************************************************************
59    Internal function prototypes
60 ***************************************************************************/
61
62// static void LoadFolderFilter(int folder_index,int filters);
63
64static file_error LoadSettingsFile(core_options *opts, const char *filename);
65static file_error SaveSettingsFile(core_options *opts, core_options *baseopts, const char *filename);
66
67static void LoadOptionsAndSettings(void);
68
69static void  CusColorEncodeString(const COLORREF *value, char* str);
70static void  CusColorDecodeString(const char* str, COLORREF *value);
71
72static void  SplitterEncodeString(const int *value, char* str);
73static void  SplitterDecodeString(const char *str, int *value);
74
75static void  FontEncodeString(const LOGFONT *f, char *str);
76static void  FontDecodeString(const char* str, LOGFONT *f);
77
78static void TabFlagsEncodeString(int data, char *str);
79static void TabFlagsDecodeString(const char *str, int *data);
80
81static DWORD DecodeFolderFlags(const char *buf);
82static const char * EncodeFolderFlags(DWORD value);
83
84static void ResetToDefaults(core_options *opts, int priority);
85
86static void ui_parse_ini_file(core_options *opts, const char *name);
87static void remove_all_source_options(void);
88
89
90#ifdef _MSC_VER
91#define snprintf _snprintf
92#endif
93
94/***************************************************************************
95    Internal defines
96 ***************************************************************************/
97
98#define UI_INI_FILENAME MAMEUINAME ".ini"
99#define DEFAULT_OPTIONS_INI_FILENAME CONFIGNAME ".ini"
100
101#define MUIOPTION_LIST_MODE                  "list_mode"
102#define MUIOPTION_CHECK_GAME               "check_game"
103#define MUIOPTION_JOYSTICK_IN_INTERFACE         "joystick_in_interface"
104#define MUIOPTION_KEYBOARD_IN_INTERFACE         "keyboard_in_interface"
105#define MUIOPTION_CYCLE_SCREENSHOT            "cycle_screenshot"
106#define MUIOPTION_STRETCH_SCREENSHOT_LARGER      "stretch_screenshot_larger"
107#define MUIOPTION_SCREENSHOT_BORDER_SIZE      "screenshot_bordersize"
108#define MUIOPTION_SCREENSHOT_BORDER_COLOR      "screenshot_bordercolor"
109#define MUIOPTION_INHERIT_FILTER            "inherit_filter"
110#define MUIOPTION_OFFSET_CLONES               "offset_clones"
111#define MUIOPTION_GAME_CAPTION               "game_caption"
112#define MUIOPTION_BROADCAST_GAME_NAME         "broadcast_game_name"
113#define MUIOPTION_RANDOM_BACKGROUND            "random_background"
114#define MUIOPTION_DEFAULT_FOLDER_ID            "default_folder_id"
115#define MUIOPTION_SHOW_IMAGE_SECTION         "show_image_section"
116#define MUIOPTION_SHOW_FOLDER_SECTION         "show_folder_section"
117#define MUIOPTION_HIDE_FOLDERS               "hide_folders"
118#define MUIOPTION_SHOW_STATUS_BAR            "show_status_bar"
119#define MUIOPTION_SHOW_TABS                  "show_tabs"
120#define MUIOPTION_SHOW_TOOLBAR               "show_tool_bar"
121#define MUIOPTION_CURRENT_TAB               "current_tab"
122#define MUIOPTION_WINDOW_X                  "window_x"
123#define MUIOPTION_WINDOW_Y                  "window_y"
124#define MUIOPTION_WINDOW_WIDTH               "window_width"
125#define MUIOPTION_WINDOW_HEIGHT               "window_height"
126#define MUIOPTION_WINDOW_STATE               "window_state"
127#define MUIOPTION_CUSTOM_COLOR               "custom_color"
128#define MUIOPTION_LIST_FONT                  "list_font"
129#define MUIOPTION_TEXT_COLOR               "text_color"
130#define MUIOPTION_CLONE_COLOR               "clone_color"
131#define MUIOPTION_HIDE_TABS                  "hide_tabs"
132#define MUIOPTION_HISTORY_TAB               "history_tab"
133#define MUIOPTION_COLUMN_WIDTHS               "column_widths"
134#define MUIOPTION_COLUMN_ORDER               "column_order"
135#define MUIOPTION_COLUMN_SHOWN               "column_shown"
136#define MUIOPTION_SPLITTERS                  "splitters"
137#define MUIOPTION_SORT_COLUMN               "sort_column"
138#define MUIOPTION_SORT_REVERSED               "sort_reversed"
139#define MUIOPTION_LANGUAGE                  "language"
140#define MUIOPTION_FLYER_DIRECTORY            "flyer_directory"
141#define MUIOPTION_CABINET_DIRECTORY            "cabinet_directory"
142#define MUIOPTION_MARQUEE_DIRECTORY            "marquee_directory"
143#define MUIOPTION_TITLE_DIRECTORY            "title_directory"
144#define MUIOPTION_CPANEL_DIRECTORY            "cpanel_directory"
145#define MUIOPTION_PCB_DIRECTORY                "pcb_directory"
146#define MUIOPTION_ICONS_DIRECTORY            "icons_directory"
147#define MUIOPTION_BACKGROUND_DIRECTORY         "background_directory"
148#define MUIOPTION_FOLDER_DIRECTORY            "folder_directory"
149#define MUIOPTION_UI_KEY_UP                  "ui_key_up"
150#define MUIOPTION_UI_KEY_DOWN               "ui_key_down"
151#define MUIOPTION_UI_KEY_LEFT               "ui_key_left"
152#define MUIOPTION_UI_KEY_RIGHT               "ui_key_right"
153#define MUIOPTION_UI_KEY_START               "ui_key_start"
154#define MUIOPTION_UI_KEY_PGUP               "ui_key_pgup"
155#define MUIOPTION_UI_KEY_PGDWN               "ui_key_pgdwn"
156#define MUIOPTION_UI_KEY_HOME               "ui_key_home"
157#define MUIOPTION_UI_KEY_END               "ui_key_end"
158#define MUIOPTION_UI_KEY_SS_CHANGE            "ui_key_ss_change"
159#define MUIOPTION_UI_KEY_HISTORY_UP            "ui_key_history_up"
160#define MUIOPTION_UI_KEY_HISTORY_DOWN         "ui_key_history_down"
161#define MUIOPTION_UI_KEY_CONTEXT_FILTERS      "ui_key_context_filters"
162#define MUIOPTION_UI_KEY_SELECT_RANDOM         "ui_key_select_random"
163#define MUIOPTION_UI_KEY_GAME_AUDIT            "ui_key_game_audit"
164#define MUIOPTION_UI_KEY_GAME_PROPERTIES      "ui_key_game_properties"
165#define MUIOPTION_UI_KEY_HELP_CONTENTS         "ui_key_help_contents"
166#define MUIOPTION_UI_KEY_UPDATE_GAMELIST      "ui_key_update_gamelist"
167#define MUIOPTION_UI_KEY_VIEW_FOLDERS         "ui_key_view_folders"
168#define MUIOPTION_UI_KEY_VIEW_FULLSCREEN      "ui_key_view_fullscreen"
169#define MUIOPTION_UI_KEY_VIEW_PAGETAB         "ui_key_view_pagetab"
170#define MUIOPTION_UI_KEY_VIEW_PICTURE_AREA      "ui_key_view_picture_area"
171#define MUIOPTION_UI_KEY_VIEW_STATUS         "ui_key_view_status"
172#define MUIOPTION_UI_KEY_VIEW_TOOLBARS         "ui_key_view_toolbars"
173#define MUIOPTION_UI_KEY_VIEW_TAB_CABINET      "ui_key_view_tab_cabinet"
174#define MUIOPTION_UI_KEY_VIEW_TAB_CPANEL      "ui_key_view_tab_cpanel"
175#define MUIOPTION_UI_KEY_VIEW_TAB_FLYER         "ui_key_view_tab_flyer"
176#define MUIOPTION_UI_KEY_VIEW_TAB_HISTORY      "ui_key_view_tab_history"
177#define MUIOPTION_UI_KEY_VIEW_TAB_MARQUEE      "ui_key_view_tab_marquee"
178#define MUIOPTION_UI_KEY_VIEW_TAB_SCREENSHOT   "ui_key_view_tab_screenshot"
179#define MUIOPTION_UI_KEY_VIEW_TAB_TITLE         "ui_key_view_tab_title"
180#define MUIOPTION_UI_KEY_VIEW_TAB_PCB         "ui_key_view_tab_pcb"
181#define MUIOPTION_UI_KEY_QUIT               "ui_key_quit"
182#define MUIOPTION_UI_JOY_UP                  "ui_joy_up"
183#define MUIOPTION_UI_JOY_DOWN               "ui_joy_down"
184#define MUIOPTION_UI_JOY_LEFT               "ui_joy_left"
185#define MUIOPTION_UI_JOY_RIGHT               "ui_joy_right"
186#define MUIOPTION_UI_JOY_START               "ui_joy_start"
187#define MUIOPTION_UI_JOY_PGUP               "ui_joy_pgup"
188#define MUIOPTION_UI_JOY_PGDWN               "ui_joy_pgdwn"
189#define MUIOPTION_UI_JOY_HOME               "ui_joy_home"
190#define MUIOPTION_UI_JOY_END               "ui_joy_end"
191#define MUIOPTION_UI_JOY_SS_CHANGE            "ui_joy_ss_change"
192#define MUIOPTION_UI_JOY_HISTORY_UP            "ui_joy_history_up"
193#define MUIOPTION_UI_JOY_HISTORY_DOWN         "ui_joy_history_down"
194#define MUIOPTION_UI_JOY_EXEC               "ui_joy_exec"
195#define MUIOPTION_EXEC_COMMAND               "exec_command"
196#define MUIOPTION_EXEC_WAIT                  "exec_wait"
197#define MUIOPTION_HIDE_MOUSE               "hide_mouse"
198#define MUIOPTION_FULL_SCREEN               "full_screen"
199
200#ifdef MESS
201// Options names
202#define MUIOPTION_DEFAULT_GAME               "default_system"
203#define MUIOPTION_HISTORY_FILE               "sysinfo_file"
204#define MUIOPTION_MAMEINFO_FILE               "messinfo_file"
205// Option values
206#define MUIDEFAULT_SELECTION               "nes"
207#define MUIDEFAULT_SPLITTERS               "152,310,468"
208#define MUIHISTORY_FILE                     "sysinfo.dat"
209#define MUIMAMEINFO_FILE                  "messinfo.dat"
210#else
211// Options names
212#define MUIOPTION_DEFAULT_GAME               "default_game"
213#define MUIOPTION_HISTORY_FILE               "history_file"
214#define MUIOPTION_MAMEINFO_FILE               "mameinfo_file"
215// Options values
216#define MUIDEFAULT_SELECTION               "puckman"
217#define MUIDEFAULT_SPLITTERS               "152,362"
218#define MUIHISTORY_FILE                     "history.dat"
219#define MUIMAMEINFO_FILE                  "mameinfo.dat"
220#endif
221
222
223
224/***************************************************************************
225    Internal structures
226 ***************************************************************************/
227
228#if 0
229typedef struct
230{
231   int folder_index;
232   int filters;
233} folder_filter_type;
234#endif
235
236/***************************************************************************
237    Internal variables
238 ***************************************************************************/
239
240static object_pool *options_memory_pool;
241
242static core_options *settings;
243
244static core_options *global = NULL;         // Global 'default' options
245
246// UI options in mameui.ini
247static const options_entry regSettings[] =
248{
249   // UI options
250   { NULL,                           NULL,       OPTION_HEADER,     "DISPLAY STATE OPTIONS" },
251   { MUIOPTION_DEFAULT_GAME,            MUIDEFAULT_SELECTION, 0,       NULL },
252   { MUIOPTION_DEFAULT_GAME,            "puckman",  0,                 NULL },
253   { MUIOPTION_DEFAULT_FOLDER_ID,         "0",        0,                 NULL },
254   { MUIOPTION_SHOW_IMAGE_SECTION,         "1",        OPTION_BOOLEAN,    NULL },
255   { MUIOPTION_FULL_SCREEN,            "0",        OPTION_BOOLEAN,    NULL },
256   { MUIOPTION_CURRENT_TAB,            "0",        0,                 NULL },
257   { MUIOPTION_SHOW_TOOLBAR,            "1",        OPTION_BOOLEAN,    NULL },
258   { MUIOPTION_SHOW_STATUS_BAR,         "1",        OPTION_BOOLEAN,    NULL },
259   { MUIOPTION_HIDE_FOLDERS,            "",         0,                 NULL },
260#ifdef MESS
261   { MUIOPTION_SHOW_FOLDER_SECTION,      "0",        OPTION_BOOLEAN,    NULL },
262   { MUIOPTION_SHOW_TABS,               "0",        OPTION_BOOLEAN,    NULL },
263   { MUIOPTION_HIDE_TABS,               "flyer, cabinet, marquee, title, cpanel, pcb", 0, NULL },
264   { MUIOPTION_HISTORY_TAB,            "1",        0,                 NULL },
265#else
266   { MUIOPTION_SHOW_FOLDER_SECTION,      "1",        OPTION_BOOLEAN,    NULL },
267   { MUIOPTION_SHOW_TABS,               "1",        OPTION_BOOLEAN,    NULL },
268   { MUIOPTION_HIDE_TABS,               "marquee, title, cpanel, pcb, history", 0, NULL },
269   { MUIOPTION_HISTORY_TAB,            "0",        0,                 NULL },
270#endif
271
272   { MUIOPTION_SORT_COLUMN,            "0",        0,                 NULL },
273   { MUIOPTION_SORT_REVERSED,            "0",        OPTION_BOOLEAN,    NULL },
274   { MUIOPTION_WINDOW_X,               "0",        0,                 NULL },
275   { MUIOPTION_WINDOW_Y,               "0",        0,                 NULL },
276   { MUIOPTION_WINDOW_WIDTH,            "640",      0,                 NULL },
277   { MUIOPTION_WINDOW_HEIGHT,            "400",      0,                 NULL },
278   { MUIOPTION_WINDOW_STATE,            "1",        0,                 NULL },
279
280   { MUIOPTION_TEXT_COLOR,               "-1",       0,                 NULL },
281   { MUIOPTION_CLONE_COLOR,            "-1",       0,                 NULL },
282   { MUIOPTION_CUSTOM_COLOR,            "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", 0, NULL },
283   /* ListMode needs to be before ColumnWidths settings */
284   { MUIOPTION_LIST_MODE,               "5",        0,                 NULL },
285   { MUIOPTION_SPLITTERS,               MUIDEFAULT_SPLITTERS, 0,       NULL },
286   { MUIOPTION_LIST_FONT,               "-8,0,0,0,400,0,0,0,0,0,0,0,0,MS Sans Serif", 0, NULL },
287   { MUIOPTION_COLUMN_WIDTHS,            "185,78,84,84,64,88,74,108,60,144,84,60", 0, NULL },
288   { MUIOPTION_COLUMN_ORDER,            "0,2,3,4,5,6,7,8,9,1,10,11", 0, NULL },
289   { MUIOPTION_COLUMN_SHOWN,            "1,0,1,1,1,1,1,1,1,1,0,0", 0,  NULL },
290
291   { NULL,                           NULL,       OPTION_HEADER,     "INTERFACE OPTIONS" },
292   { MUIOPTION_LANGUAGE,               "english",  0,                 NULL },
293   { MUIOPTION_CHECK_GAME,               "1",        OPTION_BOOLEAN,    NULL },
294   { MUIOPTION_JOYSTICK_IN_INTERFACE,      "0",        OPTION_BOOLEAN,    NULL },
295   { MUIOPTION_KEYBOARD_IN_INTERFACE,      "0",        OPTION_BOOLEAN,    NULL },
296   { MUIOPTION_RANDOM_BACKGROUND,         "0",        OPTION_BOOLEAN,    NULL },
297   { MUIOPTION_BROADCAST_GAME_NAME,      "0",        OPTION_BOOLEAN,    NULL },
298   { MUIOPTION_HIDE_MOUSE,               "0",        OPTION_BOOLEAN,    NULL },
299   { MUIOPTION_INHERIT_FILTER,            "0",        OPTION_BOOLEAN,    NULL },
300   { MUIOPTION_OFFSET_CLONES,            "0",        OPTION_BOOLEAN,    NULL },
301   { MUIOPTION_GAME_CAPTION,            "1",        OPTION_BOOLEAN,    NULL },
302   { MUIOPTION_STRETCH_SCREENSHOT_LARGER,   "0",        OPTION_BOOLEAN,    NULL },
303   { MUIOPTION_CYCLE_SCREENSHOT,         "0",        0,                 NULL },
304    { MUIOPTION_SCREENSHOT_BORDER_SIZE,      "11",       0,                 NULL },
305    { MUIOPTION_SCREENSHOT_BORDER_COLOR,   "-1",       0,                 NULL },
306   { MUIOPTION_EXEC_COMMAND,            "",         0,                 NULL },
307   { MUIOPTION_EXEC_WAIT,               "0",        0,                 NULL },
308
309   { NULL,                           NULL,       OPTION_HEADER,     "SEARCH PATH OPTIONS" },
310   { MUIOPTION_FLYER_DIRECTORY,         "flyers",   0,                 NULL },
311   { MUIOPTION_CABINET_DIRECTORY,         "cabinets", 0,                 NULL },
312   { MUIOPTION_MARQUEE_DIRECTORY,         "marquees", 0,                 NULL },
313   { MUIOPTION_TITLE_DIRECTORY,         "titles",   0,                 NULL },
314   { MUIOPTION_CPANEL_DIRECTORY,         "cpanel",   0,                 NULL },
315   { MUIOPTION_PCB_DIRECTORY,             "pcb",      0,                 NULL },
316   { MUIOPTION_BACKGROUND_DIRECTORY,      "bkground", 0,                 NULL },
317   { MUIOPTION_FOLDER_DIRECTORY,         "folders",  0,                 NULL },
318   { MUIOPTION_ICONS_DIRECTORY,         "icons",    0,                 NULL },
319
320
321   { NULL,                           NULL,       OPTION_HEADER,     "FILENAME OPTIONS" },
322   { MUIOPTION_HISTORY_FILE,            MUIHISTORY_FILE, 0,              NULL },
323   { MUIOPTION_MAMEINFO_FILE,            MUIMAMEINFO_FILE, 0,             NULL },
324
325   { NULL,                           NULL,       OPTION_HEADER,     "NAVIGATION KEY CODES" },
326   { MUIOPTION_UI_KEY_UP,               "KEYCODE_UP", 0,               NULL },
327   { MUIOPTION_UI_KEY_DOWN,            "KEYCODE_DOWN", 0,             NULL },
328   { MUIOPTION_UI_KEY_LEFT,            "KEYCODE_LEFT", 0,             NULL },
329   { MUIOPTION_UI_KEY_RIGHT,            "KEYCODE_RIGHT", 0,            NULL },
330   { MUIOPTION_UI_KEY_START,            "KEYCODE_ENTER NOT KEYCODE_LALT", 0, NULL },
331   { MUIOPTION_UI_KEY_PGUP,            "KEYCODE_PGUP", 0,             NULL },
332   { MUIOPTION_UI_KEY_PGDWN,            "KEYCODE_PGDN", 0,             NULL },
333   { MUIOPTION_UI_KEY_HOME,            "KEYCODE_HOME", 0,             NULL },
334   { MUIOPTION_UI_KEY_END,               "KEYCODE_END", 0,              NULL },
335   { MUIOPTION_UI_KEY_SS_CHANGE,         "KEYCODE_INSERT", 0,           NULL },
336   { MUIOPTION_UI_KEY_HISTORY_UP,         "KEYCODE_DEL", 0,              NULL },
337   { MUIOPTION_UI_KEY_HISTORY_DOWN,      "KEYCODE_LALT KEYCODE_0", 0,   NULL },
338
339   { MUIOPTION_UI_KEY_CONTEXT_FILTERS,      "KEYCODE_LCONTROL KEYCODE_F", 0, NULL },
340   { MUIOPTION_UI_KEY_SELECT_RANDOM,      "KEYCODE_LCONTROL KEYCODE_R", 0, NULL },
341   { MUIOPTION_UI_KEY_GAME_AUDIT,         "KEYCODE_LALT KEYCODE_A",     0, NULL },
342   { MUIOPTION_UI_KEY_GAME_PROPERTIES,      "KEYCODE_LALT KEYCODE_ENTER", 0, NULL },
343   { MUIOPTION_UI_KEY_HELP_CONTENTS,      "KEYCODE_F1",                 0, NULL },
344   { MUIOPTION_UI_KEY_UPDATE_GAMELIST,      "KEYCODE_F5",                 0, NULL },
345   { MUIOPTION_UI_KEY_VIEW_FOLDERS,      "KEYCODE_LALT KEYCODE_D",     0, NULL },
346   { MUIOPTION_UI_KEY_VIEW_FULLSCREEN,      "KEYCODE_F11",                0, NULL },
347   { MUIOPTION_UI_KEY_VIEW_PAGETAB,      "KEYCODE_LALT KEYCODE_B",     0, NULL },
348   { MUIOPTION_UI_KEY_VIEW_PICTURE_AREA,   "KEYCODE_LALT KEYCODE_P",     0, NULL },
349   { MUIOPTION_UI_KEY_VIEW_STATUS,         "KEYCODE_LALT KEYCODE_S",     0, NULL },
350    { MUIOPTION_UI_KEY_VIEW_TOOLBARS,      "KEYCODE_LALT KEYCODE_T",     0, NULL },
351
352   { MUIOPTION_UI_KEY_VIEW_TAB_CABINET,   "KEYCODE_LALT KEYCODE_3",     0, NULL },
353    { MUIOPTION_UI_KEY_VIEW_TAB_CPANEL,      "KEYCODE_LALT KEYCODE_6",     0, NULL },
354    { MUIOPTION_UI_KEY_VIEW_TAB_FLYER,      "KEYCODE_LALT KEYCODE_2",     0, NULL },
355    { MUIOPTION_UI_KEY_VIEW_TAB_HISTORY,   "KEYCODE_LALT KEYCODE_8",     0, NULL },
356    { MUIOPTION_UI_KEY_VIEW_TAB_MARQUEE,   "KEYCODE_LALT KEYCODE_4",     0, NULL },
357    { MUIOPTION_UI_KEY_VIEW_TAB_SCREENSHOT,   "KEYCODE_LALT KEYCODE_1",     0, NULL },
358    { MUIOPTION_UI_KEY_VIEW_TAB_TITLE,      "KEYCODE_LALT KEYCODE_5",     0, NULL },
359    { MUIOPTION_UI_KEY_VIEW_TAB_PCB,      "KEYCODE_LALT KEYCODE_7",     0, NULL },
360    { MUIOPTION_UI_KEY_QUIT,            "KEYCODE_LALT KEYCODE_Q",     0, NULL },
361
362   { NULL,                           NULL,       OPTION_HEADER,     "NAVIGATION JOYSTICK CODES" },
363   { MUIOPTION_UI_JOY_UP,               "",         0,                 NULL },
364   { MUIOPTION_UI_JOY_DOWN,            "",         0,                 NULL },
365   { MUIOPTION_UI_JOY_LEFT,            "",         0,                 NULL },
366   { MUIOPTION_UI_JOY_RIGHT,            "",         0,                 NULL },
367   { MUIOPTION_UI_JOY_START,            "",         0,                 NULL },
368   { MUIOPTION_UI_JOY_PGUP,            "",         0,                 NULL },
369   { MUIOPTION_UI_JOY_PGDWN,            "",         0,                 NULL },
370   { MUIOPTION_UI_JOY_HOME,            "0,0,0,0",  0,                 NULL },
371   { MUIOPTION_UI_JOY_END,               "0,0,0,0",  0,                 NULL },
372   { MUIOPTION_UI_JOY_SS_CHANGE,         "",         0,                 NULL },
373   { MUIOPTION_UI_JOY_HISTORY_UP,         "",         0,                 NULL },
374   { MUIOPTION_UI_JOY_HISTORY_DOWN,      "",         0,                 NULL },
375   { MUIOPTION_UI_JOY_EXEC,            "0,0,0,0",  0,                 NULL },
376
377#ifndef MESS
378   { NULL,                           NULL,       OPTION_HEADER,     "GAME STATISTICS" },
379#endif
380   { NULL }
381};
382
383static const options_entry perGameOptions[] =
384{
385   // per game options
386   { "_play_count",             "0",        0,                 NULL },
387   { "_play_time",              "0",        0,                 NULL },
388   { "_rom_audit",              "-1",       0,                 NULL },
389   { "_samples_audit",          "-1",       0,                 NULL },
390#ifdef MESS
391   { "_extra_software",         "",         0,                 NULL },
392#endif
393   { NULL }
394};
395
396static const options_entry filterOptions[] =
397{
398   // filters
399   { "_filters",                "0",        0,                 NULL },
400   { NULL }
401};
402
403
404
405// Screen shot Page tab control text
406// these must match the order of the options flags in options.h
407// (TAB_...)
408const char* image_tabs_long_name[MAX_TAB_TYPES] =
409{
410   "Snapshot ",
411   "Flyer ",
412   "Cabinet ",
413   "Marquee",
414   "Title",
415   "Control Panel",
416   "PCB",
417   "History ",
418};
419
420const char* image_tabs_short_name[MAX_TAB_TYPES] =
421{
422   "snapshot",
423   "flyer",
424   "cabinet",
425   "marquee",
426   "title",
427   "cpanel",
428   "pcb",
429   "history"
430};
431
432
433static BOOL save_gui_settings = TRUE;
434static BOOL save_default_options = TRUE;
435
436#if 0
437folder_filter_type *folder_filters;
438int size_folder_filters;
439int num_folder_filters;
440#endif
441
442/***************************************************************************
443    External functions
444 ***************************************************************************/
445
446static void memory_error(const char *message)
447{
448   win_message_box_utf8(NULL, message, NULL, MB_OK);
449   exit(-1);
450}
451
452
453
454void AddOptions(core_options *opts, const options_entry *entrylist, BOOL is_global)
455{
456   static const char *blacklist[] =
457   {
458      WINOPTION_SCREEN,
459      WINOPTION_ASPECT,
460      WINOPTION_RESOLUTION,
461      WINOPTION_VIEW
462   };
463   options_entry entries[2];
464   BOOL good_option;
465   int i;
466
467   for ( ; entrylist->name != NULL || (entrylist->flags & OPTION_HEADER); entrylist++)
468   {
469      good_option = TRUE;
470
471      // check blacklist
472      if (entrylist->name != NULL)
473      {
474         for (i = 0; i < ARRAY_LENGTH(blacklist); i++)
475         {
476            if (!strcmp(entrylist->name, blacklist[i]))
477            {
478               good_option = FALSE;
479               break;
480            }
481         }
482      }
483
484      // if is_global is FALSE, blacklist global options
485      if (entrylist->name && !is_global && IsGlobalOption(entrylist->name))
486         good_option = FALSE;
487
488      if (good_option)
489      {
490         memcpy(entries, entrylist, sizeof(options_entry));
491         memset(&entries[1], 0, sizeof(entries[1]));
492         options_add_entries(opts, entries);
493      }
494   }
495}
496
497
498
499core_options *CreateGameOptions(int driver_index)
500{
501   core_options *opts;
502   BOOL is_global = (driver_index == OPTIONS_TYPE_GLOBAL);
503   extern const options_entry mame_win_options[];
504
505   // create the options
506   opts = options_create(memory_error);
507
508   // add the options
509   AddOptions(opts, mame_core_options, is_global);
510   AddOptions(opts, mame_win_options, is_global);
511
512   // customize certain options
513   if (is_global)
514      options_set_option_default_value(opts, OPTION_INIPATH, "ini");
515
516#ifdef MESS
517   MessSetupGameOptions(opts, driver_index);
518#endif // MESS
519
520   return opts;
521}
522
523
524
525BOOL OptionsInit()
526{
527   // create a memory pool for our data
528   options_memory_pool = pool_alloc(memory_error);
529   if (!options_memory_pool)
530      return FALSE;
531
532   // set up the MAME32 settings (these get placed in MAME32ui.ini
533   settings = options_create(memory_error);
534   options_add_entries(settings, regSettings);
535#ifdef MESS
536   MessSetupSettings(settings);
537#endif
538
539   // set up per game options
540   {
541      char buffer[128];
542      int i, j;
543      int game_option_count = 0;
544      options_entry *driver_per_game_options;
545      options_entry *ent;
546
547      while(perGameOptions[game_option_count].name)
548         game_option_count++;
549
550      driver_per_game_options = (options_entry *) pool_malloc(options_memory_pool,
551         (game_option_count * driver_list_get_count(drivers) + 1) * sizeof(*driver_per_game_options));
552
553      for (i = 0; i < driver_list_get_count(drivers); i++)
554      {
555         for (j = 0; j < game_option_count; j++)
556         {
557            ent = &driver_per_game_options[i * game_option_count + j];
558
559            snprintf(buffer, ARRAY_LENGTH(buffer), "%s%s", drivers[i]->name, perGameOptions[j].name);
560
561            memset(ent, 0, sizeof(*ent));
562            ent->name = pool_strdup(options_memory_pool, buffer);
563            ent->defvalue = perGameOptions[j].defvalue;
564            ent->flags = perGameOptions[j].flags;
565            ent->description = perGameOptions[j].description;
566         }
567      }
568      ent = &driver_per_game_options[driver_list_get_count(drivers) * game_option_count];
569      memset(ent, 0, sizeof(*ent));
570      options_add_entries(settings, driver_per_game_options);
571   }
572
573   // set up global options
574   global = CreateGameOptions(OPTIONS_TYPE_GLOBAL);
575#if 0
576   // set up folders
577   size_folder_filters = 1;
578   num_folder_filters = 0;
579   folder_filters = (folder_filter_type *) pool_malloc(options_memory_pool, size_folder_filters * sizeof(*folder_filters));
580#endif
581   // now load the options and settings
582   LoadOptionsAndSettings();
583
584   return TRUE;
585
586}
587
588void OptionsExit(void)
589{
590   // free global options
591   options_free(global);
592   global = NULL;
593
594   // free settings
595   options_free(settings);
596   settings = NULL;
597
598   // free the memory pool
599   pool_free(options_memory_pool);
600   options_memory_pool = NULL;
601}
602
603core_options * MameUISettings(void)
604{
605   return settings;
606}
607
608core_options * MameUIGlobal(void)
609{
610   return global;
611}
612
613#if 0
614static void LoadFolderFilter(int folder_index,int filters)
615{
616   //dprintf("loaded folder filter %i %i",folder_index,filters);
617
618   if (num_folder_filters == size_folder_filters)
619   {
620      size_folder_filters *= 2;
621      folder_filters = (folder_filter_type *)realloc(
622         folder_filters,size_folder_filters * sizeof(folder_filter_type));
623   }
624   folder_filters[num_folder_filters].folder_index = folder_index;
625   folder_filters[num_folder_filters].filters = filters;
626
627   num_folder_filters++;
628}
629#endif
630
631// Restore ui settings to factory
632void ResetGUI(void)
633{
634   ResetToDefaults(settings, OPTION_PRIORITY_NORMAL);
635   // Save the new MAME32ui.ini
636   SaveOptions();
637   save_gui_settings = FALSE;
638}
639
640const char * GetImageTabLongName(int tab_index)
641{
642   assert(tab_index >= 0);
643   assert(tab_index < ARRAY_LENGTH(image_tabs_long_name));
644   return image_tabs_long_name[tab_index];
645}
646
647const char * GetImageTabShortName(int tab_index)
648{
649   assert(tab_index >= 0);
650   assert(tab_index < ARRAY_LENGTH(image_tabs_short_name));
651   return image_tabs_short_name[tab_index];
652}
653
654//============================================================
655//  OPTIONS WRAPPERS
656//============================================================
657
658static COLORREF options_get_color(core_options *opts, const char *name)
659{
660   const char *value_str;
661   unsigned int r, g, b;
662   COLORREF value;
663
664   value_str = options_get_string(opts, name);
665
666   if (sscanf(value_str, "%u,%u,%u", &r, &g, &b) == 3)
667      value = RGB(r,g,b);
668   else
669      value = (COLORREF) - 1;
670   return value;
671}
672
673static void options_set_color(core_options *opts, const char *name, COLORREF value)
674{
675   char value_str[32];
676
677   if (value == (COLORREF) -1)
678   {
679      snprintf(value_str, ARRAY_LENGTH(value_str), "%d", (int) value);
680   }
681   else
682   {
683      snprintf(value_str, ARRAY_LENGTH(value_str), "%d,%d,%d",
684         (((int) value) >>  0) & 0xFF,
685         (((int) value) >>  8) & 0xFF,
686         (((int) value) >> 16) & 0xFF);
687   }
688   options_set_string(opts, name, value_str, OPTION_PRIORITY_CMDLINE);
689}
690
691static COLORREF options_get_color_default(core_options *opts, const char *name, int default_color)
692{
693   COLORREF value = options_get_color(opts, name);
694   if (value == (COLORREF) -1)
695      value = GetSysColor(default_color);
696   return value;
697}
698
699static void options_set_color_default(core_options *opts, const char *name, COLORREF value, int default_color)
700{
701   if (value == GetSysColor(default_color))
702      options_set_color(settings, name, (COLORREF) -1);
703   else
704      options_set_color(settings, name, value);
705}
706
707static input_seq *options_get_input_seq(core_options *opts, const char *name)
708{
709   static input_seq seq;
710   const char *seq_string;
711
712   seq_string = options_get_string(opts, name);
713   input_seq_from_tokens(seq_string, &seq);
714   return &seq;
715}
716
717
718
719//============================================================
720//  OPTIONS CALLS
721//============================================================
722
723void SetViewMode(int val)
724{
725   options_set_int(settings, MUIOPTION_LIST_MODE, val, OPTION_PRIORITY_CMDLINE);
726}
727
728int GetViewMode(void)
729{
730   return options_get_int(settings, MUIOPTION_LIST_MODE);
731}
732
733void SetGameCheck(BOOL game_check)
734{
735   options_set_bool(settings, MUIOPTION_CHECK_GAME, game_check, OPTION_PRIORITY_CMDLINE);
736}
737
738BOOL GetGameCheck(void)
739{
740   return options_get_bool(settings,MUIOPTION_CHECK_GAME);
741}
742
743void SetJoyGUI(BOOL use_joygui)
744{
745   options_set_bool(settings, MUIOPTION_JOYSTICK_IN_INTERFACE, use_joygui, OPTION_PRIORITY_CMDLINE);
746}
747
748BOOL GetJoyGUI(void)
749{
750   return options_get_bool(settings, MUIOPTION_JOYSTICK_IN_INTERFACE);
751}
752
753void SetKeyGUI(BOOL use_keygui)
754{
755   options_set_bool(settings, MUIOPTION_KEYBOARD_IN_INTERFACE, use_keygui, OPTION_PRIORITY_CMDLINE);
756}
757
758BOOL GetKeyGUI(void)
759{
760   return options_get_bool(settings, MUIOPTION_KEYBOARD_IN_INTERFACE);
761}
762
763void SetCycleScreenshot(int cycle_screenshot)
764{
765   options_set_int(settings, MUIOPTION_CYCLE_SCREENSHOT, cycle_screenshot, OPTION_PRIORITY_CMDLINE);
766}
767
768int GetCycleScreenshot(void)
769{
770   return options_get_int(settings, MUIOPTION_CYCLE_SCREENSHOT);
771}
772
773void SetStretchScreenShotLarger(BOOL stretch)
774{
775   options_set_bool(settings, MUIOPTION_STRETCH_SCREENSHOT_LARGER, stretch, OPTION_PRIORITY_CMDLINE);
776}
777
778BOOL GetStretchScreenShotLarger(void)
779{
780   return options_get_bool(settings, MUIOPTION_STRETCH_SCREENSHOT_LARGER);
781}
782
783void SetScreenshotBorderSize(int size)
784{
785   options_set_int(settings, MUIOPTION_SCREENSHOT_BORDER_SIZE, size, OPTION_PRIORITY_CMDLINE);
786}
787
788int GetScreenshotBorderSize(void)
789{
790   return options_get_int(settings, MUIOPTION_SCREENSHOT_BORDER_SIZE);
791}
792
793void SetScreenshotBorderColor(COLORREF uColor)
794{
795   options_set_color_default(settings, MUIOPTION_SCREENSHOT_BORDER_COLOR, uColor, COLOR_3DFACE);
796}
797
798COLORREF GetScreenshotBorderColor(void)
799{
800   return options_get_color_default(settings, MUIOPTION_SCREENSHOT_BORDER_COLOR, COLOR_3DFACE);
801}
802
803void SetFilterInherit(BOOL inherit)
804{
805   options_set_bool(settings, MUIOPTION_INHERIT_FILTER, inherit, OPTION_PRIORITY_CMDLINE);
806}
807
808BOOL GetFilterInherit(void)
809{
810   return options_get_bool(settings, MUIOPTION_INHERIT_FILTER);
811}
812
813void SetOffsetClones(BOOL offset)
814{
815   options_set_bool(settings, MUIOPTION_OFFSET_CLONES, offset, OPTION_PRIORITY_CMDLINE);
816}
817
818BOOL GetOffsetClones(void)
819{
820   return options_get_bool(settings, MUIOPTION_OFFSET_CLONES);
821}
822
823void SetGameCaption(BOOL caption)
824{
825   options_set_bool(settings, MUIOPTION_GAME_CAPTION, caption, OPTION_PRIORITY_CMDLINE);
826}
827
828BOOL GetGameCaption(void)
829{
830   return options_get_bool(settings, MUIOPTION_GAME_CAPTION);
831}
832
833void SetBroadcast(BOOL broadcast)
834{
835   options_set_bool(settings, MUIOPTION_BROADCAST_GAME_NAME, broadcast, OPTION_PRIORITY_CMDLINE);
836}
837
838BOOL GetBroadcast(void)
839{
840   return options_get_bool(settings, MUIOPTION_BROADCAST_GAME_NAME);
841}
842
843void SetRandomBackground(BOOL random_bg)
844{
845   options_set_bool(settings, MUIOPTION_RANDOM_BACKGROUND, random_bg, OPTION_PRIORITY_CMDLINE);
846}
847
848BOOL GetRandomBackground(void)
849{
850   return options_get_bool(settings, MUIOPTION_RANDOM_BACKGROUND);
851}
852
853void SetSavedFolderID(UINT val)
854{
855   options_set_int(settings, MUIOPTION_DEFAULT_FOLDER_ID, (int) val, OPTION_PRIORITY_CMDLINE);
856}
857
858UINT GetSavedFolderID(void)
859{
860   return (UINT) options_get_int(settings, MUIOPTION_DEFAULT_FOLDER_ID);
861}
862
863void SetShowScreenShot(BOOL val)
864{
865   options_set_bool(settings, MUIOPTION_SHOW_IMAGE_SECTION, val, OPTION_PRIORITY_CMDLINE);
866}
867
868BOOL GetShowScreenShot(void)
869{
870   return options_get_bool(settings, MUIOPTION_SHOW_IMAGE_SECTION);
871}
872
873void SetShowFolderList(BOOL val)
874{
875   options_set_bool(settings, MUIOPTION_SHOW_FOLDER_SECTION, val, OPTION_PRIORITY_CMDLINE);
876}
877
878BOOL GetShowFolderList(void)
879{
880   return options_get_bool(settings, MUIOPTION_SHOW_FOLDER_SECTION);
881}
882
883static void GetsShowFolderFlags(LPBITS bits)
884{
885   char s[2000];
886   extern FOLDERDATA g_folderData[];
887   char *token;
888
889   snprintf(s, ARRAY_LENGTH(s), "%s", options_get_string(settings, MUIOPTION_HIDE_FOLDERS));
890
891   SetAllBits(bits, TRUE);
892
893   token = strtok(s,", \t");
894   while (token != NULL)
895   {
896      int j;
897
898      for (j=0;g_folderData[j].m_lpTitle != NULL;j++)
899      {
900         if (strcmp(g_folderData[j].short_name,token) == 0)
901         {
902            ClearBit(bits, g_folderData[j].m_nFolderId);
903            break;
904         }
905      }
906      token = strtok(NULL,", \t");
907   }
908}
909
910BOOL GetShowFolder(int folder)
911{
912   BOOL result;
913   LPBITS show_folder_flags = NewBits(MAX_FOLDERS);
914   GetsShowFolderFlags(show_folder_flags);
915   result = TestBit(show_folder_flags, folder);
916   DeleteBits(show_folder_flags);
917   return result;
918}
919
920void SetShowFolder(int folder,BOOL show)
921{
922   LPBITS show_folder_flags = NewBits(MAX_FOLDERS);
923   int i;
924   int num_saved = 0;
925   char str[10000];
926   extern FOLDERDATA g_folderData[];
927
928   GetsShowFolderFlags(show_folder_flags);
929
930   if (show)
931      SetBit(show_folder_flags, folder);
932   else
933      ClearBit(show_folder_flags, folder);
934
935   strcpy(str, "");
936
937   // we save the ones that are NOT displayed, so we can add new ones
938   // and upgraders will see them
939   for (i=0;i<MAX_FOLDERS;i++)
940   {
941      if (TestBit(show_folder_flags, i) == FALSE)
942      {
943         int j;
944
945         if (num_saved != 0)
946            strcat(str,", ");
947
948         for (j=0;g_folderData[j].m_lpTitle != NULL;j++)
949         {
950            if (g_folderData[j].m_nFolderId == i)
951            {
952               strcat(str,g_folderData[j].short_name);
953               num_saved++;
954               break;
955            }
956         }
957      }
958   }
959   options_set_string(settings, MUIOPTION_HIDE_FOLDERS, str, OPTION_PRIORITY_CMDLINE);
960   DeleteBits(show_folder_flags);
961}
962
963void SetShowStatusBar(BOOL val)
964{
965   options_set_bool(settings, MUIOPTION_SHOW_STATUS_BAR, val, OPTION_PRIORITY_CMDLINE);
966}
967
968BOOL GetShowStatusBar(void)
969{
970   return options_get_bool(settings, MUIOPTION_SHOW_STATUS_BAR);
971}
972
973void SetShowTabCtrl (BOOL val)
974{
975   options_set_bool(settings, MUIOPTION_SHOW_TABS, val, OPTION_PRIORITY_CMDLINE);
976}
977
978BOOL GetShowTabCtrl (void)
979{
980   return options_get_bool(settings, MUIOPTION_SHOW_TABS);
981}
982
983void SetShowToolBar(BOOL val)
984{
985   options_set_bool(settings, MUIOPTION_SHOW_TOOLBAR, val, OPTION_PRIORITY_CMDLINE);
986}
987
988BOOL GetShowToolBar(void)
989{
990   return options_get_bool(settings, MUIOPTION_SHOW_TOOLBAR);
991}
992
993void SetCurrentTab(const char *shortname)
994{
995   options_set_string(settings, MUIOPTION_CURRENT_TAB, shortname, OPTION_PRIORITY_CMDLINE);
996}
997
998const char *GetCurrentTab(void)
999{
1000   return options_get_string(settings, MUIOPTION_CURRENT_TAB);
1001}
1002
1003void SetDefaultGame(const char *name)
1004{
1005   options_set_string(settings, MUIOPTION_DEFAULT_GAME, name, OPTION_PRIORITY_CMDLINE);
1006}
1007
1008const char *GetDefaultGame(void)
1009{
1010   return options_get_string(settings, MUIOPTION_DEFAULT_GAME);
1011}
1012
1013void SetWindowArea(const AREA *area)
1014{
1015   options_set_int(settings, MUIOPTION_WINDOW_X,      area->x, OPTION_PRIORITY_CMDLINE);
1016   options_set_int(settings, MUIOPTION_WINDOW_Y,      area->y, OPTION_PRIORITY_CMDLINE);
1017   options_set_int(settings, MUIOPTION_WINDOW_WIDTH,   area->width, OPTION_PRIORITY_CMDLINE);
1018   options_set_int(settings, MUIOPTION_WINDOW_HEIGHT,   area->height, OPTION_PRIORITY_CMDLINE);
1019}
1020
1021void GetWindowArea(AREA *area)
1022{
1023   area->x      = options_get_int(settings, MUIOPTION_WINDOW_X);
1024   area->y      = options_get_int(settings, MUIOPTION_WINDOW_Y);
1025   area->width  = options_get_int(settings, MUIOPTION_WINDOW_WIDTH);
1026   area->height = options_get_int(settings, MUIOPTION_WINDOW_HEIGHT);
1027}
1028
1029void SetWindowState(UINT state)
1030{
1031   options_set_int(settings, MUIOPTION_WINDOW_STATE, state, OPTION_PRIORITY_CMDLINE);
1032}
1033
1034UINT GetWindowState(void)
1035{
1036   return options_get_int(settings, MUIOPTION_WINDOW_STATE);
1037}
1038
1039void SetCustomColor(int iIndex, COLORREF uColor)
1040{
1041   const char *custom_color_string;
1042   COLORREF custom_color[256];
1043   char buffer[10000];
1044
1045   custom_color_string = options_get_string(settings, MUIOPTION_CUSTOM_COLOR);
1046   CusColorDecodeString(custom_color_string, custom_color);
1047
1048   custom_color[iIndex] = uColor;
1049
1050   CusColorEncodeString(custom_color, buffer);
1051   options_set_string(settings, MUIOPTION_CUSTOM_COLOR, buffer, OPTION_PRIORITY_CMDLINE);
1052}
1053
1054COLORREF GetCustomColor(int iIndex)
1055{
1056   const char *custom_color_string;
1057   COLORREF custom_color[256];
1058
1059   custom_color_string = options_get_string(settings, MUIOPTION_CUSTOM_COLOR);
1060   CusColorDecodeString(custom_color_string, custom_color);
1061
1062   if (custom_color[iIndex] == (COLORREF)-1)
1063      return (COLORREF)RGB(0,0,0);
1064
1065   return custom_color[iIndex];
1066}
1067
1068void SetListFont(const LOGFONT *font)
1069{
1070   char font_string[10000];
1071   FontEncodeString(font, font_string);
1072   options_set_string(settings, MUIOPTION_LIST_FONT, font_string, OPTION_PRIORITY_CMDLINE);
1073}
1074
1075void GetListFont(LOGFONT *font)
1076{
1077   const char *font_string = options_get_string(settings, MUIOPTION_LIST_FONT);
1078   FontDecodeString(font_string, font);
1079}
1080
1081void SetListFontColor(COLORREF uColor)
1082{
1083   options_set_color_default(settings, MUIOPTION_TEXT_COLOR, uColor, COLOR_WINDOWTEXT);
1084}
1085
1086COLORREF GetListFontColor(void)
1087{
1088   return options_get_color_default(settings, MUIOPTION_TEXT_COLOR, COLOR_WINDOWTEXT);
1089}
1090
1091void SetListCloneColor(COLORREF uColor)
1092{
1093   options_set_color_default(settings, MUIOPTION_CLONE_COLOR, uColor, COLOR_WINDOWTEXT);
1094}
1095
1096COLORREF GetListCloneColor(void)
1097{
1098   return options_get_color_default(settings, MUIOPTION_CLONE_COLOR, COLOR_WINDOWTEXT);
1099}
1100
1101int GetShowTab(int tab)
1102{
1103   const char *show_tabs_string;
1104   int show_tab_flags;
1105
1106   show_tabs_string = options_get_string(settings, MUIOPTION_HIDE_TABS);
1107   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1108   return (show_tab_flags & (1 << tab)) != 0;
1109}
1110
1111void SetShowTab(int tab,BOOL show)
1112{
1113   const char *show_tabs_string;
1114   int show_tab_flags;
1115   char buffer[10000];
1116
1117   show_tabs_string = options_get_string(settings, MUIOPTION_HIDE_TABS);
1118   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1119
1120   if (show)
1121      show_tab_flags |= 1 << tab;
1122   else
1123      show_tab_flags &= ~(1 << tab);
1124
1125   TabFlagsEncodeString(show_tab_flags, buffer);
1126   options_set_string(settings, MUIOPTION_HIDE_TABS, buffer, OPTION_PRIORITY_CMDLINE);
1127}
1128
1129// don't delete the last one
1130BOOL AllowedToSetShowTab(int tab,BOOL show)
1131{
1132   const char *show_tabs_string;
1133   int show_tab_flags;
1134
1135   if (show == TRUE)
1136      return TRUE;
1137
1138   show_tabs_string = options_get_string(settings, MUIOPTION_HIDE_TABS);
1139   TabFlagsDecodeString(show_tabs_string, &show_tab_flags);
1140
1141   show_tab_flags &= ~(1 << tab);
1142   return show_tab_flags != 0;
1143}
1144
1145int GetHistoryTab(void)
1146{
1147   return options_get_int(settings, MUIOPTION_HISTORY_TAB);
1148}
1149
1150void SetHistoryTab(int tab, BOOL show)
1151{
1152   if (show)
1153      options_set_int(settings, MUIOPTION_HISTORY_TAB, tab, OPTION_PRIORITY_CMDLINE);
1154   else
1155      options_set_int(settings, MUIOPTION_HISTORY_TAB, TAB_NONE, OPTION_PRIORITY_CMDLINE);
1156}
1157
1158void SetColumnWidths(int width[])
1159{
1160   char column_width_string[10000];
1161   ColumnEncodeStringWithCount(width, column_width_string, COLUMN_MAX);
1162   options_set_string(settings, MUIOPTION_COLUMN_WIDTHS, column_width_string, OPTION_PRIORITY_CMDLINE);
1163}
1164
1165void GetColumnWidths(int width[])
1166{
1167   const char *column_width_string;
1168   column_width_string = options_get_string(settings, MUIOPTION_COLUMN_WIDTHS);
1169   ColumnDecodeStringWithCount(column_width_string, width, COLUMN_MAX);
1170}
1171
1172void SetSplitterPos(int splitterId, int pos)
1173{
1174   const char *splitter_string;
1175   int *splitter;
1176   char buffer[10000];
1177
1178   if (splitterId < GetSplitterCount())
1179   {
1180      splitter_string = options_get_string(settings, MUIOPTION_SPLITTERS);
1181      splitter = (int *) alloca(GetSplitterCount() * sizeof(*splitter));
1182      SplitterDecodeString(splitter_string, splitter);
1183
1184      splitter[splitterId] = pos;
1185
1186      SplitterEncodeString(splitter, buffer);
1187      options_set_string(settings, MUIOPTION_SPLITTERS, buffer, OPTION_PRIORITY_CMDLINE);
1188   }
1189}
1190
1191int  GetSplitterPos(int splitterId)
1192{
1193   const char *splitter_string;
1194   int *splitter;
1195
1196   splitter_string = options_get_string(settings, MUIOPTION_SPLITTERS);
1197   splitter = (int *) alloca(GetSplitterCount() * sizeof(*splitter));
1198   SplitterDecodeString(splitter_string, splitter);
1199
1200   if (splitterId < GetSplitterCount())
1201      return splitter[splitterId];
1202
1203   return -1; /* Error */
1204}
1205
1206void SetColumnOrder(int order[])
1207{
1208   char column_order_string[10000];
1209   ColumnEncodeStringWithCount(order, column_order_string, COLUMN_MAX);
1210   options_set_string(settings, MUIOPTION_COLUMN_ORDER, column_order_string, OPTION_PRIORITY_CMDLINE);
1211}
1212
1213void GetColumnOrder(int order[])
1214{
1215   const char *column_order_string;
1216   column_order_string = options_get_string(settings, MUIOPTION_COLUMN_ORDER);
1217   ColumnDecodeStringWithCount(column_order_string, order, COLUMN_MAX);
1218}
1219
1220void SetColumnShown(int shown[])
1221{
1222   char column_shown_string[10000];
1223   ColumnEncodeStringWithCount(shown, column_shown_string, COLUMN_MAX);
1224   options_set_string(settings, MUIOPTION_COLUMN_SHOWN, column_shown_string, OPTION_PRIORITY_CMDLINE);
1225}
1226
1227void GetColumnShown(int shown[])
1228{
1229   const char *column_shown_string;
1230   column_shown_string = options_get_string(settings, MUIOPTION_COLUMN_SHOWN);
1231   ColumnDecodeStringWithCount(column_shown_string, shown, COLUMN_MAX);
1232}
1233
1234void SetSortColumn(int column)
1235{
1236   options_set_int(settings, MUIOPTION_SORT_COLUMN, column, OPTION_PRIORITY_CMDLINE);
1237}
1238
1239int GetSortColumn(void)
1240{
1241   return options_get_int(settings, MUIOPTION_SORT_COLUMN);
1242}
1243
1244void SetSortReverse(BOOL reverse)
1245{
1246   options_set_bool(settings, MUIOPTION_SORT_REVERSED, reverse, OPTION_PRIORITY_CMDLINE);
1247}
1248
1249BOOL GetSortReverse(void)
1250{
1251   return options_get_bool(settings, MUIOPTION_SORT_REVERSED);
1252}
1253
1254const char* GetLanguage(void)
1255{
1256   return options_get_string(settings, MUIOPTION_LANGUAGE);
1257}
1258
1259void SetLanguage(const char* lang)
1260{
1261   options_set_string(settings, MUIOPTION_LANGUAGE, lang, OPTION_PRIORITY_CMDLINE);
1262}
1263
1264const char* GetRomDirs(void)
1265{
1266   return options_get_string(global, OPTION_ROMPATH);
1267}
1268
1269void SetRomDirs(const char* paths)
1270{
1271   options_set_string(global, OPTION_ROMPATH, paths, OPTION_PRIORITY_CMDLINE);
1272}
1273
1274const char* GetSampleDirs(void)
1275{
1276   return options_get_string(global, OPTION_SAMPLEPATH);
1277}
1278
1279void SetSampleDirs(const char* paths)
1280{
1281   options_set_string(global, OPTION_SAMPLEPATH, paths, OPTION_PRIORITY_CMDLINE);
1282}
1283
1284const char * GetIniDir(void)
1285{
1286   const char *ini_dir;
1287   const char *s;
1288
1289   ini_dir = options_get_string(global, OPTION_INIPATH);
1290   while((s = strchr(ini_dir, ';')) != NULL)
1291   {
1292      ini_dir = s + 1;
1293   }
1294   return ini_dir;
1295
1296}
1297
1298void SetIniDir(const char *path)
1299{
1300   options_set_string(global, OPTION_INIPATH, path, OPTION_PRIORITY_CMDLINE);
1301}
1302
1303const char* GetCtrlrDir(void)
1304{
1305   return options_get_string(global, OPTION_CTRLRPATH);
1306}
1307
1308void SetCtrlrDir(const char* path)
1309{
1310   options_set_string(global, OPTION_CTRLRPATH, path, OPTION_PRIORITY_CMDLINE);
1311}
1312
1313const char* GetCommentDir(void)
1314{
1315   return options_get_string(global, OPTION_COMMENT_DIRECTORY);
1316}
1317
1318void SetCommentDir(const char* path)
1319{
1320   options_set_string(global, OPTION_COMMENT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1321}
1322
1323const char* GetCfgDir(void)
1324{
1325   return options_get_string(global, OPTION_CFG_DIRECTORY);
1326}
1327
1328void SetCfgDir(const char* path)
1329{
1330   options_set_string(global, OPTION_CFG_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1331}
1332
1333const char* GetNvramDir(void)
1334{
1335   return options_get_string(global, OPTION_NVRAM_DIRECTORY);
1336}
1337
1338void SetNvramDir(const char* path)
1339{
1340   options_set_string(global, OPTION_NVRAM_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1341}
1342
1343const char* GetInpDir(void)
1344{
1345   return options_get_string(global, OPTION_INPUT_DIRECTORY);
1346}
1347
1348void SetInpDir(const char* path)
1349{
1350   options_set_string(global, OPTION_INPUT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1351}
1352
1353const char* GetImgDir(void)
1354{
1355   return options_get_string(global, OPTION_SNAPSHOT_DIRECTORY);
1356}
1357
1358void SetImgDir(const char* path)
1359{
1360   options_set_string(global, OPTION_SNAPSHOT_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1361}
1362
1363const char* GetStateDir(void)
1364{
1365   return options_get_string(global, OPTION_STATE_DIRECTORY);
1366}
1367
1368void SetStateDir(const char* path)
1369{
1370   options_set_string(global, OPTION_STATE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1371}
1372
1373const char* GetArtDir(void)
1374{
1375   return options_get_string(global, OPTION_ARTPATH);
1376}
1377
1378void SetArtDir(const char* path)
1379{
1380   options_set_string(global, OPTION_ARTPATH, path, OPTION_PRIORITY_CMDLINE);
1381}
1382
1383const char* GetMemcardDir(void)
1384{
1385   return options_get_string(global, OPTION_MEMCARD_DIRECTORY);
1386}
1387
1388void SetMemcardDir(const char* path)
1389{
1390   options_set_string(global, OPTION_MEMCARD_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1391}
1392
1393const char* GetFlyerDir(void)
1394{
1395   return options_get_string(settings, MUIOPTION_FLYER_DIRECTORY);
1396}
1397
1398void SetFlyerDir(const char* path)
1399{
1400   options_set_string(settings, MUIOPTION_FLYER_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1401}
1402
1403const char* GetCabinetDir(void)
1404{
1405   return options_get_string(settings, MUIOPTION_CABINET_DIRECTORY);
1406}
1407
1408void SetCabinetDir(const char* path)
1409{
1410   options_set_string(settings, MUIOPTION_CABINET_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1411}
1412
1413const char* GetMarqueeDir(void)
1414{
1415   return options_get_string(settings, MUIOPTION_MARQUEE_DIRECTORY);
1416}
1417
1418void SetMarqueeDir(const char* path)
1419{
1420   options_set_string(settings, MUIOPTION_MARQUEE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1421}
1422
1423const char* GetTitlesDir(void)
1424{
1425   return options_get_string(settings, MUIOPTION_TITLE_DIRECTORY);
1426}
1427
1428void SetTitlesDir(const char* path)
1429{
1430   options_set_string(settings, MUIOPTION_TITLE_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1431}
1432
1433const char * GetControlPanelDir(void)
1434{
1435   return options_get_string(settings, MUIOPTION_CPANEL_DIRECTORY);
1436}
1437
1438void SetControlPanelDir(const char *path)
1439{
1440   options_set_string(settings, MUIOPTION_CPANEL_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1441}
1442
1443const char * GetPcbDir(void)
1444{
1445   return options_get_string(settings, MUIOPTION_PCB_DIRECTORY);
1446}
1447
1448void SetPcbDir(const char *path)
1449{
1450   options_set_string(settings, MUIOPTION_PCB_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1451}
1452
1453const char * GetDiffDir(void)
1454{
1455   return options_get_string(global, OPTION_DIFF_DIRECTORY);
1456}
1457
1458void SetDiffDir(const char* path)
1459{
1460   options_set_string(global, OPTION_DIFF_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1461}
1462
1463const char* GetIconsDir(void)
1464{
1465   return options_get_string(settings, MUIOPTION_ICONS_DIRECTORY);
1466}
1467
1468void SetIconsDir(const char* path)
1469{
1470   options_set_string(settings, MUIOPTION_ICONS_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1471}
1472
1473const char* GetBgDir (void)
1474{
1475   return options_get_string(settings, MUIOPTION_BACKGROUND_DIRECTORY);
1476}
1477
1478void SetBgDir (const char* path)
1479{
1480   options_set_string(settings, MUIOPTION_BACKGROUND_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1481}
1482
1483const char* GetFolderDir(void)
1484{
1485   return options_get_string(settings, MUIOPTION_FOLDER_DIRECTORY);
1486}
1487
1488void SetFolderDir(const char* path)
1489{
1490   options_set_string(settings, MUIOPTION_FOLDER_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
1491}
1492
1493const char* GetCheatFileName(void)
1494{
1495   return options_get_string(global, OPTION_CHEAT_FILE);
1496}
1497
1498void SetCheatFileName(const char* path)
1499{
1500   options_set_string(global, OPTION_CHEAT_FILE, path, OPTION_PRIORITY_CMDLINE);
1501}
1502
1503const char* GetHistoryFileName(void)
1504{
1505   return options_get_string(settings, MUIOPTION_HISTORY_FILE);
1506}
1507
1508void SetHistoryFileName(const char* path)
1509{
1510   options_set_string(settings, MUIOPTION_HISTORY_FILE, path, OPTION_PRIORITY_CMDLINE);
1511}
1512
1513
1514const char* GetMAMEInfoFileName(void)
1515{
1516   return options_get_string(settings, MUIOPTION_MAMEINFO_FILE);
1517}
1518
1519void SetMAMEInfoFileName(const char* path)
1520{
1521   options_set_string(settings, MUIOPTION_MAMEINFO_FILE, path, OPTION_PRIORITY_CMDLINE);
1522}
1523
1524void ResetGameOptions(int driver_index)
1525{
1526   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1527
1528   save_options(OPTIONS_GAME, NULL, driver_index);
1529}
1530
1531void ResetGameDefaults(void)
1532{
1533   // Walk the global settings and reset everything to defaults;
1534   ResetToDefaults(global, OPTION_PRIORITY_CMDLINE);
1535   save_options(OPTIONS_GLOBAL, global, 1);
1536   save_default_options = FALSE;
1537}
1538
1539/*
1540 * Reset all game, vector and source options to defaults.
1541 * No reason to reboot if this is done.
1542 */
1543void ResetAllGameOptions(void)
1544{
1545   int i;
1546
1547   for (i = 0; i < driver_list_get_count(drivers); i++)
1548   {
1549      ResetGameOptions(i);
1550   }
1551
1552   /* Walk the ini/source folder deleting all ini's. */
1553   remove_all_source_options();
1554
1555   /* finally vector.ini */
1556   save_options(OPTIONS_VECTOR, NULL, 0);
1557}
1558
1559static void GetDriverOptionName(int driver_index, const char *option_name, char *buffer, size_t buffer_len)
1560{
1561   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1562   snprintf(buffer, buffer_len, "%s_%s", drivers[driver_index]->name, option_name);
1563}
1564
1565int GetRomAuditResults(int driver_index)
1566{
1567   char buffer[128];
1568   GetDriverOptionName(driver_index, "rom_audit", buffer, ARRAY_LENGTH(buffer));
1569   return options_get_int(settings, buffer);
1570}
1571
1572void SetRomAuditResults(int driver_index, int audit_results)
1573{
1574   char buffer[128];
1575   GetDriverOptionName(driver_index, "rom_audit", buffer, ARRAY_LENGTH(buffer));
1576   options_set_int(settings, buffer, audit_results, OPTION_PRIORITY_CMDLINE);
1577}
1578
1579int  GetSampleAuditResults(int driver_index)
1580{
1581   char buffer[128];
1582   GetDriverOptionName(driver_index, "samples_audit", buffer, ARRAY_LENGTH(buffer));
1583   return options_get_int(settings, buffer);
1584}
1585
1586void SetSampleAuditResults(int driver_index, int audit_results)
1587{
1588   char buffer[128];
1589   GetDriverOptionName(driver_index, "samples_audit", buffer, ARRAY_LENGTH(buffer));
1590   options_set_int(settings, buffer, audit_results, OPTION_PRIORITY_CMDLINE);
1591}
1592
1593static void IncrementPlayVariable(int driver_index, const char *play_variable, int increment)
1594{
1595   char buffer[128];
1596   int count;
1597
1598   GetDriverOptionName(driver_index, play_variable, buffer, ARRAY_LENGTH(buffer));
1599   count = options_get_int(settings, buffer);
1600   options_set_int(settings, buffer, count + increment, OPTION_PRIORITY_CMDLINE);
1601}
1602
1603void IncrementPlayCount(int driver_index)
1604{
1605   IncrementPlayVariable(driver_index, "play_count", 1);
1606}
1607
1608int GetPlayCount(int driver_index)
1609{
1610   char buffer[128];
1611   GetDriverOptionName(driver_index, "play_count", buffer, ARRAY_LENGTH(buffer));
1612   return options_get_int(settings, buffer);
1613}
1614
1615static void ResetPlayVariable(int driver_index, const char *play_variable)
1616{
1617   int i;
1618   if (driver_index < 0)
1619   {
1620      /* all games */
1621      for (i = 0; i< driver_list_get_count(drivers); i++)
1622      {
1623         /* 20070808 MSH - Was passing in driver_index instead of i. Doh! */
1624         ResetPlayVariable(i, play_variable);
1625      }
1626   }
1627   else
1628   {
1629      char buffer[128];
1630      GetDriverOptionName(driver_index, play_variable, buffer, ARRAY_LENGTH(buffer));
1631      options_set_int(settings, buffer, 0, OPTION_PRIORITY_CMDLINE);
1632   }
1633}
1634
1635void ResetPlayCount(int driver_index)
1636{
1637   ResetPlayVariable(driver_index, "play_count");
1638}
1639
1640void ResetPlayTime(int driver_index)
1641{
1642   ResetPlayVariable(driver_index, "play_time");
1643}
1644
1645int GetPlayTime(int driver_index)
1646{
1647   char buffer[128];
1648   GetDriverOptionName(driver_index, "play_time", buffer, ARRAY_LENGTH(buffer));
1649   return options_get_int(settings, buffer);
1650}
1651
1652void IncrementPlayTime(int driver_index,int playtime)
1653{
1654   IncrementPlayVariable(driver_index, "play_time", playtime);
1655}
1656
1657void GetTextPlayTime(int driver_index,char *buf)
1658{
1659   int hour, minute, second;
1660   int temp = GetPlayTime(driver_index);
1661
1662   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
1663
1664   hour = temp / 3600;
1665   temp = temp - 3600*hour;
1666   minute = temp / 60; //Calc Minutes
1667   second = temp - 60*minute;
1668
1669   if (hour == 0)
1670      sprintf(buf, "%d:%02d", minute, second );
1671   else
1672      sprintf(buf, "%d:%02d:%02d", hour, minute, second );
1673}
1674
1675input_seq* Get_ui_key_up(void)
1676{
1677   return options_get_input_seq(settings, MUIOPTION_UI_KEY_UP);
1678}
1679input_seq* Get_ui_key_down(void)
1680{
1681   return options_get_input_seq(settings, MUIOPTION_UI_KEY_DOWN);
1682}
1683input_seq* Get_ui_key_left(void)
1684{
1685   return options_get_input_seq(settings, MUIOPTION_UI_KEY_LEFT);
1686}
1687input_seq* Get_ui_key_right(void)
1688{
1689   return options_get_input_seq(settings, MUIOPTION_UI_KEY_RIGHT);
1690}
1691input_seq* Get_ui_key_start(void)
1692{
1693   return options_get_input_seq(settings, MUIOPTION_UI_KEY_START);
1694}
1695input_seq* Get_ui_key_pgup(void)
1696{
1697   return options_get_input_seq(settings, MUIOPTION_UI_KEY_PGUP);
1698}
1699input_seq* Get_ui_key_pgdwn(void)
1700{
1701   return options_get_input_seq(settings, MUIOPTION_UI_KEY_PGDWN);
1702}
1703input_seq* Get_ui_key_home(void)
1704{
1705   return options_get_input_seq(settings, MUIOPTION_UI_KEY_HOME);
1706}
1707input_seq* Get_ui_key_end(void)
1708{
1709   return options_get_input_seq(settings, MUIOPTION_UI_KEY_END);
1710}
1711input_seq* Get_ui_key_ss_change(void)
1712{
1713   return options_get_input_seq(settings, MUIOPTION_UI_KEY_SS_CHANGE);
1714}
1715input_seq* Get_ui_key_history_up(void)
1716{
1717   return options_get_input_seq(settings, MUIOPTION_UI_KEY_HISTORY_UP);
1718}
1719input_seq* Get_ui_key_history_down(void)
1720{
1721   return options_get_input_seq(settings, MUIOPTION_UI_KEY_HISTORY_DOWN);
1722}
1723
1724
1725input_seq* Get_ui_key_context_filters(void)
1726{
1727   return options_get_input_seq(settings, MUIOPTION_UI_KEY_CONTEXT_FILTERS);
1728}
1729input_seq* Get_ui_key_select_random(void)
1730{
1731   return options_get_input_seq(settings, MUIOPTION_UI_KEY_SELECT_RANDOM);
1732}
1733input_seq* Get_ui_key_game_audit(void)
1734{
1735   return options_get_input_seq(settings, MUIOPTION_UI_KEY_GAME_AUDIT);
1736}
1737input_seq* Get_ui_key_game_properties(void)
1738{
1739   return options_get_input_seq(settings, MUIOPTION_UI_KEY_GAME_PROPERTIES);
1740}
1741input_seq* Get_ui_key_help_contents(void)
1742{
1743   return options_get_input_seq(settings, MUIOPTION_UI_KEY_HELP_CONTENTS);
1744}
1745input_seq* Get_ui_key_update_gamelist(void)
1746{
1747   return options_get_input_seq(settings, MUIOPTION_UI_KEY_UPDATE_GAMELIST);
1748}
1749input_seq* Get_ui_key_view_folders(void)
1750{
1751   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_FOLDERS);
1752}
1753input_seq* Get_ui_key_view_fullscreen(void)
1754{
1755   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_FULLSCREEN);
1756}
1757input_seq* Get_ui_key_view_pagetab(void)
1758{
1759   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_PAGETAB);
1760}
1761input_seq* Get_ui_key_view_picture_area(void)
1762{
1763   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_PICTURE_AREA);
1764}
1765input_seq* Get_ui_key_view_status(void)
1766{
1767   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_STATUS);
1768}
1769input_seq* Get_ui_key_view_toolbars(void)
1770{
1771   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TOOLBARS);
1772}
1773
1774input_seq* Get_ui_key_view_tab_cabinet(void)
1775{
1776   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_CABINET);
1777}
1778input_seq* Get_ui_key_view_tab_cpanel(void)
1779{
1780   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_CPANEL);
1781}
1782input_seq* Get_ui_key_view_tab_flyer(void)
1783{
1784   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_FLYER);
1785}
1786input_seq* Get_ui_key_view_tab_history(void)
1787{
1788   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_HISTORY);
1789}
1790input_seq* Get_ui_key_view_tab_marquee(void)
1791{
1792   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_MARQUEE);
1793}
1794input_seq* Get_ui_key_view_tab_screenshot(void)
1795{
1796   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_SCREENSHOT);
1797}
1798input_seq* Get_ui_key_view_tab_title(void)
1799{
1800   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_TITLE);
1801}
1802input_seq* Get_ui_key_view_tab_pcb(void)
1803{
1804   return options_get_input_seq(settings, MUIOPTION_UI_KEY_VIEW_TAB_PCB);
1805}
1806input_seq* Get_ui_key_quit(void)
1807{
1808   return options_get_input_seq(settings, MUIOPTION_UI_KEY_QUIT);
1809}
1810
1811
1812
1813static int GetUIJoy(const char *option_name, int joycodeIndex)
1814{
1815   const char *joycodes_string;
1816   int joycodes[4];
1817
1818   assert(0 <= joycodeIndex && joycodeIndex < 4);
1819   joycodes_string = options_get_string(settings, option_name);
1820   ColumnDecodeStringWithCount(joycodes_string, joycodes, ARRAY_LENGTH(joycodes));
1821   return joycodes[joycodeIndex];
1822}
1823
1824static void SetUIJoy(const char *option_name, int joycodeIndex, int val)
1825{
1826   const char *joycodes_string;
1827   int joycodes[4];
1828   char buffer[1024];
1829
1830   assert(0 <= joycodeIndex && joycodeIndex < 4);
1831   joycodes_string = options_get_string(settings, option_name);
1832   ColumnDecodeStringWithCount(joycodes_string, joycodes, ARRAY_LENGTH(joycodes));
1833
1834   joycodes[joycodeIndex] = val;
1835   ColumnEncodeStringWithCount(joycodes, buffer, ARRAY_LENGTH(joycodes));
1836   options_set_string(settings, option_name, buffer, OPTION_PRIORITY_CMDLINE);
1837
1838
1839}
1840
1841int GetUIJoyUp(int joycodeIndex)
1842{
1843   return GetUIJoy(MUIOPTION_UI_JOY_UP, joycodeIndex);
1844}
1845
1846void SetUIJoyUp(int joycodeIndex, int val)
1847{
1848   SetUIJoy(MUIOPTION_UI_JOY_UP, joycodeIndex, val);
1849}
1850
1851int GetUIJoyDown(int joycodeIndex)
1852{
1853   return GetUIJoy(MUIOPTION_UI_JOY_DOWN, joycodeIndex);
1854}
1855
1856void SetUIJoyDown(int joycodeIndex, int val)
1857{
1858   SetUIJoy(MUIOPTION_UI_JOY_DOWN, joycodeIndex, val);
1859}
1860
1861int GetUIJoyLeft(int joycodeIndex)
1862{
1863   return GetUIJoy(MUIOPTION_UI_JOY_LEFT, joycodeIndex);
1864}
1865
1866void SetUIJoyLeft(int joycodeIndex, int val)
1867{
1868   SetUIJoy(MUIOPTION_UI_JOY_LEFT, joycodeIndex, val);
1869}
1870
1871int GetUIJoyRight(int joycodeIndex)
1872{
1873   return GetUIJoy(MUIOPTION_UI_JOY_RIGHT, joycodeIndex);
1874}
1875
1876void SetUIJoyRight(int joycodeIndex, int val)
1877{
1878   SetUIJoy(MUIOPTION_UI_JOY_RIGHT, joycodeIndex, val);
1879}
1880
1881int GetUIJoyStart(int joycodeIndex)
1882{
1883   return GetUIJoy(MUIOPTION_UI_JOY_START, joycodeIndex);
1884}
1885
1886void SetUIJoyStart(int joycodeIndex, int val)
1887{
1888   SetUIJoy(MUIOPTION_UI_JOY_START, joycodeIndex, val);
1889}
1890
1891int GetUIJoyPageUp(int joycodeIndex)
1892{
1893   return GetUIJoy(MUIOPTION_UI_JOY_PGUP, joycodeIndex);
1894}
1895
1896void SetUIJoyPageUp(int joycodeIndex, int val)
1897{
1898   SetUIJoy(MUIOPTION_UI_JOY_PGUP, joycodeIndex, val);
1899}
1900
1901int GetUIJoyPageDown(int joycodeIndex)
1902{
1903   return GetUIJoy(MUIOPTION_UI_JOY_PGDWN, joycodeIndex);
1904}
1905
1906void SetUIJoyPageDown(int joycodeIndex, int val)
1907{
1908   SetUIJoy(MUIOPTION_UI_JOY_PGDWN, joycodeIndex, val);
1909}
1910
1911int GetUIJoyHome(int joycodeIndex)
1912{
1913   return GetUIJoy(MUIOPTION_UI_JOY_HOME, joycodeIndex);
1914}
1915
1916void SetUIJoyHome(int joycodeIndex, int val)
1917{
1918   SetUIJoy(MUIOPTION_UI_JOY_HOME, joycodeIndex, val);
1919}
1920
1921int GetUIJoyEnd(int joycodeIndex)
1922{
1923   return GetUIJoy(MUIOPTION_UI_JOY_END, joycodeIndex);
1924}
1925
1926void SetUIJoyEnd(int joycodeIndex, int val)
1927{
1928   SetUIJoy(MUIOPTION_UI_JOY_END, joycodeIndex, val);
1929}
1930
1931int GetUIJoySSChange(int joycodeIndex)
1932{
1933   return GetUIJoy(MUIOPTION_UI_JOY_SS_CHANGE, joycodeIndex);
1934}
1935
1936void SetUIJoySSChange(int joycodeIndex, int val)
1937{
1938   SetUIJoy(MUIOPTION_UI_JOY_SS_CHANGE, joycodeIndex, val);
1939}
1940
1941int GetUIJoyHistoryUp(int joycodeIndex)
1942{
1943   return GetUIJoy(MUIOPTION_UI_JOY_HISTORY_UP, joycodeIndex);
1944}
1945
1946void SetUIJoyHistoryUp(int joycodeIndex, int val)
1947{
1948   SetUIJoy(MUIOPTION_UI_JOY_HISTORY_UP, joycodeIndex, val);
1949}
1950
1951int GetUIJoyHistoryDown(int joycodeIndex)
1952{
1953   return GetUIJoy(MUIOPTION_UI_JOY_HISTORY_DOWN, joycodeIndex);
1954}
1955
1956void SetUIJoyHistoryDown(int joycodeIndex, int val)
1957{
1958   SetUIJoy(MUIOPTION_UI_JOY_HISTORY_DOWN, joycodeIndex, val);
1959}
1960
1961void SetUIJoyExec(int joycodeIndex, int val)
1962{
1963   SetUIJoy(MUIOPTION_UI_JOY_EXEC, joycodeIndex, val);
1964}
1965
1966int GetUIJoyExec(int joycodeIndex)
1967{
1968   return GetUIJoy(MUIOPTION_UI_JOY_EXEC, joycodeIndex);
1969}
1970
1971const char * GetExecCommand(void)
1972{
1973   return options_get_string(settings, MUIOPTION_EXEC_COMMAND);
1974}
1975
1976void SetExecCommand(char *cmd)
1977{
1978   options_set_string(settings, MUIOPTION_EXEC_COMMAND, cmd, OPTION_PRIORITY_CMDLINE);
1979}
1980
1981int GetExecWait(void)
1982{
1983   return options_get_int(settings, MUIOPTION_EXEC_WAIT);
1984}
1985
1986void SetExecWait(int wait)
1987{
1988   options_set_int(settings, MUIOPTION_EXEC_WAIT, wait, OPTION_PRIORITY_CMDLINE);
1989}
1990
1991BOOL GetHideMouseOnStartup(void)
1992{
1993   return options_get_bool(settings, MUIOPTION_HIDE_MOUSE);
1994}
1995
1996void SetHideMouseOnStartup(BOOL hide)
1997{
1998   options_set_bool(settings, MUIOPTION_HIDE_MOUSE, hide, OPTION_PRIORITY_CMDLINE);
1999}
2000
2001BOOL GetRunFullScreen(void)
2002{
2003   return options_get_bool(settings, MUIOPTION_FULL_SCREEN);
2004}
2005
2006void SetRunFullScreen(BOOL fullScreen)
2007{
2008   options_set_bool(settings, MUIOPTION_FULL_SCREEN, fullScreen, OPTION_PRIORITY_CMDLINE);
2009}
2010
2011/***************************************************************************
2012    Internal functions
2013 ***************************************************************************/
2014
2015static void  CusColorEncodeString(const COLORREF *value, char* str)
2016{
2017   int  i;
2018   char tmpStr[256];
2019
2020   sprintf(tmpStr, "%u", (int) value[0]);
2021
2022   strcpy(str, tmpStr);
2023
2024   for (i = 1; i < 16; i++)
2025   {
2026      sprintf(tmpStr, ",%u", (unsigned) value[i]);
2027      strcat(str, tmpStr);
2028   }
2029}
2030
2031static void CusColorDecodeString(const char* str, COLORREF *value)
2032{
2033   int  i;
2034   char *s, *p;
2035   char tmpStr[256];
2036
2037   strcpy(tmpStr, str);
2038   p = tmpStr;
2039
2040   for (i = 0; p && i < 16; i++)
2041   {
2042      s = p;
2043
2044      if ((p = strchr(s,',')) != NULL && *p == ',')
2045      {
2046         *p = '\0';
2047         p++;
2048      }
2049      value[i] = atoi(s);
2050   }
2051}
2052
2053
2054void ColumnEncodeStringWithCount(const int *value, char *str, int count)
2055{
2056   int  i;
2057   char buffer[100];
2058
2059   snprintf(buffer,sizeof(buffer),"%d",value[0]);
2060
2061   strcpy(str,buffer);
2062
2063    for (i = 1; i < count; i++)
2064   {
2065      snprintf(buffer,sizeof(buffer),",%d",value[i]);
2066      strcat(str,buffer);
2067   }
2068}
2069
2070void ColumnDecodeStringWithCount(const char* str, int *value, int count)
2071{
2072   int  i;
2073   char *s, *p;
2074   char tmpStr[100];
2075
2076   if (str == NULL)
2077      return;
2078
2079   strcpy(tmpStr, str);
2080   p = tmpStr;
2081
2082    for (i = 0; p && i < count; i++)
2083   {
2084      s = p;
2085
2086      if ((p = strchr(s,',')) != NULL && *p == ',')
2087      {
2088         *p = '\0';
2089         p++;
2090      }
2091      value[i] = atoi(s);
2092    }
2093   }
2094
2095static void SplitterEncodeString(const int *value, char* str)
2096{
2097   int  i;
2098   char tmpStr[100];
2099
2100   sprintf(tmpStr, "%d", value[0]);
2101
2102   strcpy(str, tmpStr);
2103
2104   for (i = 1; i < GetSplitterCount(); i++)
2105   {
2106      sprintf(tmpStr, ",%d", value[i]);
2107      strcat(str, tmpStr);
2108   }
2109}
2110
2111static void SplitterDecodeString(const char *str, int *value)
2112{
2113   int  i;
2114   char *s, *p;
2115   char tmpStr[100];
2116
2117   strcpy(tmpStr, str);
2118   p = tmpStr;
2119
2120   for (i = 0; p && i < GetSplitterCount(); i++)
2121   {
2122      s = p;
2123
2124      if ((p = strchr(s,',')) != NULL && *p == ',')
2125      {
2126         *p = '\0';
2127         p++;
2128      }
2129      value[i] = atoi(s);
2130   }
2131}
2132
2133/* Parse the given comma-delimited string into a LOGFONT structure */
2134static void FontDecodeString(const char* str, LOGFONT *f)
2135{
2136   char*    ptr;
2137   TCHAR*     t_ptr;
2138
2139   sscanf(str, "%li,%li,%li,%li,%li,%i,%i,%i,%i,%i,%i,%i,%i",
2140         &f->lfHeight,
2141         &f->lfWidth,
2142         &f->lfEscapement,
2143         &f->lfOrientation,
2144         &f->lfWeight,
2145         (int*)&f->lfItalic,
2146         (int*)&f->lfUnderline,
2147         (int*)&f->lfStrikeOut,
2148         (int*)&f->lfCharSet,
2149         (int*)&f->lfOutPrecision,
2150         (int*)&f->lfClipPrecision,
2151         (int*)&f->lfQuality,
2152         (int*)&f->lfPitchAndFamily);
2153   ptr = strrchr(str, ',');
2154   if (ptr != NULL) {
2155      t_ptr = tstring_from_utf8(ptr + 1);
2156      if( !t_ptr )
2157         return;
2158      _tcscpy(f->lfFaceName, t_ptr);
2159      free(t_ptr);
2160   }
2161}
2162
2163/* Encode the given LOGFONT structure into a comma-delimited string */
2164static void FontEncodeString(const LOGFONT *f, char *str)
2165{
2166   char* utf8_FaceName = utf8_from_tstring(f->lfFaceName);
2167   if( !utf8_FaceName )
2168      return;
2169
2170   sprintf(str, "%li,%li,%li,%li,%li,%i,%i,%i,%i,%i,%i,%i,%i,%s",
2171         f->lfHeight,
2172         f->lfWidth,
2173         f->lfEscapement,
2174         f->lfOrientation,
2175         f->lfWeight,
2176         f->lfItalic,
2177         f->lfUnderline,
2178         f->lfStrikeOut,
2179         f->lfCharSet,
2180         f->lfOutPrecision,
2181         f->lfClipPrecision,
2182         f->lfQuality,
2183         f->lfPitchAndFamily,
2184         utf8_FaceName);
2185
2186   free(utf8_FaceName);
2187}
2188
2189static void TabFlagsEncodeString(int data, char *str)
2190{
2191   int i;
2192   int num_saved = 0;
2193
2194   strcpy(str,"");
2195
2196   // we save the ones that are NOT displayed, so we can add new ones
2197   // and upgraders will see them
2198   for (i=0;i<MAX_TAB_TYPES;i++)
2199   {
2200      if (((data & (1 << i)) == 0) && GetImageTabShortName(i))
2201      {
2202         if (num_saved != 0)
2203            strcat(str, ", ");
2204
2205         strcat(str,GetImageTabShortName(i));
2206         num_saved++;
2207      }
2208   }
2209}
2210
2211static void TabFlagsDecodeString(const char *str, int *data)
2212{
2213   char s[2000];
2214   char *token;
2215
2216   snprintf(s, ARRAY_LENGTH(s), "%s", str);
2217
2218   // simple way to set all tab bits "on"
2219   *data = (1 << MAX_TAB_TYPES) - 1;
2220
2221   token = strtok(s,", \t");
2222   while (token != NULL)
2223   {
2224      int j;
2225
2226      for (j=0;j<MAX_TAB_TYPES;j++)
2227      {
2228         if (!GetImageTabShortName(j) || (strcmp(GetImageTabShortName(j), token) == 0))
2229         {
2230            // turn off this bit
2231            *data &= ~(1 << j);
2232            break;
2233         }
2234      }
2235      token = strtok(NULL,", \t");
2236   }
2237
2238   if (*data == 0)
2239   {
2240      // not allowed to hide all tabs, because then why even show the area?
2241      *data = (1 << TAB_SCREENSHOT);
2242   }
2243}
2244
2245static file_error LoadSettingsFile(core_options *opts, const char *filename)
2246{
2247   core_file *file;
2248   file_error filerr;
2249
2250   filerr = core_fopen(filename, OPEN_FLAG_READ, &file);
2251   if (filerr == FILERR_NONE)
2252   {
2253      options_parse_ini_file(opts, file, OPTION_PRIORITY_CMDLINE);
2254      core_fclose(file);
2255   }
2256   return filerr;
2257}
2258
2259
2260static file_error SaveSettingsFile(core_options *opts, core_options *baseopts, const char *filename)
2261{
2262   core_file *file;
2263   file_error filerr;
2264
2265   if ((opts != NULL) && ((baseopts == NULL) || !options_equal(opts, baseopts)))
2266   {
2267      filerr = core_fopen(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
2268      if (filerr == FILERR_NONE)
2269      {
2270         options_output_diff_ini_file(opts, baseopts, file);
2271         core_fclose(file);
2272      }
2273   }
2274   else
2275   {
2276      filerr = osd_rmfile(filename);
2277   }
2278
2279   return filerr;
2280}
2281
2282
2283
2284static void GetGlobalOptionsFileName(char *filename, size_t filename_size)
2285{
2286   // copy INI directory
2287   snprintf(filename, filename_size, "%s\\%s.ini", GetIniDir(), CONFIGNAME);
2288}
2289
2290/* Register access functions below */
2291static void LoadOptionsAndSettings(void)
2292{
2293   char buffer[MAX_PATH];
2294
2295   // parse MAME32ui.ini - always in the current directory.
2296   LoadSettingsFile(settings, UI_INI_FILENAME);
2297
2298   // parse global options ini/mame32.ini
2299   GetGlobalOptionsFileName(buffer, ARRAY_LENGTH(buffer));
2300   LoadSettingsFile(global, buffer);
2301}
2302
2303const char * GetFolderNameByID(UINT nID)
2304{
2305   UINT i;
2306   extern FOLDERDATA g_folderData[];
2307   extern LPEXFOLDERDATA ExtraFolderData[];
2308
2309   for (i = 0; i < MAX_EXTRA_FOLDERS * MAX_EXTRA_SUBFOLDERS; i++)
2310   {
2311      if( ExtraFolderData[i] )
2312      {
2313         if (ExtraFolderData[i]->m_nFolderId == nID)
2314         {
2315            return ExtraFolderData[i]->m_szTitle;
2316         }
2317      }
2318   }
2319   for( i = 0; i < MAX_FOLDERS; i++)
2320   {
2321      if (g_folderData[i].m_nFolderId == nID)
2322      {
2323
2324         return g_folderData[i].m_lpTitle;
2325      }
2326   }
2327   return NULL;
2328}
2329
2330
2331DWORD GetFolderFlags(int folder_index)
2332{
2333   LPTREEFOLDER lpFolder = GetFolder(folder_index);
2334
2335   if (lpFolder)
2336      return lpFolder->m_dwFlags & F_MASK;
2337
2338   return 0;
2339#if 0
2340   int i;
2341
2342   for (i=0;i<num_folder_filters;i++)
2343   {
2344      if (folder_filters[i].folder_index == folder_index)
2345      {
2346         //dprintf("found folder filter %i %i",folder_index,folder_filters[i].filters);
2347         return folder_filters[i].filters;
2348      }
2349   }
2350   return 0;
2351#endif
2352}
2353
2354
2355/* Decode the flags into a DWORD */
2356static DWORD DecodeFolderFlags(const char *buf)
2357{
2358   DWORD flags = 0;
2359   int shift = 0;
2360   const char *ptr = buf;
2361
2362   while (*ptr && (1 << shift) & F_MASK)
2363   {
2364      if (*ptr++ == '1')
2365      {
2366         flags |= (1 << shift);
2367      }
2368      shift++;
2369   }
2370   return flags;
2371}
2372
2373/* Encode the flags into a string */
2374static const char * EncodeFolderFlags(DWORD value)
2375{
2376   static char buf[40];
2377   int shift = 0;
2378
2379   memset(buf,'\0', sizeof(buf));
2380
2381   while ((1 << shift) & F_MASK) {
2382      buf[shift] = (value & (1 << shift)) ? '1' : '0';
2383      shift++;
2384   }
2385
2386   return buf;
2387}
2388
2389/* MSH 20080813
2390 * Read the folder filters from MAME32ui.ini.  This must only
2391 * be called AFTER the folders have all been created.
2392 */
2393void LoadFolderFlags(void)
2394{
2395   core_options *opts;
2396   int numFolders;
2397   LPTREEFOLDER lpFolder;
2398   int i;
2399   options_entry entries[2];
2400
2401   memcpy(entries, filterOptions, sizeof(filterOptions));
2402
2403   opts = options_create(memory_error);
2404
2405   if (NULL == opts)
2406   {
2407      return;
2408   }
2409
2410   numFolders = GetNumFolders();
2411
2412   for (i = 0; i < numFolders; i++)
2413   {
2414      lpFolder = GetFolder(i);
2415
2416      if (lpFolder)
2417      {
2418         char folder_name[80];
2419         char *ptr;
2420         astring *option_name;
2421
2422         // Convert spaces to underscores
2423         strcpy(folder_name, lpFolder->m_lpTitle);
2424         ptr = folder_name;
2425         while (*ptr && *ptr != '\0')
2426         {
2427            if (*ptr == ' ')
2428            {
2429               *ptr = '_';
2430            }
2431            ptr++;
2432         }
2433
2434         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters");
2435         // create entry
2436         entries[0].name = astring_c(option_name);
2437         options_add_entries(opts, entries);
2438         astring_free(option_name);
2439      }
2440   }
2441
2442   // These are overlayed at the end of our UI ini
2443   // The normal read will skip them.
2444    LoadSettingsFile(opts, UI_INI_FILENAME);
2445
2446   // retrive the stored values
2447   for (i = 0; i < numFolders; i++)
2448   {
2449      lpFolder = GetFolder(i);
2450
2451      if (lpFolder)
2452      {
2453         char folder_name[80];
2454         char *ptr;
2455         astring *option_name;
2456         const char *value;
2457
2458         // Convert spaces to underscores
2459         strcpy(folder_name, lpFolder->m_lpTitle);
2460         ptr = folder_name;
2461         while (*ptr && *ptr != '\0')
2462         {
2463            if (*ptr == ' ')
2464            {
2465               *ptr = '_';
2466            }
2467            ptr++;
2468         }
2469         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters" );
2470         // get entry and decode it
2471         value = options_get_string(opts, astring_c(option_name));
2472         astring_free(option_name);
2473
2474         if (value)
2475         {
2476            lpFolder->m_dwFlags |= DecodeFolderFlags(value) & F_MASK;
2477         }
2478      }
2479   }
2480   // fee the options
2481   options_free(opts);
2482}
2483
2484
2485
2486// Copy options, if entry doesn't exist in the dest, create it.
2487static void copy_options_ex(core_options *pDestOpts, core_options *pSourceOpts)
2488{
2489   options_enumerator *enumerator;
2490   const char *option_name;
2491   const char *option_value;
2492   options_entry entries[2];
2493
2494   memcpy(entries, filterOptions, sizeof(filterOptions));
2495
2496   enumerator = options_enumerator_begin(pSourceOpts);
2497
2498   if (enumerator != NULL)
2499   {
2500      while((option_name = options_enumerator_next(enumerator)) != NULL)
2501      {
2502         option_value = options_get_string(pSourceOpts, option_name);
2503         {
2504            const char *existing = options_get_string(pDestOpts, option_name);
2505            if (NULL == existing || *existing == '\0')
2506            {
2507               entries[0].name = option_name;
2508               // create entry
2509               options_add_entries(pDestOpts, entries);
2510            }
2511            if (strcmp(option_value, existing) != 0)
2512               options_set_string(pDestOpts, option_name, option_value, OPTION_PRIORITY_CMDLINE);
2513         }
2514      }
2515      options_enumerator_free(enumerator);
2516   }
2517}
2518
2519// Adds our folder flags to a temporarty core_options, for saving.
2520static core_options * AddFolderFlags(core_options *settings)
2521{
2522   core_options *opts;
2523   int numFolders;
2524   int i;
2525   LPTREEFOLDER lpFolder;
2526   int num_entries = 0;
2527   options_entry entries[2];
2528
2529   opts = options_create(memory_error);
2530
2531   if (NULL == opts)
2532   {
2533      return NULL;
2534   }
2535
2536   options_add_entries(opts, regSettings);
2537   copy_options_ex(opts, settings);
2538
2539   memcpy(entries, filterOptions, sizeof(filterOptions));
2540   entries[0].name = NULL;
2541   entries[0].defvalue = NULL;
2542   entries[0].flags = OPTION_HEADER;
2543   entries[0].description = "FOLDER FILTERS";
2544   options_add_entries(opts, entries);
2545
2546   memcpy(entries, filterOptions, sizeof(filterOptions));
2547
2548   numFolders = GetNumFolders();
2549
2550   for (i = 0; i < numFolders; i++)
2551   {
2552      lpFolder = GetFolder(i);
2553      if (lpFolder && (lpFolder->m_dwFlags & F_MASK) != 0)
2554      {
2555         char folder_name[80];
2556         char *ptr;
2557         astring *option_name;
2558
2559         // Convert spaces to underscores
2560         strcpy(folder_name, lpFolder->m_lpTitle);
2561         ptr = folder_name;
2562         while (*ptr && *ptr != '\0')
2563         {
2564            if (*ptr == ' ')
2565            {
2566               *ptr = '_';
2567            }
2568            ptr++;
2569         }
2570
2571         option_name = astring_assemble_2(astring_alloc(), folder_name, "_filters" );
2572
2573         // create entry
2574         entries[0].name = astring_c(option_name);
2575         options_add_entries(opts, entries);
2576
2577         // store entry
2578            options_set_string(opts, astring_c(option_name), EncodeFolderFlags(lpFolder->m_dwFlags), OPTION_PRIORITY_CMDLINE);
2579         astring_free(option_name);
2580
2581         // increment counter
2582         num_entries++;
2583      }
2584   }
2585   if (num_entries == 0) {
2586      options_free(opts);
2587      opts = NULL;
2588   }
2589   return opts;
2590}
2591
2592// Save the UI ini
2593void SaveOptions(void)
2594{
2595   if (save_gui_settings)
2596   {
2597      // Add the folder flag to settings.
2598      core_options *opts = AddFolderFlags(settings);
2599      // Save opts if it is non-null, else save settings.
2600      // It will be null if there are no filters set.
2601      SaveSettingsFile((opts == NULL) ? settings : opts, NULL, UI_INI_FILENAME);
2602      // Free up the opts allocated by AddFolderFlags.
2603      if (opts)
2604      {
2605         options_free(opts);
2606      }
2607   }
2608}
2609
2610
2611void SaveDefaultOptions(void)
2612{
2613   char buffer[MAX_PATH];
2614   GetGlobalOptionsFileName(buffer, ARRAY_LENGTH(buffer));
2615   SaveSettingsFile(global, NULL, buffer);
2616}
2617
2618char * GetVersionString(void)
2619{
2620   return build_version;
2621}
2622
2623
2624BOOL IsGlobalOption(const char *option_name)
2625{
2626   static const char *global_options[] =
2627   {
2628      OPTION_ROMPATH,
2629#ifdef MESS
2630      OPTION_HASHPATH,
2631#endif // MESS
2632      OPTION_SAMPLEPATH,
2633      OPTION_ARTPATH,
2634      OPTION_CTRLRPATH,
2635      OPTION_INIPATH,
2636      OPTION_FONTPATH,
2637      OPTION_CFG_DIRECTORY,
2638      OPTION_NVRAM_DIRECTORY,
2639      OPTION_MEMCARD_DIRECTORY,
2640      OPTION_INPUT_DIRECTORY,
2641      OPTION_STATE_DIRECTORY,
2642      OPTION_SNAPSHOT_DIRECTORY,
2643      OPTION_DIFF_DIRECTORY,
2644      OPTION_COMMENT_DIRECTORY
2645   };
2646   int i;
2647   char command_name[128];
2648   char *s;
2649
2650   // determine command name
2651   snprintf(command_name, ARRAY_LENGTH(command_name), "%s", option_name);
2652   s = strchr(command_name, ';');
2653   if (s)
2654      *s = '\0';
2655
2656   for (i = 0; i < ARRAY_LENGTH(global_options); i++)
2657   {
2658      if (!strcmp(command_name, global_options[i]))
2659         return TRUE;
2660   }
2661   return FALSE;
2662}
2663
2664
2665/* ui_parse_ini_file - parse a single INI file */
2666static void ui_parse_ini_file(core_options *opts, const char *name)
2667{
2668   astring *fname;
2669
2670   /* open the file; if we fail, that's ok */
2671   fname = astring_assemble_4(astring_alloc(), GetIniDir(), PATH_SEPARATOR, name, ".ini");
2672   LoadSettingsFile(opts, astring_c(fname));
2673   astring_free(fname);
2674}
2675
2676
2677/*  get options, based on passed in option level. */
2678core_options * load_options(OPTIONS_TYPE opt_type, int game_num)
2679{
2680   core_options *opts;
2681   const game_driver *driver = NULL;
2682
2683   opts = CreateGameOptions(game_num);
2684
2685   if (opts == NULL)
2686   {
2687      return NULL;
2688   }
2689
2690   /* Copy over the defaults */
2691   options_copy(opts, global);
2692
2693   if (opt_type == OPTIONS_GLOBAL)
2694   {
2695      return opts;
2696   }
2697
2698   /* debug builds: parse "debug.ini" as well */
2699#ifdef MAME_DEBUG
2700   ui_parse_ini_file(opts, "debug");
2701#endif
2702   if (game_num >= 0)
2703   {
2704      driver = drivers[game_num];
2705   }
2706
2707   /* if we have a valid game driver, parse game-specific INI files */
2708   if (driver != NULL)
2709   {
2710      const game_driver *parent = driver_get_clone(driver);
2711      const game_driver *gparent = (parent != NULL) ? driver_get_clone(parent) : NULL;
2712      astring *basename;
2713      astring *srcname;
2714      machine_config drv;
2715
2716      /* expand the machine driver to look at the info */
2717      expand_machine_driver(driver->drv, &drv);
2718
2719      /* parse "vector.ini" for vector games */
2720      if (drv.video_attributes & VIDEO_TYPE_VECTOR)
2721         ui_parse_ini_file(opts, "vector");
2722
2723      if (opt_type == OPTIONS_VECTOR)
2724      {
2725         return opts;
2726      }
2727
2728      /* then parse "<sourcefile>.ini" */
2729      basename = core_filename_extract_base(astring_alloc(), driver->source_file, TRUE);
2730      srcname = astring_assemble_3(astring_alloc(), "source", PATH_SEPARATOR, astring_c(basename));
2731      ui_parse_ini_file(opts, astring_c(srcname));
2732      astring_free(srcname);
2733      astring_free(basename);
2734
2735      if (opt_type == OPTIONS_SOURCE)
2736      {
2737         return opts;
2738      }
2739
2740      /* then parent the grandparent, parent, and game-specific INIs */
2741      if (gparent != NULL)
2742         ui_parse_ini_file(opts, gparent->name);
2743      if (parent != NULL)
2744         ui_parse_ini_file(opts, parent->name);
2745
2746      if (opt_type == OPTIONS_PARENT)
2747      {
2748         return opts;
2749      }
2750
2751      ui_parse_ini_file(opts, driver->name);
2752
2753      if (opt_type == OPTIONS_GAME)
2754      {
2755         return opts;
2756      }
2757   }
2758   options_free(opts);
2759   return NULL;
2760}
2761
2762
2763
2764/*
2765 * Save ini file based on game_num and passed in opt_type.  If opts are
2766 * NULL, the ini wiil be removed.
2767 *
2768 * game_num must be valid or the driver cannot be expanded and anything
2769 * with a higher priority than OPTIONS_VECTOR will not be saved.
2770 */
2771void save_options(OPTIONS_TYPE opt_type, core_options *opts, int game_num)
2772{
2773   core_options *baseopts = NULL;
2774   const game_driver *driver = NULL;
2775   astring *filename = NULL;
2776
2777   if (OPTIONS_GLOBAL != opt_type && NULL != opts && !options_equal(opts, global))
2778   {
2779      baseopts = load_options(opt_type - 1, game_num);
2780   }
2781
2782   if (game_num >= 0)
2783   {
2784      driver = drivers[game_num];
2785   }
2786
2787   if (opt_type == OPTIONS_GLOBAL)
2788   {
2789      /* Don't try to save a null global options file,  or it will be erased. */
2790      if (NULL == opts)
2791         return;
2792      options_copy(global, opts);
2793      filename = astring_cpyc(astring_alloc(), CONFIGNAME);
2794   } else if (opt_type == OPTIONS_VECTOR)
2795   {
2796      filename = astring_cpyc(astring_alloc(), "vector");
2797   } else if (driver != NULL)
2798   {
2799      astring *basename, *srcname;
2800      machine_config drv;
2801
2802      /* expand the machine driver to look at the info */
2803      expand_machine_driver(driver->drv, &drv);
2804
2805      switch (opt_type)
2806      {
2807      case OPTIONS_SOURCE:
2808         /* determine the <sourcefile> */
2809         basename = core_filename_extract_base(astring_alloc(), driver->source_file, TRUE);
2810         srcname = astring_assemble_3(astring_alloc(), "source", PATH_SEPARATOR, astring_c(basename));
2811         filename = astring_cpyc(astring_alloc(),astring_c(srcname));
2812         astring_free(srcname);
2813         astring_free(basename);
2814         break;
2815      case OPTIONS_GAME:
2816         filename = astring_cpyc(astring_alloc(), driver->name);
2817         break;
2818      default:
2819         break;
2820      }
2821   }
2822   if (filename != NULL)
2823   {
2824      astring *filepath = NULL;
2825      filepath = astring_assemble_4(astring_alloc(), GetIniDir(), PATH_SEPARATOR, astring_c(filename), ".ini");
2826      astring_free(filename);
2827
2828      SaveSettingsFile(opts, baseopts, astring_c(filepath));
2829      astring_free(filepath);
2830   }
2831   if (baseopts != NULL)
2832   {
2833      options_free(baseopts);
2834   }
2835}
2836
2837/* Remove all the srcname.ini files from inipath/source directory. */
2838static void remove_all_source_options(void) {
2839   WIN32_FIND_DATA findFileData;
2840   HANDLE hFindFile;
2841   astring *pathname, *match;
2842   char* utf8_filename;
2843
2844   /*
2845    * Easiest to just open the ini/source folder if it exists,
2846    * then remove all the files in it that end in ini.
2847    */
2848   pathname = astring_assemble_3(astring_alloc(), GetIniDir(), PATH_SEPARATOR, "source");
2849   match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, "*.ini");
2850   if ((hFindFile = win_find_first_file_utf8(astring_c(match), &findFileData)) != INVALID_HANDLE_VALUE)
2851   {
2852      astring_free(match);
2853      utf8_filename = utf8_from_tstring(findFileData.cFileName);
2854      match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename );
2855      free(utf8_filename);
2856      osd_rmfile(astring_c(match));
2857      astring_free(match);
2858
2859      while (0 != FindNextFile(hFindFile, &findFileData))
2860      {
2861         utf8_filename = utf8_from_tstring(findFileData.cFileName);
2862         match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename );
2863         free(utf8_filename);
2864         osd_rmfile(astring_c(match));
2865         astring_free(match);
2866      }
2867
2868      FindClose(hFindFile);
2869
2870   }
2871   else
2872   {
2873      astring_free(match);
2874   }
2875   astring_free(pathname);
2876
2877}
2878
2879// Reset the given core_options to their default settings.
2880static void ResetToDefaults(core_options *opts, int priority)
2881{
2882   // iterate through the options setting each one back to the default value.
2883   options_revert(opts, priority);
2884}
2885
2886
2887
src/osd/winui/mui_opts.h
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14#ifndef MUI_OPTS_H
15#define MUI_OPTS_H
16
17#include "osdcomm.h"
18#include "osd_cpu.h"
19#include "options.h"
20#include "inputseq.h" /* for input_seq definition */
21#include <video.h> /* for MAX_SCREENS Definition*/
22
23#ifdef MESS
24#include "optionsms.h"
25#endif
26
27// Various levels of ini's we can edit.
28typedef enum {
29   OPTIONS_GLOBAL = 0,
30   OPTIONS_VECTOR,
31   OPTIONS_SOURCE,
32   OPTIONS_PARENT,
33   OPTIONS_GAME,
34   OPTIONS_MAX
35} OPTIONS_TYPE;
36
37
38enum
39{
40   COLUMN_GAMES = 0,
41   COLUMN_ORIENTATION,
42   //COLUMN_ROMS,
43   COLUMN_SAMPLES,
44   COLUMN_DIRECTORY,
45   COLUMN_TYPE,
46   COLUMN_TRACKBALL,
47   COLUMN_PLAYED,
48   COLUMN_MANUFACTURER,
49   COLUMN_YEAR,
50   COLUMN_CLONE,
51   COLUMN_SRCDRIVERS,
52   COLUMN_PLAYTIME,
53   COLUMN_MAX
54};
55
56
57// can't be the same as the VerifyRomSet() results, listed in audit.h
58enum
59{
60   UNKNOWN   = -1
61};
62
63/* Default input */
64enum
65{
66   INPUT_LAYOUT_STD,
67   INPUT_LAYOUT_HR,
68   INPUT_LAYOUT_HRSE
69};
70
71// clean stretch types
72enum
73{
74   // these must match array of strings clean_stretch_long_name in options.c
75   CLEAN_STRETCH_NONE = 0,
76   CLEAN_STRETCH_AUTO = 1,
77
78   MAX_CLEAN_STRETCH = 5,
79};
80
81#define FOLDER_OPTIONS   -2
82#define GLOBAL_OPTIONS   -1
83
84// d3d effect types
85enum
86{
87   // these must match array of strings d3d_effects_long_name in options.c
88   D3D_EFFECT_NONE = 0,
89   D3D_EFFECT_AUTO = 1,
90
91   MAX_D3D_EFFECTS = 17,
92};
93
94// d3d prescale types
95enum
96{
97   D3D_PRESCALE_NONE = 0,
98   D3D_PRESCALE_AUTO = 1,
99   MAX_D3D_PRESCALE = 10,
100};
101
102typedef struct
103{
104   int x, y, width, height;
105} AREA;
106
107typedef struct
108{
109   char* screen;
110   char* aspect;
111   char* resolution;
112   char* view;
113} ScreenParams;
114
115
116
117// List of artwork types to display in the screen shot area
118enum
119{
120   // these must match array of strings image_tabs_long_name in options.c
121   // if you add new Tabs, be sure to also add them to the ComboBox init in dialogs.c
122   TAB_SCREENSHOT = 0,
123   TAB_FLYER,
124   TAB_CABINET,
125   TAB_MARQUEE,
126   TAB_TITLE,
127   TAB_CONTROL_PANEL,
128   TAB_PCB,
129   TAB_HISTORY,
130
131   MAX_TAB_TYPES,
132   BACKGROUND,
133   TAB_ALL,
134   TAB_NONE
135};
136// Because we have added the Options after MAX_TAB_TYPES, we have to subtract 3 here
137// (that's how many options we have after MAX_TAB_TYPES)
138#define TAB_SUBTRACT 3
139
140BOOL OptionsInit(void);
141void OptionsExit(void);
142
143#define OPTIONS_TYPE_GLOBAL      -1
144#define OPTIONS_TYPE_FOLDER      -2
145
146core_options * load_options(OPTIONS_TYPE opt_type, int game_num);
147void save_options(OPTIONS_TYPE opt_type, core_options *opts, int game_num);
148
149void AddOptions(core_options *opts, const options_entry *entrylist, BOOL is_global);
150core_options * CreateGameOptions(int driver_index);
151
152core_options * MameUISettings(void);
153core_options * MameUIGlobal(void);
154
155void LoadFolderFlags(void);
156const char* GetFolderNameByID(UINT nID);
157
158void SaveOptions(void);
159
160void ResetGUI(void);
161void ResetGameDefaults(void);
162void ResetAllGameOptions(void);
163
164const char * GetImageTabLongName(int tab_index);
165const char * GetImageTabShortName(int tab_index);
166
167void SetViewMode(int val);
168int  GetViewMode(void);
169
170void SetGameCheck(BOOL game_check);
171BOOL GetGameCheck(void);
172
173void SetVersionCheck(BOOL version_check);
174BOOL GetVersionCheck(void);
175
176void SetJoyGUI(BOOL use_joygui);
177BOOL GetJoyGUI(void);
178
179void SetKeyGUI(BOOL use_keygui);
180BOOL GetKeyGUI(void);
181
182void SetCycleScreenshot(int cycle_screenshot);
183int GetCycleScreenshot(void);
184
185void SetStretchScreenShotLarger(BOOL stretch);
186BOOL GetStretchScreenShotLarger(void);
187
188void SetScreenshotBorderSize(int size);
189int GetScreenshotBorderSize(void);
190
191void SetScreenshotBorderColor(COLORREF uColor);
192COLORREF GetScreenshotBorderColor(void);
193
194void SetFilterInherit(BOOL inherit);
195BOOL GetFilterInherit(void);
196
197void SetOffsetClones(BOOL offset);
198BOOL GetOffsetClones(void);
199
200void SetGameCaption(BOOL caption);
201BOOL GetGameCaption(void);
202
203void SetBroadcast(BOOL broadcast);
204BOOL GetBroadcast(void);
205
206void SetRandomBackground(BOOL random_bg);
207BOOL GetRandomBackground(void);
208
209void SetSavedFolderID(UINT val);
210UINT GetSavedFolderID(void);
211
212void SetShowScreenShot(BOOL val);
213BOOL GetShowScreenShot(void);
214
215void SetShowFolderList(BOOL val);
216BOOL GetShowFolderList(void);
217
218BOOL GetShowFolder(int folder);
219void SetShowFolder(int folder,BOOL show);
220
221
222void SetShowStatusBar(BOOL val);
223BOOL GetShowStatusBar(void);
224
225void SetShowToolBar(BOOL val);
226BOOL GetShowToolBar(void);
227
228void SetShowTabCtrl(BOOL val);
229BOOL GetShowTabCtrl(void);
230
231void SetCurrentTab(const char *shortname);
232const char *GetCurrentTab(void);
233
234void SetDefaultGame(const char *name);
235const char *GetDefaultGame(void);
236
237void SetWindowArea(const AREA *area);
238void GetWindowArea(AREA *area);
239
240void SetWindowState(UINT state);
241UINT GetWindowState(void);
242
243void SetColumnWidths(int widths[]);
244void GetColumnWidths(int widths[]);
245
246void SetColumnOrder(int order[]);
247void GetColumnOrder(int order[]);
248
249void SetColumnShown(int shown[]);
250void GetColumnShown(int shown[]);
251
252void SetSplitterPos(int splitterId, int pos);
253int  GetSplitterPos(int splitterId);
254
255void SetCustomColor(int iIndex, COLORREF uColor);
256COLORREF GetCustomColor(int iIndex);
257
258void SetListFont(const LOGFONT *font);
259void GetListFont(LOGFONT *font);
260
261DWORD GetFolderFlags(int folder_index);
262
263void SetListFontColor(COLORREF uColor);
264COLORREF GetListFontColor(void);
265
266void SetListCloneColor(COLORREF uColor);
267COLORREF GetListCloneColor(void);
268
269int GetHistoryTab(void);
270void SetHistoryTab(int tab,BOOL show);
271
272int GetShowTab(int tab);
273void SetShowTab(int tab,BOOL show);
274BOOL AllowedToSetShowTab(int tab,BOOL show);
275
276void SetSortColumn(int column);
277int  GetSortColumn(void);
278
279void SetSortReverse(BOOL reverse);
280BOOL GetSortReverse(void);
281
282const char* GetLanguage(void);
283void SetLanguage(const char* lang);
284
285const char* GetRomDirs(void);
286void SetRomDirs(const char* paths);
287
288const char* GetSampleDirs(void);
289void  SetSampleDirs(const char* paths);
290
291const char * GetIniDir(void);
292void SetIniDir(const char *path);
293
294const char* GetCfgDir(void);
295void SetCfgDir(const char* path);
296
297const char* GetNvramDir(void);
298void SetNvramDir(const char* path);
299
300const char* GetInpDir(void);
301void SetInpDir(const char* path);
302
303const char* GetImgDir(void);
304void SetImgDir(const char* path);
305
306const char* GetStateDir(void);
307void SetStateDir(const char* path);
308
309const char* GetArtDir(void);
310void SetArtDir(const char* path);
311
312const char* GetMemcardDir(void);
313void SetMemcardDir(const char* path);
314
315const char* GetFlyerDir(void);
316void SetFlyerDir(const char* path);
317
318const char* GetCabinetDir(void);
319void SetCabinetDir(const char* path);
320
321const char* GetMarqueeDir(void);
322void SetMarqueeDir(const char* path);
323
324const char* GetTitlesDir(void);
325void SetTitlesDir(const char* path);
326
327const char * GetControlPanelDir(void);
328void SetControlPanelDir(const char *path);
329
330const char * GetPcbDir(void);
331void SetPcbDir(const char *path);
332
333const char* GetDiffDir(void);
334void SetDiffDir(const char* path);
335
336const char* GetIconsDir(void);
337void SetIconsDir(const char* path);
338
339const char *GetBgDir(void);
340void SetBgDir(const char *path);
341
342const char* GetCtrlrDir(void);
343void SetCtrlrDir(const char* path);
344
345const char* GetCommentDir(void);
346void SetCommentDir(const char* path);
347
348const char* GetFolderDir(void);
349void SetFolderDir(const char* path);
350
351const char* GetCheatFileName(void);
352void SetCheatFileName(const char* path);
353
354const char* GetHistoryFileName(void);
355void SetHistoryFileName(const char* path);
356
357const char* GetMAMEInfoFileName(void);
358void SetMAMEInfoFileName(const char* path);
359
360void ResetGameOptions(int driver_index);
361
362int GetRomAuditResults(int driver_index);
363void SetRomAuditResults(int driver_index, int audit_results);
364
365int GetSampleAuditResults(int driver_index);
366void SetSampleAuditResults(int driver_index, int audit_results);
367
368void IncrementPlayCount(int driver_index);
369int GetPlayCount(int driver_index);
370void ResetPlayCount(int driver_index);
371
372void IncrementPlayTime(int driver_index,int playtime);
373int GetPlayTime(int driver_index);
374void GetTextPlayTime(int driver_index,char *buf);
375void ResetPlayTime(int driver_index);
376
377char * GetVersionString(void);
378
379void SaveDefaultOptions(void);
380
381BOOL IsGlobalOption(const char *option_name);
382
383
384
385// Keyboard control of ui
386input_seq* Get_ui_key_up(void);
387input_seq* Get_ui_key_down(void);
388input_seq* Get_ui_key_left(void);
389input_seq* Get_ui_key_right(void);
390input_seq* Get_ui_key_start(void);
391input_seq* Get_ui_key_pgup(void);
392input_seq* Get_ui_key_pgdwn(void);
393input_seq* Get_ui_key_home(void);
394input_seq* Get_ui_key_end(void);
395input_seq* Get_ui_key_ss_change(void);
396input_seq* Get_ui_key_history_up(void);
397input_seq* Get_ui_key_history_down(void);
398
399input_seq* Get_ui_key_context_filters(void);
400input_seq* Get_ui_key_select_random(void);
401input_seq* Get_ui_key_game_audit(void);
402input_seq* Get_ui_key_game_properties(void);
403input_seq* Get_ui_key_help_contents(void);
404input_seq* Get_ui_key_update_gamelist(void);
405input_seq* Get_ui_key_view_folders(void);
406input_seq* Get_ui_key_view_fullscreen(void);
407input_seq* Get_ui_key_view_pagetab(void);
408input_seq* Get_ui_key_view_picture_area(void);
409input_seq* Get_ui_key_view_status(void);
410input_seq* Get_ui_key_view_toolbars(void);
411
412input_seq* Get_ui_key_view_tab_cabinet(void);
413input_seq* Get_ui_key_view_tab_cpanel(void);
414input_seq* Get_ui_key_view_tab_flyer(void);
415input_seq* Get_ui_key_view_tab_history(void);
416input_seq* Get_ui_key_view_tab_marquee(void);
417input_seq* Get_ui_key_view_tab_screenshot(void);
418input_seq* Get_ui_key_view_tab_title(void);
419input_seq* Get_ui_key_view_tab_pcb(void);
420input_seq* Get_ui_key_quit(void);
421
422
423int GetUIJoyUp(int joycodeIndex);
424void SetUIJoyUp(int joycodeIndex, int val);
425
426int GetUIJoyDown(int joycodeIndex);
427void SetUIJoyDown(int joycodeIndex, int val);
428
429int GetUIJoyLeft(int joycodeIndex);
430void SetUIJoyLeft(int joycodeIndex, int val);
431
432int GetUIJoyRight(int joycodeIndex);
433void SetUIJoyRight(int joycodeIndex, int val);
434
435int GetUIJoyStart(int joycodeIndex);
436void SetUIJoyStart(int joycodeIndex, int val);
437
438int GetUIJoyPageUp(int joycodeIndex);
439void SetUIJoyPageUp(int joycodeIndex, int val);
440
441int GetUIJoyPageDown(int joycodeIndex);
442void SetUIJoyPageDown(int joycodeIndex, int val);
443
444int GetUIJoyHome(int joycodeIndex);
445void SetUIJoyHome(int joycodeIndex, int val);
446
447int GetUIJoyEnd(int joycodeIndex);
448void SetUIJoyEnd(int joycodeIndex, int val);
449
450int GetUIJoySSChange(int joycodeIndex);
451void SetUIJoySSChange(int joycodeIndex, int val);
452
453int GetUIJoyHistoryUp(int joycodeIndex);
454void SetUIJoyHistoryUp(int joycodeIndex, int val);
455
456int GetUIJoyHistoryDown(int joycodeIndex);
457void SetUIJoyHistoryDown(int joycodeIndex, int val);
458
459int GetUIJoyExec(int joycodeIndex);
460void SetUIJoyExec(int joycodeIndex, int val);
461
462const char* GetExecCommand(void);
463void SetExecCommand(char* cmd);
464
465int GetExecWait(void);
466void SetExecWait(int wait);
467
468BOOL GetHideMouseOnStartup(void);
469void SetHideMouseOnStartup(BOOL hide);
470
471BOOL GetRunFullScreen(void);
472void SetRunFullScreen(BOOL fullScreen);
473
474void ColumnEncodeStringWithCount(const int *value, char *str, int count);
475void ColumnDecodeStringWithCount(const char* str, int *value, int count);
476
477#endif
478
src/osd/winui/dirwatch.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14// standard windows headers
15#define WIN32_LEAN_AND_MEAN
1316#include <windows.h>
17
18// standard C headers
1419#include <string.h>
1520#include <tchar.h>
21
22// MAME/MAMEUI headers
1623#include "dirwatch.h"
17#include "m32util.h"
24#include "mui_util.h"
1825#include "strconv.h"
1926
2027typedef BOOL (WINAPI *READDIRECTORYCHANGESFUNC)(HANDLE hDirectory, LPVOID lpBuffer,
src/osd/winui/help/mameui.hm
r0r1368
1// MAKEHELP.BAT generated Help Map file.  Used by MAME32.HHP. 
2 
3// Commands (ID_* and IDM_*) 
4HID_TOOLBAR_EDIT                        0x1005C
5HID_CONTEXT_SHOW_FOLDER_START           0x19858
6HID_CONTEXT_SHOW_FOLDER_END             0x19920
7HID_FILE_EXIT                           0x19C41
8HID_ABOUT                               0x19C43
9HID_FILE_PLAY                           0x19C44
10HID_HELP_ABOUT                          0x19C46
11HID_VIEW_LARGE_ICON                     0x19C47
12HID_VIEW_SMALL_ICON                     0x19C48
13HID_VIEW_LIST_MENU                      0x19C49
14HID_VIEW_DETAIL                         0x19C4A
15HID_VIEW_GROUPED                        0x19C4B
16HID_OPTIONS_FONT                        0x19C4C
17HID_OPTIONS_CLONE_COLOR                 0x19C4D
18HID_OPTIONS_DIR                         0x19C4E
19HID_OPTIONS_DEFAULTS                    0x19C4F
20HID_OPTIONS_RESET_DEFAULTS              0x19C50
21HID_OPTIONS_INTERFACE                   0x19C51
22HID_FILE_AUDIT                          0x19C52
23HID_FILE_PLAY_RECORD                    0x19C53
24HID_FILE_PLAY_BACK                      0x19C54
25HID_FILE_PLAY_RECORD_WAVE               0x19C55
26HID_FILE_PLAY_RECORD_MNG                0x19C56
27HID_VIEW_PICTURE_AREA                   0x19C57
28HID_HELP_CONTENTS                       0x19C59
29HID_HELP_WHATS_NEW32                    0x19C5A
30HID_HELP_TROUBLE                        0x19C5B
31HID_HELP_RELEASE                        0x19C5C
32HID_HELP_WHATS_NEW                      0x19C5D
33HID_HELP_CHEATS                         0x19C5E
34HID_VIEW_BYGAME                         0x19C62
35HID_VIEW_BYDIRECTORY                    0x19C63
36HID_VIEW_BYMANUFACTURER                 0x19C64
37HID_VIEW_BYYEAR                         0x19C65
38HID_VIEW_BYTYPE                         0x19C66
39HID_VIEW_BYTIMESPLAYED                  0x19C67
40HID_VIEW_LINEUPICONS                    0x19C68
41HID_UPDATE_GAMELIST                     0x19C6A
42HID_SORT_ASCENDING                      0x19C6D
43HID_SORT_DESCENDING                     0x19C6E
44HID_CUSTOMIZE_FIELDS                    0x19C70
45HID_GAME_PROPERTIES                     0x19C71
46HID_VIEW_PAGETAB                        0x19C72
47HID_VIEW_FOLDERS                        0x19C73
48HID_VIEW_TOOLBARS                       0x19C74
49HID_VIEW_STATUS                         0x19C75
50HID_CONTEXT_FILTERS                     0x19C76
51HID_CONTEXT_RENAME_CUSTOM               0x19C77
52HID_CONTEXT_ADD_CUSTOM                  0x19C79
53HID_CONTEXT_REMOVE_CUSTOM               0x19C7A
54HID_GAME_AUDIT                          0x19C7B
55HID_CONTEXT_SELECT_RANDOM               0x19C7C
56HID_OPTIONS_LANGUAGE                    0x19C7D
57HID_VIEW_TAB_SCREENSHOT                 0x19C7E
58HID_VIEW_TAB_FLYER                      0x19C7F
59HID_VIEW_TAB_CABINET                    0x19C80
60HID_VIEW_TAB_MARQUEE                    0x19C81
61HID_VIEW_TAB_TITLE                      0x19C82
62HID_VIEW_TAB_CONTROL_PANEL              0x19C83
63HID_VIEW_TAB_PCB                        0x19C84
64HID_VIEW_TAB_HISTORY                    0x19C85
65HID_OPTIONS_BG                          0x19C86
66HID_TOGGLE_TAB_SCREENSHOT               0x19C87
67HID_TOGGLE_TAB_FLYER                    0x19C88
68HID_TOGGLE_TAB_CABINET                  0x19C89
69HID_TOGGLE_TAB_MARQUEE                  0x19C8A
70HID_TOGGLE_TAB_TITLE                    0x19C8B
71HID_TOGGLE_TAB_CONTROL_PANEL            0x19C8C
72HID_TOGGLE_TAB_PCB                      0x19C8D
73HID_TOGGLE_TAB_HISTORY                  0x19C8E
74HID_VIEW_FULLSCREEN                     0x19C8F
75HID_CONTEXT_RESET_PLAYTIME              0x19C90
76HID_CONTEXT_RESET_PLAYCOUNT             0x19C91
77HID_FOLDER_PROPERTIES                   0x19C92
78HID_FOLDER_AUDIT                        0x19C93
79HID_UI_UP                               0x19C94
80HID_UI_DOWN                             0x19C95
81HID_UI_LEFT                             0x19C96
82HID_UI_RIGHT                            0x19C97
83HID_UI_START                            0x19C98
84HID_UI_PGUP                             0x19C99
85HID_UI_PGDOWN                           0x19C9A
86HID_UI_HOME                             0x19C9B
87HID_UI_END                              0x19C9C
88HID_UI_HISTORY_UP                       0x19C9D
89HID_UI_HISTORY_DOWN                     0x19C9E
90HID_FILE_LOADSTATE                      0x19C9F
91HID_FOLDER_SOURCEPROPERTIES             0x19CA0
92HID_FOLDER_VECTORPROPERTIES             0x19CA1
93HID_ARRANGE_ICONS                       0x19CA2
94 
95// Prompts (IDP_*) 
96 
97// Resources (IDR_*) 
98HIDR_MAIN_MENU                          0x2006D
99HIDR_UI_MENU                            0x2006E
100HIDR_CONTEXT_MENU                       0x20076
101HIDR_CONTEXT_HEADER                     0x20097
102HIDR_CONTEXT_TREE                       0x200A8
103HIDR_CONTEXT_SCREENSHOT                 0x200B5
104 
105// Dialogs (IDD_*) 
106HIDD_MAIN                               0x20065
107HIDD_ABOUT                              0x2006C
108HIDD_DIRECTX                            0x20072
109HIDD_AUDIT                              0x20073
110HIDD_DIRECTORIES                        0x20074
111HIDD_CUSTOM_FILE                        0x20075
112HIDD_PROP_GAME                          0x20098
113HIDD_PROP_AUDIT                         0x20099
114HIDD_PROP_DISPLAY                       0x2009A
115HIDD_PROP_SOUND                         0x2009B
116HIDD_PROP_ADVANCED                      0x2009C
117HIDD_PROP_INPUT                         0x2009D
118HIDD_PROP_MISC                          0x2009E
119HIDD_PROP_VECTOR                        0x2009F
120HIDD_COLUMNS                            0x200A0
121HIDD_FILTERS                            0x200A9
122HIDD_RESET                              0x200AA
123HIDD_LOAD_PROGRESS                      0x200AB
124HIDD_INTERFACE_OPTIONS                  0x200AD
125HIDD_PROP_HISTORY                       0x200B0
126HIDD_ROM_ERROR                          0x200B1
127HIDD_LANGUAGE                           0x200B2
128HIDD_ERROR                              0x200B3
129HIDD_PROP_DIRECT3D                      0x200B8
130HIDD_PROP_CONTROLLER                    0x200B9
131HIDD_PROP_SCREEN                        0x200BB
132 
133// Frame Controls (IDW_*) 
134HIDW_STATUS                             0x50070
src/osd/winui/help/cntx_help.txt
r0r1368
1.topic HIDC_ADSTICK
2Selects appropriate host controller for emulated controls.
3.topic HIDC_ANTIALIAS
4Enables anti-aliasing of vector lines providing a smoother look.
5.topic HIDC_ARTWORK_CROP
6Enables cropping external artwork down to selected window or resolution
7.topic HIDC_ASPECT
8Enables manual override of Mame32's 4:3 or 3:4 aspect ratio calculation.  Rarely used.
9.topic HIDC_ASPECTRATIOD
10Enables manual override of Mame32's 4:3 or 3:4 aspect ratio calculation.  Rarely used.
11.topic HIDC_ASPECTRATION
12Enables manual override of Mame32's 4:3 or 3:4 aspect ratio calculation.  Rarely used.
13.topic HIDC_AUDIO_LATENCY
14Selects the level of audio latency, adjusting this can often eliminate desync of the sound and associated scratchiness.
15.topic HIDC_AUTOFRAMESKIP
16Enables automatic frame skipping during emulation attempting to keep at 100%.
17.topic HIDC_BACKDROPS
18Enables the backdrops of artwork in supported games.
19.topic HIDC_BEAM
20Selects the width of the vector lines in vector games.
21.topic HIDC_BEZELS
22Enables the bezel artwork in supported games.
23.topic HIDC_BIOS
24Selects a particular BIOS in a driver family or individual games e.g. NeoGeo.
25.topic HIDC_BRIGHTCORRECT
26Selects the brightness level of the screen [but not artwork or UI].
27.topic HIDC_BROADCAST
28Enables programmatically broadcasting the game being played to attached devices.
29.topic HIDC_CHEAT
30Enables cheat capability using the in-game [tab] menu.
31.topic HIDC_CONTRAST
32Selects the contrast level of the screen [but not artwork or UI].
33.topic HIDC_CYCLETIMESEC
34.topic HIDC_D3D_FILTER
35Enables bilinear filtering during image stretch.
36.topic HIDC_D3D_VERSION
37Selects the version of Direct3D to use, 9 by default.
38.topic HIDC_DEBUG
39.topic HIDC_DEFAULT_INPUT
40Selects .\ctrlr\*.cfg files to use for custom controller mappings.
41.topic HIDC_DIAL
42Selects appropriate host controller for emulated controls.
43.topic HIDC_DUAL_LIGHTGUN
44Enables support for dual light guns.
45.topic HIDC_ENABLE_AUTOSAVE
46Enables Mame32 to use the contents of the \sav directory to restart a game at last quit.
47.topic HIDC_FILTER_CLONES
48Enables filtering out clones, leaving only parent games showing.
49.topic HIDC_FILTER_EDIT
50Allows typing in text to filter, including: gamename, description, driver, and manufacturer.
51.topic HIDC_FILTER_HORIZONTAL
52Enables filtering out horizontal games, leaving only vertical games showing.
53.topic HIDC_FILTER_NONWORKING
54Enables filtering out non-working games, leaving only working games showing.
55.topic HIDC_FILTER_ORIGINALS
56Enables filtering out parent games, leaving only clones showing.
57.topic HIDC_FILTER_RASTER
58Enables filtering out raster games, leaving only vector games showing.
59.topic HIDC_FILTER_UNAVAILABLE
60Enables filtering out unavailable games, leaving only available games showing.
61.topic HIDC_FILTER_VECTOR
62Enables filtering out vector games, leaving only raster games showing.
63.topic HIDC_FILTER_VERTICAL
64Enables filtering out vertical games, leaving only horizontal games showing.
65.topic HIDC_FILTER_WORKING
66Enables filtering out working games, leaving only non-working games showing.
67.topic HIDC_FLICKER
68Selects the flicker level for vector lines.
69.topic HIDC_FLIPX
70Enables flipping the screen horizontally.
71.topic HIDC_FLIPY
72Enables flipping the screen vertically.
73.topic HIDC_FRAMESKIP
74Selects the number of frames skipped during emulation.
75.topic HIDC_FSBRIGHTNESS
76Selects the level of the full-screen brightness including artwork and UI.
77.topic HIDC_FSCONTRAST
78Selects the level of the full-screen contrast including artwork and UI.
79.topic HIDC_FSGAMMA
80Selects the level of the full-screen gamma including artwork and UI.
81.topic HIDC_GAME_CAPTION
82.topic HIDC_GAMMA
83Selects the gamma level of the screen [but not artwork or UI].
84.topic HIDC_HIDE_MOUSE
85Enables hiding the mouse cursor on launch, useful for fullscreen UI w/ keyboard controlled cabinets, etc.
86.topic HIDC_HIGH_PRIORITY
87Selects Mame32's thread priority, default is 0.  Running at real-time 1 is not recommended for potential control lag and sound desync.
88.topic HIDC_HISTORY
89Enables display of the history.dat file if present in the root directory.
90.topic HIDC_HWSTRETCH
91Enables hardware stretch for DirectDraw.
92.topic HIDC_JDZ
93Selects the level for an analogue joystick's deadzone.
94.topic HIDC_JOY_GUI
95Enables controlling the Mame32 GUI with a gamepad.
96.topic HIDC_JOYSTICK
97Enables gamepad control within games.
98.topic HIDC_JSAT
99Selects the level for an analogue joystick's saturation.
100.topic HIDC_KEEPASPECT
101Enables creating windows for games that are way out of proportion e.g. thick, or tall.
102.topic HIDC_LANGUAGECHECK
103.topic HIDC_LANGUAGEEDIT
104.topic HIDC_LIGHTGUN
105Enables lightgun devices.
106.topic HIDC_LIGHTGUNDEVICE
107Selects appropriate host controller for emulated controls.
108.topic HIDC_LOG
109Enables programmatic logging as a game is played, saved out to file.
110.topic HIDC_MAXIMIZE
111Enables maximizing the game window or creating a very small window.
112.topic HIDC_MOUSE
113Enables mouse support within games.
114.topic HIDC_MULTITHREAD_RENDERING
115Enables handing off the final video blit to a second thread.  Still experimental [.118] and may cause issues.
116.topic HIDC_NUMSCREENS
117Selects number of screens for Mame32 to produce, windowed or multi-head physical monitors.
118.topic HIDC_OVERLAYS
119Enables art overlays in supported games.
120.topic HIDC_PADDLE
121Selects appropriate host controller for emulated controls.
122.topic HIDC_PAUSEBRIGHT
123Selects level of brightness for screen when paused.
124.topic HIDC_PEDAL
125Selects appropriate host controller for emulated controls.
126.topic HIDC_POSITIONAL
127Selects appropriate host controller for emulated controls.
128.topic HIDC_PRESCALE
129Selects level of prescaling, the higher the number, the sharper the stretched filtered image.
130.topic HIDC_PROP_RESET
131Enables resetting recent changes to the open tab.
132.topic HIDC_RANDOM_BG
133Enables random GUI background selection on restart, *.png files in \bkground directory.
134.topic HIDC_REFRESH
135Selects host monitor refresh rate.
136.topic HIDC_REFRESHSPEED
137Enables altering the speed of gameplay to keep the refresh rate lower than the screen.
138.topic HIDC_RELOAD
139Enables reload functionality for second button on lightguns.
140.topic HIDC_RESET_DEFAULT
141Enables resetting of games to default settings.
142.topic HIDC_RESET_EFFECT
143Enables resetting and clearing out the *.png effect chosen.
144.topic HIDC_RESET_FILTERS
145Enables resetting and clearing filters applied to folders.
146.topic HIDC_RESET_GAMES
147Enables resetting games to use default options.
148.topic HIDC_RESET_UI
149Enables resetting the options to fresh Mame32 install settings.
150.topic HIDC_ROTATE
151Selects rotation setting for game display.  Use the Auto options for pivot LCDs.
152.topic HIDC_SAMPLERATE
153Selects the output samplerate for games.
154.topic HIDC_SAMPLES
155Enables the use of external samples.
156.topic HIDC_SCREEN
157Selects screenX depends on the number of screens setting.  Allows different settings for each screen.
158.topic HIDC_SCREENSELECT
159Selects the physical monitor to display window or full-screen multi-head output.
160.topic HIDC_SELECT_EFFECT
161Selects a *.png file in the \artwork directory for creating monitor-like effects.
162.topic HIDC_SIZES
163Selects from DirectX interrogated resolutions.
164.topic HIDC_SKIP_GAME_INFO
165Enables skipping game info screen when games started.
166.topic HIDC_SPEED
167Selects the speed of gameplay, relative to realtime; smaller numbers are slower.
168.topic HIDC_SLEEP
169Enables giving more timeslices back to the system, allowing Mame32 to 'play nicer' with other apps.
170.topic HIDC_START_GAME_CHECK
171Enables running a mini-audit on application launch.
172.topic HIDC_STEADYKEY
173Enables the steadykey hack.
174.topic HIDC_STRETCH_SCREENSHOT_LARGER
175Enables increasing the size of the art pane items if the window is expanded.
176.topic HIDC_SWITCHRES
177Enables the switching of resolutions in fullscreen gaming.
178.topic HIDC_SYNCREFRESH
179Enables syncing the game internal speed to the host monitor.
180.topic HIDC_THROTTLE
181Enables throttling games to run at 100%.
182.topic HIDC_TRACKBALL
183Selects appropriate host controller for emulated controls.
184.topic HIDC_TRIPLE_BUFFER
185Enables the use of triple buffering during fullscreen gaming.
186.topic HIDC_USE_DEFAULT
187.topic HIDC_USE_MOUSE
188Selects appropriate host controller for emulated controls.
189.topic HIDC_USE_SOUND
190Enables sound within games.
191.topic HIDC_VIDEO_MODE
192Selects the default rendering method.
193.topic HIDC_VIEW
194Selects the view in use in games.
195.topic HIDC_VOLUME
196Selects the volume level in games.
197.topic HIDC_WAITVSYNC
198Enables waiting for vertical sync.
199.topic HIDC_WINDOWED
200Enables running games in a window.
src/osd/winui/help/html/mameui_systemreq.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI System Requirements</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43<base target="_blank">
44</head>
45 
46<body background="../images/bkground.gif">
47 
48<p class="MsoNormal" style="page-break-after: avoid; margin-left: 0in; margin-right: 0in; margin-top: 12.0pt; margin-bottom: 3.0pt">
49<b><i><span style="font-size: 14.0pt">System Requirements</span></i></b></p>
50<p class="MsoNormal">MameUI runs on Microsoft Windows 98SE, Windows 
51ME, Windows 2000, Windows XP, Windows 2003 Server, and Windows Vista.</p>
52<p class="MsoNormal">&nbsp;</p>
53<p class="MsoNormal">Because of the wide range of arcade hardware supported by 
54MameUI, system requirements vary considerably.&nbsp; The 
55more complex the original arcade hardware, the more CPU power is needed to 
56emulate it.&nbsp; Mame strives for accuracy in its emulation; as such, over 
57time, the performance point shifts as the underlying engine has been reworked 
58and refined.&nbsp; Early games now require a bit more PC processing power to run 
59than they did in earlier versions of Mame.&nbsp; This is typically not a great 
60concern as modern PCs can run these early games easily at thousands of times 
61their original speed.&nbsp; More recent games can often take upwards of 512M of memory, and AMD Athlon / Pentium 4 chips to emulate at 100% speed with effects.&nbsp; For those 
62wishing to upgrade their systems; <b>MameUI benefits most from adding more CPU 
63power, using a 64bit build on a 64bit OS</b>, and then memory and upgraded video card.</p>
64<p class="MsoNormal">&nbsp;</p>
65<p class="MsoNormal">Currently there are some games supported in MameUI which are not 
66playable at full frame rate on today's PC hardware.&nbsp; Many of these are 
67mid to late 90's and beyond advanced 3D games which MameUI renders in software for accuracy sake.&nbsp; 
68Recent developments in Mame [.120] have allowed some of these games to get close 
69to 100% playable on high-end overclocked [3.6Ghz+] Intel Core2Duo and Quad Core 
70cpus.&nbsp; Additionally the fastest combination for MameUI is one of the 
71previously mentioned CPUs plus the 64bit version of MameUI combined with a 64bit 
72Operating System like Vista Ultimate 64.</p>
73 
74<p class="MsoNormal">&nbsp;</p>
75<p class="MsoNormal"><font size="1">
76<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-14 12:42 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37777" --> 
77/ john iv</font></p>
78 
79</body>
80 
81</html>
src/osd/winui/help/html/mameui_properties.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Properties</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41div.Section1
42   {page:Section1;}
43-->
44</style>
45</head>
46 
47<body background="../images/bkground.gif">
48 
49<h2>Default Options &amp; Game Properties</h2>
50<p class="MsoNormal">The default options and game properties tabs of MameUI are 
51used to set the vast majority of game play parameters.&nbsp; The Game Properties 
52dialogue box, accessible from the File • Properties menu item, shares all the 
53tabs of the Default Options dialogue box, accessible from the Options • Default 
54Options menu item.&nbsp; The Game Properties dialogue contains two additional tabs 
55which give information on the game selected, and its current audited state.</p>
56<p class="MsoNormal">&nbsp;</p>
57<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
58<span style="font-family: Symbol">
59<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
60</span></span><font color="#800000"><b>General Tab</b></font> : [only available in Game Properties dialogue] 
61This tab provides information on the game selected, this information includes 
62manufacturer name and date, driver status, original CPU, original sound 
63hardware, original screen resolution and orientation, and number of colors.</p>
64<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
65&nbsp;</p>
66<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
67<span style="font-family: Symbol">
68<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
69</span></span><font color="#800000"><b>Audit Tab</b></font> : [only available in the Game Properties 
70dialogue] This tab performs a ‘mini-audit’ on the game selected, determining its 
71status compared to what MameUI expects.&nbsp; Status will be reported and missing 
72files with CRC information will appear in the details view.</p>
73<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
74&nbsp;</p>
75<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
76<span style="font-family: Symbol">
77<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
78</span></span><font color="#800000"><b>Display Tab</b></font> : This tab allows the setting of numerous video 
79options.</p>
80<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
81&nbsp;</p>
82<p class="MsoNormal" style="margin-left:.75in"><b>
83Run in a window</b> : MameUI 
84will launch the game selected in a window on the desktop, the window can be 
85resized by pausing the emulation and dragging the borders.&nbsp; The resolution of 
86the window can also be set in the Screen tab.</p>
87<p class="MsoNormal" style="margin-left:.75in"><b>Start out maximized </b>: 
88Toggling this option on ensures that when windowed mode is used, the maximum 
89amount of space is used.&nbsp; Toggle this option off to play the smallest version of 
90the windowed game.</p>
91<p class="MsoNormal" style="margin-left:.75in"><b>Enforce aspect ratio </b>: 
92This option is used in conjunction with windowed mode, it forces the aspect 
93ratio to be maintained when the game is paused and the window is dragged and 
94resized.&nbsp; Turn this off to create long, thin game windows, or short fat, etc.</p>
95<p class="MsoNormal" style="margin-left:.75in"><b>Throttle </b>: This option 
96prevents MameUI from running games as fast as the host CPU can go.&nbsp; Unless this 
97is toggled on, a modern x86 processor will run Donkey Kong at a thousand times 
98its original speed.</p>
99<p class="MsoNormal" style="margin-left:.75in"><b>Rotation </b>: This drop down 
100box allows MameUI to rotate the video output by 90 degrees in either direction.&nbsp; 
101This setting is useful if used in conjunction with a pivoting monitor [the auto 
102options], or 
103playing games with a monitor on its side.&nbsp; Doing so allows vertical orientated 
104games to be played full screen.&nbsp; The additional 'auto clockwise' and 'auto 
105anti-clockwise' settings are particularly useful for rotating LCD monitors, 
106these settings will force vertical games to one 90 degree angle or the other 
107depending on which way the LCD pivots.<br>
108<b>Flip screen upside down </b>: 
109This option mirrors the image vertically.</p>
110<p class="MsoNormal" style="margin-left:.75in"><b>Flip screen left right </b>: 
111This option mirrors the image horizontally.</p>
112<p class="MsoNormal" style="margin-left:.75in"><b>Direct3D</b> : <b>Use Bilinear 
113Filtering</b> : This option enables bilinear filtering on game screen graphics.&nbsp; 
114'Fuzziness' of image can be controlled by the bitmap prescaling option, 
115increasing it sharpens the image.&nbsp; Leaving this unchecked produces the 
116crispest output but does point filtering leading to scaling artifacts.</p>
117<p class="MsoNormal" style="margin-left:.75in"><b>Direct3D</b> : <b>Version</b> 
118: This option allows toggling between version 9 and version 8 of D3D.&nbsp; It's 
119almost always preferable to stay with 9.</p>
120<p class="MsoNormal" style="margin-left:.75in"><b>DirectDraw</b> : <b>Stretch 
121using hardware</b> : Used in conjunction with DDraw as the video mode, this 
122toggle if turned off scales upwards the size of the games original native 
123resolution at the same aspect ratio.</p>
124<p class="MsoNormal" style="margin-left:.75in"><b>Bitmap prescaling</b> : This 
125option works in conjunction with bilinear filtering.&nbsp; The higher up the 
126slider, the sharper the screen output.</p>
127<p class="MsoNormal" style="margin-left:.75in"><b>Gamma correction </b>: &nbsp;This 
128option controls the gamma, which produces a potentially nonlinear black to white 
129ramp, for the game screens. This option does not affect the artwork or other 
130parts of the display. Using MameUI's in-game tilde menu [~], one can individually 
131set the gamma for each game screen; this option controls the initial value for 
132all visible game screens. The standard value is 1.0, which gives a linear ramp 
133from black to white. Selecting lower values (down to 0.1) will increase the 
134nonlinearity toward black,&nbsp; while selecting higher values (up to 3.0) will 
135push the nonlinearity&nbsp; toward white. The default is 1.0.</p>
136<p class="MsoNormal" style="margin-left:.75in"><b>Brightness correction </b>: 
137This option controls the default brightness, or black level, of the game 
138screens. This option does not affect the artwork or other parts of the display.&nbsp; 
139Using MameUI's in-game tilde menu [~], one can individually set the brightness for 
140each game screen; this option controls the initial value for all visible game 
141screens. The standard value is 1.0. Selecting lower values (down to 0.1) will 
142produce a darkened display, while selecting higher values (up to 2.0) will give 
143a brighter display. The default is 1.0.</p>
144<p class="MsoNormal" style="margin-left:.75in"><b>Contrast correction </b>:&nbsp; 
145Controls the contrast, or white level, of the game screens. This option does not 
146affect the artwork or other parts of the display. Using MameUI's in-game tilde menu 
147[~], one can individually set the contrast for each game screen; this option 
148controls the initial value for all visible game screens. The standard value is 
1491.0. Selecting lower values (down to 0.1) will produce a dimmer display, while 
150selecting higher values (up to 2.0) will give a more saturated display. The 
151default is 1.0.</p>
152<p class="MsoNormal" style="margin-left:.75in"><b>Pause Brightness </b>: This 
153option controls the screen brightness when a game is paused.</p>
154<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
155<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
156<span style="font-family: Symbol">
157<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
158</span></span><font color="#800000"><b>Advanced Tab</b></font> : This tab allows the setting of 
159additional numerous 
160video options.</p>
161<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
162<p class="MsoNormal" style="margin-left:.75in"><b>Triple buffering </b>: This 
163option controls how MameUI draws to the screen, if toggled on, it will draw to 
164three buffers and cycle between them.&nbsp; This setting when toggled on can also 
165help alleviate tearing that sometimes occurs in some scrolling games.</p>
166<p class="MsoNormal" style="margin-left:.75in"><b>Sync to monitor refresh </b>: 
167This option tells MameUI to ignore the original game’s refresh rate and sync it 
168to the output monitor’s current rate.&nbsp; This can cause the game to run too 
169fast if the output monitor is using 85Hz for example.&nbsp; This option is 
170preferable if MameUI is used with authentic arcade monitor hardware and video 
171card modes that are tweaked appropriately.</p>
172<p class="MsoNormal" style="margin-left:.75in"><b>Wait for vertical sync </b>: 
173This option tells MameUI to wait for the refresh period on the output monitor to 
174finish before starting to draw video to the screen, this works functionally 
175similarly to triple buffer but is better suited for running games in a window to 
176alleviate tearing. </p>
177<p class="MsoNormal" style="margin-left:.75in"><b>Refresh speed </b>: 
178This option tells MameUI to alter the speed of the emulation for games that run 
179at a higher speed than the host monitor.&nbsp; For example this should be 
180checked if running Pac-Man on a fixed 60Hz LCD since Pac-Man runs at 60.60Hz.&nbsp; 
181This alleviates sound hiccups as well in the previous situation.</p>
182<p class="MsoNormal" style="margin-left:.75in"><b>Emulation speed </b>: 
183This slider allows for the altering of the emulation speed, it can be dropped 
184down or increased by three [or to 100 in the \ini.] </p>
185<p class="MsoNormal" style="margin-left:.75in"><b>Frame skipping </b>: These 
186settings allow MameUI to skip frames of animation when playing games, if the 
187host CPU is not fast enough to run the game.&nbsp; Optimally this should be 
188toggled off and 'draw every frame' selected.</p>
189<p class="MsoNormal" style="margin-left:.75in"><b>Full screen gamma</b> : This 
190option is similar to the gamma correction in the display tab but works on all 
191graphic elements of the screen including the UI.</p>
192<p class="MsoNormal" style="margin-left:.75in"><b>Full screen brightness </b>: 
193This option is similar to the brightness correction in the display tab but works 
194on all graphic elements of the screen including the UI.</p>
195<p class="MsoNormal" style="margin-left:.75in"><b>Full screen contrast</b> : 
196This option is similar to the contrast correction in the display tab but works 
197on all graphic elements of the screen including the UI.</p>
198<p class="MsoNormal" style="margin-left:.75in"><b>Effect</b> : Starting with 
199version .107 simulated arcade monitor effects are handled by the overlay of 
200*.png masks on the game.&nbsp; The *.png files reside in the \artwork directory 
201and are simple patterns creatable and editable in applications like Photoshop.&nbsp; 
202If scan lines are desired and a very high resolution is being used [1280x1024 or 
203above] the Scanlines75x4 item is suggested.&nbsp; For games with artwork whose 
204playfields are smaller on screen as the results of bezels, it's recommended to 
205use Scanlines75x3 or Scanlines75x2.</p>
206<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
207<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
208<span style="font-family: Symbol">
209<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
210</span></span><font color="#800000">
211<span style="font-style:normal; font-variant:normal; font-weight:700">Screen</span><b> Tab</b></font> : This tab allows the 
212alteration of the various screen output settings.</p>
213<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
214&nbsp;</p>
215<p class="MsoNormal" style="margin-left:.75in"><b>
216Number of screens </b>:<b>
217</b>This 
218slider controls the number of screens MameUI will draw.&nbsp; In windowed mode 
219up to four different output windows can be created of varying sizes, shapes, 
220etc.&nbsp; In full screen mode the number of screens can match the physical 
221number of monitors connected to the host system.&nbsp; This allows playing 
222multi-monitor arcade games like Punch-Out or similar on 2 physical computer 
223monitors in dual head mode.</p>
224<p class="MsoNormal" style="margin-left:.75in"><b>Screen </b>: This 
225option allows the choice of the physical monitor to use in conjunction with 
226number of screens and screennumber.&nbsp; The drop down is populated by the
227<a href="file://./DISPLAY1">\\.\DISPLAY1</a> and/or <a href="file://./DISPLAY2">
228\\.\DISPLAY2</a> and so forth.&nbsp; Leaving this toggle to Auto will have 
229MameUI attempt to order the game screens as it sees fit, for Punch-Out for 
230example it will place the main fighting screen on <a href="file://./DISPLAY1">
231\\.\DISPLAY1</a> and the status/display screen on secondary monitor
232<a href="file://./DISPLAY2">\\.\DISPLAY2</a>. </p>
233<p class="MsoNormal" style="margin-left:.75in"><b>Aspect Ratio </b>: Allows 
234control over the physical aspect ratio of the physical monitor for each screen.&nbsp; 
235If running full screen and auto aspect ratio is <b>off</b>, then switch 
236resolutions to fit must be toggled on to work.&nbsp; Typically this should be 
237set to autoselect unless weird shaped windows for game play are desired.</p>
238<p class="MsoNormal" style="margin-left:.75in"><b>View</b> : This drop down 
239allows the selection of the default view of the in-game display.&nbsp; This can 
240be auto which is effectively 4:3 for horizontal games or 3:4 for vertical games, 
241native, which is the game's original native resolution, or cocktail which is 
242duplicated view for 2 people playing the game on opposite sides of a cocktail 
243cabinet.</p>
244<p class="MsoNormal" style="margin-left:.75in"><b>Screennumber</b> : This drop 
245down is populated based on the slider setting of number of screens to its left.&nbsp; 
246Each item in the screennumber drop down can be individually tailored with 
247screen, resolution, aspect ratio, and view. Thus it is possible to have 
248elaborate combinations for game play, for example.&nbsp; Number of screens 3, 
249run in windowed mode, have screen0 go to the secondary
250<a href="file://./DISPLAY2">\\.\DISPLAY2</a>, running in 320x240 resolution at a 
251color depth of 16bpp with a refresh of 75Hz, screen1 go to primary display
252<a href="file://./DISPLAY1">\\.\DISPLAY1</a>, run at
253<a href="mailto:640x480x32@60">640x480x32@60</a> and use the cocktail view, etc.&nbsp; 
254Each item in the Screennumber drop down will populate its own settings and 
255maintain those settings until returned to a default.</p>
256<p class="MsoNormal" style="margin-left:.75in"><b>Resolution</b> : These options 
257control the size and refresh rate of the screennumbers.&nbsp; In 
258windowed mode only the resolution is selectable.</p>
259<p class="MsoNormal" style="margin-left:.75in"><b>Switch resolutions to fit</b> 
260: This toggle must be <b>on</b> if any of the resolution choices are altered 
261away from auto in full screen mode.&nbsp; It does not impact windowed mode.</p>
262<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
263<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
264<span style="font-family: Symbol">
265<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
266</span></span><b><font color="#800000">Sound Tab</font> </b>: This tab allows for setting the sound options.</p>
267<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
268&nbsp;</p>
269<p class="MsoNormal" style="margin-left:.75in"><b>
270Enable sound and sound CPUs
271</b>: This setting toggles sound on or off in games.</p>
272<p class="MsoNormal" style="margin-left:.75in"><b>Use samples </b>: This setting 
273allows MameUI to utilize samples for games which do not have their sound 
274hardware emulated, or were using analogue circuitry.</p>
275<p class="MsoNormal" style="margin-left:.75in"><b>Sample Rate </b>: This setting 
276tells MameUI at what rate to output sound, the higher, the better.&nbsp; Lowering 
277this setting can also result in faster performance on lower end machines.</p>
278<p class="MsoNormal" style="margin-left:.75in"><b>Volume attenuation </b>: This 
279setting allows MameUI to set the initial volume level, the default is 0dB.</p>
280<p class="MsoNormal" style="margin-left:.75in"><b>Audio latency </b>: This 
281slider allows the adjustment of the amount of latency built into the audio 
282streaming.&nbsp; Increasing the slider to the right on faster machines can help 
283alleviate some desync and scratchiness in the sound on some configurations.</p>
284<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
285&nbsp;</p>
286<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
287<span style="font-family: Symbol">
288<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
289</span></span><b><font color="#800000">Controllers Tab</font> </b>: This tab allows for setting the game 
290controller options.</p>
291<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
292&nbsp;</p>
293<p class="MsoNormal" style="margin-left:.75in"><b>
294Enable joystick input </b>: 
295This setting tells MameUI to utilize any currently connected joysticks.&nbsp; 
296MameUI 
297will interrogate the game controllers control panel and use ID#1 and up.</p>
298<p class="MsoNormal" style="margin-left:.75in"><b>Analog joystick deadzone</b> : 
299This setting controls how MameUI translates analog input to games that require 
300digital input.</p>
301<p class="MsoNormal" style="margin-left:.75in"><b>Enable lightgun input</b> : 
302This setting tells MameUI to utilize a lightgun for target/shooting games that 
303require analogue control, like Crossbow, Police Trainer, Rev X, etc. and will 
304only be available on non-XP based systems.&nbsp; If using XP then mouse input 
305should be toggled on to allow mapping of the lightgun functions in the in-game [<b>TAB</b>] 
306menu.</p>
307<p class="MsoNormal" style="margin-left:.75in"><b>Offscreen shots reload</b> : 
308This option if checked will internally remap the second mouse button and allow 
309it to be used for simulated 'reloading' in gun games that require it.</p>
310<p class="MsoNormal" style="margin-left:.75in"><b>Dual lightguns</b> : This is a 
311legacy switch for non-XP systems which activates code to handle internal mapping 
312of the second light gun connected to the system.&nbsp; If WinXP is used this is 
313not required and is grayed out, the second gun is mapped like a joystick or 
314mouse in the in-game [<b>TAB</b>] menu.</p>
315<p class="MsoNormal" style="margin-left:.75in"><b>Enable mouse input </b>: This 
316setting tells MameUI to utilize the mouse in games that require analogue control 
317methods.&nbsp; On XP systems the mouse toggle should be on if a lightgun is to 
318be utilised.</p>
319<p class="MsoNormal" style="margin-left:.75in"><b>Enable steadykey support </b>: 
320This option tells MameUI to use a different keyboard handling routine that makes it 
321easier to register simultaneous key presses for games that require it for 
322special moves [Street Fighter II, etc.].&nbsp; However it can produce more sluggish results in other games.</p>
323<p class="MsoNormal" style="margin-left:.75in"><b>Default input layout </b>: 
324This drop down menu allows MameUI to choose between multiple key mappings, 
325including keyboard mapping for various third-party control panels.&nbsp; It will also display user defined 
326controller mappings, if created in the \ctrlr directory.&nbsp; Various arcade 
327game controller companies produce custom made configuration files for their 
328setups; these *.cfg files need to go in the \MameUI\ctrlr folder to be 
329recognized in the MameUI controllers tab.&nbsp; These files are the responsibility of 
330the controller companies themselves and are not included or endorsed by MameUI, 
331they can typically be found at the companies’ web sites.</p>
332<p class="MsoNormal" style="margin-left:.75in"><strong>Multiple keyboards</strong> 
333: Enabling this checkbox tells MameUI to allow mapping to different physical 
334keyboards that may be attached to the host system, this allows rather esoteric 
335options like multiple keyboards for games like 2 player Keyboard Mania or Typing 
336of the Dead etc.&nbsp; If left off MameUI maps all keyboard controls to all 
337keyboard devices.</p>
338<p class="MsoNormal" style="margin-left:.75in"><strong>Multiple mice</strong> : 
339Enabling this checkbox tells MameUI to allow mapping to different physical mice 
340devices.&nbsp; Useful for systems that have spinners, trackballs, main system 
341mice etc.&nbsp; If left off MameUI maps all mice controls to all mouse devices.<br>
342</p>
343<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
344<p class="MsoNormal" style="margin-left:.75in; text-indent:-.25in">
345<span style="font-family: Symbol">
346<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
347</span></span>
348<font color="#800000">
349<span style="font-style:normal; font-variant:normal; font-weight:700">Controller 
350Mapping</span></font><b><font color="#800000"> Tab</font> </b>: This tab allows choosing which analogue device 
351connected to the system for MameUI to map a game's internal analogue controls 
352to.&nbsp; These options should be used in lieu of the global 'mouse' setting 
353which can conflict with attached joysticks/gamepads.</p>
354<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
355&nbsp;</p>
356<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
357<span style="font-family: Symbol">
358<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
359</span></span><b><font color="#800000">Miscellaneous Tab</font> </b>: This tab allows for setting additional 
360options.</p>
361<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
362&nbsp;</p>
363<p class="MsoNormal" style="margin-left:.75in"><b>Enable game cheats </b>: This 
364setting if toggled on allows MameUI to use external cheat.dat files.</p>
365<p class="MsoNormal" style="margin-left:.75in"><b>
366<span style="font-size: 10.0pt; font-family: Arial">Error log (for developers)
367</span></b><span style="font-size: 10.0pt; font-family: Arial">: This setting if 
368toggled on produces an error log of illegal memory accesses.</span></p>
369<p class="MsoNormal" style="margin-left:.75in"><b>S<span style="font-size: 10.0pt; font-family: Arial">leep 
370when 
371possible
372</span></b><span style="font-size: 10.0pt; font-family: Arial">: This setting if 
373toggled on allows MameUI to be more multitasking friendly in that it does not 
374use as much processor time.&nbsp; If this setting is toggled off MameUI will 
375utilize 100% of the CPU for playing games.&nbsp; Some machines slow down 
376dramatically if this setting is toggled on, particularly laptops.&nbsp; This 
377maps to the -sleep option in Mame.</span></p>
378<p class="MsoNormal" style="margin-left:.75in">
379<b>Skip game info</b> : If this options is on, MameUI will immediately launch a 
380game without information screens.&nbsp; However screens regarding problems in 
381the drivers will still be shown [missing sound, unemulated protection, problems 
382with video etc.].</p>
383<p class="MsoNormal" style="margin-left:.75in">
384<span style="font-size: 10.0pt; font-family: Arial"> <b>Save game state on exit</b> : This toggle will allow 
385MameUI to automatically 
386save the current machine state when the game is exited with the ESC key.&nbsp; 
387As a result when the game is re-launched it's like the machine was never turned 
388off.&nbsp; This feature allows older games to maintain their hi-scores 
389indefinitely where it wasn't originally supported.&nbsp; The files are stored in 
390the MameUI\sta directory.&nbsp; The list of games that support save states is 
391present in the left hand folder view pane of the UI as 'Save State'.</span></p>
392<p class="MsoNormal" style="margin-left:.75in">
393<b>Thread Priority slider</b> : Increasing the Windows thread priority for 
394MameUI 
395giving it more CPU and resources slices, can negatively impact other running 
396processes.&nbsp; Using setting 1 sets it to real-time which interferes with 
397keyboard and joystick controls as well as other running apps.&nbsp; Setting 1 is 
398not recommended as a result.&nbsp; Some Dells and other laptop computers may 
399require setting slider to -15 to get keyboard control working properly.</p>
400<p class="MsoNormal" style="margin-left:.75in">
401<b>Multi-threaded rendering </b>: This toggle allows multi-core or multi-chip or 
402HyperThreaded machines to pass the final video blit off to a second thread.&nbsp; 
403This can lead up to a 40% increase in unthrottled FPS using D3D in GPU limited 
404games.&nbsp; However it does not have a real world effect on games that are CPU 
405bound, like the heavy seattle.c, or vegas.c games.&nbsp; Unless in possession of 
406one of these types of machines, this should be toggled off to avoid potential 
407slowdowns.</p>
408<p class="MsoNormal" style="margin-left:.75in"><b>
409Use additional game artwork
410</b>: This setting if toggled on allows MameUI to utilize the external artwork 
411packages 
412available at <b><a target="_blank" href="http://www.mame.net/downart.html">
413Mame.net</a></b> for display in games like Armor Attack, Discs of Tron, Lunar 
414Lander, Warrior, etc.&nbsp;The artwork packages are placed in the \artwork directory.&nbsp; 
415Each element of the artwork package can be toggled: bezel, overlay, and 
416background.&nbsp; </p>
417<p class="MsoNormal" style="margin-left:.75in"><b>Crop Artwork</b> : Selecting 
418the crop artwork toggle will shrink the scene down to the games original 
419dimensions, cropping any available art pieces.</p>
420<p class="MsoNormal" style="margin-left:.75in"><b>BIOS</b> : This drop down 
421allows the use of a variety of different supported NeoGeo or Sega BIOS files.&nbsp; 
422The option will only be available when altering the driver family via the source 
423folder view on the left pane, or individual games in the driver family.</p>
424<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
425 
426<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
427<span style="font-family: Symbol">
428<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
429</span></span><b><font color="#800000">Vector Tab</font> </b>: This tab allows for setting additional 
430options for games that originally utilized a vector monitor instead of a raster 
431monitor. [Asteroids, Battlezone, Armor Attack, etc.]</p>
432<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
433&nbsp;</p>
434<p class="MsoNormal" style="margin-left: .75in"><b>
435Draw antialiased vectors </b>
436: This setting if toggled on tells MameUI to draw vector lines with an 
437additional pleasing antialiased look.</p>
438<p class="MsoNormal" style="margin-left: .75in"><b>Beam width</b> : This slider 
439allows MameUI to set the beam width on the vector lines drawn, increasing it 
440creates wider vectors. </p>
441<p class="MsoNormal" style="margin-left: .75in"><b>Flicker</b> : This slider 
442tells MameUI to artificially create a flicker effect on the vector lines.</p>
443<p class="MsoNormal" style="margin-left: .75in">&nbsp;</p>
444<p class="MsoNormal" style="margin-left: 0; margin-bottom:0">
445<img border="0" src="../images/1.jpg" width="250" height="344"><img border="0" src="../images/2.jpg" width="250" height="344"><img border="0" src="../images/3.jpg" width="250" height="344"><img border="0" src="../images/4.jpg" width="250" height="344"><img border="0" src="../images/5.jpg" width="250" height="344"><img border="0" src="../images/6.jpg" width="250" height="344"><img border="0" src="../images/7.jpg" width="250" height="344"><img border="0" src="../images/8.jpg" width="250" height="344"></p>
446 
447<p class="MsoNormal" style="margin-left: .75in">&nbsp;</p>
448<p class="MsoNormal" style="margin-left: 0; margin-bottom:0"><font size="1">
449<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
450/ john iv</font></p>
451 
452</body>
453 
454</html>
src/osd/winui/help/html/mameui_credits.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Credits</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41 div.MsoNormal
42   {mso-style-parent:"";
43   margin-bottom:.0001pt;
44   font-size:10.0pt;
45   font-family:Arial;
46   margin-left:0in; margin-right:0in; margin-top:0in}
47-->
48</style>
49<base target="_blank">
50</head>
51 
52<body background="../images/bkground.gif">
53 
54<h1>MameUI Credits &amp; Resources</h1>
55<h2><b>Credits</b></h2>
56<p class="MsoNormal">The current MameUI DEV team:</p>
57<p class="MsoNormal">&nbsp;</p>
58<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
59<span style="font-family: Symbol">
60<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
61</span></span><b>Chris Kirmse</b></p>
62<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
63<span style="font-family: Symbol">
64<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
65</span></span><b>Mike Haaland</b></p>
66<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
67<span style="font-family: Symbol">
68<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
69</span></span><b>René Single</b></p>
70<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
71<span style="font-family: Symbol">
72<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
73</span></span><b>
74<a href="http://mameui.classicgaming.gamespy.com/">John L. Hardy IV</a></b></p>
75<p class="MsoNormal" style="margin-left:.75in">&nbsp;</p>
76<p class="MsoNormal">Special thanks to Michael Soderstrom for project 
77co-ordination and source maintenance from 1997-2001.</p>
78<p class="MsoNormal">&nbsp;</p>
79<p class="MsoNormal">Additional appreciated code contributions by : Jeff 
80Miller, Dan Miller, Andrew Kirmse, Mohammad Rezaei, <font face="Arial" size="2">
81René Single, </font>John Zissopoulos, Nathan 
82Woods, Robert Schlabbach, Sword, Emuman, BUT, <font face="Arial" size="2">'Mamesick', </font>
83Sauro Puccini,<b> </b><font face="Arial" size="2">Tor 
84Arne Vestbø, </font>R. J. Sheppard, Visk, K&amp;K, 
85Patrick Jones, and ‘Ren Höek’.</p>
86<p class="MsoNormal">&nbsp;</p>
87<h2><b>Resources</b></h2>
88<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
89<span style="font-family: Symbol">
90<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
91</span></span><b>
92<a target="_blank" href="http://mameui.classicgaming.gamespy.com/">The 
93MameUI Homepage</a> </b>:<b> </b>Home to the MameUI binary/source, 
94icons, screenshots, testing, work in progress updates, bug 
95reporting/tracking, message board, and benchmarking.</p>
96<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
97<span style="font-family: Symbol">
98<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
99</span></span><b>
100<a target="_blank" href="http://groups.msn.com/MameUI/">The 
101MameUI 
102Message Board</a> </b>:<b> </b>Forum for discussion of MameUI related issues.</p>
103<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
104<span style="font-family: Symbol">
105<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
106</span></span><b>
107<a target="_blank" href="http://mameui.classicgaming.gamespy.com//MameUI_Bugs.xls">MameUI 
108Defect Tracking and Bug Reports</a> </b>: Excel spreadsheet which displays 
109information about current MameUI feature requests and issues.&nbsp; Check before 
110reporting potential bugs.</p>
111<p class="MsoNormal"><b>&nbsp;</b></p>
112<div class="MsoNormal" align="center" style="text-align:center">
113  <span style="font-family: Courier New">
114  <hr size="2" width="100%" align="center"></span>
115</div>
116<p class="MsoNormal"><b>&nbsp;</b></p>
117<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
118<span style="font-family: Symbol">
119<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
120</span></span><b><a href="http://www.mamedev.org">MameDEV.org</a> </b>:<b> </b>Home of 
121baseline MAME.</p>
122<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
123<span style="font-family: Symbol">
124<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
125</span></span><b>
126<a target="_blank" href="http://www.mametesters.org">MameTesters.org</a> </b>:<b> </b>
127Reporting and tracking baseline Mamebugs.</p>
128<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">&nbsp;</p>
129<p class="MsoNormal" style="margin-left: 0" align="left">MameUI © 
1302007 C. Kirmse, M. Haaland, &amp; the MameUI team</p>
131<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">&nbsp;</p>
132<p class="MsoNormal" style="margin-left: 0" align="left">this help 
133file authored by john iv</p>
134 
135<p class="MsoNormal" style="margin-left: 0" align="left">
136<font size="1">
137<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-12 10:17 PM -0800<!--webbot bot="Timestamp" endspan i-checksum="38219" --></font></p>
138 
139</body>
140 
141</html>
src/osd/winui/help/html/mameui_visual_elements.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Toolbar / Status Bar / Windows</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>MameUI Toolbar / Status Bar / Windows</h2>
48<p class="MsoNormal">&nbsp;</p>
49<p class="MsoNormal">The MameUI <b>toolbar</b> extends the width of the application 
50at the top and 
51can be toggled on by using the View • Toolbar menu item, or the <b>Alt-T </b>keyboard 
52shortcut.&nbsp; The buttons on the toolbar from left to right are : toggle folder 
53list, toggle screenshot, large icons view, small icons view, list view, details 
54view, help about, and help file.&nbsp; Click the items to toggle them on or off.&nbsp; 
55The toolbar also contains the game search box, typing into this text box will 
56filter out games.&nbsp; It is similar in function to the Ctrl-F filter but only 
57filters on game descriptive name.</p>
58<p class="MsoNormal">
59<img border="0" src="../images/toolbar.gif" width="632" height="28"></p>
60<p class="MsoNormal">&nbsp;</p>
61<p class="MsoNormal">The MameUI <b>status bar</b> extends the width of the application 
62at the bottom and can be toggled on by using the View • Status Bar menu item, or 
63the <b>Alt-S</b> keyboard shortcut.&nbsp; The status bar indicates the full name of the game 
64highlighted, and gives its internal status flag as to whether it’s working or if 
65there are some issues with the emulation.&nbsp; The status bar also indicates the 
66game count for the particular view used.</p>
67<p class="MsoNormal">
68<img border="0" src="../images/statusbar.gif" width="632" height="20"></p>
69<p class="MsoNormal">
70&nbsp;</p>
71<p class="MsoNormal"><b>MameUI can be divided into three windowed sections:</b></p>
72<p class="MsoNormal">&nbsp;</p>
73<p class="MsoNormal">The first section on the far left is the <b>folder view</b>, 
74toggled on by using the View • Folder List menu item, or the Alt-D keyboard 
75shortcut.&nbsp; This contains a tree style list that expands for certain items like 
76year, manufacturer, and custom.&nbsp; By selecting one of these items, MameUI will 
77display the games that meet that criterion.&nbsp; For example: selecting year / 1978, 
78MameUI will 
79display all the supported games manufactured in 1978.&nbsp;  </p>
80<ul>
81  <li>
82<p class="MsoNormal">MameUI will  display user 
83created folders based on *.ini files located in the \MameUI\folders directory.&nbsp; 
84See files in that location for examples.&nbsp; This location also houses the 
85favorites.ini, where favorite games can be added to the text file and easily 
86moved to other computers.<br>
87&nbsp; </p>
88  </li>
89  <li>
90<p class="MsoNormal">MameUI supports dragging and dropping games from the middle 
91section game list into a custom folder in the left pane.&nbsp; MameUI supports 
92the same procedure by secondary clicking on the game in the game list and 
93choosing the 'add to custom folder' option.<br>
94&nbsp;</p>
95  </li>
96  <li>
97<p class="MsoNormal">MameUI also supports secondary clicking on a custom folder 
98and renaming it, editing the custom folder name can also be accomplished by 
99clicking the name of the folder three times quickly.<br>
100&nbsp;</p>
101  </li>
102  <li>
103<p class="MsoNormal">Secondary clicking on any of the folders also allows 
104selectively displaying or hiding them in the tree.<br>
105&nbsp;</p>
106  </li>
107  <li>
108<p class="MsoNormal">Secondary clicking the vector folders and the \source\gamedriver 
109folder allows for customizing 
110away from default the games in that folder.<font face="Arial" size="2">&nbsp; 
111Secondary click on the vector folder • properties in the folder pane to set 
112options for that group of games.&nbsp; To alter global settings for game 
113families select the properties for it, e.g. dkong.c for the Donkey Kong family 
114of games&nbsp; This will change options for 
115all games based on that driver.&nbsp; Thus there is the possibility to have 
116four levels of alterations when a game's individual properties are viewed 
117in All Games or any folder.&nbsp; The changes can be backed out of 
118hierarchically with reset to default on each respective properties, or by 
119deleting the .ini files in the \ini directory.</font></p>
120  </li>
121</ul>
122<p class="MsoNormal">The second, middle section of MameUI is the <b>game list</b>, 
123always toggled on. &nbsp;This is where MameUI lists all of the games chosen 
124in the left folder view.&nbsp; MameUI has the option to display the games as large 
125icons, small icons, a list icons view, or details.&nbsp; Choosing details allows 
126MameUI to display, in columnar mode, the game name as well as additional 
127informational fields, chosen in the View • Customize Fields menu item.</p>
128<p class="MsoNormal">&nbsp;</p>
129<p class="MsoNormal">The third section, on the far right, is the <b>screenshot/art 
130area</b>, toggled on by using the View • Screenshot menu item, or the <b>Alt-P</b> keyboard 
131shortcut.&nbsp; This area of the GUI will display the optional artwork for each game 
132selected, the artwork modes are toggled through by clicking on the picture area.&nbsp; The 
133modes are: screenshot, flyer, cabinet, marquees,  title shots, control panels, 
134and history.&nbsp; <b>Alt-B</b> 
135will toggle the screenshot tabs which give a visual selection method besides 
136clicking the artwork area.&nbsp; Secondary clicking on the screenshot area will 
137also bring up a shortcut dialogue with the file types available and allow 
138toggling on or off individual tabs.&nbsp; The area under the screenshot mode 
139will also display the history.dat information if that file is present [it will 
140not display in the screenshot area if the history tab is enabled].&nbsp; Each of 
141the tabs can be navigated to by their accelerator keys, <b>Alt-1</b>, <b>Alt-2</b>,
142<b>Alt-3</b>, etc. Further 
143information about these files is in
144<a style="color: blue; text-decoration: underline; text-underline: single" href="mameui_art.htm">Art and Support Files</a>.</p>
145 
146<p class="MsoNormal">&nbsp;</p>
147 
148<p class="MsoNormal"><font size="1">
149<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-11 01:10 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37299" --> 
150/ john iv</font></p>
151 
152</body>
153 
154</html>
src/osd/winui/help/html/mameui_viewmenu.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI View Menu</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>View Menu</h2>
48<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
49<span style="font-family: Symbol">
50<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
51</span></span><b>Toolbar</b> : Selecting this option from the view menu will 
52toggle the toolbar on or off.</p>
53<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
54<span style="font-family: Symbol">
55<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
56</span></span><b>Status Bar</b> : Selecting this option from the view menu will 
57toggle the status bar on or off.</p>
58<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
59<span style="font-family: Symbol">
60<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
61</span></span><b>Folder List</b> : Selecting this option from the view menu will 
62toggle the folder list view on or off.</p>
63<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
64<span style="font-family: Symbol">
65<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
66</span></span><b>Screenshot</b> : Selecting this option from the view menu will 
67toggle the screenshot area on or off.</p>
68<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
69<span style="font-family: Symbol">
70<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
71</span></span><b>Screenshot Tab</b> : Selecting this option from the view menu will 
72toggle the screenshot area tabs, allowing to choose between the multiple 
73different art types.&nbsp; Note that history.dat information is only displayed 
74in the snapshot view.</p>
75<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
76<span style="font-family: Symbol">
77<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
78</span></span><b>Fullscreen</b> : Selecting this option from the view menu will 
79 
80switch the GUI into full screen mode.&nbsp; This will expand to fill the current 
81desktop resolution, it will hide the menu bar, and it will hide the windows 
82taskbar.&nbsp; Toggle in and out of it with F11, other alt shortcut keys are 
83still active.</p>
84<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
85<span style="font-family: Symbol">
86<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
87</span></span><b>Show Pictures</b> : Selecting this option from the view menu will 
88allow toggling the display of the individual art tabs in the screenshot area.</p>
89<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
90<span style="font-family: Symbol">
91<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
92</span></span><b>Large Icons</b> : Selecting this option from the view menu will 
93display large icons in the gamelist area.</p>
94<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
95<span style="font-family: Symbol">
96<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
97</span></span><b>Small Icons</b> : Selecting this option from the view menu will 
98display small icons in a different grid pattern in the gamelist area.</p>
99<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
100<span style="font-family: Symbol">
101<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
102</span></span><b>List</b> : Selecting this option from the view menu will 
103display small icons in the gamelist area.</p>
104<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
105<span style="font-family: Symbol">
106<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
107</span></span><b>Details</b> : Selecting this option from the view menu will 
108display small icons along with full game name and any other fields chosen with 
109the View • Customize Fields option.</p>
110<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
111<span style="font-family: Symbol">
112<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
113</span></span><b>Grouped</b> : Selecting this option from the view menu will 
114display small icons along with full game name and any other fields chosen with 
115the View • Customize Fields option, however the clone games will be displayed 
116indented and alphabetized under their parents..</p>
117<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
118<span style="font-family: Symbol">
119<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
120</span></span><b>Arrange Icons </b>: Selecting this option from the view menu 
121will order the gamelist area by the choice made; game, directory, manufacturer, 
122times played, type, or year.</p>
123<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
124<span style="font-family: Symbol">
125<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
126</span></span><b>Line Up Icons </b>: Selecting this option from the view menu 
127will re-align the icons in views where it does not automatically happen.</p>
128<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
129<span style="font-family: Symbol">
130<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
131</span></span><b>Refresh </b>: Selecting this option from the view menu will 
132initiate an update of the gamelist while MameUI searches for the existence of 
133zip files that match game directory names.&nbsp; This is not as exhaustive as the 
134audit function on the File menu.</p>
135<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
136<span style="font-family: Symbol">
137<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
138</span></span><b>Custom Filters </b>: Selecting this option from the view menu 
139will allow for the selective hiding of certain types of games.&nbsp; Manually typing 
140in a phrase in the filter text box will only display games that have that text 
141in their names [note valid input for the description filter are, game name, 
142driver name e.g. 'cps2.c', and manufacturer].</p>
143<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
144<span style="font-family: Symbol">
145<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
146</span></span><b>Customize Fields </b>: Selecting this option from the view menu 
147will allow choosing which fields are displayed in columnar mode in the game list 
148details view, selectable from the View • Details.&nbsp; The columns can also be 
149ordered by moving them up and down the right hand side of the well.&nbsp; The game 
150name field is always the first item and cannot be changed. </p>
151 
152<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">&nbsp;</p>
153<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
154<font size="1">
155<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-11 01:11 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37427" --> 
156/ john iv</font></p>
157 
158</body>
159 
160</html>
src/osd/winui/help/html/mameui_changes.txt
r0r1368
1 -|peplus    "Player's Edge Plus (PP0516) Double Bonus Poker"
2 +|guts      "Guts n' Glory (prototype)"
3 +|mazeinv   "Maze Invaders (prototype)"
4 +|nextfase  "Next Fase (bootleg of Phoenix)"
5 +|pepp0516  "Player's Edge Plus (PP0516) Double Bonus Poker"
6 +|skykids   "Sky Kid (Manufactured by Sipem)"
7 C|bnzabros  "Bonanza Bros (US, Floppy DS3-5000-07d? Based)"
8 c|bnzabros  "Bonanza Bros (US, Floppy DS3-5000-07d?)"
9 C|bnzabrsj  "Bonanza Bros (Japan, Floppy DS3-5000-07b Based)"
10 c|bnzabrsj  "Bonanza Bros (Japan, Floppy DS3-5000-07b)"
11 C|chplft    "Choplifter (8751 315-5151)"
12 c|chplft    "Choplifter"
13 c|chplftb   "Choplifter (alternate)"
14 C|chplftb   "Choplifter (unprotected)"
15 C|condor    "Condor (bootleg of Phoenix)"
16 c|condor    "Condor"
17 c|crkdown   "Crack Down (World, FD1094 317-0058-04c)"
18 C|crkdown   "Crack Down (World,Floppy Based, FD1094 317-0058-04c)"
19 c|crkdownj  "Crack Down (Japan, FD1094 317-0058-04b)"
20 C|crkdownj  "Crack Down (Japan,Floppy Based, FD1094 317-0058-04b)"
21 c|crkdownu  "Crack Down (US, FD1094 317-0058-04d)"
22 C|crkdownu  "Crack Down (US,Floppy Based, FD1094 317-0058-04d)"
23 C|dcclub    "Dynamic Country Club (World, ROM Based)"
24 c|dcclub    "Dynamic Country Club"
25 c|dcclubfd  "Dynamic Country Club (FD1094 317-0058-09d)"
26 C|dcclubfd  "Dynamic Country Club (US, Floppy Based, FD1094 317-0058-09d)"
27 c|dcclubj   "Dynamic Country Club (Japan)"
28 C|dcclubj   "Dynamic Country Club (Japan, ROM Based)"
29 C|falcon    "Falcon (bootleg of Phoenix) (set 1)"
30 c|falcon    "Falcon (bootleg set 1)"
31 C|falcona   "Falcon (bootleg of Phoenix) (set 2)"
32 c|falcona   "Falcon (bootleg set 2)"
33 C|fenix     "Fenix (bootleg of Phoenix)"
34 c|fenix     "Fenix"
35 C|gground   "Gain Ground (World, 3 Players, Floppy Based, FD1094 317-0058-03c?)"
36 c|gground   "Gain Ground (World, FD1094 317-0058-03c?)"
37 C|ggroundj  "Gain Ground (Japan, 2 Players, Floppy Based, FD1094 317-0058-03b)"
38 c|ggroundj  "Gain Ground (Japan, FD1094 317-0058-03b)"
39 C|griffon   "Griffon (bootleg of Phoenix)"
40 c|griffon   "Griffon"
41 C|hangon    "Hang-On (Rev A)"
42 c|hangon    "Hang-On"
43 C|hangon1   "Hang-On"
44 c|hotrod    "Hot Rod (World, 3 Players, Turbo set 1)"
45 C|hotrod    "Hot Rod (World, 3 Players, Turbo set 1, Floppy Based)"
46 c|hotroda   "Hot Rod (World, 3 Players, Turbo set 2)"
47 C|hotroda   "Hot Rod (World, 3 Players, Turbo set 2, Floppy Based)"
48 c|hotrodj   "Hot Rod (Japan, 4 Players)"
49 C|hotrodj   "Hot Rod (Japan, 4 Players, Floppy Based)"
50 C|mahmajn   "Tokoro San no MahMahjan (Japan, ROM Based)"
51 c|mahmajn   "Tokoro San no MahMahjan"
52 C|mahmajn2  "Tokoro San no MahMahjan 2 (Japan, ROM Based)"
53 c|mahmajn2  "Tokoro San no MahMahjan 2"
54 C|qgh       "Quiz Ghost Hunter (Japan, ROM Based)"
55 c|qgh       "Quiz Ghost Hunter"
56 C|qrouka    "Quiz Rouka Ni Tattenasai (Japan, ROM Based)"
57 c|qrouka    "Quiz Rouka Ni Tattenasai"
58 c|qsww      "Quiz Syukudai wo Wasuremashita (Japan, FD1094 317-0058-08b)"
59 C|qsww      "Quiz Syukudai wo Wasuremashita (Japan, Floppy Based, FD1094 317-0058-08b)"
60 C|quizmeku  "Quiz Mekurumeku Story (Japan, ROM Based)"
61 c|quizmeku  "Quiz Mekurumeku Story"
62 c|roughrac  "Rough Racer (Japan, FD1094 317-0058-06b)"
63 C|roughrac  "Rough Racer (Japan, Floppy Based, FD1094 317-0058-06b)"
64 c|sgmast    "Super Masters Golf (FD1094 317-0058-05d?)"
65 C|sgmast    "Super Masters Golf (World?, Floppy Based, FD1094 317-0058-05d?)"
66 c|sgmastc   "Jumbo Ozaki Super Masters Golf (World, FD1094 317-0058-05c)"
67 C|sgmastc   "Jumbo Ozaki Super Masters Golf (World, Floppy Based, FD1094 317-0058-05c)"
68 c|sgmastj   "Jumbo Ozaki Super Masters Golf (Japan, FD1094 317-0058-05b)"
69 C|sgmastj   "Jumbo Ozaki Super Masters Golf (Japan, Floppy Based, FD1094 317-0058-05b)"
70 C|shtngmsb  "Shooting Master (set 2, 8751 315-5159a)"
71 C|shtngmst  "Shooting Master (set 1, 8751 315-5159)"
72 c|shtngmst  "Shooting Master"
73 C|sspiritj  "Scramble Spirits (Japan, Floppy DS3-5000-02-REV-A Based)"
74 c|sspiritj  "Scramble Spirits (Japan, Floppy DS3-5000-02-REV-A)"
75 C|sspirits  "Scramble Spirits (World, Floppy Based)"
76 c|sspirits  "Scramble Spirits"
77 c|sspirtfc  "Scramble Spirits (FD1094 317-0058-02c)"
78 C|sspirtfc  "Scramble Spirits (World set 2?, Floppy Based, FD1094 317-0058-02c)"
79 C|supbtima  "Super Burger Time (World, set 2)"
80 c|supbtime  "Super Burger Time (World)"
81 C|supbtime  "Super Burger Time (World, set 1)"
82 C|vautour   "Vautour (bootleg of Phoenix) (set 1)"
83 c|vautour   "Vautour (set 1 - Jeutel France)"
84 C|vautour2  "Vautour (bootleg of Phoenix) (set 2)"
85 c|vautour2  "Vautour (set 2)"
src/osd/winui/help/html/mameui_settings.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Settings</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43<base target="_blank">
44</head>
45 
46<body background="../images/bkground.gif">
47 
48<h2>MameUI Settings</h2>
49 
50<h3><font face="Arial">Suggested MameUI Default Settings</font></h3>
51<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
52<span style="font-family: Symbol; color: windowtext">
53<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
54</span></span>
55<span style="font-style: normal; font-variant: normal; font-weight: normal; color:windowtext">
56Advanced / Triple Buffering ensures there should be no 'tearing' of screen 
57images if the frame rate doesn't exactly match the monitor screen refresh in 
58full-screen mode.&nbsp;
59</span>Particularly evident in vertical scrolling games.&nbsp; This however can 
60lead to sound stuttering on games that are above 60Hz [early Namco games like 
61Pac-Man, etc.] if the user's monitor is 
62not capable of being driven at a higher refresh rate, like modern LCDs.&nbsp; If 
63a modern LCD fixed at 60Hz is in use, toggle on the Advanced • Refresh game 
64speed. </p>
65<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
66<span style="font-family: Symbol; color: windowtext">
67<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
68</span></span>
69<span style="font-style: normal; font-variant: normal; font-weight: normal; color:windowtext">
70Simulated monitor effects are now handled via *.png files in the \artwork 
71directory.&nbsp; They are accessed in Advanced / Select Effect.&nbsp; 
72Scanlines75x4 provides a 75% black line every four pixel rows.</span></p>
73<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
74<span style="font-family: Symbol; color: windowtext">
75<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
76</span></span>Bitmap prescaling in Display is the new control for determining 
77how fuzzy or sharp the bilinear filtering of D3D is.&nbsp; Increasing this 
78number sharpens the game pixels.</p>
79<h3>
80<img border="0" src="../images/1.jpg"><img border="0" src="../images/2.jpg"><img border="0" src="../images/3.jpg"><img border="0" src="../images/4.jpg"><img border="0" src="../images/5.jpg"><img border="0" src="../images/6.jpg"><img border="0" src="../images/7.jpg"><img border="0" src="../images/8.jpg"></h3>
81<h3>
82<img border="0" src="../images/int.jpg" width="500" height="347"></h3>
83<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
84</p>
85 
86<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
87&nbsp;</p>
88 
89<p style="margin-left: 0; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
90<font size="1">
91<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
92/ john iv</font></p>
93 
94</body>
95 
96</html>
src/osd/winui/help/html/mameui_installprocedures.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Installation Procedures</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43<base target="_blank">
44</head>
45 
46<body background="../images/bkground.gif">
47 
48<h2>Install Procedures</h2>
49 
50<h3><font face="Arial">To Install MameUI Manually</font></h3>
51<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
52<span style="font-family: Symbol; color: windowtext">
53<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
54</span></span>
55<span style="font-style: normal; font-variant: normal; font-weight: normal; color:windowtext">
56Download the latest MameUI binary distribution [not the source] self-extracting archive 
57available at
58</span>
59<span style="font-style: normal; font-variant: normal; font-weight: 700; color:windowtext">
60<a target="_blank" href="http://mameui.classicgaming.gamespy.com/">MameUI</a></span><span style="font-style: normal; font-variant: normal; font-weight: normal; color:windowtext">.</span></p>
61<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
62<span style="font-family: Symbol; color: windowtext">
63<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
64</span></span>Double-click the self-extracting archive .exe, and point the 
65directory install location to the root of the c:\ drive, or just type in the box 
66&quot;c:\&quot; [no quotes].&nbsp; This will create 
67a c:\MameUI directory with the program and all its support files within it.</p>
68<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
69<span style="font-family: Symbol; color: windowtext">
70<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
71</span></span>MameUI requires ROMs to play games; if attempting to play a game 
72the ROMs of which are not present it will fail and list the files missing.&nbsp; Download the  freely available public domain ROMs 
73[Robby Roto, Gridlee, Alien Arena, and others] from <b>
74<a style="color: blue; text-decoration: underline; text-underline: single" target="_blank" href="http://www.mamedev.org/roms/">Mamedev.org</a></b>.&nbsp; Place these files 
75<i><b>still zipped</b></i>, into the 
76\MameUI\ROMs folder.&nbsp; <b>Again, do not unzip them</b>.</p>
77<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
78<span style="font-family: Symbol; color: windowtext">
79<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
80</span></span>Double-click the MameUI icon to launch the program.&nbsp; MameUI 
81will go through its initial diagnostics and search for available games in the 
82c:\MameUI\ROMs directory, and then display the GUI.&nbsp; If the games do not 
83appear on the available game list, hit F5 to force a game search or do a File 
84menu / Audit.</p>
85<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
86<span style="font-family: Symbol; color: windowtext">
87<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
88</span></span>To activate mouse control or attached gamepads to use within 
89games, it is necessary to toggle those options on in the Options • Default 
90Options • Controllers tab.</p>
91<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
92<span style="font-family: Symbol">
93<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
94</span></span>Once a game has been selected and double-clicked, MameUI will 
95produce two information screens and then it will run the game.&nbsp; Since 
96MameUI is 
97emulating the original hardware, the software thinks it’s still in an arcade and 
98is starting up for the first time in the morning.&nbsp; Initial diagnostic screens 
99are run through, as well as possibly some accounting information presented to 
100the arcade owner.</p>
101<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
102<span style="font-family: Symbol">
103<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
104</span></span>The game should now be running its demo/attract mode.&nbsp; Insert a 
105coin with the [<b>5</b>] key on the keyboard, the mappings for coin inserts are: 
106player 1 [<b>5</b>], player 2 [<b>6</b>], player 3 [<b>7</b>], player 4 [<b>8</b>].&nbsp; 
107Now that a coin has been inserted, start the game with the [<b>1</b>] key on the 
108keyboard.&nbsp; Game start mappings are player 1 [<b>1</b>], player 2 [<b>2</b>], 
109player 3 [<b>3</b>], player 4 [<b>4</b>].</p>
110<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
111<span style="font-family: Symbol">
112<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
113</span></span>MameUI’s default control scheme is to use the inverted T arrow 
114keys on the keyboard for directional controls, and the left [<b>CTRL</b>] key as the 
115primary action button.</p>
116<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
117<span style="font-family: Symbol">
118<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
119</span></span>While in a game within MameUI, the internal configuration menu 
120system can be activated by pressing the [<b>TAB</b>] key.&nbsp; This will bring up 
121the control options.&nbsp; These options allow remapping MameUI controls to whatever 
122keyboard keys or gamepad buttons are desired.&nbsp; The Input (general) area controls the global settings, and 
123the Input (this game) are the controls for the game selected.&nbsp; To change the 
124mapping, select the control to change by arrowing down to it, hit the [<b>ENTER</b>] 
125key and then the new desired control.&nbsp; Hit the [<b>ESC</b>] key to exit the [<b>TAB</b>] 
126menu back to the game. Note: If there are multiple mouse devices attached to the 
127system they can be individually configured by selecting their control in the [<strong>TAB</strong>] 
128menu and moving the mouse or trackball left or right, up or down to map it.</p>
129<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
130<span style="font-family: Symbol">
131<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
132</span></span>Other keys of interest while playing a game are : </p>
133<p class="MsoNormal" style="margin-left:.75in">[<b>TAB</b>] key to bring up the 
134internal menu system.</p>
135<p class="MsoNormal" style="margin-left:.75in">[<b>~ TILDE</b>] the onscreen 
136display.</p>
137<p class="MsoNormal" style="margin-left:.75in">[<b>Shift-p</b>] advance paused 
138screen one frame at a time<br>
139[<b>p</b>] for the pause button.</p>
140<p class="MsoNormal" style="margin-left:.75in">[<b>F3</b>] resets the game.</p>
141<p class="MsoNormal" style="margin-left:.75in">[<b>F4</b>] displays the tile 
142manager and the game’s 
143color palette.</p>
144<p class="MsoNormal" style="margin-left:.75in">[<b>Shift-F7</b>] save current 
145game state [a-z, 1-0] (See save state folder view for supported games)</p>
146<p class="MsoNormal" style="margin-left:.75in">[<b>F7</b>] load game state [a-z, 
1471-0] (See save state folder view on left for supported games)</p>
148<p class="MsoNormal" style="margin-left:.75in">[<b>F9</b>] changes the frameskip 
149on the fly.</p>
150<p class="MsoNormal" style="margin-left:.75in">[<b>F10</b>] toggles throttling.</p>
151<p class="MsoNormal" style="margin-left:.75in">[<b>F11</b>] toggles the speed 
152display 
153display.<br>
154[<b>Shift-F12</b>] toggles MNG recording, once starts, second finishes.</p>
155<p class="MsoNormal" style="margin-left:.75in">[<b>F12</b>] takes a *.png 
156snapshot of the game and places it in the \MameUI\snap directory.</p>
157<p class="MsoNormal" style="margin-left:.75in">[<b>ESC</b>] exits from the game 
158back to the MameUI GUI.</p>
159 
160<p class="MsoNormal" style="margin-left:.75in">[<b>Left-Alt + Enter</b>] toggle 
161from fullscreen mode to windowed mode.</p>
162<p class="MsoNormal" style="margin-left:.75in">[<strong>Insert</strong>] fast 
163forwards with full unthrottle and highest frameskip, convenient for speeding 
164through slow start-up of certain games.</p>
165 
166<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
167&nbsp;</p>
168 
169<p style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
170<font size="1">
171<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-12 02:02 PM -0800<!--webbot bot="Timestamp" endspan i-checksum="37539" --> 
172/ john iv</font></p>
173 
174</body>
175 
176</html>
src/osd/winui/help/html/mameui_playing.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Playing a Game &amp; Internal Controls</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>Playing a Game &amp; Internal Controls</h2>
48<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
49<span style="font-family: Symbol; color: windowtext">
50<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
51</span></span>To activate mouse control or attached gamepads to use within 
52games, it is necessary to toggle those options on in the Options • Default 
53Options • Controllers tab.</p>
54<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
55<span style="font-family: Symbol">
56<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
57</span></span>Once a game has been selected and double-clicked, MameUI will 
58produce two information screens and then it will run the game.&nbsp; Since 
59MameUI is 
60emulating the original hardware, the software thinks it’s still in an arcade and 
61is starting up for the first time in the morning.&nbsp; Initial diagnostic screens 
62are run through, as well as possibly some accounting information presented to 
63the arcade owner.</p>
64<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
65<span style="font-family: Symbol">
66<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
67</span></span>The game should now be running its demo/attract mode.&nbsp; Insert a 
68coin with the [<b>5</b>] key on the keyboard, the mappings for coin inserts are: 
69player 1 [<b>5</b>], player 2 [<b>6</b>], player 3 [<b>7</b>], player 4 [<b>8</b>].&nbsp; 
70Now that a coin has been inserted, start the game with the [<b>1</b>] key on the 
71keyboard.&nbsp; Game start mappings are player 1 [<b>1</b>], player 2 [<b>2</b>], 
72player 3 [<b>3</b>], player 4 [<b>4</b>].</p>
73<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
74<span style="font-family: Symbol">
75<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
76</span></span>MameUI’s default control scheme is to use the inverted T arrow 
77keys on the keyboard for directional controls, and the left [<b>CTRL</b>] key as the 
78primary action button.</p>
79<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
80<span style="font-family: Symbol">
81<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
82</span></span>While in a game within MameUI, the internal configuration menu 
83system can be activated by pressing the [<b>TAB</b>] key.&nbsp; This will bring up 
84the control options.&nbsp; These options allow remapping MameUI controls to whatever 
85keyboard keys or gamepad buttons are desired.&nbsp; The Input (general) area controls the global settings, and 
86the Input (this game) are the controls for the game selected.&nbsp; To change the 
87mapping, select the control to change by arrowing down to it, hit the [<b>ENTER</b>] 
88key and then the new desired control.&nbsp; Hit the [<b>ESC</b>] key to exit the [<b>TAB</b>] 
89menu back to the game. Note: If there are multiple mouse devices attached to the 
90system they can be individually configured by selecting their control in the [<strong>TAB</strong>] 
91menu and moving the mouse or trackball left or right, up or down to map it.</p>
92<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
93<span style="font-family: Symbol">
94<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
95</span></span>Other keys of interest while playing a game are : </p>
96<p class="MsoNormal" style="margin-left:.75in">[<b>TAB</b>] key to bring up the 
97internal menu system.</p>
98<p class="MsoNormal" style="margin-left:.75in">[<b>~ TILDE</b>] the onscreen 
99display.</p>
100<p class="MsoNormal" style="margin-left:.75in">[<b>Shift-p</b>] advance paused 
101screen one frame at a time<br>
102[<b>p</b>] for the pause button.</p>
103<p class="MsoNormal" style="margin-left:.75in">[<b>F3</b>] resets the game.</p>
104<p class="MsoNormal" style="margin-left:.75in">[<b>F4</b>] displays the tile 
105manager and the game’s 
106color palette.</p>
107<p class="MsoNormal" style="margin-left:.75in">[<b>Shift-F7</b>] save current 
108game state [a-z, 1-0] (See save state folder view for supported games)</p>
109<p class="MsoNormal" style="margin-left:.75in">[<b>F7</b>] load game state [a-z, 
1101-0] (See save state folder view on left for supported games)</p>
111<p class="MsoNormal" style="margin-left:.75in">[<b>F9</b>] changes the frameskip 
112on the fly.</p>
113<p class="MsoNormal" style="margin-left:.75in">[<b>F10</b>] toggles throttling.</p>
114<p class="MsoNormal" style="margin-left:.75in">[<b>F11</b>] toggles the speed 
115display 
116display.<br>
117[<b>Shift-F12</b>] toggles MNG recording, once starts, second finishes.</p>
118<p class="MsoNormal" style="margin-left:.75in">[<b>F12</b>] takes a *.png 
119snapshot of the game and places it in the \MameUI\snap directory.</p>
120<p class="MsoNormal" style="margin-left:.75in">[<b>ESC</b>] exits from the game 
121back to the MameUI GUI.</p>
122 
123<p class="MsoNormal" style="margin-left:.75in">[<b>Left-Alt + Enter</b>] toggle 
124from fullscreen mode to windowed mode.</p>
125<p class="MsoNormal" style="margin-left:.75in">[<strong>Insert</strong>] fast 
126forwards with full unthrottle and highest frameskip, convenient for speeding 
127through slow start-up of certain games.</p>
128 
129<p class="MsoNormal" style="margin-left: .75in">&nbsp;</p>
130<p class="MsoNormal" style="margin-left: .75in"><font size="1">
131<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
132/ john iv</font></p>
133 
134</body>
135 
136</html>
src/osd/winui/help/html/mameui_filemenu.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI File Menu</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>File Menu</h2>
48<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
49<span style="font-family: Symbol">
50<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
51</span></span><b>Play Game</b> : Selecting this option from the file menu will 
52launch the highlighted game.</p>
53<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
54<span style="font-family: Symbol">
55<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
56</span></span><b>Play and Record Input</b> : Selecting this option from the file 
57menu will allow for the creation of an *.inp file which will allow MameUI to 
58record keystrokes in the game being played for playback later.&nbsp; Similar to a 
59VCR.</p>
60<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
61<span style="font-family: Symbol">
62<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
63</span></span><b>Playback Input</b> : Selecting this option from the file menu 
64will allow the loading and playing of a previously recorded *.inp file.</p>
65<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
66<span style="font-family: Symbol">
67<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
68</span></span><b>Play and Record Wave Output</b> : Selecting this option from the file menu 
69will allow the recording of a sound file while playing a game.&nbsp; The *.wav 
70file is placed in the \inp directory by default.</p>
71<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
72<span style="font-family: Symbol">
73<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
74</span></span><b>Play and Record MNG Output</b> : Selecting this option from the file menu 
75will allow the recording of a MNG video file while playing a game.&nbsp; The *.mng 
76file is placed in the \inp directory by default.</p>
77<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
78<span style="font-family: Symbol">
79<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
80</span></span><b>Load Savestate</b> : Selecting this option from the file menu 
81will allow the loading and playing of a previously saved machine state, the 
82state being loaded must match the highlighted game.</p>
83<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
84<span style="font-family: Symbol">
85<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
86</span></span><b>Select Random Game</b> : Selecting this option from the file 
87menu will cause MameUI to randomly highlight a game in the game list shortcut 
88key is <b>Ctrl-R</b>.</p>
89<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
90<span style="font-family: Symbol">
91<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
92</span></span><b><a href="mame32_properties.htm">Properties</a></b> : Selecting this option from the file menu will 
93display the highlighted game’s individual settings, these settings over-ride 
94those made to all games in the Options • Default Options menu item.&nbsp;</p>
95<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
96<span style="font-family: Symbol">
97<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
98</span></span><b>Audit All Games</b> : Selecting this option from the file menu 
99will initiate an exhaustive check on the available games, verifying them to 
100MameUI’s expected results.</p>
101<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
102<span style="font-family: Symbol">
103<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
104</span></span>
105<span style="font-style:normal; font-variant:normal; font-weight:700">Exit</span> : Selecting this option from the file menu will exit 
106the program.</p>
107 
108<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">&nbsp;</p>
109<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
110<font size="1">
111<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
112/ john iv</font></p>
113 
114</body>
115 
116</html>
src/osd/winui/help/html/mameui_whatsnew32.htm
r0r1368
1</style>
2 
3<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
4 
5<title>MameUI Whatsnew</title>
6<!--[if gte mso 9]><xml>
7 <o:DocumentProperties>
8  <o:Author>john4</o:Author>
9  <o:Template>Normal</o:Template>
10  <o:LastAuthor>john4</o:LastAuthor>
11  <o:Revision>100</o:Revision>
12  <o:TotalTime>113</o:TotalTime>
13  <o:Created>2003-11-03T04:49:00Z</o:Created>
14  <o:LastSaved>2004-08-30T18:21:00Z</o:LastSaved>
15  <o:Pages>6</o:Pages>
16  <o:Words>3470</o:Words>
17  <o:Characters>19785</o:Characters>
18  <o:Lines>164</o:Lines>
19  <o:Paragraphs>46</o:Paragraphs>
20  <o:CharactersWithSpaces>23209</o:CharactersWithSpaces>
21  <o:Version>11.6360</o:Version>
22 </o:DocumentProperties>
23</xml><![endif]--><!--[if gte mso 9]><xml>
24 <w:WordDocument>
25  <w:DisplayBackgroundShape/>
26  <w:ActiveWritingStyle Lang="EN-US" VendorID="64" DLLVersion="131078"
27   NLCheck="1">1</w:ActiveWritingStyle>
28  <w:SpellingState>Clean</w:SpellingState>
29  <w:GrammarState>Clean</w:GrammarState>
30  <w:ValidateAgainstSchemas/>
31  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
32  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
33  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
34  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
35 </w:WordDocument>
36</xml><![endif]--><!--[if gte mso 9]><xml>
37 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
38 </w:LatentStyles>
39</xml><![endif]-->
40<style>
41<!--
42 /* Font Definitions */
43 @font-face
44   {font-family:Wingdings;
45   panose-1:5 0 0 0 0 0 0 0 0 0;
46   mso-font-charset:2;
47   mso-generic-font-family:auto;
48   mso-font-pitch:variable;
49   mso-font-signature:0 268435456 0 0 -2147483648 0;}
50@font-face
51   {font-family:SimSun;
52   panose-1:2 1 6 0 3 1 1 1 1 1;
53   mso-font-alt:\5B8B\4F53;
54   mso-font-charset:134;
55   mso-generic-font-family:auto;
56   mso-font-format:other;
57   mso-font-pitch:variable;
58   mso-font-signature:1 135135232 16 0 262144 0;}
59@font-face
60   {font-family:"\@SimSun";
61   mso-font-charset:134;
62   mso-generic-font-family:auto;
63   mso-font-pitch:variable;
64   mso-font-signature:3 135135232 16 0 262145 0;}
65 /* Style Definitions */
66 p.MsoNormal, li.MsoNormal, div.MsoNormal
67   {mso-style-parent:"";
68   margin-bottom:.0001pt;
69   mso-pagination:widow-orphan;
70   font-size:10.0pt;
71   font-family:Arial;
72   mso-fareast-font-family:"Times New Roman";
73   color:windowtext; margin-left:0in; margin-right:0in; margin-top:0in}
74h1
75   {margin-top:12.0pt;
76   margin-right:0in;
77   margin-bottom:3.0pt;
78   margin-left:0in;
79   mso-pagination:widow-orphan;
80   page-break-after:avoid;
81   mso-outline-level:1;
82   font-size:16.0pt;
83   font-family:Arial;
84   mso-fareast-font-family:SimSun;
85   color:windowtext;
86   font-weight:bold;}
87h2
88   {margin-top:12.0pt;
89   margin-right:0in;
90   margin-bottom:3.0pt;
91   margin-left:0in;
92   mso-pagination:widow-orphan;
93   page-break-after:avoid;
94   mso-outline-level:2;
95   font-size:14.0pt;
96   font-family:Arial;
97   mso-fareast-font-family:SimSun;
98   color:windowtext;
99   font-weight:bold;
100   font-style:italic;}
101p
102   {mso-margin-top-alt:auto;
103   margin-right:0in;
104   mso-margin-bottom-alt:auto;
105   margin-left:0in;
106   mso-pagination:widow-orphan;
107   font-size:10.0pt;
108   font-family:Arial;
109   mso-fareast-font-family:"Times New Roman";
110   color:black;}
111span.GramE
112   {mso-style-name:"";
113   mso-gram-e:yes}
114@page Section1
115   {size:8.5in 11.0in;
116   margin:1.0in 1.25in 1.0in 1.25in;
117   mso-header-margin:.5in;
118   mso-footer-margin:.5in;
119   mso-paper-source:0;}
120div.Section1
121   {page:Section1;}
122 /* List Definitions */
123 @list l0
124   {mso-list-id:8872955;
125   mso-list-template-ids:-1360482768;}
126@list l0:level1
127   {mso-level-number-format:bullet;
128   mso-level-text:\F0A7;
129   mso-level-tab-stop:.5in;
130   mso-level-number-position:left;
131   text-indent:-.25in;
132   mso-ansi-font-size:10.0pt;
133   font-family:Wingdings;}
134@list l0:level2
135   {mso-level-tab-stop:1.0in;
136   mso-level-number-position:left;
137   text-indent:-.25in;}
138@list l0:level3
139   {mso-level-tab-stop:1.5in;
140   mso-level-number-position:left;
141   text-indent:-.25in;}
142@list l0:level4
143   {mso-level-tab-stop:2.0in;
144   mso-level-number-position:left;
145   text-indent:-.25in;}
146@list l0:level5
147   {mso-level-tab-stop:2.5in;
148   mso-level-number-position:left;
149   text-indent:-.25in;}
150@list l0:level6
151   {mso-level-tab-stop:3.0in;
152   mso-level-number-position:left;
153   text-indent:-.25in;}
154@list l0:level7
155   {mso-level-tab-stop:3.5in;
156   mso-level-number-position:left;
157   text-indent:-.25in;}
158@list l0:level8
159   {mso-level-tab-stop:4.0in;
160   mso-level-number-position:left;
161   text-indent:-.25in;}
162@list l0:level9
163   {mso-level-tab-stop:4.5in;
164   mso-level-number-position:left;
165   text-indent:-.25in;}
166@list l1
167   {mso-list-id:45884847;
168   mso-list-template-ids:-1235059890;}
169@list l1:level1
170   {mso-level-number-format:bullet;
171   mso-level-text:\F0A7;
172   mso-level-tab-stop:.5in;
173   mso-level-number-position:left;
174   text-indent:-.25in;
175   mso-ansi-font-size:10.0pt;
176   font-family:Wingdings;}
177@list l1:level2
178   {mso-level-tab-stop:1.0in;
179   mso-level-number-position:left;
180   text-indent:-.25in;}
181@list l1:level3
182   {mso-level-tab-stop:1.5in;
183   mso-level-number-position:left;
184   text-indent:-.25in;}
185@list l1:level4
186   {mso-level-tab-stop:2.0in;
187   mso-level-number-position:left;
188   text-indent:-.25in;}
189@list l1:level5
190   {mso-level-tab-stop:2.5in;
191   mso-level-number-position:left;
192   text-indent:-.25in;}
193@list l1:level6
194   {mso-level-tab-stop:3.0in;
195   mso-level-number-position:left;
196   text-indent:-.25in;}
197@list l1:level7
198   {mso-level-tab-stop:3.5in;
199   mso-level-number-position:left;
200   text-indent:-.25in;}
201@list l1:level8
202   {mso-level-tab-stop:4.0in;
203   mso-level-number-position:left;
204   text-indent:-.25in;}
205@list l1:level9
206   {mso-level-tab-stop:4.5in;
207   mso-level-number-position:left;
208   text-indent:-.25in;}
209@list l2
210   {mso-list-id:439879227;
211   mso-list-template-ids:1518119328;}
212@list l2:level1
213   {mso-level-number-format:bullet;
214   mso-level-text:\F0A7;
215   mso-level-tab-stop:.5in;
216   mso-level-number-position:left;
217   text-indent:-.25in;
218   mso-ansi-font-size:10.0pt;
219   font-family:Wingdings;}
220@list l2:level2
221   {mso-level-tab-stop:1.0in;
222   mso-level-number-position:left;
223   text-indent:-.25in;}
224@list l2:level3
225   {mso-level-tab-stop:1.5in;
226   mso-level-number-position:left;
227   text-indent:-.25in;}
228@list l2:level4
229   {mso-level-tab-stop:2.0in;
230   mso-level-number-position:left;
231   text-indent:-.25in;}
232@list l2:level5
233   {mso-level-tab-stop:2.5in;
234   mso-level-number-position:left;
235   text-indent:-.25in;}
236@list l2:level6
237   {mso-level-tab-stop:3.0in;
238   mso-level-number-position:left;
239   text-indent:-.25in;}
240@list l2:level7
241   {mso-level-tab-stop:3.5in;
242   mso-level-number-position:left;
243   text-indent:-.25in;}
244@list l2:level8
245   {mso-level-tab-stop:4.0in;
246   mso-level-number-position:left;
247   text-indent:-.25in;}
248@list l2:level9
249   {mso-level-tab-stop:4.5in;
250   mso-level-number-position:left;
251   text-indent:-.25in;}
252@list l3
253   {mso-list-id:489293858;
254   mso-list-template-ids:1845671390;}
255@list l3:level1
256   {mso-level-number-format:bullet;
257   mso-level-text:\F0A7;
258   mso-level-tab-stop:.5in;
259   mso-level-number-position:left;
260   text-indent:-.25in;
261   mso-ansi-font-size:10.0pt;
262   font-family:Wingdings;}
263@list l3:level2
264   {mso-level-tab-stop:1.0in;
265   mso-level-number-position:left;
266   text-indent:-.25in;}
267@list l3:level3
268   {mso-level-tab-stop:1.5in;
269   mso-level-number-position:left;
270   text-indent:-.25in;}
271@list l3:level4
272   {mso-level-tab-stop:2.0in;
273   mso-level-number-position:left;
274   text-indent:-.25in;}
275@list l3:level5
276   {mso-level-tab-stop:2.5in;
277   mso-level-number-position:left;
278   text-indent:-.25in;}
279@list l3:level6
280   {mso-level-tab-stop:3.0in;
281   mso-level-number-position:left;
282   text-indent:-.25in;}
283@list l3:level7
284   {mso-level-tab-stop:3.5in;
285   mso-level-number-position:left;
286   text-indent:-.25in;}
287@list l3:level8
288   {mso-level-tab-stop:4.0in;
289   mso-level-number-position:left;
290   text-indent:-.25in;}
291@list l3:level9
292   {mso-level-tab-stop:4.5in;
293   mso-level-number-position:left;
294   text-indent:-.25in;}
295@list l4
296   {mso-list-id:619726884;
297   mso-list-template-ids:-1537423390;}
298@list l4:level1
299   {mso-level-number-format:bullet;
300   mso-level-text:\F0A7;
301   mso-level-tab-stop:.5in;
302   mso-level-number-position:left;
303   text-indent:-.25in;
304   mso-ansi-font-size:10.0pt;
305   font-family:Wingdings;}
306@list l4:level2
307   {mso-level-tab-stop:1.0in;
308   mso-level-number-position:left;
309   text-indent:-.25in;}
310@list l4:level3
311   {mso-level-tab-stop:1.5in;
312   mso-level-number-position:left;
313   text-indent:-.25in;}
314@list l4:level4
315   {mso-level-tab-stop:2.0in;
316   mso-level-number-position:left;
317   text-indent:-.25in;}
318@list l4:level5
319   {mso-level-tab-stop:2.5in;
320   mso-level-number-position:left;
321   text-indent:-.25in;}
322@list l4:level6
323   {mso-level-tab-stop:3.0in;
324   mso-level-number-position:left;
325   text-indent:-.25in;}
326@list l4:level7
327   {mso-level-tab-stop:3.5in;
328   mso-level-number-position:left;
329   text-indent:-.25in;}
330@list l4:level8
331   {mso-level-tab-stop:4.0in;
332   mso-level-number-position:left;
333   text-indent:-.25in;}
334@list l4:level9
335   {mso-level-tab-stop:4.5in;
336   mso-level-number-position:left;
337   text-indent:-.25in;}
338@list l5
339   {mso-list-id:621153244;
340   mso-list-template-ids:995154020;}
341@list l5:level1
342   {mso-level-number-format:bullet;
343   mso-level-text:\F0A7;
344   mso-level-tab-stop:.5in;
345   mso-level-number-position:left;
346   text-indent:-.25in;
347   mso-ansi-font-size:10.0pt;
348   font-family:Wingdings;}
349@list l5:level2
350   {mso-level-tab-stop:1.0in;
351   mso-level-number-position:left;
352   text-indent:-.25in;}
353@list l5:level3
354   {mso-level-tab-stop:1.5in;
355   mso-level-number-position:left;
356   text-indent:-.25in;}
357@list l5:level4
358   {mso-level-tab-stop:2.0in;
359   mso-level-number-position:left;
360   text-indent:-.25in;}
361@list l5:level5
362   {mso-level-tab-stop:2.5in;
363   mso-level-number-position:left;
364   text-indent:-.25in;}
365@list l5:level6
366   {mso-level-tab-stop:3.0in;
367   mso-level-number-position:left;
368   text-indent:-.25in;}
369@list l5:level7
370   {mso-level-tab-stop:3.5in;
371   mso-level-number-position:left;
372   text-indent:-.25in;}
373@list l5:level8
374   {mso-level-tab-stop:4.0in;
375   mso-level-number-position:left;
376   text-indent:-.25in;}
377@list l5:level9
378   {mso-level-tab-stop:4.5in;
379   mso-level-number-position:left;
380   text-indent:-.25in;}
381@list l6
382   {mso-list-id:730887387;
383   mso-list-template-ids:-2040104406;}
384@list l6:level1
385   {mso-level-number-format:bullet;
386   mso-level-text:\F0A7;
387   mso-level-tab-stop:.5in;
388   mso-level-number-position:left;
389   text-indent:-.25in;
390   mso-ansi-font-size:10.0pt;
391   font-family:Wingdings;}
392@list l6:level2
393   {mso-level-tab-stop:1.0in;
394   mso-level-number-position:left;
395   text-indent:-.25in;}
396@list l6:level3
397   {mso-level-tab-stop:1.5in;
398   mso-level-number-position:left;
399   text-indent:-.25in;}
400@list l6:level4
401   {mso-level-tab-stop:2.0in;
402   mso-level-number-position:left;
403   text-indent:-.25in;}
404@list l6:level5
405   {mso-level-tab-stop:2.5in;
406   mso-level-number-position:left;
407   text-indent:-.25in;}
408@list l6:level6
409   {mso-level-tab-stop:3.0in;
410   mso-level-number-position:left;
411   text-indent:-.25in;}
412@list l6:level7
413   {mso-level-tab-stop:3.5in;
414   mso-level-number-position:left;
415   text-indent:-.25in;}
416@list l6:level8
417   {mso-level-tab-stop:4.0in;
418   mso-level-number-position:left;
419   text-indent:-.25in;}
420@list l6:level9
421   {mso-level-tab-stop:4.5in;
422   mso-level-number-position:left;
423   text-indent:-.25in;}
424@list l7
425   {mso-list-id:1220288851;
426   mso-list-template-ids:880986230;}
427@list l7:level1
428   {mso-level-number-format:bullet;
429   mso-level-text:\F0A7;
430   mso-level-tab-stop:.5in;
431   mso-level-number-position:left;
432   text-indent:-.25in;
433   mso-ansi-font-size:10.0pt;
434   font-family:Wingdings;}
435@list l7:level2
436   {mso-level-tab-stop:1.0in;
437   mso-level-number-position:left;
438   text-indent:-.25in;}
439@list l7:level3
440   {mso-level-tab-stop:1.5in;
441   mso-level-number-position:left;
442   text-indent:-.25in;}
443@list l7:level4
444   {mso-level-tab-stop:2.0in;
445   mso-level-number-position:left;
446   text-indent:-.25in;}
447@list l7:level5
448   {mso-level-tab-stop:2.5in;
449   mso-level-number-position:left;
450   text-indent:-.25in;}
451@list l7:level6
452   {mso-level-tab-stop:3.0in;
453   mso-level-number-position:left;
454   text-indent:-.25in;}
455@list l7:level7
456   {mso-level-tab-stop:3.5in;
457   mso-level-number-position:left;
458   text-indent:-.25in;}
459@list l7:level8
460   {mso-level-tab-stop:4.0in;
461   mso-level-number-position:left;
462   text-indent:-.25in;}
463@list l7:level9
464   {mso-level-tab-stop:4.5in;
465   mso-level-number-position:left;
466   text-indent:-.25in;}
467@list l8
468   {mso-list-id:1275020199;
469   mso-list-template-ids:551206706;}
470@list l8:level1
471   {mso-level-number-format:bullet;
472   mso-level-text:\F0A7;
473   mso-level-tab-stop:.5in;
474   mso-level-number-position:left;
475   text-indent:-.25in;
476   mso-ansi-font-size:10.0pt;
477   font-family:Wingdings;}
478@list l8:level2
479   {mso-level-tab-stop:1.0in;
480   mso-level-number-position:left;
481   text-indent:-.25in;}
482@list l8:level3
483   {mso-level-tab-stop:1.5in;
484   mso-level-number-position:left;
485   text-indent:-.25in;}
486@list l8:level4
487   {mso-level-tab-stop:2.0in;
488   mso-level-number-position:left;
489   text-indent:-.25in;}
490@list l8:level5
491   {mso-level-tab-stop:2.5in;
492   mso-level-number-position:left;
493   text-indent:-.25in;}
494@list l8:level6
495   {mso-level-tab-stop:3.0in;
496   mso-level-number-position:left;
497   text-indent:-.25in;}
498@list l8:level7
499   {mso-level-tab-stop:3.5in;
500   mso-level-number-position:left;
501   text-indent:-.25in;}
502@list l8:level8
503   {mso-level-tab-stop:4.0in;
504   mso-level-number-position:left;
505   text-indent:-.25in;}
506@list l8:level9
507   {mso-level-tab-stop:4.5in;
508   mso-level-number-position:left;
509   text-indent:-.25in;}
510@list l9
511   {mso-list-id:1357196694;
512   mso-list-template-ids:795358278;}
513@list l9:level1
514   {mso-level-number-format:bullet;
515   mso-level-text:\F0A7;
516   mso-level-tab-stop:.5in;
517   mso-level-number-position:left;
518   text-indent:-.25in;
519   mso-ansi-font-size:10.0pt;
520   font-family:Wingdings;}
521@list l9:level2
522   {mso-level-tab-stop:1.0in;
523   mso-level-number-position:left;
524   text-indent:-.25in;}
525@list l9:level3
526   {mso-level-tab-stop:1.5in;
527   mso-level-number-position:left;
528   text-indent:-.25in;}
529@list l9:level4
530   {mso-level-tab-stop:2.0in;
531   mso-level-number-position:left;
532   text-indent:-.25in;}
533@list l9:level5
534   {mso-level-tab-stop:2.5in;
535   mso-level-number-position:left;
536   text-indent:-.25in;}
537@list l9:level6
538   {mso-level-tab-stop:3.0in;
539   mso-level-number-position:left;
540   text-indent:-.25in;}
541@list l9:level7
542   {mso-level-tab-stop:3.5in;
543   mso-level-number-position:left;
544   text-indent:-.25in;}
545@list l9:level8
546   {mso-level-tab-stop:4.0in;
547   mso-level-number-position:left;
548   text-indent:-.25in;}
549@list l9:level9
550   {mso-level-tab-stop:4.5in;
551   mso-level-number-position:left;
552   text-indent:-.25in;}
553@list l10
554   {mso-list-id:1503541588;
555   mso-list-template-ids:823551726;}
556@list l10:level1
557   {mso-level-number-format:bullet;
558   mso-level-text:\F0A7;
559   mso-level-tab-stop:.5in;
560   mso-level-number-position:left;
561   text-indent:-.25in;
562   mso-ansi-font-size:10.0pt;
563   font-family:Wingdings;}
564@list l10:level2
565   {mso-level-tab-stop:1.0in;
566   mso-level-number-position:left;
567   text-indent:-.25in;}
568@list l10:level3
569   {mso-level-tab-stop:1.5in;
570   mso-level-number-position:left;
571   text-indent:-.25in;}
572@list l10:level4
573   {mso-level-tab-stop:2.0in;
574   mso-level-number-position:left;
575   text-indent:-.25in;}
576@list l10:level5
577   {mso-level-tab-stop:2.5in;
578   mso-level-number-position:left;
579   text-indent:-.25in;}
580@list l10:level6
581   {mso-level-tab-stop:3.0in;
582   mso-level-number-position:left;
583   text-indent:-.25in;}
584@list l10:level7
585   {mso-level-tab-stop:3.5in;
586   mso-level-number-position:left;
587   text-indent:-.25in;}
588@list l10:level8
589   {mso-level-tab-stop:4.0in;
590   mso-level-number-position:left;
591   text-indent:-.25in;}
592@list l10:level9
593   {mso-level-tab-stop:4.5in;
594   mso-level-number-position:left;
595   text-indent:-.25in;}
596@list l11
597   {mso-list-id:1535195385;
598   mso-list-template-ids:-778014484;}
599@list l11:level1
600   {mso-level-number-format:bullet;
601   mso-level-text:\F0A7;
602   mso-level-tab-stop:.5in;
603   mso-level-number-position:left;
604   text-indent:-.25in;
605   mso-ansi-font-size:10.0pt;
606   font-family:Wingdings;}
607@list l11:level2
608   {mso-level-tab-stop:1.0in;
609   mso-level-number-position:left;
610   text-indent:-.25in;}
611@list l11:level3
612   {mso-level-tab-stop:1.5in;
613   mso-level-number-position:left;
614   text-indent:-.25in;}
615@list l11:level4
616   {mso-level-tab-stop:2.0in;
617   mso-level-number-position:left;
618   text-indent:-.25in;}
619@list l11:level5
620   {mso-level-tab-stop:2.5in;
621   mso-level-number-position:left;
622   text-indent:-.25in;}
623@list l11:level6
624   {mso-level-tab-stop:3.0in;
625   mso-level-number-position:left;
626   text-indent:-.25in;}
627@list l11:level7
628   {mso-level-tab-stop:3.5in;
629   mso-level-number-position:left;
630   text-indent:-.25in;}
631@list l11:level8
632   {mso-level-tab-stop:4.0in;
633   mso-level-number-position:left;
634   text-indent:-.25in;}
635@list l11:level9
636   {mso-level-tab-stop:4.5in;
637   mso-level-number-position:left;
638   text-indent:-.25in;}
639@list l12
640   {mso-list-id:1924140378;
641   mso-list-template-ids:-893489372;}
642@list l12:level1
643   {mso-level-number-format:bullet;
644   mso-level-text:\F0A7;
645   mso-level-tab-stop:.5in;
646   mso-level-number-position:left;
647   text-indent:-.25in;
648   mso-ansi-font-size:10.0pt;
649   font-family:Wingdings;}
650@list l12:level2
651   {mso-level-tab-stop:1.0in;
652   mso-level-number-position:left;
653   text-indent:-.25in;}
654@list l12:level3
655   {mso-level-tab-stop:1.5in;
656   mso-level-number-position:left;
657   text-indent:-.25in;}
658@list l12:level4
659   {mso-level-tab-stop:2.0in;
660   mso-level-number-position:left;
661   text-indent:-.25in;}
662@list l12:level5
663   {mso-level-tab-stop:2.5in;
664   mso-level-number-position:left;
665   text-indent:-.25in;}
666@list l12:level6
667   {mso-level-tab-stop:3.0in;
668   mso-level-number-position:left;
669   text-indent:-.25in;}
670@list l12:level7
671   {mso-level-tab-stop:3.5in;
672   mso-level-number-position:left;
673   text-indent:-.25in;}
674@list l12:level8
675   {mso-level-tab-stop:4.0in;
676   mso-level-number-position:left;
677   text-indent:-.25in;}
678@list l12:level9
679   {mso-level-tab-stop:4.5in;
680   mso-level-number-position:left;
681   text-indent:-.25in;}
682@list l13
683   {mso-list-id:1983192207;
684   mso-list-template-ids:-1719795094;}
685@list l13:level1
686   {mso-level-number-format:bullet;
687   mso-level-text:\F0A7;
688   mso-level-tab-stop:.5in;
689   mso-level-number-position:left;
690   text-indent:-.25in;
691   mso-ansi-font-size:10.0pt;
692   font-family:Wingdings;}
693@list l13:level2
694   {mso-level-tab-stop:1.0in;
695   mso-level-number-position:left;
696   text-indent:-.25in;}
697@list l13:level3
698   {mso-level-tab-stop:1.5in;
699   mso-level-number-position:left;
700   text-indent:-.25in;}
701@list l13:level4
702   {mso-level-tab-stop:2.0in;
703   mso-level-number-position:left;
704   text-indent:-.25in;}
705@list l13:level5
706   {mso-level-tab-stop:2.5in;
707   mso-level-number-position:left;
708   text-indent:-.25in;}
709@list l13:level6
710   {mso-level-tab-stop:3.0in;
711   mso-level-number-position:left;
712   text-indent:-.25in;}
713@list l13:level7
714   {mso-level-tab-stop:3.5in;
715   mso-level-number-position:left;
716   text-indent:-.25in;}
717@list l13:level8
718   {mso-level-tab-stop:4.0in;
719   mso-level-number-position:left;
720   text-indent:-.25in;}
721@list l13:level9
722   {mso-level-tab-stop:4.5in;
723   mso-level-number-position:left;
724   text-indent:-.25in;}
725@list l14
726   {mso-list-id:1997802346;
727   mso-list-template-ids:325871162;}
728@list l14:level1
729   {mso-level-number-format:bullet;
730   mso-level-text:\F0A7;
731   mso-level-tab-stop:.5in;
732   mso-level-number-position:left;
733   text-indent:-.25in;
734   mso-ansi-font-size:10.0pt;
735   font-family:Wingdings;}
736@list l14:level2
737   {mso-level-tab-stop:1.0in;
738   mso-level-number-position:left;
739   text-indent:-.25in;}
740@list l14:level3
741   {mso-level-tab-stop:1.5in;
742   mso-level-number-position:left;
743   text-indent:-.25in;}
744@list l14:level4
745   {mso-level-tab-stop:2.0in;
746   mso-level-number-position:left;
747   text-indent:-.25in;}
748@list l14:level5
749   {mso-level-tab-stop:2.5in;
750   mso-level-number-position:left;
751   text-indent:-.25in;}
752@list l14:level6
753   {mso-level-tab-stop:3.0in;
754   mso-level-number-position:left;
755   text-indent:-.25in;}
756@list l14:level7
757   {mso-level-tab-stop:3.5in;
758   mso-level-number-position:left;
759   text-indent:-.25in;}
760@list l14:level8
761   {mso-level-tab-stop:4.0in;
762   mso-level-number-position:left;
763   text-indent:-.25in;}
764@list l14:level9
765   {mso-level-tab-stop:4.5in;
766   mso-level-number-position:left;
767   text-indent:-.25in;}
768@list l15
769   {mso-list-id:2000308197;
770   mso-list-template-ids:-1152595466;}
771@list l15:level1
772   {mso-level-number-format:bullet;
773   mso-level-text:\F0A7;
774   mso-level-tab-stop:.5in;
775   mso-level-number-position:left;
776   text-indent:-.25in;
777   mso-ansi-font-size:10.0pt;
778   font-family:Wingdings;}
779@list l15:level2
780   {mso-level-tab-stop:1.0in;
781   mso-level-number-position:left;
782   text-indent:-.25in;}
783@list l15:level3
784   {mso-level-tab-stop:1.5in;
785   mso-level-number-position:left;
786   text-indent:-.25in;}
787@list l15:level4
788   {mso-level-tab-stop:2.0in;
789   mso-level-number-position:left;
790   text-indent:-.25in;}
791@list l15:level5
792   {mso-level-tab-stop:2.5in;
793   mso-level-number-position:left;
794   text-indent:-.25in;}
795@list l15:level6
796   {mso-level-tab-stop:3.0in;
797   mso-level-number-position:left;
798   text-indent:-.25in;}
799@list l15:level7
800   {mso-level-tab-stop:3.5in;
801   mso-level-number-position:left;
802   text-indent:-.25in;}
803@list l15:level8
804   {mso-level-tab-stop:4.0in;
805   mso-level-number-position:left;
806   text-indent:-.25in;}
807@list l15:level9
808   {mso-level-tab-stop:4.5in;
809   mso-level-number-position:left;
810   text-indent:-.25in;}
811@list l16
812   {mso-list-id:2035185965;
813   mso-list-template-ids:57055450;}
814@list l16:level1
815   {mso-level-number-format:bullet;
816   mso-level-text:\F0A7;
817   mso-level-tab-stop:.5in;
818   mso-level-number-position:left;
819   text-indent:-.25in;
820   mso-ansi-font-size:10.0pt;
821   font-family:Wingdings;}
822@list l16:level2
823   {mso-level-tab-stop:1.0in;
824   mso-level-number-position:left;
825   text-indent:-.25in;}
826@list l16:level3
827   {mso-level-tab-stop:1.5in;
828   mso-level-number-position:left;
829   text-indent:-.25in;}
830@list l16:level4
831   {mso-level-tab-stop:2.0in;
832   mso-level-number-position:left;
833   text-indent:-.25in;}
834@list l16:level5
835   {mso-level-tab-stop:2.5in;
836   mso-level-number-position:left;
837   text-indent:-.25in;}
838@list l16:level6
839   {mso-level-tab-stop:3.0in;
840   mso-level-number-position:left;
841   text-indent:-.25in;}
842@list l16:level7
843   {mso-level-tab-stop:3.5in;
844   mso-level-number-position:left;
845   text-indent:-.25in;}
846@list l16:level8
847   {mso-level-tab-stop:4.0in;
848   mso-level-number-position:left;
849   text-indent:-.25in;}
850@list l16:level9
851   {mso-level-tab-stop:4.5in;
852   mso-level-number-position:left;
853   text-indent:-.25in;}
854ol
855   {margin-bottom:0in;}
856ul
857   {margin-bottom:0in;}
858-->
859</style>
860<!--[if gte mso 10]>
861<style>
862 /* Style Definitions */
863 table.MsoNormalTable
864   {mso-style-name:"Table Normal";
865   mso-tstyle-rowband-size:0;
866   mso-tstyle-colband-size:0;
867   mso-style-noshow:yes;
868   mso-style-parent:"";
869   mso-padding-alt:0in 5.4pt 0in 5.4pt;
870   mso-para-margin:0in;
871   mso-para-margin-bottom:.0001pt;
872   mso-pagination:widow-orphan;
873   font-size:10.0pt;
874   font-family:"Times New Roman";
875   mso-ansi-language:#0400;
876   mso-fareast-language:#0400;
877   mso-bidi-language:#0400}
878</style>
879<![endif]--><!--[if gte mso 9]><xml>
880 <o:shapedefaults v:ext="edit" spidmax="1026"/>
881</xml><![endif]--><!--[if gte mso 9]><xml>
882 <o:shapelayout v:ext="edit">
883  <o:idmap v:ext="edit" data="1"/>
884 </o:shapelayout></xml><![endif]-->
885</head>
886 
887<body bgcolor=white background="../images/bkground.gif" lang=EN-US
888style='tab-interval:.5in'>
889 
890<div class=Section1>
891 
892<h1>Changes to MameUI</h1>
893 
894<h2><span style='font-size:12.0pt'>v.</span><font size="3">120.2</font></h2>
895 
896<ul type=square>
897 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
898     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Rebranded Mame32 to MameUI32 
899   and MameUI64 to avoid confusion with the baseline builds that are now being 
900   released as 64bit native apps.&nbsp; [<b style='mso-bidi-font-weight:
901     normal'>Mike Haaland / John IV</b>]</li>
902</ul>
903 
904<h2><span style='font-size:12.0pt'>v.</span><font size="3">120.2</font></h2>
905 
906<ul type=square>
907 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
908     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added support for a 
909   'nonworking.png' which will appear for non-working games in the art panes if 
910   the specific game *.png doesn't exist <strong>and</strong> the game is 
911   flagged as non-working in the core.<font face="Arial" size="2"> </font>[<b style='mso-bidi-font-weight:
912     normal'>Mike Haaland / John IV</b>]</li>
913</ul>
914 
915<h2><span style='font-size:12.0pt'>v.</span><font size="3">118.6</font></h2>
916 
917<ul type=square>
918 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
919     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added game search/filter to 
920   the toolbar.&nbsp; Works similarly to the Ctrl-F filter but doesn't search 
921   on manufacturer, driver name, or shortname.<font face="Arial" size="2">&nbsp; 
922   Added PCB art pane view. </font>[<b style='mso-bidi-font-weight:
923     normal'>René Single / John IV</b>]</li>
924</ul>
925 
926<h2><span style='font-size:12.0pt'>v.</span><font size="3">118.5</font></h2>
927 
928<ul type=square>
929 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
930     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Per MameDEV request; removed 
931   the ROMs view customization item, and reworked auditing to not show an icon 
932   change state for unavailable sets in all games folder view.&nbsp; This was 
933   to bring MameUI into compliance w/ the section of the Mame terms of usage 
934   which states '<font face="Arial" size="2">Do not provide a means of 
935   generating a list of games that specifically identifies those games for 
936   which the user does not have image files'.&nbsp; Audit functionality and 
937   game search on start is still present to populate the 'Available' folder 
938   view. </font>[<b style='mso-bidi-font-weight:
939     normal'>Mike Haaland</b>]</li>
940   <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
941     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Promoted screen orientation 
942   folder view to 'horizontal' and 'vertical' top level views and added them to 
943   the Ctrl-F filter dialogue. [<b style='mso-bidi-font-weight:
944     normal'>Mike Haaland</b>]</li>
945</ul>
946 
947<h2><span style='font-size:12.0pt'>v.</span><font size="3">118.2</font></h2>
948 
949<ul type=square>
950 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
951     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Fixed all recent options 
952   related bugs as well as expanding the functionality of the audit control so 
953   it doesn't cut off anymore. [<b style='mso-bidi-font-weight:
954     normal'>Mike Haaland</b>]</li>
955</ul>
956 
957<h2><span style='font-size:12.0pt'>v.</span><font size="3">110.2</font></h2>
958 
959<ul type=square>
960 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
961     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Re-arranged UI elements in 
962   Options menus. [<b style='mso-bidi-font-weight:
963     normal'>Radius</b>]</li>
964</ul>
965 
966<h2><span style='font-size:12.0pt'>v.</span><font size="3">107.1</font></h2>
967 
968<ul type=square>
969 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
970     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Updated the help file to 
971   include the new UI support for the core's latest video changes.&nbsp;[<b style='mso-bidi-font-weight:
972     normal'>John IV</b>]</li>
973</ul>
974 
975<h2><span style='font-size:12.0pt'>v.</span><font size="3">107</font></h2>
976 
977<ul type=square>
978 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
979     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added UI support for the large 
980   amount of core changes made by Aaron Giles for the new video renderer.&nbsp;[<b style='mso-bidi-font-weight:
981     normal'>René Single / John IV</b>]</li>
982   <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
983     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Created the new scanline *.png 
984   files in \artwork for use with the new -effect switch. [<b>John IV</b>]</li>
985</ul>
986 
987<h2><span style='font-size:12.0pt'>v.</span><font size="3">105.2</font></h2>
988 
989<ul type=square>
990 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
991     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added BIOS folder view on the 
992   left pane.&nbsp; This folder lists all the BIOSes supported by MameUI and 
993   allows launching them as if turning on a machine without a cartridge etc. in 
994   it, like the Neo-Geo.&nbsp; [<b style='mso-bidi-font-weight:
995     normal'>René Single</b>]</li>
996</ul>
997 
998<h2><span style='font-size:12.0pt'>v.</span><font size="3">104.7</font></h2>
999 
1000<ul type=square>
1001 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1002     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added properties for driver.c 
1003   and vector on secondary click shortcut menu.&nbsp; This is the same as 
1004   altering the properties on the vector folder and the \source\driver folder 
1005   on the left pane.&nbsp; [<b style='mso-bidi-font-weight:
1006     normal'>René Single / John IV</b>]</li>
1007</ul>
1008 
1009<h2><span style='font-size:12.0pt'>v.</span><font size="3">104.4</font></h2>
1010 
1011<ul type=square>
1012 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1013     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added support for priority 
1014   switch, now a slider.&nbsp; Note: there may be system related issues going 
1015   to setting 1 (lagging keyboard, joystick controls), default is 0. [<b style='mso-bidi-font-weight:
1016     normal'>René Single</b>]</li>
1017   <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1018     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Removed multi-screen folder 
1019   view on left pane as that flag has been removed in the core. [<b style='mso-bidi-font-weight:
1020     normal'>René Single</b>]</li>
1021   <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1022     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added mngwrite option to 
1023   launch a game and immediately begin recording a MNG movie file. [<b style='mso-bidi-font-weight:
1024     normal'>René Single</b>]</li>
1025</ul>
1026 
1027<h2><span style='font-size:12.0pt'>v.</span><font size="3">101.1</font></h2>
1028 
1029<ul type=square>
1030 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1031     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added support for savestate 
1032   game folder view on left.&nbsp; Added switch for autosave. 
1033   [<b style='mso-bidi-font-weight:
1034     normal'>René Single</b>]</li>
1035</ul>
1036 
1037<h2><span style='font-size:12.0pt'>v.</span><font size="3">100</font></h2>
1038 
1039<ul type=square>
1040 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1041     mso-list:l8 level1 lfo1;tab-stops:list .5in'>New Galaxian homage about.bmp. 
1042   [<b style='mso-bidi-font-weight:
1043     normal'>John IV</b>]</li>
1044</ul>
1045 
1046<h2><span style='font-size:12.0pt'>v.99.</span><font size="3">3</font></h2>
1047 
1048<ul type=square>
1049 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1050     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Re-implemented history.dat for 
1051   MameUI which had its support removed from core. [<b style='mso-bidi-font-weight:
1052     normal'>René Single</b>]</li>
1053</ul>
1054 
1055<h2><span style='font-size:12.0pt'>v.98.</span><font size="3">3</font></h2>
1056 
1057<ul type=square>
1058 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1059     mso-list:l8 level1 lfo1;tab-stops:list .5in'>UI dialogues realignment. [<b>Radius</b>]</li>
1060   <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1061     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added ability to type in Mame 
1062   shortname in the Ctrl-F text filter, i.e. 'ddonpach'. [<b>John IV / Mash</b>]</li>
1063</ul>
1064 
1065<h2><span style='font-size:12.0pt'>v.96.4</span></h2>
1066 
1067<ul type=square>
1068 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1069     mso-list:l8 level1 lfo1;tab-stops:list .5in'>First pass at adding support 
1070   for the analogue and digital controller section of the core. [<b style='mso-bidi-font-weight:
1071     normal'>René Single</b>]</li>
1072</ul>
1073 
1074<h2><span style='font-size:12.0pt'>v.95.</span><font size="3">5</font></h2>
1075 
1076<ul type=square>
1077 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1078     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added core's -screen switch to 
1079   UI to allow playing games on secondary/tertiary monitors in multi-head 
1080   setups. [<b style='mso-bidi-font-weight:
1081     normal'>René Single</b>]</li>
1082</ul>
1083 
1084<h2><span style='font-size:12.0pt'>v.90.3</span></h2>
1085 
1086<ul type=square>
1087 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1088     mso-list:l8 level1 lfo1;tab-stops:list .5in'>More UI dialogues realignment. [<b style='mso-bidi-font-weight:
1089     normal'>Radius</b>]</li>
1090</ul>
1091 
1092<h2><span style='font-size:12.0pt'>v.89.3</span></h2>
1093 
1094<ul type=square>
1095 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1096     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Re-aligned UI elements in 
1097   Options menus and added some XP-style icons. [<b style='mso-bidi-font-weight:
1098     normal'>Radius</b>]</li>
1099</ul>
1100 
1101<h2><span style='font-size:12.0pt'>v.88.1<o:p></o:p></span></h2>
1102 
1103<ul type=square>
1104 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1105     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added switch to toggle 
1106   validity checking in the binary. [<b style='mso-bidi-font-weight:
1107     normal'>René Single</b>]</li>
1108</ul>
1109 
1110<h2><span style='font-size:12.0pt'>v.87.1<o:p></o:p></span></h2>
1111 
1112<ul type=square>
1113 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1114     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Increased start up speed via 
1115   driver info caching. [<b>Sauro Puccini / Chris Kirmse</b>]</li>
1116</ul>
1117 
1118<h2><span style='font-size:12.0pt'>v.86.1<o:p></o:p></span></h2>
1119 
1120<ul type=square>
1121 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1122     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Reworked MameUI folder
1123     properties and their initial memory allocation.<span
1124     style='mso-spacerun:yes'>  </span>Results in halving MameUI’s memory
1125     footprint on most systems. [<b style='mso-bidi-font-weight:normal'>René
1126     Single</b>]</li>
1127</ul>
1128 
1129<h2><span style='font-size:12.0pt'>v.86<o:p></o:p></span></h2>
1130 
1131<ul type=square>
1132 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1133     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Reworked MameUI multisession
1134     behaviour.<span style='mso-spacerun:yes'>  </span>When launching a game, 
1135   MameUI
1136     will now dynamically resize itself in memory rather than spawning a
1137     separate core process, saving some memory (this new feature impacts the
1138     icons on windowed mode playing and the show caption option). [<b
1139     style='mso-bidi-font-weight:normal'>Chris Kirmse</b>]</li>
1140 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1141     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Re-added support for custom
1142     controller selection again in the controller tab. [<b style='mso-bidi-font-weight:
1143     normal'>Chris Kirmse</b>]</li>
1144</ul>
1145 
1146<h2><span style='font-size:12.0pt'>v.84.5<o:p></o:p></span></h2>
1147 
1148<ul type=square>
1149 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1150     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Cleaned up the Options •
1151     Interface Options menu, adding sliders. [<b style='mso-bidi-font-weight:
1152     normal'>René Single</b>]</li>
1153 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1154     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Internal clean-ups to provide
1155     support for the new core changes. [<b style='mso-bidi-font-weight:normal'>Chris
1156     Kirmse</b> / <b style='mso-bidi-font-weight:normal'>Nathan Woods</b>]</li>
1157</ul>
1158 
1159<h2><span style='font-size:12.0pt'>v.84.2<o:p></o:p></span></h2>
1160 
1161<ul type=square>
1162 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1163     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added feature request to
1164     place a border around the artwork in the art pane, user selectable size
1165     and color (0=no border). [<b>René Single</b><b style='mso-bidi-font-weight:
1166     normal'> / John IV</b>]</li>
1167 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1168     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added dump status folder
1169     view, an easy reference for un-dumped and badly dumped ROMs for folks who
1170     may be in a position to update them. [<b>René Single</b><span
1171     style='mso-bidi-font-weight:bold'>]</span></li>
1172 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1173     mso-list:l8 level1 lfo1;tab-stops:list .5in'><span style='mso-bidi-font-weight:
1174     bold'>Expanded game list font control to go beyond the original 16 color
1175     choices allowing access to a greater UI customization (see last color on
1176     drop down list ‘custom’). [<b>René Single</b>]</span></li>
1177 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1178     mso-list:l8 level1 lfo1;tab-stops:list .5in'><span style='mso-bidi-font-weight:
1179     bold'>Added wave output option to match the core.<span
1180     style='mso-spacerun:yes'>  </span>File menu / Play and Record Wave output.
1181     [<b>Chris Kirmse</b>]</span></li>
1182</ul>
1183 
1184<h2><span style='font-size:12.0pt'>v.84<o:p></o:p></span></h2>
1185 
1186<ul type=square>
1187 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1188     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Various internal treeview
1189     fixes [year / manufacturer] and cleanups. [<b style='mso-bidi-font-weight:
1190     normal'>Nathan Woods / <span style='mso-bidi-font-weight:bold'>René Single</span>
1191     / Mamesick / Chris Kirmse</b>]</li>
1192 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1193     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Factored out list view
1194     handling into its own module, picker.c.<span style='mso-spacerun:yes'> 
1195     </span>Auto_malloc() now used and appears to result in a speed up of the
1196     GUI game list scrolling, however at the moment it does cause slight pauses
1197     moving from one ‘view’ to another. [<b style='mso-bidi-font-weight:normal'>Nathan
1198     Woods</b>]</li>
1199 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1200     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added ability to display
1201     games in windowed mode without their titlebar caption. Not fully
1202     functioning w/ GCC compile. [<b>René Single / John IV</b><span
1203     style='mso-bidi-font-weight:bold'>]</span></li>
1204</ul>
1205 
1206<h2><span style='font-size:12.0pt'>v.82<o:p></o:p></span></h2>
1207 
1208<ul type=square>
1209 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1210     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Brought game ‘not working’
1211     status messages in-line with core [status bar, general properties, etc.]
1212     and rearranged status area on properties tab.<span
1213     style='mso-spacerun:yes'>  </span>[<b style='mso-bidi-font-weight:normal'>Mamesick</b>]</li>
1214 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1215     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added sample folder view. [<b
1216     style='mso-bidi-font-weight:normal'>Mamesick</b>]</li>
1217 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1218     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Renamed Hard Disk folder view
1219     to CHD due to newly supported CD CHDs. [<b style='mso-bidi-font-weight:
1220     normal'>John IV / Nathan Woods</b>]</li>
1221</ul>
1222 
1223<h2><span style='font-size:12.0pt'>v.81<o:p></o:p></span></h2>
1224 
1225<ul type=square>
1226 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1227     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Moved placement of
1228     bkground.png to \bkground folder instead of \snap folder. [<b>René Single</b>]</li>
1229 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1230     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Fixed erroneous behaviour for
1231     Imperfect folder view. [<b>René Single</b>]</li>
1232 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1233     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Corrected audio latency
1234     slider movement and setting past notch 4. [<b>René Single</b>]</li>
1235 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1236     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added customizable quit key
1237     [default Alt-Q] for the mappable keyboard solution option. [<b>René Single</b>]</li>
1238 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1239     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added new History.dat option
1240     to allow display under any or all of the art views in Options • Interface
1241     Options. [<b>René Single</b>]</li>
1242</ul>
1243 
1244<h2><span style='font-size:12.0pt'>v.79</span></h2>
1245 
1246<ul type=square>
1247 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1248     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added an ‘Imperfect’ folder
1249     view on the left pane, this categorizes the various problems flagged in
1250     games. [<b>René Single</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1251 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1252     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Reworked handling of the BIOS
1253     option, now that there are multiple drivers that support different BIOSes
1254     [neogeo.c, stv.c] the global setting is not appropriate.<span
1255     style='mso-spacerun:yes'>  </span>Select the driver from the source folder
1256     view on the left pane and change its BIOS settings, this will alter it for
1257     all games in that driver.<span style='mso-spacerun:yes'>  </span>The
1258     functionality remains the same for altering individual games settings in
1259     all games view or anywhere else. [<b>René Single</b>]</li>
1260 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1261     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added the ability to control
1262     the MameUI GUI via mappable keyboard solutions.<span
1263     style='mso-spacerun:yes'>  </span>This feature is intended to compliment
1264     the GUI control via joystick option first offered in version .70
1265     below.<span style='mso-spacerun:yes'>  </span>It is designed to allow
1266     users of Mame cabinets with keyboard encoders the same functionality and
1267     is controlled in the mameUI32/64.ini file [mapping the enter key to button 1
1268     to launch a game for example], using the same syntax as the \ctrlr files.
1269     [<b style='mso-bidi-font-weight:normal'>Jarek Burczynski / Chris Kirmse</b>]<span
1270     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1271 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1272     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added support for the new
1273     core switches for lightgun modifications; reload to allow mapping reload
1274     to keys, and dual gun setups. [<b style='mso-bidi-font-weight:normal'>Chris
1275     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1276 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1277     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added accelerator key for
1278     folder level ‘mini-audits’, Alt-U [<b>René Single</b><b style='mso-bidi-font-weight:
1279     normal'> / John IV</b>].<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1280 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1281     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added accelerator key support
1282     for scrolling up and down through history.dat text window. CTRL-Page Up /
1283     CTRL-Page Down.<b style='mso-bidi-font-weight:normal'> </b>[<b>René Single</b>]<span
1284     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1285 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1286     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added toggle in Grouped view
1287     to allow clones missing a parent to display non-indented. [<b>René Single</b><span
1288     style='mso-bidi-font-weight:bold'>]</span><span style='font-size:12.0pt;
1289     font-family:"Times New Roman"'><o:p></o:p></span></li>
1290 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1291     mso-list:l8 level1 lfo1;tab-stops:list .5in'><span style='mso-bidi-font-weight:
1292     bold'>Added support for the core’s new save state loading on game
1293     start.<span style='mso-spacerun:yes'>  </span>[<b>René Single</b>]</span><span
1294     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1295 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1296     mso-list:l8 level1 lfo1;tab-stops:list .5in'><span style='mso-bidi-font-weight:
1297     bold'>Added support for the core’s new keyboard LED choices, USB or PS/2.
1298     [<b>René Single</b>]</span><span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1299</ul>
1300 
1301<h2><span style='font-size:12.0pt'>v.78</span></h2>
1302 
1303<ul type=square>
1304 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1305     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added the ability to do ‘mini-audits’
1306     on each of the folders on the left pane.<span style='mso-spacerun:yes'> 
1307     </span>Secondary click on the folders to see audit as a choice. [<b>René
1308     Single</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1309 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1310     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Changed behaviour of MameUI
1311     when displaying games that have the protection not emulated flag,
1312     previously it would flag these games as non-working and display the
1313     warning.ico.<span style='mso-spacerun:yes'>  </span>Now warning.ico and
1314     non-working status will only occur if the game has the non-working flag
1315     attached in the driver. [<b>René Single / </b><b style='mso-bidi-font-weight:
1316     normal'>Mamesick / John IV / Chris Kirmse</b>]<span style='font-size:12.0pt;
1317     font-family:"Times New Roman"'><o:p></o:p></span></li>
1318 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1319     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Increased CPU and sound area
1320     on games’ properties page to accommodate 5 lines now that tceptor and tmnt
1321     utilise it. [<b>René Single / Chris Kirmse</b>]<span style='font-size:
1322     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1323 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1324     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Altered behaviour of
1325     properties titlebar on driver.ini to show the driver name instead of
1326     ‘folder’ properties. [<b>René Single / Chris Kirmse</b>]<span
1327     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1328 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1329     mso-list:l8 level1 lfo1;tab-stops:list .5in'>No longer UPX compressing the
1330     MameUI .exe.<span style='mso-spacerun:yes'>  </span>This saves 20 Megs
1331     when MameUI is loaded into memory, will allow for better dynamic loading,
1332     and won’t trip off virus detectors that have trouble w/ UPX compression.<span
1333     style='mso-spacerun:yes'>  </span>As a result, MameUI.exe is now 20 Megs
1334     in size on the hard drive.<span style='mso-spacerun:yes'>  </span>The
1335     distribution package is also being changed and compressed with 7-Zip as a
1336     self-extracting archive, this actually makes the distribution package
1337     about 1 Meg smaller than previous releases. [<b style='mso-bidi-font-weight:
1338     normal'>John IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1339 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1340     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Switched default settings in
1341     MameUI to disable auto frameskipping and to use draw every frame per
1342     discussion on MameDEV list. [<b style='mso-bidi-font-weight:normal'>John
1343     IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1344 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1345     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Added 48000 as a sample rate
1346     option, works well with modern soundcards and chips. [<b style='mso-bidi-font-weight:
1347     normal'>John IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1348</ul>
1349 
1350<h2><span style='font-size:12.0pt'>v.77</span></h2>
1351 
1352<ul type=square>
1353 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1354     mso-list:l8 level1 lfo1;tab-stops:list .5in'>Fulfilling the longstanding
1355     feature req. added the ability to globally alter vector.ini and driver.ini
1356     to match the core.&nbsp; Secondary click on the vector folder • properties
1357     in the folder pane to set options for that group of games.&nbsp; To alter
1358     global settings for game families, drill down into the source folder in
1359     the folder pane, and secondary click on a driver's properties i.e.
1360     1942.c.&nbsp; This will change options for all games based on that
1361     driver.&nbsp; The different levels of alteration are color coded,
1362     vector.ini changes are red, driver.ini changes are green, and individual
1363     game settings are blue.&nbsp; Thus there is the possibility to have four
1364     color/levels of alterations when a game's individual properties are viewed
1365     in All Games or any folder.&nbsp; The changes can be backed out of
1366     hierarchically with reset to default on each respective properties, the
1367     reset to default global option, or by deleting the .ini files in the \ini
1368     directory.<span style='mso-spacerun:yes'>  </span><b style='mso-bidi-font-weight:
1369     normal'>Note</b>: Currently the color alterations do not display properly
1370     with XP in themed mode, but the functionality works [bug 462].<span
1371     style='mso-spacerun:yes'>  </span>Coded solutions to this issue via DIFF
1372     are welcomed. [<b>René Single / Chris Kirmse / John IV</b>]<span
1373     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1374</ul>
1375 
1376<h2><span style='font-size:12.0pt'>v.76</span></h2>
1377 
1378<ul type=square>
1379 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1380     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Added programmatically
1381     populated lightgun and multi-monitor folders. [<b>René Single</b>]<span
1382     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1383 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1384     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Added reset play count and
1385     play time for individual games, and globally. [Secondary click on game,
1386     &amp; Options • Interface Options. [<b>René Single</b>]<span
1387     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1388 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1389     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Allowed filter propagation
1390     downward from parent folders, toggle this feature in Options • Interface
1391     Options. [<b>René Single</b>]<span style='font-size:12.0pt;font-family:
1392     "Times New Roman"'><o:p></o:p></span></li>
1393 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1394     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Changed behavior of vertical
1395     scrollbar in history pane, will not show if there is less text than
1396     available room. [<b>René Single</b>]<span style='font-size:12.0pt;
1397     font-family:"Times New Roman"'><o:p></o:p></span></li>
1398 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1399     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Extended game not working
1400     status support to show more flags in status bar and game properties. [<b>René
1401     Single</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1402 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1403     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Added tool tip text to status
1404     bar if longer than displayable name is selected. [<b>René Single</b>]<span
1405     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1406 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1407     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Increased history.dat buffer
1408     to prevent cut-off and overflow. [<b>René Single</b>]<span
1409     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1410 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1411     mso-list:l7 level1 lfo2;tab-stops:list .5in'>Re-implemented ability to
1412     show game's icon on title bar in windowed mode. [<b>René Single</b>]<span
1413     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1414</ul>
1415 
1416<h2><span style='font-size:12.0pt'>v.72</span></h2>
1417 
1418<ul type=square>
1419 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1420     mso-list:l0 level1 lfo3;tab-stops:list .5in'>Added the ability to scale
1421     the right side art pane contents upwards as the window size increases,
1422     toggle on Options • Interface Options. [<b>René Single / Chris Kirmse</b>]<span
1423     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1424 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1425     mso-list:l0 level1 lfo3;tab-stops:list .5in'>Expanded the reach of the
1426     CTRL-F text filter, it can now act on name, driver name e.g. 'cps2.c', and
1427     manufacturer.&nbsp; This is a quick method for immediately seeing a driver
1428     family instead of drilling down through the source folder on the left. [<b>René
1429     Single / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1430</ul>
1431 
1432<h2><span style='font-size:12.0pt'>v.71</span></h2>
1433 
1434<ul type=square>
1435 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1436     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Added the ability to
1437     selectively disable built in folder views on the left pane, secondary
1438     click in the window area for the dialogue box. [<b>Chris Kirmse</b>]<span
1439     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1440 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1441     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Added control panel art tab.
1442     [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1443 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1444     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Fixed audit control overflow
1445     issue. [<b>René Single</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1446 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1447     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Designed art tab state
1448     toggles to be more readable in MameUI32/64.ini. [<b>Chris Kirmse</b>]<span
1449     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1450 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1451     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Added the ability to have
1452     MameUI automatically cycle the selected art views at an interval, in
1453     seconds.&nbsp; Accessible in Options • Interface Options. [<b>René Single
1454     / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1455 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1456     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Added the ability to track
1457     the amount of time spent playing each game in minutes and seconds.&nbsp;
1458     Displays in details or grouped view.&nbsp; Add the column in View • Customize
1459     fields. [<b>René Single / Chris Kirmse</b>]<span style='font-size:12.0pt;
1460     font-family:"Times New Roman"'><o:p></o:p></span></li>
1461 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1462     mso-list:l1 level1 lfo4;tab-stops:list .5in'>Added the ability to view
1463     game's icon on title bar in windowed mode. [<b>René Single / Chris Kirmse</b>]<span
1464     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1465</ul>
1466 
1467<h2><span style='font-size:12.0pt'>v.70.1</span></h2>
1468 
1469<ul type=square>
1470 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1471     mso-list:l12 level1 lfo5;tab-stops:list .5in'>Removed saturate slider from
1472     D3D tab. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:
1473     "Times New Roman"'><o:p></o:p></span></li>
1474 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1475     mso-list:l12 level1 lfo5;tab-stops:list .5in'>Fixed cleanstretch and
1476     prescale settings not holding. [<b>Chris Kirmse</b>]<span
1477     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1478 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1479     mso-list:l12 level1 lfo5;tab-stops:list .5in'>Implemented BIOS selection
1480     on per game basis [only Neo Geo games currently] and allowed temporary
1481     global settings for BIOS via number. [<b>Chris Kirmse</b>]<span
1482     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1483</ul>
1484 
1485<h2><span style='font-size:12.0pt'>v.70</span></h2>
1486 
1487<ul type=square>
1488 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1489     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added art tab with only
1490     history.dat.&nbsp; If this tab is enabled and history.dat is present
1491     history text will no longer appear beneath the screenshot. [<b>Tor Arne
1492     Vestbø / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1493 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1494     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added option to hide the
1495     mouse cursor on launch in full screen on Options • Interface Options. [<b>Tor
1496     Arne Vestbø</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1497 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1498     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Addressed some long standing
1499     bugs dealing with icon decimation and windows title bar size, and
1500     details/grouped view not holding the column size on return from large icon
1501     view post-session restart. [<b>René Single</b>]<span style='font-size:
1502     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1503 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1504     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added option to expand MameUI
1505     to full screen kiosk mode without any windows controls [F11]. [<b>Tor Arne
1506     Vestbø / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1507 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1508     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Created new Berzerk homage about.bmp. [<b>John IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1509 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1510     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Reworked drop down for D3D
1511     prescale effect, now allowing various levels of sharpness to be used. [<b>Chris
1512     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1513 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1514     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Updated win32ui.c to pull
1515     certain information more appropriately out of layout.c. [<b>Nathan
1516     Woods/MESS32</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1517 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1518     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Removed obsoleted version
1519     mismatch toggle. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1520     font-family:"Times New Roman"'><o:p></o:p></span></li>
1521 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1522     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added a built in orientation
1523     folder view for displaying vertical and horizontal games. [<b>René Single</b>]<span
1524     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1525 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1526     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added support for the new
1527     cleanstretch options. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1528     font-family:"Times New Roman"'><o:p></o:p></span></li>
1529 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1530     mso-list:l3 level1 lfo6;tab-stops:list .5in'>Added ability to map joystick
1531     actions in MameUI32/64.ini to control GUI navigation instead of being hard
1532     coded:<br>
1533     <b>Format</b>: joystick_number, stick_type, axis_or_button, direction<br>
1534     <br>
1535     #define JOYCODE_STICK_BTN 0<br>
1536     #define JOYCODE_STICK_AXIS 1<br>
1537     #define JOYCODE_STICK_POV 2<br>
1538     #define JOYCODE_DIR_BTN 0<br>
1539     #define JOYCODE_DIR_NEG 1<br>
1540     #define JOYCODE_DIR_POS 2<span style='font-family:"Times New Roman"'><o:p></o:p></span></li>
1541</ul>
1542 
1543<p style='margin-left:.5in'>So, pressing button 3 on joystick one would be:
15441,0,3,0<br>
1545<br>
1546ui_joy_up 1,1,2,1<br>
1547ui_joy_down 1,1,2,2<br>
1548ui_joy_left 1,1,1,1<br>
1549ui_joy_right 1,1,1,2<br>
1550ui_joy_start 1,0,1,0<br>
1551ui_joy_pgup 2,1,2,1<br>
1552ui_joy_pgdwn 2,1,2,2<br>
1553ui_joy_home 0,0,0,0<br>
1554ui_joy_end 0,0,0,0<br>
1555ui_joy_ss_change 2,0,3,0<br>
1556ui_joy_history_up 2,0,4,0<br>
1557ui_joy_history_down 2,0,1,0<br>
1558ui_joy_exec 0,0,0,0</p>
1559 
1560<p style='margin-left:.5in'>For stick type POV there are no directions, only
1561four axes (0-3) [<b>Tor Arne Vestbø</b>]</p>
1562 
1563<h2><span style='font-size:12.0pt'>v.69</span></h2>
1564 
1565<ul type=square>
1566 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1567     mso-list:l11 level1 lfo7;tab-stops:list .5in'>Added support for the new
1568     D3D filter and effects options in Options • Default Game Options •
1569     Direct3D, see help menu contents for further descriptions of the new
1570     features. [<b>John IV / Chris Kirmse</b>]<span style='font-size:12.0pt;
1571     font-family:"Times New Roman"'><o:p></o:p></span></li>
1572 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1573     mso-list:l11 level1 lfo7;tab-stops:list .5in'>Added support for the new
1574     core toggle -bios to allow selection of the various supported Neo Geo
1575     BIOSes. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:
1576     "Times New Roman"'><o:p></o:p></span></li>
1577</ul>
1578 
1579<h2><span style='font-size:12.0pt'>v.68</span></h2>
1580 
1581<ul type=square>
1582 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1583     mso-list:l9 level1 lfo8;tab-stops:list .5in'>Added code to allow clicking
1584     anywhere in the screenshot window to toggle the art views.&nbsp; No longer
1585     necessary to click directly on the default image. [<b>K&amp;K</b>]<span
1586     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1587 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1588     mso-list:l9 level1 lfo8;tab-stops:list .5in'>Added code to allow disabling
1589     / toggling individual art views on the view menu and the context menu of
1590     the art window. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1591     font-family:"Times New Roman"'><o:p></o:p></span></li>
1592 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1593     mso-list:l9 level1 lfo8;tab-stops:list .5in'>Added support for the new
1594     core D3D items, accessible on the Options • Default Game Options • Direct3D.
1595     [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1596 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1597     mso-list:l9 level1 lfo8;tab-stops:list .5in'>Added support for the new
1598     core audio latency settings. [<b>Chris Kirmse</b>]<span style='font-size:
1599     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1600</ul>
1601 
1602<h2><span style='font-size:12.0pt'>v.67</span></h2>
1603 
1604<ul type=square>
1605 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1606     mso-list:l14 level1 lfo9;tab-stops:list .5in'>Re-worked the rotation
1607     options to a drop down, and included the new switches for auto-clockwise /
1608     auto-anti-clockwise for pivot monitors. [<b>Chris Kirmse</b>]<span
1609     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1610</ul>
1611 
1612<h2><span style='font-size:12.0pt'>v.66</span></h2>
1613 
1614<ul type=square>
1615 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1616     mso-list:l4 level1 lfo10;tab-stops:list .5in'>Moved towards an *.ini based
1617     settings storage scheme to more closely match the Mame.exe core,
1618     individual game *.inis whose settings are altered are stored in the \ini
1619     directory. The MameUI GUI settings are stored in MameUI32/64.ini in the root
1620     w/ MameUI.exe, and MameUI.ini is stored in the \ini directory and should
1621     be interchangeable with a regular Mame.ini.&nbsp; Purge these two items to
1622     return to baseline, the registry is no longer used for MameUI. [<b>Chris
1623     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1624 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1625     mso-list:l4 level1 lfo10;tab-stops:list .5in'>Provided an additional 'migration'
1626     version of MameUI which will copy the contents of the registry key and
1627     write it out to the new *.ini scheme when exiting.&nbsp; Useful for people
1628     who have a large number of individual game customizations. [<b>John IV /
1629     Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1630 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1631     mso-list:l4 level1 lfo10;tab-stops:list .5in'>Added toggle for high thread
1632     priority in Options • Interface Options to match the core's new
1633     -high_priority switch.&nbsp; This will devote more system resources and
1634     time to MameUI at the expense of other already running programs. [<b>Chris
1635     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1636</ul>
1637 
1638<h2><span style='font-size:12.0pt'>v.65</span></h2>
1639 
1640<ul type=square>
1641 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1642     mso-list:l10 level1 lfo11;tab-stops:list .5in'>Updated columnedit.c to
1643     allow for MESS32 usage in software view. [<b>Nathan Woods/MESS32</b>]<span
1644     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1645 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1646     mso-list:l10 level1 lfo11;tab-stops:list .5in'>Reworked F5/refresh
1647     routines to utilise more audit code and logic. [<b>Chris Kirmse</b>]<span
1648     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1649 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1650     mso-list:l10 level1 lfo11;tab-stops:list .5in'>Reworked -lightgun
1651     handling, enabling independently selectable mouse control for those games.
1652     [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1653 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1654     mso-list:l10 level1 lfo11;tab-stops:list .5in'>Custom icons are included
1655     in the distribution \icons directory to show what the control/tree icons
1656     are without having to go through the source. [<b>John IV</b>]<span
1657     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1658</ul>
1659 
1660<h2><span style='font-size:12.0pt'>v.63.1</span></h2>
1661 
1662<ul type=square>
1663 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1664     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Fixed analogue dead-zone not
1665     being maintained, and pre-0.63 timing not being maintained. [<b>Chris
1666     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1667 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1668     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Added folder view for hard
1669     drive based games. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1670     font-family:"Times New Roman"'><o:p></o:p></span></li>
1671 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1672     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Addressed missing/blank
1673     custom icon display indexing issue on F5/refresh. [<b>Chris Kirmse</b>]<span
1674     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1675 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1676     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Sped up MameUI launch /
1677     folder reading routine. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1678     font-family:"Times New Roman"'><o:p></o:p></span></li>
1679 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1680     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Fixed screenshot area
1681     decimation when resizing images larger than the viewable area. [<b>John IV
1682     / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1683 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1684     mso-list:l5 level1 lfo12;tab-stops:list .5in'>Added additional help topic
1685     IDs and tool tips. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1686     font-family:"Times New Roman"'><o:p></o:p></span></li>
1687</ul>
1688 
1689<h2><span style='font-size:12.0pt'>v.63</span></h2>
1690 
1691<ul type=square>
1692 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1693     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added code to ROM loading
1694     dialogue to visually indicate user intervention when the game being
1695     launched may not work due to 'no good dump' this will match the baseline
1696     Mame [press ok to continue].&nbsp; Examples include the game Astyanax,
1697     64th Street etc. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1698     font-family:"Times New Roman"'><o:p></o:p></span></li>
1699 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1700     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Return to baseline non-I686
1701     compile as it prevented MameUI working on a variety of machines. [<b>John
1702     IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1703 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1704     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Made numerous code changes
1705     to allow MameUI to be compiled with the new MinGW 2.0 package. [<b>Chris
1706     Kirmse / Mike Haaland</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1707 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1708     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Distribution compiles are
1709     now done using above mentioned MinGW 2.0 package. [<b>John IV</b>]<span
1710     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1711 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1712     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added code to allow for a
1713     tool tip to appear showing the full name of a game whose description is
1714     cut-off by column width in details/grouped view.&nbsp; Hover cursor over
1715     game to activate. [<b>Andrew Kirmse / Chris Kirmse</b>]<span
1716     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1717 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1718     mso-list:l16 level1 lfo13;tab-stops:list .5in'>The default
1719     \folders\Favorites.ini has been cleaned out.&nbsp; Now that it is easy to
1720     drag and drop or secondary click to add games from the main list to the
1721     custom folders, it no longer needs to serve as an example using personal
1722     favorites. Be sure to backup existing \folders\Favorites.ini if using the
1723     built in installer version of the MameUI distribution. [<b>John IV</b>]<span
1724     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1725 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1726     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Tweaked code for drag &amp;
1727     drop of games into custom folders.&nbsp; In a custom folder to drag an
1728     item out for deletion, it must go out of the game list pane either left,
1729     right, up, or down beneath the last item in the pane or further out of the
1730     GUI. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1731 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1732     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Reworked internal file
1733     handling code to interface with Aaron's substantial core updates. [<b>Chris
1734     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1735 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1736     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Submitted code suggestion
1737     to allow for more granular sorting and display of items in the Manufacturers
1738     view, so companies will no longer be grouped with others incorrectly. [<b>René
1739     Single</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1740 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1741     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Created new main icon and
1742     about.bmp 'Ladybug Homage'. [<b>John IV</b>]<span style='font-size:12.0pt;
1743     font-family:"Times New Roman"'><o:p></o:p></span></li>
1744 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1745     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Fixed ascending/descending
1746     toggle via View • Arrange Icons for columns other than Game.&nbsp; Added
1747     some logic to the -listsourcefile column display. Prevented color depth
1748     and refresh rate settings from being displayed if games are played in
1749     windowed mode. [<b>René Single / Chris Kirmse</b>]<span style='font-size:
1750     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1751 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1752     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Made Misc. art option gray
1753     properly when its parent control was deselected. [<b>Chris Kirmse</b>]<span
1754     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1755 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1756     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Submitted code to clean up
1757     some issues with the list and small icons view and icons squishing in
1758     details view upon return from another view like large icons. [<b>René
1759     Single / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1760 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1761     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Upgraded MameUI to utilize
1762     the new common controls from Windows XP, allowing the proper look of an XP
1763     application without the need for an external manifest file. [<b>Chris
1764     Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1765 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1766     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added ability to rename
1767     custom folders from the tree view, secondary click on them and choose
1768     rename folder from the context menu, or click the name of the folder three
1769     times quickly. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;
1770     font-family:"Times New Roman"'><o:p></o:p></span></li>
1771 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1772     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added the 'Source' folder
1773     view, this will display all the driver.c files and all the games within
1774     each family. [<b>Mike Haaland</b>]<span style='font-size:12.0pt;
1775     font-family:"Times New Roman"'><o:p></o:p></span></li>
1776 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1777     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Removed the
1778     \folders\BIOS.ini as it is now obviated by the built-in Source folder
1779     view. [<b>John IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1780 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1781     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added -sourcefileinfo
1782     information to the general tab for each <span class=GramE>games'</span>
1783     properties, to easily and quickly see what driver family a game belongs
1784     to. [<b>Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1785 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1786     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added the long requested
1787     clone offset aka 'Grouped' view.&nbsp; This will display the parent games
1788     flush left, with all their clones alphabetized beneath them indented
1789     inward. Excellent for grouping the clones whose names may be considerably
1790     different than their <span class=GramE>parents,</span> and allowing typing
1791     the name of the game to go to the parent set immediately.&nbsp; [<b>John
1792     IV / Chris Kirmse</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1793 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1794     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Reworked the Startup
1795     Options to now be Interface Options, and added checkboxes to support
1796     Aaron's new disclaimer / info screen toggle. [<b>Chris Kirmse</b>]<span
1797     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1798 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1799     mso-list:l16 level1 lfo13;tab-stops:list .5in'>Added new switches -rdtsc /
1800     -pause_brightness to match the core. [<b>Chris Kirmse</b>]<span
1801     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1802</ul>
1803 
1804<h2><span style='font-size:12.0pt'>v.62</span></h2>
1805 
1806<ul type=square>
1807 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1808     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Internalized the code for
1809     rotate.exe, MameUI can now choose its background images from Options •
1810     Background Image, and choose a random one on startup.&nbsp; Options •
1811     Startup Options • Select Random Background Image. [<b>K&amp;K</b>]<span
1812     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1813 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1814     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Added tabs for the
1815     screenshot art <span class=GramE>area,</span> toggle with Alt-b. [<b>K&amp;K</b>]<span
1816     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1817 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1818     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Added code to increase speed
1819     of audit. [<b>K&amp;K</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1820 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1821     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Added secondary click menu
1822     pop-up for screenshot area. [<b>Sword</b>]<span style='font-size:12.0pt;
1823     font-family:"Times New Roman"'><o:p></o:p></span></li>
1824 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1825     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Allowed bkground.png to be displayed
1826     in history.dat area under screenshot, font color changed to match GUI font
1827     color. [<b>K&amp;K</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1828 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1829     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Created new icons for the
1830     various tabs in Default Options / Game Properties dialogue boxes. [<b>John
1831     IV</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1832 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1833     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Updated the ColumnEdit and
1834     Properties code to make them both more extensible. [<b>Nathan Woods/MESS32</b>]<span
1835     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1836 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1837     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Included index fixes to
1838     speed load time in treeview.c, particularly with extra \folders *.inis. [<b>Jeff
1839     Miller</b>] <span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1840 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1841     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Fixed an issue where the
1842     startup focus in the details list would jump to the top of the list before
1843     returning to the prior selection. [<b>Chris Kirmse</b>]<span
1844     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1845 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1846     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Main distribution now
1847     compiled with I686=1 for Pentium Pro optimization.&nbsp; Doesn't impact
1848     high end AMD chips at all but provides speed increases to lower range PII,
1849     P3 machines. [<b>John IV</b>]<span style='font-size:12.0pt;font-family:
1850     "Times New Roman"'><o:p></o:p></span></li>
1851 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1852     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Created new *.ini files for
1853     the \folders directory.&nbsp; Replace the old ones with these (<span
1854     class=GramE>except</span> any user-modified of course). [<b>John IV</b>]<span
1855     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1856 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1857     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Created a new MameUI MSI
1858     installer package.&nbsp; This should be easier for beginners. [<b>John IV</b>]<span
1859     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1860 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1861     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Added the ability to drag and
1862     drop games into the custom *.ini folders. [<b>Chris Kirmse</b>] <span
1863     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1864 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1865     mso-list:l6 level1 lfo14;tab-stops:list .5in'>Added the ability to
1866     secondary click on a game to add or remove it from an *.ini file in the
1867     \folders directory. [<b>Patrick Jones / Chris Kirmse</b>]<span
1868     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1869</ul>
1870 
1871<h2><span style='font-size:12.0pt'>v.61</span></h2>
1872 
1873<ul type=square>
1874 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1875     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Fixed a nasty crasher where
1876     MameUI would hang if loading a game that required user intervention in
1877     Mame[w] <span class=GramE>like</span> 'The Astyanax', and there was no
1878     joystick connected to the system. [<b>Sword</b>]<span style='font-size:
1879     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1880 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1881     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Fixed a couple of fringe
1882     case crashers when Windows is shut down beneath MameUI, i.e. a cabinet
1883     setting. [<b>Robert John Sheppard</b>]<span style='font-size:12.0pt;
1884     font-family:"Times New Roman"'><o:p></o:p></span></li>
1885 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1886     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Removed -dirty / -nodirty
1887     options to match Aaron's core changes. [<b>John IV</b>]<span
1888     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1889 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1890     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added dialogue box support
1891     for new artwork switches, added -ini support to Options • Directories. [<b>Mike
1892     Haaland</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1893 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1894     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added dialogue box support
1895     for LED disablement, artwork resolution. [<b>Mike Haaland</b>]<span
1896     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1897 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1898     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added brightness slider,
1899     removed -bpp per Aaron's changes. [<b>Mike Haaland</b>]<span
1900     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1901 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1902     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added sound chip and CPU
1903     information to the folder views.&nbsp; Added the long requested feature to
1904     create user defined folder views, see \folders files for examples. [<b>Sword,
1905     BUT, Emuman / Mike Haaland</b>] <span style='font-size:12.0pt;font-family:
1906     "Times New Roman"'><o:p></o:p></span></li>
1907 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1908     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Created Artwork, BIOS, and
1909     Custom folder views. [<b>John IV</b>]<span style='font-size:12.0pt;
1910     font-family:"Times New Roman"'><o:p></o:p></span></li>
1911 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1912     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added support for displaying
1913     -listsourcefile [source] field to the View • Customize Fields.&nbsp; Handy
1914     for sorting to test global driver changes across all its <span
1915     class=GramE>games.,</span> or using to report game problems to
1916     MameTesters.com. [<b>Mike Haaland</b>]<span style='font-size:12.0pt;
1917     font-family:"Times New Roman"'><o:p></o:p></span></li>
1918 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1919     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Created new Version and
1920     Classification folder views. [<b>John IV</b>]<span style='font-size:12.0pt;
1921     font-family:"Times New Roman"'><o:p></o:p></span></li>
1922 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1923     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added support for the new
1924     -lightgun switch. [<b>John IV</b>]<span style='font-size:12.0pt;
1925     font-family:"Times New Roman"'><o:p></o:p></span></li>
1926 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1927     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Removed 'add to favorites'
1928     from context menus and file menu since it is now possible/preferable to
1929     have favorites stored in the portable, user-defined, external text file
1930     [\folders]. <span class=GramE>Which also of course would survive a
1931     registry key purge.</span> <span class=GramE>Times played is</span> still
1932     accessible as a column in details view. [<b>John IV</b>]<span
1933     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1934 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1935     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Updated help file with new
1936     settings, added baseline Mame[w] documents to help file. [<b>John IV</b>]<span
1937     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1938 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1939     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Added \titles directory
1940     support to allow for title screenshots viewing. [<b>John IV</b>]<span
1941     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1942 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1943     mso-list:l2 level1 lfo15;tab-stops:list .5in'>Created new MameUI icon and <span
1944     class=GramE>About</span> graphic. [<b>John IV</b>]<span style='font-size:
1945     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1946</ul>
1947 
1948<h2><span style='font-size:12.0pt'>v.60</span></h2>
1949 
1950<ul type=square>
1951 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1952     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Created and added the new
1953     MameUI HTML Help File. [<b>John IV</b>]<span style='font-size:12.0pt;
1954     font-family:"Times New Roman"'><o:p></o:p></span></li>
1955 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1956     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Updated context sensitive
1957     help support to MameUI, all controls should be mapped to pop-up help. [<b>Mike
1958     Haaland</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1959 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1960     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Added 'Use less CPU if
1961     possible' check box in Options • Default Options • Miscellaneous.&nbsp;
1962     This toggles the new baseline Mame[w] sleep / -nosleep switch.&nbsp; If
1963     toggled on, it will return more time slices to the processor and be more
1964     amenable to multi-tasking with other applications.&nbsp; If toggled off,
1965     MameUI will continue to take 100% of the CPU time as it has historically.&nbsp;
1966     It should be toggled 'off' for people experiencing severe slowdowns,
1967     particularly laptop users. [<b>John IV / Mike Haaland</b>]<span
1968     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1969 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1970     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Added option to set the
1971     directory for hard drive image diff files to match Mame[w] in Options •
1972     Directories. Fixed screenshot area decimation when image sized too large
1973     for area.&nbsp; Scales properly now and looks great.&nbsp; Fixed flip
1974     options. [<b>Sword</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1975 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1976     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Added option to set the
1977     directory for icons in Options • Directories. [<b>John IV</b>]<span
1978     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1979 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1980     mso-list:l13 level1 lfo16;tab-stops:list .5in'>Added support for new
1981     external controller mapping. This adds support for common arcade
1982     controllers and provides the ability to create user defined mappings for
1983     home built solutions.&nbsp; See Options • Default Options • Controllers.
1984     Also see the controller mapping document in the Mame Documents help
1985     section. [<b>Ron Fries</b>]<span style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
1986</ul>
1987 
1988<h2><span style='font-size:12.0pt'>v.59</span></h2>
1989 
1990<ul type=square>
1991 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1992     mso-list:l15 level1 lfo17;tab-stops:list .5in'>Added 'Allow game selection
1993     by joystick' check box to Startup Options.&nbsp; Allows navigation and
1994     game launch via controller<span class=GramE>:</span><br>
1995     joystick 1 up = up arrow<br>
1996     joystick 1 down = down arrow<br>
1997     joystick 1 left = left arrow<br>
1998     joystick 1 right = right arrow<br>
1999     joystick 1 button 1 = play game<br>
2000     joystick 1 button 2 = page up<br>
2001     joystick 1 button 5 = page down<br>
2002     joystick 1 button 3 = end<br>
2003     joystick 1 button 6 = home. [<b>Chris Kirmse</b>]<span style='font-size:
2004     12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
2005 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2006     mso-list:l15 level1 lfo17;tab-stops:list .5in'>Fixed a few files to allow
2007     a MinGW compile without errors. [<b>Sword</b>]<span style='font-size:12.0pt;
2008     font-family:"Times New Roman"'><o:p></o:p></span></li>
2009 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2010     mso-list:l15 level1 lfo17;tab-stops:list .5in'>Added 'Broadcast selected game
2011     to all windows' check box in Startup Options, this allows third party
2012     applications to be programmatically told what game is being played in
2013     MameUI.&nbsp; It can be used to hook into applications like LED reader
2014     boards, or instant message clients, etc. [<b>Chris Kirmse</b>]<span
2015     style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></li>
2016</ul>
2017 
2018<p><font size="1">
2019<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 02:06 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="38017" -->/ <span class=GramE>john</span> iv</font></p>
2020 
2021</div>
2022 
2023</body>
2024 
2025</html>
src/osd/winui/help/html/mameui_overview.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Overview &amp; History</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26-->
27</style>
28</head>
29 
30<body background="../images/bkground.gif">
31 
32<h1>MameUI Overview &amp; History</h1>
33 
34<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
35MameUI is an emulator.&nbsp; Simply put, it allows a PC to mimic the internal 
36hardware of a large number of stand-alone arcade machines from 1975 to 2003+.&nbsp; 
37Combined with the original ROMs from these arcade machines, MameUI will 
38display and play 
39the games on a PC.&nbsp; The software thinks it’s still running on its 
40original box.&nbsp; MameUI is the GUI version of Mame™, the M.ultiple A.rcade 
41M.achine E.mulator.&nbsp; It has an attractive, 
42elegant, graphical interface which allows the user to forego having to type 
43command line parameters, although it can still be passed these arguments.&nbsp; For many, 
44it’s easier to click the icon of the game.</p>
45<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
46</p>
47<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
48<b>1997.02.05</b> - In the beginning, Italian programmer and arcade preservationist, 
49Nicola Salmoria, combined his individual game emulators into the DOS based 
50multi-game emulator, Mame.&nbsp; It was released Feb. 05, 1997.&nbsp; Since the 
51source was also released, numerous people contributed new drivers to add support 
52for more and more games.&nbsp; The number of contributors grew into the hundreds 
53and has continued to increase over the years.</p>
54<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
55<b>1997.08</b> - Mame32 was the first port of Mame to the Microsoft Windows 
56platform.&nbsp; It originally came out in August of 1997, adding the GUI and a 
57considerable amount of new code to transition to Win32.&nbsp; The original 
58Mame32 was authored by Chris Kirmse and later integrated Michael Soderstrom's 
59Win32 command-line port of Mame.&nbsp; Michael then coordinated, maintained the 
60source, and produced the releases.&nbsp; Mike Haaland and John Hardy IV joined 
61the project in late 1997.&nbsp; Mike would wholly revamp the user interface to 
62its current state and continue collaborating on core development. John provided 
63testing, WIP updates, artwork, and served as the external point of contact for 
64the team.&nbsp; Mame32 
65releases followed the Mame DOS releases by a few days to a few weeks over the next 
66four years.</p>
67<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
68<b>2001.05.24</b> - With the inexorable phasing out of DOS, the authors of the 
69DOS based Mame ported it to the Microsoft Windows platform as a command line 
70application.&nbsp; Evolutionally similar to MameDOS, it is run by typing in arguments 
71from a command prompt, and has no GUI. [many people try to double click it, 
72which opens up the command line window briefly, displays a message, then closes].&nbsp;</p>
73<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
74<b>2001.07.24</b> - Mame32 was re-positioned, with the familiar GUI grafted onto 
75the new Mame Windows engine.&nbsp; Mame32 is currently maintained by Kirmse, 
76Haaland, and Hardy and is now released by John IV shortly after Mame on the <b>
77<a target="_blank" href="http://mameui.classicgaming.gamespy.com/">MameUI</a></b> site.</p>
78<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
79<strong>2007.11.11</strong> - Mame32 was rebranded as MameUI to avoid confusion 
80of the 64bit build and the core version.&nbsp; It is compiled as MameUI32 and 
81MameUI64 for the different target platforms.</p>
82 
83<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">&nbsp;</p>
84<p style="margin-left: 0in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
85<font size="1">
86<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-12 01:57 PM -0800<!--webbot bot="Timestamp" endspan i-checksum="38483" --> 
87/ john iv</font></p>
88 
89</body>
90 
91</html>
src/osd/winui/help/html/mameui_download.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Download Locations</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43<base target="_blank">
44</head>
45 
46<body background="../images/bkground.gif">
47 
48<h2>Download Locations</h2>
49<p class="MsoNormal">The official site for MameUI downloads:</p>
50<p class="MsoNormal">
51<a target="_blank" href="http://mameui.classicgaming.gamespy.com/">
52<span style="font-weight: 700; color: #0000FF; text-decoration: underline">The 
53MameUI Homepage</span></a></p>
54 
55<p class="MsoNormal">&nbsp;</p>
56<p class="MsoNormal"><font size="1">
57<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-12 02:03 PM -0800<!--webbot bot="Timestamp" endspan i-checksum="37667" --> 
58/ john iv</font></p>
59 
60</body>
61 
62</html>
src/osd/winui/help/html/mameui_support.htm
r0r1368
1<html xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
2 
3<head>
4<style type="text/css">
5div.Section1
6   {page:Section1;}
7 h1
8   {margin-top:12.0pt;
9   margin-right:0in;
10   margin-bottom:3.0pt;
11   margin-left:0in;
12   page-break-after:avoid;
13   font-size:16.0pt;
14   font-family:"Arial","sans-serif";
15   color:windowtext;
16   font-weight:bold;
17}
18p
19   {margin-right:0in;
20   margin-left:0in;
21   font-size:10.0pt;
22   font-family:"Arial","sans-serif";
23   color:black;
24}
25a:link
26   {color:blue;
27   text-decoration:underline;
28   text-underline:single;
29}
30</style>
31</head>
32 
33<body style="background-image: url('../images/bkground.gif')">
34 
35<div class="Section1">
36   <h1 style="mso-margin-bottom-alt: auto"><span style="COLOR: black">MameUI 
37   Troubleshooting [&amp; Tips]<o:p></o:p></span></h1>
38   <p style="MARGIN-TOP: 0in">MameUI has been in development since 1997.<span style="mso-spacerun: yes">&nbsp;
39   </span>It is mature, complex, and robust.&nbsp; However, since the Mame 
40   project itself is a documentation effort, and development is continuous, 
41   there will be times when changes to the core program effect MameUI.&nbsp; 
42   When problems do occur with a specific game in a specific version of MameUI, 
43   a previous version of MameUI may be used.&nbsp; </p>
44   <p style="MARGIN-TOP: 0in">MameUI is now an integrated GUI front end which 
45   passes user input from the GUI to the
46   <b style="mso-bidi-font-weight: normal"><a href="http://www.mamedev.org/">
47   <span style="COLOR: black">Mame</span></a></b> engine/core.<span style="mso-spacerun: yes">&nbsp;
48   </span>Thus, any problems that occur in the
49   <b style="mso-bidi-font-weight: normal"><a href="http://www.mamedev.org">
50   <span style="COLOR: black">Mame</span></a></b> engine will be inherited by 
51   MameUI.&nbsp; Prior to <b>
52   <a href="http://groups.msn.com/mameui/messageboard.msnw">
53   <span style="COLOR: black">reporting problems</span></a> </b>
54   <span style="mso-bidi-font-weight: bold">against MameUI</span>, verify that 
55   the issue is not a known, core defect in
56   <b style="mso-bidi-font-weight: normal"><a href="http://www.mamedev.org/">
57   <span style="COLOR: black">Mame</span></a></b>.&nbsp; The <b>
58   <a target="_blank" href="http://www.mametesters.org/">
59   <span style="COLOR: black">Mametesters.org</span></a></b> site is designed 
60   to track and report bugs in the baseline
61   <b style="mso-bidi-font-weight: normal"><a href="http://www.mamedev.org/">
62   <span style="COLOR: black">Mame</span></a></b> version.&nbsp; To find if a 
63   problem plagues the game in question, do an
64   <b style="mso-bidi-font-weight: normal">alt-enter</b> on the game and note 
65   its driver/source name at the bottom of the general properties tab; then 
66   search the Mametesters’ bug database and search their
67   <b style="mso-bidi-font-weight: normal">
68   <a href="http://www.mameworld.info/ubbthreads/postlist.php?Cat=&amp;Board=mametesters">
69   <span style="COLOR: black">message board</span></a></b>.<span style="mso-spacerun: yes">&nbsp;
70   </span>The current list of known MameUI specific issues and defect tracking 
71   is available at <b>
72   <a target="_blank" href="http://mameui.classicgaming.gamespy.com//MameUI_Bugs.xls">
73   <span style="COLOR: black">MameUI</span></a></b>.&nbsp; &nbsp;</p>
74   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
75   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">ROMs and 
76   CHDs Related Topics</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
77   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
78   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
79   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
80   </span></span></span>Utilization of an external ROMs management utility like
81   <b style="mso-bidi-font-weight: normal"><a href="http://www.clrmame.com/">
82   <span style="COLOR: black">Clrmame</span></a></b> is recommended for repair 
83   and identification of damaged sets.</p>
84   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
85   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
86   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
87   </span></span></span>If receiving missing ROMs error messages when 
88   attempting to run a game, secondary click on the game in the list and choose 
89   properties, do an audit on that game [or use <b>Alt-A</b>].<span style="mso-spacerun: yes">&nbsp;
90   </span>The audit will determine which files are missing from the ROMset 
91   currently being played.<span style="mso-spacerun: yes">&nbsp; </span>MameUI 
92   will not run a game which fails its internal audit.</p>
93   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
94   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
95   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
96   </span></span></span>Mame is an ongoing documentation project. Sometimes old 
97   ROM sets are found to have miss-dumped, missing, or damaged ROMs, which need 
98   to be replaced.&nbsp; As new versions of Mame are released, the Mame 
99   developers add support for these new iterations of ROMs, supplanting or 
100   renaming the old supported versions.<span style="mso-spacerun: yes">&nbsp;
101   </span>Thus, often, older versions of ROMs which did work in older versions 
102   of MameUI, will <u>not</u> work with newer versions of MameUI because they 
103   are now read as incomplete or wrong.<span style="mso-spacerun: yes">&nbsp;
104   </span>MameUI will not play the game in question until the updated ROMs are 
105   utilized.</p>
106   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
107   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
108   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
109   </span></span></span>MameUI utilizes the idea of a parent / clone 
110   relationship for its games.&nbsp; If trying to play a clone or a bootleg of 
111   a game, MameUI will need the ROMs for the clone game, <b>and</b> the parent 
112   set.&nbsp; MameUI indicates the parent set of a clone at the bottom of the 
113   game’s properties tab, or more easily in grouped view, View \ Grouped.</p>
114   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
115   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
116   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
117   </span></span></span>MameUI utilizes the idea of having single zip files to 
118   house the BIOS files for a large number of similar games.<span style="mso-spacerun: yes">&nbsp;
119   </span>The NeoGeo games for example, share upwards of ten BIOS files in 
120   every game.&nbsp; Mame will look to neogeo.zip as the BIOS zip, if this file 
121   is freestanding along with the other NeoGeo games, it will use it. 
122   Otherwise, MameUI expects all the BIOS files in every NeoGeo game’s zip 
123   file. DECO cassette, PGM, and Playchoice are some examples of other BIOS 
124   games.&nbsp; An error message will occur if the BIOS files are not present 
125   and those games are run.<span style="mso-spacerun: yes">&nbsp; </span>
126   Occasionally, new ROMs will need to be added to the BIOS packages 
127   themselves, this occurred recently with the ‘ng-lo.rom’ and then 6 new 
128   regional BIOSes in the neogeo.zip. MameUI will not audit a game as correct 
129   without all the BIOS files with the correct CRC, while it may however be 
130   possible to play the game after an error message.</p>
131   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
132   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
133   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
134   </span></span></span>Games that support .CHD [compressed hunks of data] 
135   images [Max Force, Killer Instinct I &amp; II, Area 51, Vicious Circle, War 
136   Gods, beatmania games, and items in the CHD folder view on the left pane] 
137   have to have their ROMs and .CHD files in a very specific directory 
138   structure. The <b style="mso-bidi-font-weight: normal">single</b> large .CHD 
139   file needs to go in the \ROMs\gamename\ directory, and have the *.CHD 
140   extension, e.g. \ROMs\area51\area51.chd.<span style="mso-spacerun: yes">&nbsp;
141   </span>These games also have ROMs, these go one level up in the \ROMs folder 
142   proper like any other game.<span style="mso-spacerun: yes">&nbsp; </span>So 
143   in the end two files should exist for these games one *.zip in the \ROMs 
144   folder and the *.chd in a sub-directory named for the game.<span style="mso-spacerun: yes">&nbsp;
145   </span></p>
146   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
147   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
148   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
149   </span></span></span><b>F5 </b>/ View • Refresh in the GUI. (Do this anytime 
150   ROMs are altered, renaming, etc.)</p>
151   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
152   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
153   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
154   </span></span></span>If games are not displaying in the game list, ensure 
155   the appropriate folder view on the far left is toggled, i.e. 'all games' and 
156   it doesn't have filtering on it to stop the display of the game being 
157   searched for.</p>
158   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
159   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
160   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
161   </span></span></span>Use the Options • Reset to default menu choice and 
162   check all of the items, restart MameUI.</p>
163   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l5 level1 lfo2; tab-stops: list .5in">
164   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
165   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
166   </span></span></span>Final option, manually delete the MameUI32/64.ini and the 
167   Mame.ini file in the \ini directory.</p>
168   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
169   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Crash 
170   Related Topics</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
171   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
172   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
173   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
174   </span></span></span>Delete the \cfg\*.CFG, \diff\*.DIF, \ini\*.INI, or 
175   \nv\*.NV files for the game that's crashing.</p>
176   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
177   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
178   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
179   </span></span></span>Check to see that the zip file is valid and that it's 
180   not corrupt or read-only.</p>
181   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
182   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
183   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
184   </span></span></span>Verify the presence of the \ini directory under 
185   MameUI.exe’s location.</p>
186   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
187   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
188   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
189   </span></span></span>If versions of MameUI prior to .66 had been installed 
190   on the system, verify that the old registry key has been deleted with 
191   regedit.exe. HKEY_CURRENT_USER/Software/Freeware/Mame32</p>
192   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
193   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
194   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
195   </span></span></span>If crashing during an audit or an [<b>F5</b>] refresh, 
196   it could be a corrupt .zip file. &nbsp;Extract it and re-zip. Pkunzip -t *.zip. 
197   Note the file that dies during the audit and concentrate on that one. Also 
198   verify that if zip files are not used, that the folder is not empty, or 
199   contains partial or damaged ROMs.<span style="mso-spacerun: yes">&nbsp;
200   </span>Utilization of an external ROMs management utility like
201   <b style="mso-bidi-font-weight: normal"><a href="http://www.clrmame.com/">
202   <span style="COLOR: black">Clrmame</span></a></b> is recommended for repair 
203   and identification of damaged sets.</p>
204   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
205   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
206   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
207   </span></span></span>If seeing crashes or weird screen coloration, try 
208   disabling running background apps [in Win98, use msconfig.exe], Norton 
209   Crashguard, PnP programs like Kaaza, eDonkey, LimeWire, popup killers, 
210   viruscans, MS Office Fast Find, the Microsoft Office Bar, Intellimouse, even 
211   IE subscription updates, etc. Try moving MameUI away from compressed 
212   [DriveSpace, DoubleSpace, stacker] drives.&nbsp; IntelliMouse and Office 
213   Toolbars have been known to cause conflicts.<span style="mso-spacerun: yes">&nbsp;
214   </span>Also disable items in the system tray, like the CD player, etc.&nbsp; 
215   It may also be necessary to download and install the latest version of 
216   DirectX from Microsoft to prevent some errors.</p>
217   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
218   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
219   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
220   </span></span></span>If MameUI crashes with an access violation it may be 
221   the DEP (Data Execution Prevention) setting on that machine.<span style="mso-spacerun: yes">&nbsp;
222   </span>Add MameUI to the exception list in Control Panel / System / Advanced 
223   / DEP.</p>
224   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
225   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
226   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
227   </span></span></span>In some instances games may fail to start if the 
228   installed directory path contains a large number of characters and spaces, 
229   to alleviate this, install MameUI and its support directory structure into a 
230   shorter path name, i.e. c:\MameUI\.</p>
231   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
232   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
233   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
234   </span></span></span>MameUI may fail to launch its games in situations where 
235   an errant, non-DX compliant, or badly written gamepad USB adapter 
236   driver/software is used.<span style="mso-spacerun: yes">&nbsp; </span>This 
237   includes some cheap Playstation, SNES, U64 converters.</p>
238   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
239   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
240   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
241   </span></span></span>Games may fail to start if a video cards DirectX driver 
242   is flakey, utilise an earlier one to test or re-install DirectX.</p>
243   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
244   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
245   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
246   </span></span></span>Some recent viruses which attach to .exes will cause 
247   page faults and access violations in MameUI when it's run.&nbsp; Use an 
248   anti-virus check and verify MameUI is not infected.</p>
249   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
250   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
251   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
252   </span></span></span>Odd behaviour may be exhibited in NT based systems if 
253   attempting to run games while security/permissions settings do not allow it 
254   or the user is not an administrator or member of the administrator’s group.</p>
255   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
256   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
257   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
258   </span></span></span>Some anti-virus packages may slow down navigation 
259   within the MameUI directory.<span style="mso-spacerun: yes">&nbsp; </span>
260   These are false positives and the anti-virus vendors should update their 
261   virus dat signatures.<span style="mso-spacerun: yes">&nbsp; </span>It may 
262   also be possible to exclude the MameUI.exe from real-time scanning as a 
263   workaround.</p>
264   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
265   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
266   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
267   </span></span></span>In the event of MameUI not launching a game and just 
268   sitting there, try placing the entire MameUI directory and its 
269   sub-directories including \ROMs into a more simple path, like c:\MameUI 
270   instead of &quot;c:\Games for Fun\MameUI Goes Here\&quot;.<span style="mso-spacerun: yes">&nbsp;
271   </span>Simplify the path.</p>
272   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
273   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
274   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
275   </span></span></span>On rare occasions malformed or damaged *.dat files 
276   [history.dat, mameinfo.dat, cheat.dat] can cause MameUI to error on startup 
277   when it tries to read them.<span style="mso-spacerun: yes">&nbsp; </span>
278   Remove those files individually to check for the one causing the crash.</p>
279   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
280   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
281   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
282   </span></span></span>With the move to XML based Controller *.cfg files in 
283   the .8x era it is necessary to remove the old \Ctrlr\*.ini files and use 
284   their new *.cfg counterparts, otherwise MameUI may launch games then 
285   immediately return to the GUI.</p>
286   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
287   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
288   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
289   </span></span></span>Use the Options • Reset to default menu choice and 
290   check all of the items, restart MameUI.</p>
291   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .5in">
292   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
293   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
294   </span></span></span>Final option, manually delete the MameUI32/64.ini and the 
295   Mame.ini file in the \ini directory.</p>
296   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
297   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Performance 
298   Related Topics [incl. sound scratchiness and stuttering]</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
299   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
300   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
301   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
302   </span></span></span>MameUI will start to crackle, scratch, or echo if the 
303   game running is too taxing for the processor in use. This can be visually 
304   confirmed by turning on FPS display with [<b>F11</b>], and frame skip to 
305   auto with [<b>F8</b>].&nbsp; If the FPS dips anywhere or frame skipping 
306   rises anywhere during the game play, the game is maxing out the CPU and 
307   sound breakup could occur.<span style="mso-spacerun: yes">&nbsp; </span>If 
308   upgrading machine components, provide MameUI with as much hardware as 
309   possible; a faster CPU makes the most difference, followed by video card, 
310   and RAM.</p>
311   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
312   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
313   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
314   </span></span></span>MameUI will start to 'skip' sound on games that run 
315   slightly over the host monitor refresh rate in full-screen mode with 
316   triplebuffer.&nbsp; For example, Pac-Man and other early Namco games run at 
317   60.60Hz and if they are run on a fixed 60Hz LCD monitor using triplebuffer 
318   they will skip since the emulation is outpacing the monitor. In this 
319   instance it is necessary to toggle on the 'Refresh Speed' switch in the 
320   Options • Default Options • Advanced tab.&nbsp; This issue can also be 
321   overcome by running the game in windowed mode.</p>
322   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
323   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
324   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
325   </span></span></span>With the advent of MameUI .120 some historically 
326   hardware punishing games become playable on high end overclocked [3.6Ghz+] 
327   Intel Core2Duo and Quad Cores.&nbsp; These processors combined with 64bit 
328   operating systems and native 64bit MameUI provide almost 100% playability in 
329   namcos21.c / namcos22.c / seattle.c and midvunit.c games.</p>
330   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
331   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
332   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
333   </span></span></span>Some of the largest games supported by MameUI [NeoGeo 
334   mainly] can run into the hundreds of megabyte range when they are 
335   uncompressed into memory, this combined with MameUI in memory, plus OS 
336   overhead can lead to very slow performance as Windows swaps the information 
337   out to disk if there is not enough physical memory.&nbsp; 512M to 1G of 
338   memory is recommended for all current games [.118].</p>
339   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
340   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
341   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
342   </span></span></span>As Mame has continued development, infrastructure and 
343   accuracy has improved.<span style="mso-spacerun: yes">&nbsp; </span>As such, 
344   the optimization point of the games has shifted so that older games may be 
345   slower unthrottled overall than when run on earlier versions.<span style="mso-spacerun: yes">&nbsp;
346   </span>For example, in version .36 Donkey Kong may have run unthrottled at 
347   1900 FPS, but in .77 it runs 1500 FPS.<span style="mso-spacerun: yes">&nbsp;
348   </span>Regardless, modern machines should have no problem running these 
349   earlier games at their intended 60 FPS rate.</p>
350   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
351   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
352   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
353   </span></span></span>Periodically, speed-up hacks in the core code will be 
354   removed to provide more accurate emulation of the games.<span style="mso-spacerun: yes">&nbsp;
355   </span>This can result in a drop in FPS for that particular family of games, 
356   but can be offset by upgrading the machine Mame is used on.</p>
357   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
358   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
359   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
360   </span></span></span>AMD’s Cool ‘n Quiet technology on certain setups has 
361   been known to cause slowdowns and lags while working in the MameUI GUI as 
362   well as causing some in-game sound and graphic stuttering.<span style="mso-spacerun: yes">&nbsp;
363   </span>Disable the feature in the BIOS to verify.</p>
364   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
365   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
366   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
367   </span></span></span>On certain system setups (older), DirectDraw may be a 
368   faster option than the D3D settings.<span style="mso-spacerun: yes">&nbsp;
369   </span>Choose Ddraw as the video mode in Default Options • Display. </p>
370   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
371   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
372   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
373   </span></span></span>If seeing a severe slowdown in games that previously 
374   didn't, toggle the Use less CPU time if possible menu item in Options • 
375   Default Options • Miscellaneous.&nbsp; This happens to laptop users 
376   particularly.</p>
377   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
378   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
379   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
380   </span></span></span>Certain games in MameUI perform better on machines that 
381   cannot handle them 100% if auto-frame skipping is turned <b>off</b>.&nbsp;
382   </p>
383   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
384   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
385   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
386   </span></span></span>Certain games if run with D3D settings will perform 
387   better if Triplebuffering is set to <b style="mso-bidi-font-weight: normal">
388   off</b>.<span style="mso-spacerun: yes">&nbsp; </span>D3D will double buffer 
389   if triple is turned off.</p>
390   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
391   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
392   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
393   </span></span></span>There may be certain sound anomalies in games if the 
394   *.cfg files have become damaged, delete all the files in \cfg to remedy.</p>
395   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
396   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
397   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
398   </span></span></span>If games are running too <b>fast</b>, verify in the 
399   Options • Default Game Options menu that the throttle option is turned <b>on</b>, 
400   that sync to monitor refresh is turned <b>off </b>and Wait for Vertical Sync 
401   is turned <b>off</b> in the Options • Default Game Options • Advanced menu.<span style="mso-spacerun: yes">&nbsp;
402   </span></p>
403   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
404   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
405   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
406   </span></span></span>MameUI video performance can be greatly enhanced if 
407   running in 32bpp mode by ensuring AGP Fast Writes are toggled on in the 
408   motherboard BIOS.<span style="mso-spacerun: yes">&nbsp; </span>The videocard 
409   drivers also need to support this setting, the switch for this may be in the 
410   advanced tab of the Windows display control panel applet.</p>
411   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
412   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
413   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
414   </span></span></span>There are some soundcards like early PCI
415   <span class="SpellE">Soundblasters</span> 128 that will cause scratchiness 
416   if their hardware acceleration is turned up too high.&nbsp; Move the slider 
417   down various steps to troubleshoot in Control Panel • Sound • Advanced 
418   Audio.</p>
419   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
420   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
421   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
422   </span></span></span>There are some older video card/video driver 
423   combinations that <b>can</b> do hardware stretching, but are slower than 
424   running with hardware stretch <b>off</b>. If games are too sluggish with the 
425   hw stretch on, toggle it off if possible.&nbsp; Some PCI graphic cards have 
426   been seen to have this problem.</p>
427   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo6; tab-stops: list .5in">
428   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
429   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
430   </span></span></span>If a large number of icons are being used in the GUI, 
431   it is typically quicker to unzip them into the \icons folder instead of 
432   leaving them zipped as icons.zip.</p>
433   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
434   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Joysticks / 
435   Mice / Gamepad / Lightgun Related Topics</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
436   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l6 level1 lfo8; tab-stops: list .5in">
437   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
438   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
439   </span></span></span>Gamepads and mouse are disabled by default on first 
440   MameUI launch, enable them by toggling their check boxes on in Options • 
441   Default Options • Controllers.</p>
442   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l6 level1 lfo8; tab-stops: list .5in">
443   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
444   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
445   </span></span></span>MameUI relies on DirectX’s DirectInput for joystick 
446   support, ensure the game pad is seen as present and active in the game 
447   controller control panel: start menu • settings • control panel • game 
448   controllers.</p>
449   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l6 level1 lfo8; tab-stops: list .5in">
450   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
451   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
452   </span></span></span>If seeing keys ‘stick’ while playing, verify that the 
453   operating systems’ accessibility options and their shortcut keys are turned 
454   off, things like ‘sticky keys’, and verify that Popup killers or other 
455   resident programs are not mapped to the sticking key.<span style="mso-spacerun: yes">&nbsp;
456   </span>Also keys can stick on some KVM switch boxes if their hotkey switches 
457   are set to [<b style="mso-bidi-font-weight: normal">Ctrl</b>] etc.</p>
458   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l6 level1 lfo8; tab-stops: list .5in">
459   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
460   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
461   </span></span></span>Daisy chained gameport Microsoft Sidewinders [original] 
462   in Win2k or XP do not work very well.&nbsp; Use USB gamepads instead. Single 
463   Sidewinders may also cause odd behavior like ghost button presses.</p>
464   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l6 level1 lfo8; tab-stops: list .5in">
465   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
466   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
467   </span></span></span>Lightguns and mice are treated like mappable joysticks 
468   in current versions of Mame.<span style="mso-spacerun: yes">&nbsp; </span>If 
469   multiple mice are in use it is necessary to enter the in-game [<b style="mso-bidi-font-weight: normal">TAB</b>] 
470   menu and map their axes in the ‘Input General’ section.</p>
471   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
472   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Settings 
473   Topics</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
474   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
475   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
476   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
477   </span></span></span>With the advent of version 0.66 MameUI no longer stores 
478   its configuration information in the Windows registry, it stores it in 
479   \MameUI32/64.ini and \ini\Mame.ini.<span style="mso-spacerun: yes">&nbsp;
480   </span>To remove vestiges of the old versions, run regedit.exe and delete 
481   the following key: HKEY_CURRENT_USER\Software\Freeware\MameUI.</p>
482   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
483   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
484   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
485   </span></span></span>If having trouble saving keyboard mappings and 
486   configuration, verify that the *.cfg files are not read-only and that a 
487   \MameUI\cfg directory is present.</p>
488   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
489   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
490   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
491   </span></span></span>If GUI settings and/or audit results aren’t being 
492   maintained, verify the existence of a writeable MameUI32/64.ini and that the 
493   \ini directory is present and writeable [not read only] under the MameUI.exe 
494   location.</p>
495   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
496   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
497   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
498   </span></span></span>If baseline Mame settings like directories and game 
499   options are not being maintained, verify the existence of a writeable 
500   Mame.ini [not read-only] in the \ini directory and that the \ini directory 
501   itself is writeable.</p>
502   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
503   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
504   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
505   </span></span></span>If experiencing odd behavior with MameUI saving files 
506   or not appearing to clear its settings, verify that there are not multiple 
507   shortcuts pointing to different versions, that an .exe is not being used by 
508   itself instead of a shortcut to the .exe, or a shortcut pointing to an old 
509   version of the .exe.<span style="mso-spacerun: yes">&nbsp; </span>Also 
510   verify that there are not multiple versions of MameUI running in memory as 
511   the last one out will save the settings.</p>
512   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
513   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
514   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
515   </span></span></span>If seeing MameUI folders being created on the desktop, 
516   verify that the .exe itself is not sitting on the desktop and being launched 
517   which is not correct. Verify that a short-cut to the original is being 
518   properly utilised.<span style="mso-spacerun: yes">&nbsp; </span>This means 
519   setting the properties on the shortcut to ‘start in’ the appropriate 
520   directory that the original .exe resides in.</p>
521   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
522   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
523   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
524   </span></span></span>If the in-game [<b>TAB</b>] menu is no longer working 
525   or can’t be accessed, it has been mapped to another key; delete the 
526   default.cfg file in the \MameUI\cfg directory.</p>
527   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
528   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
529   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
530   </span></span></span>If in-game [<b style="mso-bidi-font-weight: normal">TAB</b>] 
531   settings need to be completely reset due to bad mappings, delete the 
532   default.cfg file in the \MameUI\cfg directory.</p>
533   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
534   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
535   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
536   </span></span></span>To remove the mappings on an individual game from the [<b style="mso-bidi-font-weight: normal">TAB</b>] 
537   menu, delete its *.cfg file in the \MameUI\cfg directory, i.e. dkong.cfg, 
538   asteroid.cfg.</p>
539   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
540   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
541   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
542   </span></span></span>If having trouble mapping keys with the [<b style="mso-bidi-font-weight: normal">TAB</b>] 
543   menu, verify the game is not paused while mapping.</p>
544   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
545   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
546   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
547   </span></span></span>MameUI inherits a limit from baseline Mame on the 
548   amount of characters that can be used for the ROM paths.<span style="mso-spacerun: yes">&nbsp;
549   </span>If directory settings are not being maintained, pare down the number 
550   and names of the directories being added or simply use a single \ROMs 
551   directory which MameUI expects.</p>
552   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
553   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
554   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
555   </span></span></span>If having trouble getting games to display in the 
556   proper orientation [they will not rotate] verify that rotation is set to 
557   default, and that there are no video-card specific hot-keys set in Windows’ 
558   advanced display settings tab that could impact rotation, ATI and NVIDIA 
559   both now include the ability to rotate the Windows screen to portrait 
560   orientation.</p>
561   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
562   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
563   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
564   </span></span></span>If games are appearing sideways regardless of rotation 
565   settings, an onboard Intel graphic chipset or similar may be in use.<span style="mso-spacerun: yes">&nbsp;
566   </span>Disable the auto rotation capabilities of the Intel graphic chip.</p>
567   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
568   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
569   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
570   </span></span></span>MameUI now supports the core’s –<span class="SpellE">mt</span> 
571   switch.<span style="mso-spacerun: yes">&nbsp; </span>This allows 
572   multi-threading of the final video blit during games. Dual core chips [X2, 
573   C2D, etc.] can take advantage of this feature to offload the work to the 
574   second thread and make MameUI more efficient.<span style="mso-spacerun: yes">&nbsp;
575   </span>Speed gains are seen on the unthrottled GPU bound games like dkong, 
576   invaders, etc.</p>
577   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo10; tab-stops: list .5in">
578   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
579   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
580   </span></span></span>MameUI now stores its settings in external *.ini files 
581   instead of the registry.<span style="mso-spacerun: yes">&nbsp; </span>If it 
582   is necessary to return MameUI to baseline, simply delete the MameUI32/64.ini 
583   file and the Mame.ini file in the \ini directory.<span style="mso-spacerun: yes">&nbsp;
584   </span>The next time MameUI runs it will recreate those files with the 
585   default settings.</p>
586   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
587   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">GUI Related 
588   Topics &amp; Miscellaneous Tips</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
589   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
590   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
591   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
592   </span></span></span>MameUI will read freestanding icons in the \icons 
593   directory first, then icons in the icons.zip file.&nbsp; </p>
594   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
595   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
596   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
597   </span></span></span>If seeing icon palette corruption in the GUI when 
598   returning from a full screen game, try increasing the desktop color depth to 
599   24bpp or 32bpp.</p>
600   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
601   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
602   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
603   </span></span></span>Sometimes icons in large icon view may appear to be 
604   missing their white color or have portions transparent, this is the result 
605   of having white chosen as the windows desktop window setting in Control 
606   Panel / Display.&nbsp; Change the window setting to slightly off-white or 
607   another color to return the icons to their appropriate look.</p>
608   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
609   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
610   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
611   </span></span></span>To toggle the MameUI UI fullscreen [no Windows titlebar 
612   and potentially no toolbar or status bar] and back use the [<b style="mso-bidi-font-weight: normal">F11</b>] 
613   key.</p>
614   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
615   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
616   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
617   </span></span></span>The GUI text may disappear from the folder view if the 
618   GUI font color chosen is very close to the Windows system background color 
619   scheme or if it is a large enough font [or bold] to anti-alias. </p>
620   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
621   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
622   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
623   </span></span></span>MameUI no longer supports *.bmp format and may show a 
624   blank or empty background if a *.bmp is erroneously renamed and used for 
625   bkground.png, or if the bkground directory is marked as read only and MameUI 
626   cannot create the bkground.png file when run.</p>
627   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
628   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
629   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
630   </span></span></span>To return to a blank gray background in the GUI, delete 
631   the bkground.png file in the \MameUI\bkground directory.</p>
632   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
633   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
634   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
635   </span></span></span>Quickly navigate through games in the details view by 
636   simply typing the first few letters in the name of the game, the highlight 
637   will jump to that game and become more granular as the name is typed out.</p>
638   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
639   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
640   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
641   </span></span></span>Select a random game with [<b>Ctrl-R</b>].</p>
642   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
643   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
644   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
645   </span></span></span>Audit an individual game with [<b>Alt-A</b>].</p>
646   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
647   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
648   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
649   </span></span></span>Various arcade game controller companies produce custom 
650   made configuration files for their setups; these *.cfg files need to go in 
651   the \MameUI\ctrlr folder to be recognized in the MameUI controllers tab.<span style="mso-spacerun: yes">&nbsp;
652   </span>These files are the responsibility of the controller companies 
653   themselves and are not included or endorsed by MameUI, they can typically be 
654   found at the companies’ web sites.</p>
655   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
656   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
657   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
658   </span></span></span>In grouped view, clones are indented regardless of 
659   whether their parents are visible; in a non-All Games folder this means that 
660   there is not a direct relationship of a clone to the game item above it if 
661   that games’ parent is not shown.&nbsp; This behaviour can be changed by the 
662   setting Interface Options • No offset for clones missing parent in view.</p>
663   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
664   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
665   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
666   </span></span></span>Certain items in the GUI may be missing if MameUI is 
667   run on a Win2K/XP box and the user is not an admin or member of the admin 
668   group.</p>
669   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo12; tab-stops: list .5in">
670   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
671   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
672   </span></span></span>The unavailable folder and the available filter are 
673   disabled in MameUI due to a direct request from Nicola.</p>
674   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
675   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Keyboard 
676   Shortcuts</span></strong><span style="FONT-SIZE: 12pt"><o:p></o:p></span></p>
677   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo14; tab-stops: list .5in">
678   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
679   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
680   </span></span></span><b style="mso-bidi-font-weight: normal">Type letters of 
681   game name</b> to jump directly to its first instance.<span style="mso-spacerun: yes">&nbsp;
682   </span><b style="mso-bidi-font-weight: normal">Alt-1 through Alt-7</b>: 
683   Toggle art views.<span style="mso-spacerun: yes">&nbsp; </span>
684   <b style="mso-bidi-font-weight: normal">Alt-A</b>: Audit selected game.<span style="mso-spacerun: yes">&nbsp;
685   </span><b style="mso-bidi-font-weight: normal">Alt-B</b>: Toggle art tabs.<span style="mso-spacerun: yes">&nbsp;
686   </span><b style="mso-bidi-font-weight: normal">Alt-D</b>: Toggle folder 
687   pane.<span style="mso-spacerun: yes">&nbsp; </span>
688   <b style="mso-bidi-font-weight: normal">Alt-P</b>: Toggle screenshot area.<span style="mso-spacerun: yes">&nbsp;
689   </span><b style="mso-bidi-font-weight: normal">Alt-S</b>: Toggle status bar.
690   <b style="mso-bidi-font-weight: normal">Alt-T</b>: Toggle toolbar.
691   <b style="mso-bidi-font-weight: normal">Alt-U</b>: Audit selected folder.
692   <b style="mso-bidi-font-weight: normal">Alt-Enter</b>: Show games’ 
693   properties.<span style="mso-spacerun: yes">&nbsp; </span>
694   <b style="mso-bidi-font-weight: normal">Ctrl-F</b>: Text filter.<span style="mso-spacerun: yes">&nbsp;
695   </span><b style="mso-bidi-font-weight: normal">Ctrl-R</b>: Choose random 
696   game from GUI. <b style="mso-bidi-font-weight: normal">Ctrl-Page Up</b>: 
697   Scroll up in history.dat text window.<span style="mso-spacerun: yes">&nbsp;
698   </span><b style="mso-bidi-font-weight: normal">Ctrl-Page Down</b>: Scroll 
699   down in history.dat text window. <b style="mso-bidi-font-weight: normal">F11</b>: 
700   Fullscreen mode toggle.</p>
701   <p style="BACKGROUND: white; MARGIN: 0in 0in 5pt 0.25in"><strong>
702   <span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Arial','sans-serif'">Refresh 
703   Restart Instructions<o:p></o:p></span></strong></p>
704   <p style="MARGIN: 0in 0in 5pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo14; tab-stops: list .5in">
705   <span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol">
706   <span style="mso-list: Ignore">·<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
707   </span></span></span><b style="mso-bidi-font-weight: normal">a.</b> 
708   Re-download the binary dist package from
709   <a href="http://mameui.classicgaming.gamespy.com/">
710   <span style="COLOR: black">MameUI</span></a>.<span style="mso-spacerun: yes">&nbsp;
711   </span><b style="mso-bidi-font-weight: normal">b.</b> Disable running 
712   anti-virus packages before extracting the files.
713   <b style="mso-bidi-font-weight: normal">c.</b> Double-click the 
714   self-extracting archive. <span style="mso-spacerun: yes">&nbsp;</span><b style="mso-bidi-font-weight: normal">d.</b> 
715   When prompted, enter “c:\” [no quotes] as the destination folder.<span style="mso-spacerun: yes">&nbsp;
716   </span><b style="mso-bidi-font-weight: normal">e.</b> Launch MameUI by 
717   double-clicking its .exe, allow the audit/refresh to finish, it should go 
718   quick as there are no ROMs.<span style="mso-spacerun: yes">&nbsp; </span>
719   <b style="mso-bidi-font-weight: normal">f.</b> Put a couple of zipped ROMs 
720   from <a href="http://www.mamedev.org/roms"><span style="COLOR: black">
721   mamedev.org</span></a> in the c:\MameUI\ROMs directory.<span style="mso-spacerun: yes">&nbsp;
722   </span><b style="mso-bidi-font-weight: normal">g.</b> Launch MameUI, audit 
723   the two games individually with [<b style="mso-bidi-font-weight: normal">Alt-A</b>].<span style="mso-spacerun: yes">&nbsp;
724   </span><b style="mso-bidi-font-weight: normal">h.</b> Launch Robby or 
725   Gridlee.<span style="mso-spacerun: yes">&nbsp; </span>
726   <b style="mso-bidi-font-weight: normal">i.</b> Quit the game, then quit 
727   MameUI.<span style="mso-spacerun: yes">&nbsp; </span>
728   <b style="mso-bidi-font-weight: normal">j.</b> Add more ROMs and try again.<br style="mso-special-character: line-break">
729   <br style="mso-special-character: line-break">
730   </p>
731   <p style="MARGIN: 0in 0in 5pt 0.25in"><span style="FONT-SIZE: 8pt">
732   <span style="mso-no-proof: yes">8/17/2007 1:17:01 AM</span> / john iv<o:p></o:p></span></p>
733</div>
734 
735 
736</html>
src/osd/winui/help/html/mameui_optionsmenu.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Options Menu</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>Options Menu</h2>
48<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
49<span style="font-family: Symbol">
50<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
51</span></span><b>Game List Font</b> :&nbsp; Selecting this option from the options 
52menu will change the font used for the GUI display.</p>
53<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
54<span style="font-family: Symbol">
55<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
56</span></span><b>Game List Clone Color</b> :&nbsp; Selecting this option from the options 
57menu will change the font color used for the GUI display of clones in the 
58'Grouped' game list view.</p>
59<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
60<span style="font-family: Symbol">
61<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
62</span></span><b>Directories </b>: Selecting this option from the options menu 
63will allow for choosing a different directory for a number of MameUI support 
64files including: ROMs, samples, config, high scores, snapshots, input files, 
65state, artwork, memory card, flyers, cabinets, marquees, and nvram.&nbsp; Normally 
66these directories are created under the MameUI executable’s directory.</p>
67<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
68<span style="font-family: Symbol">
69<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
70</span></span><b><a href="mame32_properties.htm">Default Options</a> </b>: Selecting this option from the options 
71menu will allow for the global customization of all games in the game list.&nbsp; 
72These settings are overridden by altering the individual game settings using the 
73File • Properties menu item.</p>
74<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
75<span style="font-family: Symbol">
76<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
77</span></span><b>Reset to Default </b>: Selecting this option from the options 
78menu will allow for resetting various parts of MameUI to their defaults.&nbsp; 
79MameUI 
80will prompt before resetting, giving the option to cancel. </p>
81<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
82<span style="font-family: Symbol">
83<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
84</span></span>
85<span style="font-style:normal; font-variant:normal; font-weight:700">Interface</span><b> 
86Options </b>: Selecting this option from the options 
87menu will allow: <br>Toggling on or off the search for new games on start.<br>Toggling on or off the ability to use a game pad to navigate the GUI 
88(see mame32ui.ini for examples).<br>
89Toggling on or off the ability to use a keyboard encoder solution to 
90navigate the GUI and launch games [helpful in Mame cabs] (see mame32ui.ini for 
91examples).<br>Selecting a random image from the \bkground directory on startup.<br>
92Toggling on or off MameUI broadcasting 
93the selected game programmatically to other listening applications like message 
94clients, or an LED message bar, <br>The cursor to be hidden [helpful in Mame 
95cabs].<br>
96Selecting inheritable filters, this allows parent folders to set the filters 
97for their children sub-folders.<br>
98No offset for clones missing parent in view toggle will cause clones not be 
99indented if the parent game is not present due to current folder view, missing 
100ROMs, or filtering.<br>Allow history.dat file to be displayed under any, all, or none of the art 
101views.<br>
102Show game caption toggles the titlebar and controls in windowed mode, if 
103off, only a single frame will surround the playing game.&nbsp; If on, the full 
104titlebar will appear complete with icon and name of the game being played.<br>
105Globally clear the play time and number of times played counters.<br>
106Stretch screenshot to larger size, this will enlarge the items in the art 
107pane scaling them upwards depending on the size of the GUI.<br>Screenshot border size and color creates a user defined border around the 
108art work in the art pane on the right, set to zero to remove borders completely.</p>
109<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
110&nbsp;</p>
111<blockquote>
112   <p class="MsoNormal" style="margin-left: 0; margin-bottom:0">
113   <img border="0" src="../images/int.jpg" width="500" height="347"></p>
114</blockquote>
115<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
116&nbsp;</p>
117<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
118<span style="font-family: Symbol">
119<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
120</span></span><b>Background Image </b>: Selecting this option from the options menu 
121allows the choosing of a background image from the \bkground directory.&nbsp; 
122This image will be displayed beneath the three window panes in the GUI. </p>
123<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
124&nbsp;</p>
125<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
126<font size="1">
127<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
128/ john iv</font></p>
129 
130</body>
131 
132</html>
src/osd/winui/help/html/mameui_art.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Art &amp; Support Files</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41div.Section1
42   {page:Section1;}
43.style1 {
44   font-weight: bold;
45}
46-->
47</style>
48<base target="_blank">
49</head>
50 
51<body background="../images/bkground.gif">
52 
53<h2>Art &amp; Support Files</h2>
54<p class="MsoNormal">MameUI's flexible GUI framework allows for some beautiful 
55customization; including font color, icons, screenshot art, and background images.&nbsp; 
56The official site for the snaps and icons is <b>
57<a target="_blank" href="http://mameui.classicgaming.gamespy.com/">MameUI</a></b>.&nbsp; The following files are used for this customization.</p>
58<p class="MsoNormal">&nbsp;</p>
59<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
60<span style="font-family: Symbol">
61<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
62</span></span><b>
63<a style="color: blue; text-decoration: underline; text-underline: single" target="_blank" href="http://mameui.classicgaming.gamespy.com/">Icons.zip</a></b> 
64: This file contains icons for every game in MameUI and the folder view on the 
65far left.&nbsp; Place it in the \MameUI\icons folder, it can remain zipped to 
66save slack HD space but the zip file must be named icons.zip.</p>
67<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
68<span style="font-family: Symbol">
69<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
70</span></span><b>
71<a style="color: blue; text-decoration: underline; text-underline: single" target="_blank" href="http://mameui.classicgaming.gamespy.com/">Snap.zip</a></b> : These are a series of files that contain in-game screenshots 
72of every parent game in MameUI.&nbsp; Download the packs and extract their 
73contents into the \MameUI\snap directory or combine their *.png contents into 
74one large snap.zip file.</p>
75<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
76<span style="font-family: Symbol">
77<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
78</span></span><b>
79Titles.zip</b> : This file can provide support for screenshots showing the 
80titles of the game in MameUI, place in \titles directory.&nbsp; </p>
81<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
82<span style="font-family: Symbol">
83<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
84</span></span><b>Marquees.zip</b> : This file can provide support for the 
85marquee images that appear on the top of arcade machines, place in \marquees 
86directory..</p>
87<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
88<span style="font-family: Symbol">
89<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
90</span></span>
91<span style="font-style:normal; font-variant:normal; font-weight:700">Cpanel</span><b>.zip</b> : This file can provide support for the 
92images of arcade control panels, place in \cpanel directory..</p>
93<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
94<span style="font-family: Symbol">
95<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
96</span></span>
97<span style="font-style: normal; font-variant: normal; line-height: normal;" class="style1">
98PCB</span><b>.zip</b> : This file can provide support for the 
99images of arcade printed circuit boards, place in \pcb directory..</p>
100<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
101<span style="font-family: Symbol">
102<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
103</span></span><b>
104Bkground.zip</b> : This file contains numerous images that are used as the 
105background for the MameUI GUI [beneath the game list, behind the 
106screenshot/folder areas]. Download this file and extract its contents into the 
107\MameUI\bkground directory. Choose a background 
108image in the Options menu.&nbsp; To have it rotated randomly on MameUI launch, 
109toggle the checkbox in the Options • Interface Options menu.</p>
110<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
111<span style="font-family: Symbol">
112<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
113</span></span><b>
114<a target="_blank" href="http://www.arcadeflyers.net">Flyers.zip</a></b> : This file can provide support for the original flyers sent to 
115arcade operators, exhorting them to buy the games, place in \flyers directory.</p>
116<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
117<span style="font-family: Symbol">
118<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
119</span></span><b>
120Cabinets.zip</b> : These are a series of files that contain images of the 
121actual physical arcade machines themselves.&nbsp; Download the packs and extract their contents into the \MameUI\cabinets 
122directory or combine their *.png contents into one large cabinets.zip.</p>
123<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
124<span style="font-family: Symbol">
125<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
126</span></span><b>
127<a style="color: blue; text-decoration: underline; text-underline: single" target="_blank" href="http://www.arcade-history.com">History.dat</a></b> : This file contains the original game’s designer’s names, 
128and assorted trivia.&nbsp; Place this file in the \MameUI folder alongside 
129MameUI.exe. It will display if the history art tab is toggled, or if the history 
130tab is not selected, it will display beneath snapshots.</p>
131 
132<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in; margin-right: 0in; margin-top: 0in; margin-bottom: 3.75pt">
133<font size="1">
134<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-12 02:05 PM -0800<!--webbot bot="Timestamp" endspan i-checksum="37923" --> 
135/ john iv</font></p>
136 
137</body>
138 
139</html>
src/osd/winui/help/html/mameui_help.htm
r0r1368
1<html>
2 
3<head>
4<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
5<meta name="ProgId" content="FrontPage.Editor.Document">
6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
7<title>MameUI Help Menu</title>
8<style>
9<!--
10p
11   {margin-right:0in;
12   margin-left:0in;
13   font-size:10.0pt;
14   font-family:Arial;
15   color:black}
16h1
17   {margin-top:12.0pt;
18   margin-right:0in;
19   margin-bottom:3.0pt;
20   margin-left:0in;
21   page-break-after:avoid;
22   font-size:16.0pt;
23   font-family:Arial;
24   color:windowtext;
25   font-weight:bold}
26h2
27   {margin-top:12.0pt;
28   margin-right:0in;
29   margin-bottom:3.0pt;
30   margin-left:0in;
31   page-break-after:avoid;
32   font-size:14.0pt;
33   font-family:Arial;
34   font-style:italic}
35 p.MsoNormal
36   {mso-style-parent:"";
37   margin-bottom:.0001pt;
38   font-size:10.0pt;
39   font-family:Arial;
40   margin-left:0in; margin-right:0in; margin-top:0in}
41-->
42</style>
43</head>
44 
45<body background="../images/bkground.gif">
46 
47<h2>Help Menu</h2>
48<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
49<span style="font-family: Symbol">
50<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
51</span></span><b>Help Topics</b> :&nbsp; Selecting this option from the help menu 
52will launch the MameUI help file.</p>
53<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
54<span style="font-family: Symbol">
55<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
56</span></span><b>Troubleshooting</b> :&nbsp; Selecting this option from the help menu 
57will display the troubleshooting topic in the help file.</p>
58<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
59<span style="font-family: Symbol">
60<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
61</span></span><b>New Game Changes</b> :&nbsp; Selecting this option from the help menu 
62will display added, removed, changed games.</p>
63<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
64<span style="font-family: Symbol">
65<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
66</span></span>
67<span style="font-style:normal; font-variant:normal; font-weight:700">Mame </span>
68<span style="font-weight: 700">Whatsnew.txt</span> :&nbsp; Selecting this option from the help menu 
69will display the baseline Mame whatsnew.txt file which contains information 
70about source changes, games added, driver improvements, etc.</p>
71<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
72<span style="font-family: Symbol">
73<img width="11" height="11" src="../images/mame321.gif" alt="*"><span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
74</span></span><b>About </b>: Selecting this option from the help menu will 
75display  information about the version of 
76MameUI and its contributors.</p>
77 
78<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">&nbsp;</p>
79<p class="MsoNormal" style="text-indent: -.25in; margin-left: .75in">
80<font size="1">
81<!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d %I:%M %p %Z" startspan -->2007-11-10 01:41 AM -0800<!--webbot bot="Timestamp" endspan i-checksum="37617" --> 
82/ john iv</font></p>
83 
84</body>
85 
86</html>
src/osd/winui/help/images/1.jpg
src/osd/winui/help/images/bkground.gif
src/osd/winui/help/images/folder.gif
src/osd/winui/help/images/2.jpg
src/osd/winui/help/images/3.jpg
src/osd/winui/help/images/4.jpg
src/osd/winui/help/images/5.jpg
src/osd/winui/help/images/6.jpg
src/osd/winui/help/images/7.jpg
src/osd/winui/help/images/8.jpg
src/osd/winui/help/images/toolbar.gif
src/osd/winui/help/images/int.jpg
src/osd/winui/help/images/mame321.gif
src/osd/winui/help/images/statusbar.gif
src/osd/winui/help/mameui.hhk
r0r1368
1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<HTML>
3<HEAD>
4<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
5<!-- Sitemap 1.0 -->
6</HEAD><BODY>
7<UL>
8</UL>
9</BODY></HTML>
src/osd/winui/help/stoplist.stp
r0r1368
1a
2about
3after
4against
5all
6also
7among
8an
9and
10are
11as
12at
13be
14became
15because
16been
17between
18but
19by
20can
21come
22do
23during
24each
25early
26for
27form
28found
29from
30had
31has
32have
33he
34mame32
35his
36however
37in
38include
39into
40is
41it
42its
43late
44later
45me
46med
47made
48many
49may
50more
51most
52near
53no
54non
55not
56of
57on
58only
59or
60other
61over
62several
63she
64some
65such
66than
67that
68the
69their
70then
71there
72these
73they
74this
75through
76to
77under
78until
79use
80was
81we
82were
83when
84where
85which
86who
87with
88you
src/osd/winui/help/docs/Mame License.htm
r0r1368
1<body background="../images/bkground.gif">
2 
3<div id="outer">
4   <div id="center">
5      <div class="content">
6         <font face="Arial"><b>Copyright © 1997-2007, Nicola Salmoria 
7         and the MAME team<br>
8         All rights reserved.</b></font><font face="Arial" size="2"> </font>
9         <p><font face="Arial" size="2">Redistribution and use of this code 
10         or any derivative works are permitted provided that the following 
11         conditions are met: </font></p>
12         <ul>
13            <li><font face="Arial" size="2">Redistributions may not be sold, 
14            nor may they be used in a commercial product or activity. </font>
15            </li>
16            <li><font face="Arial" size="2">Redistributions that are 
17            modified from the original source must include the complete 
18            source code, including the source code for all components used 
19            by a binary built from the modified sources. However, as a 
20            special exception, the source code distributed need not include 
21            anything that is normally distributed (in either source or 
22            binary form) with the major components (compiler, kernel, and so 
23            on) of the operating system on which the executable runs, unless 
24            that component itself accompanies the executable. </font></li>
25            <li><font face="Arial" size="2">Redistributions must reproduce 
26            the above copyright notice, this list of conditions and the 
27            following disclaimer in the documentation and/or other materials 
28            provided with the distribution. </font></li>
29         </ul>
30         <p><font face="Arial" size="2">THIS SOFTWARE IS PROVIDED BY THE 
31         COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR 
32         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
33         WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
34         ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
35         CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
36         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
37         LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
38         USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
39         ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
40         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
41         OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
42         SUCH DAMAGE. </font></div>
43   </div>
44</div>
src/osd/winui/help/docs/Command Line Settings.htm
r0r1368
1 
2<head>
3<style type="text/css">
4.style1 {
5   font-family: Arial, Helvetica, sans-serif;
6}
7.style2 {
8   font-size: x-small;
9}
10</style>
11</head>
12 
13<body style="background-image: url('../images/bkground.gif')">
14 
15<span class="style1"><span class="style2"><strong>This file describes general usage 
16information about MAME. It is intended<br>
17to cover aspects of using and configuring the program that are common<br>
18across operating systems. For additional OS-specific options, please see<br>
19the separate documentation for your particular version of MAME.</strong></strong><br>
20<br>
21<br>
22<br>
23Using the program<br>
24-----------------<br>
25<br>
26The usual way to run MAME is by telling it to run a particular game:<br>
27<br>
28mame &lt;gamename&gt; [options]<br>
29<br>
30For example:<br>
31<br>
32mame robby -nosound<br>
33<br>
34...will run Robby Roto without sound. There are many, many options <br>
35available. All commonly supported options are listed below. Options that<br>
36are specific to one operating system or version of MAME will be listed<br>
37in a separate document.<br>
38<br>
39An alternative way to run MAME is to give it a command:<br>
40<br>
41mame &lt;command&gt; [parameters]<br>
42<br>
43For example:<br>
44<br>
45mame -listsource gridlee<br>
46<br>
47...will print the name of the source file where the gridlee driver lives <br>
48to the screen. There are just a handful of these commands in MAME. They <br>
49are all listed below, just before the options list.<br>
50<br>
51<br>
52<br>
53Default Keys<br>
54------------<br>
55<br>
56All the keys below are fully configurable in the user interface. This list<br>
57shows the standard keyboard configuration.<br>
58<br>
59Tab Toggles the configuration menu.<br>
60<br>
61~ Toggles the On Screen Display. When the on-screen display is<br>
62visible, you can use the following keys to control it:<br>
63<br>
64Up - select previous parameter to modify<br>
65Down - select next parameter to modify<br>
66Enter - reset parameter value to its default<br>
67<br>
68Left - decrease the value of the selected parameter<br>
69</span><span class="style2">Control+Left - decrease the value by 10x<br>
70</span><span class="style2">Shift+Left - decrease the value by 0.1x<br>
71</span><span class="style2">Alt+Left - decrease the value by the smallest amount<br>
72<br>
73Right - increase the value of the selected parameter<br>
74</span><span class="style2">Control+Right - increase the value by 10x<br>
75</span><span class="style2">Shift+Right - increase the value by 0.1x<br>
76</span><span class="style2">Alt+Right - increase the value by the smallest amount<br>
77<br>
78P Pauses the game.<br>
79<br>
80</span><span class="style2">Shift+P While paused, advances to next frame.<br>
81<br>
82F1 Toggle crosshairs for games that use them. Each subsequent<br>
83press will enable crosshairs for one more player.<br>
84<br>
85F2 Service Mode for games that support it.<br>
86<br>
87F3 Resets the game.<br>
88<br>
89Shift+F3 Performs a &quot;hard reset&quot;, which tears everything down and re-<br>
90creates it from scratch. This is a more thorough and complete<br>
91reset than an F3.<br>
92<br>
93F4 Shows the game palette, decoded GFX, and any tilemaps. Use the<br>
94Enter key to switch between the three modes (palette, graphics,<br>
95and tilemaps). Press F4 again to turn off the display. The key<br>
96controls in each mode vary slightly:<br>
97<br>
98* Palette/colortable mode:<br>
99[ ] - switch between palette and colortable modes<br>
100Up/Down - scroll up/down one line at a time<br>
101Page Up/Page Down - scroll up/down one page at a time<br>
102Home/End - move to top/bottom of list<br>
103-/+ - increase/decrease the number of colors per row<br>
104Enter - switch to graphics viewer<br>
105<br>
106* Graphics mode:<br>
107[ ] - switch between different graphics sets<br>
108Up/Down - scroll up/down one line at a time<br>
109Page Up/Page Down - scroll up/down one page at a time<br>
110Home/End - move to top/bottom of list<br>
111Left/Right - change color displayed<br>
112R - rotate tiles 90 degrees clockwise<br>
113-/+ - increase/decrease the number of tiles per row<br>
114Enter - switch to tilemap viewer<br>
115<br>
116* Tilemap mode:<br>
117[ ] - switch between different tilemaps<br>
118Up/Down/Left/Right - scroll 8 pixels at a time<br>
119</span><span class="style2">Shift+Up/Down/Left/Right - scroll 1 pixel at a time<br>
120</span><span class="style2">Control+Up/Down/Left/Right - scroll 64 pixels at a time<br>
121R - rotate tilemap view 90 degrees clockwise<br>
122-/+ - increase/decrease the zoom factor<br>
123Enter - switch to palette/colortable mode<br>
124<br>
125Note: Not all games have decoded graphics and/or tilemaps.<br>
126<br>
127F6 Toggle cheat mode (if started with &quot;-cheat&quot;).<br>
128<br>
129F7 Load a save state. You will be requested to press a key to<br>
130determine which save state you wish to load. Note that the save<br>
131state feature is not supported for a large number of drivers. If<br>
132support is not enabled for a given driver, you will receive a <br>
133warning when attempting to save or load.<br>
134<br>
135Shift+F7 Create a save state. Requires an additional keypress to identify<br>
136the state, similar to the load option above.<br>
137<br>
138F8 Decrease frame skip on the fly.<br>
139<br>
140F9 Increase frame skip on the fly.<br>
141<br>
142F10 Toggle speed throttling.<br>
143<br>
144F11 Toggles speed display.<br>
145<br>
146Shift+F11 Toggles profiler display (debug builds only).<br>
147<br>
148F12 Saves a screen snapshot.<br>
149<br>
150Insert Fast forward. While held, runs the game with throttling disabled<br>
151and with the maximum frameskip.<br>
152<br>
153Escape Exits emulator.<br>
154<br>
155<br>
156<br>
157<br>
158Core commands<br>
159-------------<br>
160<br>
161-help / -h / -?<br>
162<br>
163Displays current MAME version and copyright notice.<br>
164<br>
165-validate / -valid<br>
166<br>
167Performs internal validation on every driver in the system. Run this<br>
168before submitting changes to ensure that you haven't violated any of<br>
169the core system rules.<br>
170<br>
171<br>
172<br>
173Configuration commands<br>
174----------------------<br>
175<br>
176</span></span></span>-<span class="style2"><span class="style1">createconfig / -cc<br>
177<br>
178Creates the default mame.ini file. All the configuration options<br>
179(not commands) described below can be permanently changed by editing <br>
180this configuration file.<br>
181<br>
182</span>
183</span>-<span class="style2"><span class="style1">showconfig / -sc<br>
184<br>
185Displays the current configuration settings. If you route this to a<br>
186file, you can use it as an INI file. For example, the command:<br>
187<br>
188mame -showconfig &gt;mame.ini<br>
189<br>
190is equivalent to -createconfig.<br>
191<br>
192-showusage / -su<br>
193<br>
194Displays a summary of all the command line options. For options that<br>
195are not mentioned here, the short summary given by &quot;mame -showusage&quot; <br>
196is usually sufficient.<br>
197<br>
198<br>
199<br>
200Frontend commands<br>
201-----------------<br>
202<br>
203Note: By default, all the '-list' commands below write info to the screen.<br>
204If you wish to write the info to a textfile instead, add this to the end <br>
205of your command:<br>
206<br>
207&gt; filename<br>
208<br>
209...where 'filename' is the textfile's path and name <br>
210(e.g., c:\mame\list.txt).<br>
211<br>
212-listxml / -lx [&lt;gamename|wildcard&gt;]<br>
213<br>
214List comprehensive details for all of the supported games. The output<br>
215is quite long, so it is usually better to redirect this into a file. <br>
216The output is in XML format. By default all games are listed; however,<br>
217you can limit this list by specifying a driver name or wildcard after <br>
218the -listxml command.<br>
219<br>
220-listfull / -ll [&lt;gamename|wildcard&gt;]<br>
221<br>
222Displays a list of game driver names and descriptions. By default all<br>
223games are listed; however, you can limit this list by specifying a <br>
224driver name or wildcard after the -listfull command.<br>
225<br>
226</span>
227</span>-<span class="style2"><span class="style1">listsource / -ls [&lt;gamename|wildcard&gt;]<br>
228<br>
229Displays a list of drivers and the names of the source files their <br>
230game drivers live in. Useful for finding which driver a game runs on <br>
231in order to fix bugs. By default all games are listed; however, you <br>
232can limit this list by specifying a driver name or wildcard after <br>
233the -listsource command.<br>
234<br>
235-listclones / -lc [&lt;gamename|wildcard&gt;]<br>
236<br>
237Displays a list of clones. By default all clones are listed; however, <br>
238you can limit this list by specifying a driver name or wildcard after <br>
239the -listsource command.<br>
240<br>
241</span>
242</span>-<span class="style2"><span class="style1">listcrc<br>
243<br>
244Displays a full list of CRCs of all ROM images referenced by all<br>
245drivers within MAME.<br>
246<br>
247-listroms &lt;gamename&gt;<br>
248<br>
249Displays a list of ROM images referenced by the specified game.<br>
250<br>
251-listsamples &lt;gamename&gt;<br>
252<br>
253Displays a list of samples referenced by the specified game.<br>
254<br>
255-verifyroms [&lt;gamename|wildcard&gt;]<br>
256<br>
257Checks for invalid or missing ROM images. By default all drivers that<br>
258have valid ZIP files or directories in the rompath are verified; <br>
259however, you can limit this list by specifying a driver name or <br>
260wildcard after the -verifyroms command.<br>
261<br>
262-verifysamples [&lt;gamename|wildcard&gt;]<br>
263<br>
264Checks for invalid or missing samples. By default all drivers that<br>
265have valid ZIP files or directories in the samplepath are verified; <br>
266however, you can limit this list by specifying a driver name or <br>
267wildcard after the -verifyroms command.<br>
268<br>
269</span>
270</span>-<span class="style2"><span class="style1">romident<br>
271<br>
272Attempts to identify ROM files, if they are known to MAME, in the<br>
273specified .zip file or directory. This command can be used to try and <br>
274identify ROM sets taken from unknown boards. On exit, the errorlevel <br>
275is returned as one of the following:<br>
276<br>
2770: means all files were identified<br>
2787: means all files were identified except for 1 or more &quot;non-ROM&quot;<br>
279files<br>
2808: means some files were identified<br>
2819: means no files were identified<br>
282<br>
283<br>
284<br>
285Configuration options<br>
286---------------------<br>
287<br>
288-[no]readconfig / -[no]rc<br>
289<br>
290Enables or disables the reading of the config files. When enabled<br>
291(which is the default), MAME reads the following config files in order:<br>
292<br>
293- mame.ini<br>
294- &lt;mymame&gt;.ini (i.e. if MAME was renamed mame060.exe, MAME<br>
295parses mame060.ini here)<br>
296- mamed.ini (if this is a debug build, i.e. mamed.exe)<br>
297- vector.ini (for vector games only)<br>
298- &lt;driver&gt;.ini (based on the source filename of the driver)<br>
299- &lt;parent&gt;.ini (for clones only, may be called recursively)<br>
300- &lt;gamename&gt;.ini<br>
301<br>
302The settings in the later ini's override those in the earlier ini's.<br>
303So, for example, if you wanted to disable overlay effects in the<br>
304vector games, you can create a vector.ini with the &quot;effect none&quot; line<br>
305in it, and it will override whatever effect value you have in your<br>
306mame.ini. The default is ON (-readconfig).<br>
307<br>
308<br>
309<br>
310Core search path options<br>
311------------------------<br>
312<br>
313-rompath / -rp &lt;path&gt;<br>
314<br>
315Specifies a list of paths within which to find ROM or hard disk images.<br>
316Multiple paths can be specified by separating them with semicolons.<br>
317The default is 'roms' (that is, a directory &quot;roms&quot; in the same directory<br>
318as the MAME executable).<br>
319<br>
320</span>
321</span>-<span class="style2"><span class="style1">samplepath / -sp &lt;path&gt;<br>
322<br>
323Specifies a list of paths within which to find sample files. Multiple <br>
324paths can be specified by separating them with semicolons. The default <br>
325is 'samples' (that is, a directory &quot;samples&quot; in the same directory as<br>
326the MAME executable).<br>
327<br>
328</span>
329</span>-<span class="style2"><span class="style1">artpath / -artwork_directory &lt;path&gt;<br>
330<br>
331Specifies a list of paths within which to find artwork files. Multiple <br>
332paths can be specified by separating them with semicolons. The default <br>
333is 'artwork' (that is, a directory &quot;artwork&quot; in the same directory as<br>
334the MAME executable).<br>
335<br>
336</span>
337</span>-<span class="style2"><span class="style1">ctrlrpath / -ctrlr_directory &lt;path&gt;<br>
338<br>
339Specifies a list of paths within which to find controller-specific<br>
340configuration files. Multiple paths can be specified by separating <br>
341them with semicolons. The default is 'ctrlr' (that is, a directory <br>
342&quot;ctrlr&quot; in the same directory as the MAME executable).<br>
343<br>
344</span>
345</span>-<span class="style2"><span class="style1">inipath &lt;path&gt;<br>
346<br>
347Specifies a list of paths within which to find .INI files. Multiple <br>
348paths can be specified by separating them with semicolons. The default <br>
349is '.;ini' (that is, search in the current directory first, and then<br>
350in the directory &quot;ini&quot; in the same directory as the MAME executable).<br>
351<br>
352</span>
353</span>-<span class="style2"><span class="style1">fontpath &lt;path&gt;<br>
354<br>
355Specifies a list of paths within which to find .BDF font files. Multiple <br>
356paths can be specified by separating them with semicolons. The default <br>
357is '.' (that is, search in the same directory as the MAME executable).<br>
358<br>
359<br>
360<br>
361Core Output Directory Options<br>
362-----------------------------<br>
363<br>
364</span>
365</span>-<span class="style2"><span class="style1">cfg_directory &lt;path&gt;<br>
366<br>
367Specifies a single directory where configuration files are stored.<br>
368Configuration files store user configurable settings that are read at<br>
369startup and written when MAME exits. The default is 'cfg' (that is,<br>
370a directory &quot;cfg&quot; in the same directory as the MAME executable). If <br>
371this directory does not exist, it will be automatically created.<br>
372<br>
373</span>
374</span>-<span class="style2"><span class="style1">nvram_directory &lt;path&gt;<br>
375<br>
376Specifies a single directory where NVRAM files are stored. NVRAM files<br>
377store the contents of EEPROM and non-volatile RAM (NVRAM) for games<br>
378which used this type of hardware. This data is read at startup and <br>
379written when MAME exits. The default is 'nvram' (that is, a directory <br>
380&quot;nvram&quot; in the same directory as the MAME executable). If this <br>
381directory does not exist, it will be automatically created.<br>
382<br>
383</span>
384</span>-<span class="style2"><span class="style1">memcard_directory &lt;path&gt;<br>
385<br>
386Specifies a single directory where memory card files are stored. <br>
387Memory card files store the contents of removable memory cards for <br>
388games which used this type of hardware. This data is read and written <br>
389under control of the user via the &quot;Memory Card&quot; menu in the user <br>
390interface. The default is 'memcard' (that is, a directory &quot;memcard&quot; <br>
391in the same directory as the MAME executable). If this directory does <br>
392not exist, it will be automatically created.<br>
393<br>
394</span>
395</span>-<span class="style2"><span class="style1">input_directory &lt;path&gt;<br>
396<br>
397Specifies a single directory where input recording files are stored.<br>
398Input recordings are created via the -record option and played back <br>
399via the -playback option. The default is 'inp' (that is, a directory <br>
400&quot;inp&quot; in the same directory as the MAME executable). If this directory <br>
401does not exist, it will be automatically created.<br>
402<br>
403</span>
404</span>-<span class="style2"><span class="style1">state_directory &lt;path&gt;<br>
405<br>
406Specifies a single directory where save state files are stored. Save<br>
407state files are read and written either upon user request, or when <br>
408using the -autosave option. The default is 'sta' (that is, a directory <br>
409</span>
410</span>&quot;<span class="style2"><span class="style1">sta&quot; in the same directory as the MAME executable). 
411If this directory <br>
412does not exist, it will be automatically created.<br>
413<br>
414</span>
415</span>-<span class="style2"><span class="style1">snapshot_directory &lt;path&gt;<br>
416<br>
417Specifies a single directory where screen snapshots are stored, when<br>
418requested by the user. The default is 'snap' (that is, a directory <br>
419&quot;snap&quot; in the same directory as the MAME executable). If this <br>
420directory does not exist, it will be automatically created.<br>
421<br>
422-diff_directory &lt;path&gt;<br>
423<br>
424Specifies a single directory where hard drive differencing files are <br>
425stored. Hard drive differencing files store any data that is written<br>
426back to a hard disk image, in order to preserve the original image. <br>
427The differencing files are created at startup when a game with a hard <br>
428disk image. The default is 'diff' (that is, a directory &quot;diff&quot; in the <br>
429same directory as the MAME executable). If this directory does not <br>
430exist, it will be automatically created.<br>
431<br>
432</span>
433</span>-<span class="style2"><span class="style1">comment_directory &lt;path&gt;<br>
434<br>
435Specifies a single directory where debugger comment files are stored. <br>
436Debugger comment files are written by the debugger when comments are<br>
437added to the disassembly for a game. The default is 'comments' (that <br>
438is, a directory &quot;comments&quot; in the same directory as the MAME <br>
439executable). If this directory does not exist, it will be <br>
440automatically created.<br>
441<br>
442<br>
443<br>
444Core Filename Options<br>
445---------------------<br>
446<br>
447</span>
448</span>-<span class="style2"><span class="style1">cheat_file &lt;filename&gt;<br>
449<br>
450Specifies the name of the cheat database file. The default is <br>
451'cheat.dat'.<br>
452<br>
453<br>
454<br>
455Core state/playback options<br>
456---------------------------<br>
457<br>
458-state &lt;slot&gt;<br>
459<br>
460Immediately after starting the specified game, will cause the save <br>
461state in the specified &lt;slot&gt; to be loaded.<br>
462<br>
463-[no]autosave<br>
464<br>
465When enabled, automatically creates a save state file when exiting <br>
466MAME and automatically attempts to reload it when later starting MAME <br>
467with the same game. This only works for games that have explicitly <br>
468enabled save state support in their driver. The default is OFF <br>
469(-noautosave).<br>
470<br>
471-playback / -pb &lt;filename&gt;<br>
472<br>
473Specifies a file from which to play back a series of game inputs. This<br>
474feature does not work reliably for all games, but can be used to watch<br>
475a previously recorded game session from start to finish. In order to<br>
476make things consistent, you should only record and playback with all<br>
477configuration (.cfg), NVRAM (.nv), and memory card files deleted. The<br>
478default is NULL (no playback).<br>
479<br>
480-record / -rec &lt;filename&gt;<br>
481<br>
482Specifies a file to record all input from a game session. This can be<br>
483used to record a game session for later playback. This feature does <br>
484not work reliably for all games, but can be used to watch a previously <br>
485recorded game session from start to finish. In order to make things <br>
486consistent, you should only record and playback with all configuration <br>
487(.cfg), NVRAM (.nv), and memory card files deleted. The default is <br>
488NULL (no recording).<br>
489<br>
490</span>
491</span>-<span class="style2"><span class="style1">mngwrite &lt;filename&gt;<br>
492<br>
493Writes each video frame to the given &lt;filename&gt; in MNG format, <br>
494producing an animation of the game session. Note that -mngwrite only <br>
495writes video frames; it does not save any audio data. Use -wavwrite <br>
496for that, and reassemble the audio/video using offline tools. The <br>
497default is NULL (no recording).<br>
498<br>
499</span>
500</span>-<span class="style2"><span class="style1">wavwrite &lt;filename&gt;<br>
501<br>
502Writes the final mixer output to the given &lt;filename&gt; in WAV format, <br>
503producing an audio recording of the game session. The default is <br>
504NULL (no recording).<br>
505<br>
506<br>
507<br>
508Core performance options<br>
509------------------------<br>
510<br>
511-[no]autoframeskip / -[no]afs<br>
512<br>
513Automatically determines the frameskip level while you're playing the<br>
514game, adjusting it constantly in a frantic attempt to keep the game<br>
515running at full speed. Turning this on overrides the value you have <br>
516set for -frameskip below. The default is OFF (-noautoframeskip).<br>
517<br>
518-frameskip / -fs &lt;level&gt;<br>
519<br>
520Specifies the frameskip value. This is the number of frames out of<br>
521every 12 to drop when running. For example, if you say -frameskip 2,<br>
522then MAME will display 10 out of every 12 frames. By skipping those<br>
523frames, you may be able to get full speed in a game that requires more<br>
524horsepower than your computer has. The default value is -frameskip 0,<br>
525which skips no frames.<br>
526<br>
527</span>
528</span>-<span class="style2"><span class="style1">seconds_to_run / -str &lt;seconds&gt;<br>
529<br>
530This option can be used for benchmarking and automated testing. It tells <br>
531MAME to stop execution after a fixed number of seconds. By combining <br>
532this with a fixed set of other command line options, you can set up a <br>
533consistent environment for benchmarking MAME performance. In addition, <br>
534upon exit, the -str option will write a screenshot called final.png<br>
535to the game's snapshot directory.<br>
536<br>
537-[no]throttle<br>
538<br>
539Configures the default thottling setting. When throttling is on, MAME<br>
540attempts to keep the game running at the game's intended speed. When<br>
541throttling is off, MAME runs the game as fast as it can. Note that the<br>
542fastest speed is more often than not limited by your graphics card,<br>
543especially for older games. The default is ON (-throttle).<br>
544<br>
545-[no]sleep<br>
546<br>
547Allows MAME to give time back to the system when running with -throttle.<br>
548This allows other programs to have some CPU time, assuming that the<br>
549game isn't taxing 100% of your CPU resources. This option can <br>
550potentially cause hiccups in performance if other demanding programs<br>
551are running. The default is ON (-sleep).<br>
552<br>
553<br>
554<br>
555Core rotation options<br>
556---------------------<br>
557<br>
558-[no]rotate<br>
559<br>
560Rotate the game to match its normal state (horizontal/vertical). This<br>
561ensures that both vertically and horizontally oriented games show up<br>
562correctly without the need to rotate your monitor. If you want to keep <br>
563the game displaying 'raw' on the screen the way it would have in the <br>
564arcade, turn this option OFF. The default is ON (-rotate).<br>
565<br>
566-[no]ror<br>
567-[no]rol<br>
568<br>
569Rotate the game screen to the right (clockwise) or left (counter-<br>
570clockwise) relative to either its normal state (if -rotate is <br>
571specified) or its native state (if -norotate is specified). The <br>
572default for both of these options is OFF (-noror -norol).<br>
573<br>
574-[no]flipx<br>
575-[no]flipy<br>
576<br>
577Flip (mirror) the game screen either horizontally (-flipx) or <br>
578vertically (-flipy). The flips are applied after the -rotate and <br>
579</span>
580</span>-<span class="style2"><span class="style1">ror/-rol options are applied. The default for both 
581of these options <br>
582is OFF (-noflipx -noflipy).<br>
583<br>
584-[no]autoror<br>
585-[no]autorol<br>
586<br>
587These options are designed for use with pivoting screens that only<br>
588pivot in a single direction. If your screen only pivots clockwise,<br>
589use -autorol to ensure that the game will fill the screen either<br>
590horizontally or vertically in one of the directions you can handle.<br>
591If your screen only pivots counter-clockwise, use -autoror.<br>
592<br>
593<br>
594<br>
595Core artwork options<br>
596--------------------<br>
597<br>
598-[no]artwork_crop / -[no]artcrop<br>
599<br>
600Enable cropping of artwork to the game screen area only. This works<br>
601best with -video gdi or -video d3d, and means that vertically oriented<br>
602games running full screen can display their artwork to the left and <br>
603right sides of the screen. This does not work with -video ddraw <br>
604because of the way the game screens are rendered and scaled after the <br>
605fact. This option can also be controlled via the Video Options menu in <br>
606the user interface. The default is OFF (-noartwork_crop).<br>
607<br>
608-[no]use_backdrops / -[no]backdrop<br>
609<br>
610Enables/disables the display of backdrops. The default is ON<br>
611(-use_backdrops).<br>
612<br>
613-[no]use_overlays / -[no]overlay<br>
614<br>
615Enables/disables the display of overlays. The default is ON<br>
616(-use_overlays).<br>
617<br>
618-[no]use_bezels / -[no]bezel<br>
619<br>
620Enables/disables the display of bezels. The default is ON<br>
621(-use_bezels).<br>
622<br>
623<br>
624<br>
625Core screen options<br>
626-------------------<br>
627<br>
628-brightness &lt;value&gt;<br>
629<br>
630Controls the default brightness, or black level, of the game screens. <br>
631This option does not affect the artwork or other parts of the display.<br>
632Using the MAME UI, you can individually set the brightness for each <br>
633game screen; this option controls the initial value for all visible <br>
634game screens. The standard value is 1.0. Selecting lower values (down <br>
635to 0.1) will produce a darkened display, while selecting higher values <br>
636(up to 2.0) will give a brighter display. The default is 1.0.<br>
637<br>
638-contrast &lt;value&gt;<br>
639<br>
640Controls the contrast, or white level, of the game screens. This <br>
641option does not affect the artwork or other parts of the display. <br>
642Using the MAME UI, you can individually set the contrast for each <br>
643game screen; this option controls the initial value for all visible <br>
644game screens. The standard value is 1.0. Selecting lower values (down <br>
645to 0.1) will produce a dimmer display, while selecting higher values <br>
646(up to 2.0) will give a more saturated display. The default is 1.0.<br>
647<br>
648-gamma &lt;value&gt;<br>
649<br>
650Controls the gamma, which produces a potentially nonlinear black to<br>
651white ramp, for the game screens. This option does not affect the <br>
652artwork or other parts of the display. Using the MAME UI, you can <br>
653individually set the gamma for each game screen; this option controls <br>
654the initial value for all visible game screens. The standard value is <br>
6551.0, which gives a linear ramp from black to white. Selecting lower <br>
656values (down to 0.1) will increase the nonlinearity toward black, <br>
657while selecting higher values (up to 3.0) will push the nonlinearity <br>
658toward white. The default is 1.0.<br>
659<br>
660-pause_brightness &lt;value&gt;<br>
661<br>
662This controls the brightness level when MAME is paused. The default<br>
663value is 0.65.<br>
664<br>
665<br>
666<br>
667Core vector options<br>
668-------------------<br>
669<br>
670-[no]antialias / -[no]aa<br>
671<br>
672Enables antialiased line rendering for vector games. The default is ON<br>
673(-antialias).<br>
674<br>
675-beam &lt;width&gt;<br>
676<br>
677Sets the width of the vectors. This is a scaling factor against the<br>
678standard vector width. A value of 1.0 will keep the default vector <br>
679line width. Smaller values will reduce the width, and larger values <br>
680will increase the width. The default is 1.0.<br>
681<br>
682-flicker &lt;value&gt;<br>
683<br>
684Simulates a vector &quot;flicker&quot; effect, similar to a vector monitor that<br>
685needs adjustment. This option requires a float argument in the range <br>
686of 0.00 - 100.00 (0=none, 100=maximum). The default is 0.<br>
687<br>
688<br>
689<br>
690Core sound options<br>
691------------------<br>
692<br>
693-[no]sound<br>
694<br>
695Enable or disable sound altogether. The default is ON (-sound).<br>
696<br>
697-samplerate &lt;value&gt; / -sr &lt;value&gt;<br>
698<br>
699Sets the audio sample rate. Smaller values (e.g. 11025) cause lower<br>
700audio quality but faster emulation speed. Higher values (e.g. 48000)<br>
701cause higher audio quality but slower emulation speed. The default is<br>
70248000.<br>
703<br>
704-[no]samples<br>
705<br>
706Use samples if available. The default is ON (-samples).<br>
707<br>
708-volume / -vol &lt;value&gt;<br>
709<br>
710Sets the startup volume. It can later be changed with the user <br>
711interface (see Keys section). The volume is an attenuation in dB: <br>
712e.g., &quot;-volume -12&quot; will start with -12dB attenuation. The default <br>
713is 0.<br>
714<br>
715<br>
716<br>
717Core input options<br>
718------------------<br>
719<br>
720-ctrlr &lt;controller&gt;<br>
721<br>
722Enables support for special controllers. Configuration files are<br>
723loaded from the ctrlrpath. They are in the same format as the .cfg<br>
724files that are saved, but only control configuration data is read<br>
725from the file. The default is NULL (no controller file).<br>
726<br>
727-[no]mouse<br>
728<br>
729Controls whether or not MAME makes use of mouse controllers. When<br>
730this is enabled, you will likely be unable to use your mouse for other<br>
731purposes until you exit or pause the game. The default is OFF <br>
732(-nomouse).<br>
733<br>
734-[no]joystick / -[no]joy<br>
735<br>
736Controls whether or not MAME makes use of joystick/gamepad controllers.<br>
737When this is enabled, MAME will ask DirectInput about which <br>
738controllers are connected. The default is OFF (-nojoystick).<br>
739<br>
740-[no]lightgun / -[no]gun<br>
741<br>
742Controls whether or not MAME makes use of lightgun controllers.<br>
743Note that most lightguns map to the mouse, so using -lightgun and<br>
744-mouse together may produce strange results. The default is OFF<br>
745(-nolightgun).<br>
746<br>
747-[no]multikeyboard / -[no]multikey<br>
748<br>
749Determines whether MAME differentiates between multiple keyboards.<br>
750Some systems may report more than one keyboard; by default, the data<br>
751from all of these keyboards is combined so that it looks like a single<br>
752keyboard. Turning this option on will enable MAME to report keypresses<br>
753on different keyboards independently. The default is OFF <br>
754(-nomultikeyboard).<br>
755<br>
756-[no]multimouse<br>
757<br>
758Determines whether MAME differentiates between multiple mice. Some <br>
759systems may report more than one mouse device; by default, the data<br>
760from all of these mice is combined so that it looks like a single<br>
761mouse. Turning this option on will enable MAME to report mouse <br>
762movement and button presses on different mice independently. The <br>
763default is OFF (-nomultimouse).<br>
764<br>
765-[no]steadykey / -[no]steady<br>
766<br>
767Some games require two or more buttons to be pressed at exactly the<br>
768same time to make special moves. Due to limitations in the keyboard<br>
769hardware, it can be difficult or even impossible to accomplish that<br>
770using the standard keyboard handling. This option selects a different<br>
771handling that makes it easier to register simultaneous button presses,<br>
772but has the disadvantage of making controls less responsive. The<br>
773default is OFF (-nosteadykey)<br>
774<br>
775-[no]offscreen_reload / -[no]reload<br>
776<br>
777Controls whether or not MAME treats a second button input from a<br>
778lightgun as a reload signal. In this case, MAME will report the gun's<br>
779position as (0,MAX) with the trigger held, which is equivalent to an<br>
780offscreen reload. This is only needed for games that required you to <br>
781shoot offscreen to reload, and then only if your gun does not support <br>
782off screen reloads. The default is OFF (-nooffscreen_reload).<br>
783<br>
784</span>
785</span>-<span class="style2"><span class="style1">joystick_map &lt;map&gt; / -joymap &lt;map&gt;<br>
786<br>
787Controls how joystick values map to digital joystick controls. MAME<br>
788accepts all joystick input from the system as analog data. For true<br>
789analog joysticks, this needs to be mapped down to the usual 4-way or<br>
7908-way digital joystick values. To do this, MAME divides the analog<br>
791range into a 9x9 grid. It then takes the joystick axis position (for<br>
792X and Y axes only), maps it to this grid, and then looks up a <br>
793translation from a joystick map. This parameter allows you to specify<br>
794the map. The default is 'auto', which means that a standard 8-way,<br>
7954-way, or 4-way diagonal map is selected automatically based on the<br>
796input port configuration of the current game.<br>
797<br>
798Maps are defined as a string of numbers and characters. Since the grid<br>
799is 9x9, there are a total of 81 characters necessary to define a<br>
800complete map. Below is an example map for an 8-way joystick:<br>
801<br>
802777888999 Note that the numeric digits correspond to the keys<br>
803777888999 on a numeric keypad. So '7' maps to up+left, '4' maps<br>
804777888999 to left, '5' maps to neutral, etc. In addition to the<br>
805444555666 numeric values, you can specify the character 's',<br>
806444555666 which means &quot;sticky&quot;. In this case, the value of the<br>
807444555666 map is the same as it was the last time a non-sticky<br>
808111222333 value was read.<br>
809111222333<br>
810111222333<br>
811<br>
812To specify the map for this parameter, you can specify a string of<br>
813rows separated by a '.' (which indicates the end of a row), like so:<br>
814<br>
815777888999.777888999.777888999.444555666.444555666.444555666.<br>
816111222333.111222333.111222333<br>
817<br>
818However, this can be reduced using several shorthands supported by the<br>
819&lt;map&gt; parameter. If information about a row is missing, then it is <br>
820assumed that any missing data in columns 5-9 are left/right symmetric <br>
821with data in columns 0-4; and any missing data in colums 0-4 is <br>
822assumed to be copies of the previous data. The same logic applies to<br>
823missing rows, except that up/down symmetry is assumed.<br>
824<br>
825By using these shorthands, the 81 character map can be simply <br>
826specified by this 11 character string: 7778...4445<br>
827<br>
828Looking at the first row, 7778 is only 4 characters long. The 5th <br>
829entry can't use symmetry, so it is assumed to be equal to the previous<br>
830character '8'. The 6th character is left/right symmetric with the 4th <br>
831character, giving an '8'. The 7th character is left/right symmetric<br>
832with the 3rd character, giving a '9' (which is '7' with left/right<br>
833flipped). Eventually this gives the full 777888999 string of the row.<br>
834<br>
835The second and third rows are missing, so they are assumed to be <br>
836identical to the first row. The fourth row decodes similarly to the<br>
837first row, producing 444555666. The fifth row is missing so it is<br>
838assumed to be the same as the fourth.<br>
839<br>
840The remaining three rows are also missing, so they are assumed to be<br>
841the up/down mirrors of the first three rows, giving three final rows<br>
842of 111222333.<br>
843<br>
844</span>
845</span>-<span class="style2"><span class="style1">joystick_deadzone &lt;value&gt; / -joy_deadzone &lt;value&gt; / 
846-jdz &lt;value&gt;<br>
847<br>
848If you play with an analog joystick, the center can drift a little.<br>
849joystick_deadzone tells how far along an axis you must move before the<br>
850axis starts to change. This option expects a float in the range of<br>
8510.0 to 1.0. Where 0 is the center of the joystick and 1 is the outer<br>
852limit. The default is 0.3.<br>
853<br>
854</span>
855</span>-<span class="style2"><span class="style1">joystick_saturation &lt;value&gt; / joy_saturation 
856&lt;value&gt; / -jsat &lt;value&gt;<br>
857<br>
858If you play with an analog joystick, the ends can drift a little,<br>
859and may not match in the +/- directions. joystick_saturation tells how <br>
860far along an axis movement change will be accepted before it reaches <br>
861the maximum range. This option expects a float in the range of 0.0 to <br>
8621.0, where 0 is the center of the joystick and 1 is the outer limit.<br>
863The default is 0.85.<br>
864<br>
865<br>
866<br>
867Core input automatic enable options<br>
868-----------------------------------<br>
869<br>
870</span>
871</span>-<span class="style2"><span class="style1">paddle_device &lt;keyboard|mouse|joystick|lightgun|none&gt; 
872/ -paddle<br>
873</span>
874</span>-<span class="style2"><span class="style1">adstick_device &lt;keyboard|mouse|joystick|lightgun|none&gt; 
875/ -adstick<br>
876</span>
877</span>-<span class="style2"><span class="style1">pedal_device &lt;keyboard|mouse|joystick|lightgun|none&gt; 
878/ -pedal<br>
879</span>
880</span>-<span class="style2"><span class="style1">dial_device &lt;keyboard|mouse|joystick|lightgun|none&gt; 
881/ -dial<br>
882</span>
883</span>-<span class="style2"><span class="style1">trackball_device &lt;keyboard|mouse|joystick|lightgun|none&gt; 
884/ -trackball<br>
885</span>
886</span>-<span class="style2"><span class="style1">lightgun_device &lt;keyboard|mouse|joystick|lightgun|none&gt;<br>
887</span>
888</span>-<span class="style2"><span class="style1">positional_device &lt;keyboard|mouse|joystick|lightgun|none&gt;<br>
889<br>
890Each of these options controls autoenabling the mouse, joystick, or<br>
891lightgun depending on the presence of a particular class of analog<br>
892control for a particular game. For example, if you specify the option<br>
893-paddle mouse, then any game that has a paddle control will <br>
894automatically enable mouse controls just as if you had explicitly <br>
895specified -mouse. Note that these controls override the values of <br>
896-[no]mouse, -[no]joystick, etc.<br>
897<br>
898<br>
899<br>
900Debugging options<br>
901-----------------<br>
902<br>
903-[no]log<br>
904<br>
905Creates a file called error.log which contains all of the internal<br>
906log messages generated by the MAME core and game drivers. The default <br>
907is OFF (-nolog).<br>
908<br>
909-[no]verbose / -[no]v<br>
910<br>
911Displays internal diagnostic information. This information is very <br>
912useful for debugging problems with your configuration. IMPORTANT: when<br>
913reporting bugs, please run with mame -verbose and include the <br>
914resulting information. The default is OFF (-noverbose).<br>
915<br>
916-[no]debug<br>
917<br>
918Activates the integrated debugger. This is available only if the <br>
919program is compiled with MAME_DEBUG defined. By default, the debugger <br>
920is entered by pressing the tilde (~) key during emulation. It is also<br>
921entered immediately at startup. The default is ON (-debug).<br>
922<br>
923</span>
924</span>-<span class="style2"><span class="style1">debugscript &lt;filename&gt;<br>
925<br>
926Specifies a file that contains a list of debugger commands to execute<br>
927immediately upon startup. The default is NULL (no commands).<br>
928<br>
929<br>
930<br>
931Core misc options<br>
932-----------------<br>
933<br>
934-bios &lt;biosname&gt;<br>
935<br>
936Specifies the specific BIOS to use with the current game, for game<br>
937systems that make use of a BIOS. The -listxml output will list all of<br>
938the possible BIOS names for a game. The default is 'default'.<br>
939<br>
940-[no]cheat / -[no]c<br>
941<br>
942Enables the reading of the cheat database, if present, and the Cheat<br>
943menu in the user interface. The default is OFF (-nocheat).<br>
944<br>
945-[no]skip_gameinfo<br>
946<br>
947Forces MAME to skip displaying the game info screen. The default is <br>
948OFF (-noskip_gameinfo).<br>
949</span>
950</span></h1>
951 
952</div>
953<p><span class="style3"><span class="style4"><strong><span class="style1">
954<span class="style2">This file describes 
955Windows-specific usage information about MAME. It is <br>
956intended to cover aspects of using and configuring the program that are <br>
957specific to running MAME from the command line on a Windows-based system.<br>
958For common options that apply to all systems, please see config.txt.</span></span></strong><span class="style1"><span class="style2"><br>
959<br>
960<br>
961<br>
962Default Keys<br>
963------------<br>
964<br>
965In addition to the keys described in config.txt, the following additional<br>
966keys are defined for Windows versions of MAME:<br>
967<br>
968<br>
969Alt+Enter Toggles between full-screen and windowed 
970mode.<br>
971<br>
972<br>
973<br>
974Windows debugging options<br>
975-------------------------<br>
976<br>
977-[no]oslog<br>
978<br>
979Outputs the error.log data to the Windows debugger. This can be used at<br>
980the same time as -log to output the log data to both targets as well.<br>
981Default is OFF (-nooslog).<br>
982<br>
983<br>
984<br>
985Windows performance options<br>
986---------------------------<br>
987<br>
988-priority &lt;priority&gt;<br>
989<br>
990Sets the thread priority for the MAME threads. By default the priority<br>
991is left alone to guarantee proper cooperation with other applications. <br>
992The valid range is -15 to 1, with 1 being the highest priority. The <br>
993default is 0 (NORMAL priority).<br>
994<br>
995-[no]multithreading / -[no]mt<br>
996<br>
997Enables multithreading within MAME. At the moment, this causes the <br>
998window and all DirectDraw/Direct3D code to execute on a second thread, <br>
999which can improve performance on hyperthreaded and multicore systems. <br>
1000The default is OFF (-nomultithreading).<br>
1001<br>
1002<br>
1003<br>
1004Windows video options<br>
1005---------------------<br>
1006<br>
1007-video &lt;gdi|ddraw|d3d|none&gt;<br>
1008<br>
1009Specifies which video subsystem to use for drawing. By specifying 'gdi'<br>
1010here, you tell MAME to render video using standard Windows graphics<br>
1011drawing calls. This is the slowest but most compatible option. <br>
1012Specifying 'ddraw' instructs MAME to use DirectDraw for rendering. <br>
1013This causes MAME to render everything at a lower resolution and then <br>
1014upscale the results at the end. This produces high performance, <br>
1015especially on older or low-power video cards, but has a noticeably <br>
1016lower output quality. Specifying 'd3d' tells MAME to use Direct3D for <br>
1017rendering. This produces the highest quality output and enables all <br>
1018rendering options. It is recommended if you have a recent (2002+) <br>
1019video card. The final option 'none' displays no windows and does no <br>
1020drawing. This is primarily present for doing CPU benchmarks without <br>
1021the overhead of the video system. The default is d3d.<br>
1022<br>
1023-numscreens &lt;count&gt;<br>
1024<br>
1025Tells MAME how many output windows to create. For most games, a single<br>
1026output window is all you need, but some games originally used multiple<br>
1027screens. Each screen (up to 4) has its own independent settings for<br>
1028physical monitor, aspect ratio, resolution, and view, which can be<br>
1029set using the options below. The default is 1.<br>
1030<br>
1031-[no]window<br>
1032<br>
1033Run MAME in either a window or full screen. The default is OFF<br>
1034(-nowindow).<br>
1035<br>
1036-[no]maximize / -[no]max<br>
1037<br>
1038Controls initial window size in windowed mode. If it is set on, the<br>
1039window will initially be set to the maximum supported size when you<br>
1040start MAME. If it is turned off, the window will start out at the<br>
1041smallest supported size. This option only has an effect when the <br>
1042-window option is used. The default is ON (-maximize).<br>
1043<br>
1044-[no]keepaspect / -[no]ka<br>
1045<br>
1046Enables aspect ratio enforcement. When this option is on, the game's<br>
1047proper aspect ratio (generally 4:3 or 3:4) is enforced, so you get the<br>
1048game looking like it should. When running in a window with this option<br>
1049on, you can only resize the window to the proper aspect ratio, unless<br>
1050you are holding down the CONTROL key. By turning the option off, the<br>
1051aspect ratio is allowed to float. In full screen mode, this means that<br>
1052all games will stretch to the full screen size (even vertical games).<br>
1053In window mode, it means that you can freely resize the window without<br>
1054any constraints. The default is ON (-keepaspect).<br>
1055<br>
1056-prescale &lt;amount&gt;<br>
1057<br>
1058Controls the size of the screen images when they are passed off to the<br>
1059graphics system for scaling. At the minimum setting of 1, the screen<br>
1060is rendered at its original resolution before being scaled. At higher<br>
1061settings, the screen is expanded by a factor of &lt;amount&gt; before being<br>
1062scaled. With -video ddraw or -video d3d, this produces a less blurry<br>
1063image at the expense of some speed. In -video ddraw mode, this also<br>
1064increases the effective resolution of non-screen elements such as <br>
1065artwork and fonts. The default is 1.<br>
1066<br>
1067-effect &lt;filename&gt;<br>
1068<br>
1069Specifies a single PNG file that is used as an overlay over any game<br>
1070screens in the video display. This PNG file is assumed to live in the<br>
1071root of one of the artpath directories. The pattern in the PNG file is <br>
1072repeated both horizontally and vertically to cover the entire game <br>
1073screen areas (but not any external artwork), and is rendered at<br>
1074the target resolution of the game image. For -video gdi and -video d3d<br>
1075modes, this means that one pixel in the PNG will map to one pixel on<br>
1076your output display. For -video ddraw, this means that one pixel in the<br>
1077PNG will map to one pixel in the prescaled game screen. If you wish to<br>
1078use an effect that requires mapping n PNG pixels to each game screen<br>
1079pixel with -video ddraw, you need to specify a -prescale factor of n as<br>
1080well. The RGB values of each pixel in the PNG are multiplied against the<br>
1081RGB values of the target screen. The default is 'none', meaning no <br>
1082effect.<br>
1083<br>
1084-[no]waitvsync<br>
1085<br>
1086Waits for the refresh period on your computer's monitor to finish<br>
1087before starting to draw video to your screen. If this option is off,<br>
1088MAME will just draw to the screen at any old time, even in the middle<br>
1089of a refresh cycle. This can cause &quot;tearing&quot; artifacts, where the top<br>
1090portion of the screen is out of sync with the bottom portion. Tearing<br>
1091is not noticeable on all games, and some people hate it more than<br>
1092others. However, if you turn this option on, you will waste more of<br>
1093your CPU cycles waiting for the proper time to draw, so you will see a<br>
1094performance hit. You should only need to turn this on in windowed mode.<br>
1095In full screen mode, it is only needed if -triplebuffer does not<br>
1096remove the tearing, in which case you should use -notriplebuffer <br>
1097</span></span>
1098</span></span>-<span class="style3"><span class="style4"><span class="style1"><span class="style2">waitvsync. Note that 
1099this option does not work with -video gdi mode.<br>
1100The default is OFF (-nowaitvsync).<br>
1101<br>
1102-[no]syncrefresh<br>
1103<br>
1104Enables speed throttling only to the refresh of your monitor. This<br>
1105means that the game's actual refresh rate is ignored; however, the<br>
1106sound code still attempts to keep up with the game's original refresh<br>
1107rate, so you may encounter sound problems. This option is intended <br>
1108mainly for those who have tweaked their video card's settings to<br>
1109provide carefully matched refresh rate options. Note that this option <br>
1110does not work with -video gdi mode.The default is OFF (-nosyncrefresh).<br>
1111<br>
1112<br>
1113<br>
1114DirectDraw-specific options<br>
1115---------------------------<br>
1116<br>
1117-[no]hwstretch / -[no]hws<br>
1118<br>
1119When enabled, MAME uses the hardware stretching abilities of your<br>
1120video card to scale the game image and associated artwork to the <br>
1121target resolution. Depending on the quality of your graphic card and <br>
1122its drivers, this may be a fractional, antialiased scaling (nice) or <br>
1123an integer, blocky scaling (not so nice), in which case you might want<br>
1124to disable this option. In addition, if you have configured specific<br>
1125arcade-like video modes for MAME and don't want MAME to perform any<br>
1126non-integral scaling of the image, you should also disable this option.<br>
1127The default is ON (-hwstretch).<br>
1128<br>
1129<br>
1130<br>
1131Direct3D-specific options<br>
1132-------------------------<br>
1133<br>
1134-d3dversion &lt;version&gt;<br>
1135<br>
1136MAME supports both Direct3D 9 and Direct3D 8 for maximum compatibility.<br>
1137By default, it will automatically detect which one it can use and use<br>
1138that version exclusively. You can override MAME's selection with this<br>
1139option. It is primarily intended as a means for the MAME developers to<br>
1140test compatibility with older hardware; for the most part, there is no<br>
1141reason to alter this setting. The default is 9.<br>
1142<br>
1143-[no]filter / -[no]d3dfilter / -[no]flt<br>
1144<br>
1145Enable bilinear filtering on the game screen graphics. When disabled,<br>
1146point filtering is applied, which is crisper but leads to scaling<br>
1147artifacts. If you don't like the filtered look, you are probably better<br>
1148off increasing the -prescale value rather than turning off filtering<br>
1149altogether. The default is ON (-filter).<br>
1150<br>
1151<br>
1152<br>
1153Per-window options<br>
1154------------------<br>
1155<br>
1156-screen &lt;display&gt;<br>
1157-screen0 &lt;display&gt;<br>
1158-screen1 &lt;display&gt;<br>
1159-screen2 &lt;display&gt;<br>
1160-screen3 &lt;display&gt;<br>
1161<br>
1162Specifies which physical monitor on your system you wish to have each<br>
1163window use by default. In order to use multiple windows, you must have<br>
1164increased the value of the -numscreens option. The name of each <br>
1165display in your system can be determined by running MAME with the <br>
1166-verbose option. The display names are typically in the format of: <br>
1167\\.\DISPLAYn, where 'n' is a number from 1 to the number of connected <br>
1168monitors. The default value for these options is 'auto', which means <br>
1169that the first window is placed on the first display, the second <br>
1170window on the second display, etc.<br>
1171<br>
1172The -screen0, -screen1, -screen2, -screen3 parameters apply to the<br>
1173specific window. The -screen parameter applies to all windows. The<br>
1174window-specific options override values from the all window option.<br>
1175<br>
1176-aspect &lt;width:height&gt; / -screen_aspect &lt;num:den&gt;<br>
1177-aspect0 &lt;width:height&gt;<br>
1178-aspect1 &lt;width:height&gt;<br>
1179-aspect2 &lt;width:height&gt;<br>
1180-aspect3 &lt;width:height&gt;<br>
1181<br>
1182Specifies the physical aspect ratio of the physical monitor for each<br>
1183window. In order to use multiple windows, you must have increased the <br>
1184value of the -numscreens option. The physical aspect ratio can be<br>
1185determined by measuring the width and height of the visible screen <br>
1186image and specifying them separated by a colon. The default value for<br>
1187these options is 'auto', which means that MAME assumes the aspect <br>
1188ratio is proportional to the number of pixels in the desktop video <br>
1189mode for each monitor.<br>
1190<br>
1191The -aspect0, -aspect1, -aspect2, -aspect3 parameters apply to the<br>
1192specific window. The -aspect parameter applies to all windows. The<br>
1193window-specific options override values from the all window option.<br>
1194<br>
1195-resolution &lt;widthxheight[@refresh]&gt; / -r &lt;widthxheight[@refresh]&gt;<br>
1196-resolution0 &lt;widthxheight[@refresh]&gt; / -r0 &lt;widthxheight[@refresh]&gt;<br>
1197-resolution1 &lt;widthxheight[@refresh]&gt; / -r1 &lt;widthxheight[@refresh]&gt;<br>
1198-resolution2 &lt;widthxheight[@refresh]&gt; / -r2 &lt;widthxheight[@refresh]&gt;<br>
1199-resolution3 &lt;widthxheight[@refresh]&gt; / -r3 &lt;widthxheight[@refresh]&gt;<br>
1200<br>
1201Specifies an exact resolution to run in. In full screen mode, MAME <br>
1202will try to use the specific resolution you request. The width and<br>
1203height are required; the refresh rate is optional. If omitted or<br>
1204set to 0, MAME will determine the mode auomatically. For example,<br>
1205-resolution 640x480 will force 640x480 resolution, but MAME is free to<br>
1206choose the refresh rate. Similarly, -resolution 0x0@60 will force a<br>
120760Hz refresh rate, but allows MAME to choose the resolution. The <br>
1208string &quot;auto&quot; is also supported, and is equivalent to 0x0@0. In window <br>
1209mode, this resolution is used as a maximum size for the window. This <br>
1210option requires the -switchres option as well in order to actually <br>
1211enable resolution switching with -video ddraw or -video d3d. The <br>
1212default value for these options is 'auto'.<br>
1213<br>
1214The -resolution0, -resolution1, -resolution2, -resolution3 parameters <br>
1215apply to the specific window. The -resolution parameter applies to all<br>
1216windows. The window-specific options override values from the all <br>
1217window option.<br>
1218<br>
1219-view &lt;viewname&gt;<br>
1220-view0 &lt;viewname&gt; <br>
1221-view1 &lt;viewname&gt;<br>
1222-view2 &lt;viewname&gt;<br>
1223-view3 &lt;viewname&gt;<br>
1224<br>
1225Specifies the initial view setting for each window. The &lt;viewname&gt; <br>
1226does not need to be a perfect match; rather, it will select the first <br>
1227view whose name matches all the characters specified by &lt;viewname&gt;. <br>
1228For example, -view native will match the &quot;Native (15:14)&quot; view even <br>
1229though it is not a perfect match. The value 'auto' is also supported, <br>
1230and requests that MAME perform a default selection. The default value <br>
1231for these options is 'auto'.<br>
1232<br>
1233The -view0, -view1, -view2, -view3 parameters apply to the<br>
1234specific window. The -view parameter applies to all windows. The<br>
1235window-specific options override values from the all window option.<br>
1236<br>
1237<br>
1238<br>
1239Full screen options<br>
1240-------------------<br>
1241<br>
1242-[no]triplebuffer / -[no]tb<br>
1243<br>
1244Enables or disables &quot;triple buffering&quot;. Normally, MAME just draws<br>
1245directly to the screen, without any fancy buffering. But with this<br>
1246option enabled, MAME creates three buffers to draw to, and cycles<br>
1247between them in order. It attempts to keep things flowing such that one<br>
1248buffer is currently displayed, the second buffer is waiting to be<br>
1249displayed, and the third buffer is being drawn to. -triplebuffer will <br>
1250override -waitvsync, if the buffer is sucessfully created. This option<br>
1251does not work with -video gdi. The default is OFF (-notriplebuffer).<br>
1252<br>
1253-[no]switchres<br>
1254<br>
1255Enables resolution switching. This option is required for the<br>
1256-resolution* options to switch resolutions in full screen mode. On<br>
1257modern video cards, there is little reason to switch resolutions unless<br>
1258you are trying to achieve the &quot;exact&quot; pixel resolutions of the original<br>
1259games, which requires significant tweaking. This option is also useful <br>
1260on LCD displays, since they run with a fixed resolution and switching<br>
1261resolutions on them is just silly. This option does not work with<br>
1262-video gdi. The default is OFF (-noswitchres).<br>
1263<br>
1264</span></span>
1265</span></span>-<span class="style3"><span class="style4"><span class="style1"><span class="style2">full_screen_brightness 
1266/ -fsb &lt;value&gt;<br>
1267<br>
1268Controls the brightness, or black level, of the entire display. The<br>
1269standard value is 1.0. Selecting lower values (down to 0.1) will produce<br>
1270a darkened display, while selecting higher values (up to 2.0) will<br>
1271give a brighter display. Note that not all video cards have hardware to<br>
1272support this option. This option does not work with -video gdi. The<br>
1273default is 1.0.<br>
1274<br>
1275</span></span>
1276</span></span>-<span class="style3"><span class="style4"><span class="style1"><span class="style2">full_screen_contrast / 
1277-fsc &lt;value&gt;<br>
1278<br>
1279Controls the contrast, or white level, of the entire display. The<br>
1280standard value is 1.0. Selecting lower values (down to 0.1) will produce<br>
1281a dimmer display, while selecting higher values (up to 2.0) will<br>
1282give a more saturated display. Note that not all video cards have <br>
1283hardware to support this option. This option does not work with <br>
1284-video gdi. The default is 1.0.<br>
1285<br>
1286</span></span>
1287</span></span>-<span class="style3"><span class="style4"><span class="style1"><span class="style2">full_screen_gamma / -fsg 
1288&lt;value&gt;<br>
1289<br>
1290Controls the gamma, which produces a potentially nonlinear black to<br>
1291white ramp, for the entire display. The standard value is 1.0, which <br>
1292gives a linear ramp from black to white. Selecting lower values (down <br>
1293to 0.1) will increase the nonlinearity toward black, while selecting <br>
1294higher values (up to 3.0) will push the nonlinearity toward white. Note <br>
1295that not all video cards have hardware to support this option. This <br>
1296option does not work with -video gdi. The default is 1.0.<br>
1297<br>
1298<br>
1299<br>
1300Windows sound options<br>
1301---------------------<br>
1302<br>
1303</span></span>
1304</span></span>-<span class="style3"><span class="style4"><span class="style1"><span class="style2">audio_latency &lt;value&gt;<br>
1305<br>
1306This controls the amount of latency built into the audio streaming. By<br>
1307default MAME tries to keep the DirectSound audio buffer between 1/5 and<br>
13082/5 full. On some systems, this is pushing it too close to the edge,<br>
1309and you get poor sound sometimes. The latency parameter controls the<br>
1310lower threshold. The default is 1 (meaning lower=1/5 and upper=2/5).<br>
1311Set it to 2 (-audio_latency 2) to keep the sound buffer between 2/5 and<br>
13123/5 full. If you crank it up to 4, you can definitely notice the lag.<br>
1313<br>
1314<br>
1315<br>
1316Input device options<br>
1317--------------------<br>
1318<br>
1319-[no]dual_lightgun / -[no]dual<br>
1320<br>
1321Controls whether or not MAME attempts to track two lightguns connected<br>
1322at the same time. This option requires -lightgun. This option is a hack<br>
1323for supporting older dual lightgun setups. If you have multiple <br>
1324lightguns connected, you will probably just need to enable -mouse and<br>
1325configure each lightgun independently. The default is OFF<br>
1326(-nodual_lightgun).</span></span></span></span></p>
1327 
1328 
1329</html>
src/osd/winui/help/docs/Mame Statement of Purpose.htm
r0r1368
1<body background="../images/bkground.gif">
2 
3<div id="outer">
4   <div id="center">
5      <div class="content">
6         <b>
7         <font face="Arial">MAME, the Multiple Arcade Machine 
8         Emulator<br>
9         Copyright © 1997-2007 by Nicola Salmoria and the MAME team </font>
10         </b>
11         <h2><font face="Arial" size="3">I. Purpose</font></h2>
12         <p><font face="Arial" size="2">MAME is strictly a non-profit 
13         project. Its main purpose is to be a reference to the inner workings 
14         of the emulated arcade machines. This is done both for educational 
15         purposes and for preservation purposes, in order to prevent many 
16         historical games from disappearing forever once the hardware they 
17         run on stops working. Of course, in order to preserve the games and 
18         demonstrate that the emulated behavior matches the original, you 
19         must also be able to actually play the games. This is considered a 
20         nice side effect, and is not MAME's primary focus. </font></p>
21         <p><font face="Arial" size="2">It is not our intention to infringe 
22         on any copyrights or patents on the original games. All of MAME's 
23         source code is either our own or freely available. To operate, the 
24         emulator requires images of the original ROMs, CDs, or hard disks 
25         from the arcade machines, which must be provided by the user. No 
26         portions of the original game code are included in the executable.
27         </font></p>
28         <h2><font face="Arial" size="3">II. Cost</font></h2>
29         <p><font face="Arial" size="2">MAME is free. Its source code is 
30         free. Selling either is not allowed. </font></p>
31         <h2><font face="Arial" size="3">III. Image Files</font></h2>
32         <p><font face="Arial" size="2">ROM, CD, and hard disk images are all 
33         copyrighted material. They cannot be distributed without the 
34         explicit permission of the copyright owner. They are not &quot;abandonware&quot;, 
35         nor have any of the games supported by MAME passed out of copyright.
36         </font></p>
37         <p><font face="Arial" size="2">MAME is not intended to be used as a 
38         tool for mass copyright infringement. Therefore, it is strongly 
39         against the authors' wishes to sell, advertise, or link to resources 
40         that provide illegal copies of ROM, CD, or hard disk images. </font>
41         </p>
42         <h2><font face="Arial" size="3">IV. Derivative Works</font></h2>
43         <p><font face="Arial" size="2">Derivative works are allowed under 
44         the MAME license. However, you are discouraged from providing 
45         specific functionality that goes against the philosophy of the MAME 
46         team. Specifically: </font></p>
47         <ul>
48            <li><font face="Arial" size="2">Do not add games which are more 
49            recent than 3 years old, or which are still being sold new by 
50            the company that produced them. MAME is not intended to be a 
51            platform that competes with arcade games that are still being 
52            actively sold. </font></li>
53            <li><font face="Arial" size="2">Do not provide a means of 
54            generating a list of games that specifically identifies those 
55            games for which the user does not have image files. This only 
56            encourages users to seek out sources for illegal ROM, CD, and 
57            hard disk images in order to &quot;complete&quot; their collection. </font>
58            </li>
59            <li><font face="Arial" size="2">Do not remove the startup screen 
60            that contains information about why certain non-working games 
61            don't work. This only serves to generate a bunch of useless 
62            email traffic to the developers asking why the games don't work.
63            </font></li>
64         </ul>
65         <p><font face="Arial" size="2">Because the name MAME is trademarked, 
66         you must abide by the rules of the trademark usage if you wish to 
67         use &quot;MAME&quot; as part of the name your derivative work. In general, 
68         this means you must request permission, which requires that you 
69         follow the guidelines above. </font></p>
70         <p><font face="Arial" size="2">The version number of any derivative 
71         work should reflect the version number of the MAME release it was 
72         derived from. </font></p>
73         <h2><font face="Arial" size="3">V. Official Contact Information</font></h2>
74         <p><font face="Arial" size="2">For questions regarding the MAME 
75         license, trademark, or other usage, go to
76         <a href="http://www.mamedev.com/contact.html?legal">
77         http://www.mamedev.com/</a>.</font></div>
78   </div>
79</div>
src/osd/winui/help/docs/whatsnew.txt
r0r1368
10.121u2
2-------
3 
4 
5MAMETesters Bugs Fixed
6----------------------
7 
8 
9Source Changes
10--------------
11Added speedup hack to the mosaicf2 driver. [David Haywood]
12 
13Fixed BCD math error in i8051 core. [stephh]
14 
15Fixed the m6800 cpu core so that the cpu variants can be compiled
16independently once again. [Atari Ace]
17 
18More formally separated the RSP core from the N64 driver. [Atari Ace]
19 
20Fixed invalid dips in panicr and added dip locations. [Sonikos]
21 
22Switched some #defines in the core over to enums. Also adjusted the 
23GAME macro so that it results in const data, and that it is defined 
24in terms of the more generic GAMEL macro. [Atari Ace]
25 
26Converted some more unnecessary globals into statics. [Atari Ace]
27 
28Fixes the M68008 data bus to properly use 8-bit accesses. [Curt Coder]
29 
30Cleaned up the peplus.c driver. Added MACHINE_RESET to fix autohold
31option. Added layouts for several types of games. [stephh]
32 
33Fix array overrun in get_num_dips. [Nathan Woods, Michael Zapf]
34 
35Moved redundant check for bank switching out of inline code, which
36nets a small speedup in the midwunit driver. [Christophe Jaillet]
37 
38Added save state support to a number of Konami custom chips. [Lei Wu]
39 
40Add -pipe flag for GCC in makefile (GCC will pipe between cpp, cc and
41as rather than using temporary files, which speeds up compiling).
42[Vas Crabb]
43 
44Cleanups to the inline functions: [Vas Crabb]
45 * Add attributes to functions in eigccppc.h and eigccx86.h to cause 
46    GCC to always inline them, and to treat them as arithmetic 
47    operators when appropriate (so GCC can identify loop invariants 
48    or common subexpressions involving these functions)
49 * Mark locals in functions in eigccppc.h and eigccx86.h as register, 
50    so GCC won't always allocate stack space even at O0 optimisation 
51    level
52 * Add dummy +m operands to atomic access functions in eigccppc.h so 
53    that GCC will not cache values across calls even if values are 
54    not volatile - this will cause GCC to allocate an additional 
55    register at O0 optimisation, but not if optimisation is on
56 * Don't include <altivec.h> in rgbvmx.h if __APPLE_ALTIVEC__ is 
57    defined, as this will cause a compiler warning.
58 
59Cleaned up inputs in the System 24 driver: [Sonikos]
60 - Fixed dips in qrouka, sgmastc, sgmastcj, roughrac, qsww
61 - Fixed input in dcclub, sgmastc, sgmastj, qrouka (the last is still 
62    missing input for the 3rd & 4th player)
63 - Added more description for each game: region, system (rom or floppy
64    based), version
65     
66Removed useless pen_array in the midtunit driver, saving some memory
67and getting a small speed boost. [Christophe Jaillet]
68 
69Added 3D glasses support to the tceptor driver. [BUT]
70 
71Unified timer callbacks. All timer callbacks are now passed both a
72pointer and a parameter. The pointer can only be set at timer 
73allocation time; the parameter can be changed whenever the timer
74is adjusted. Removed most explicit uses of timer_*_ptr functions in
75favor of the more generic routines. [Aaron Giles]
76 
77Deprecated cpu_yield* functions except for cpu_yield() itself, which
78yields for the current timeslice only. Drivers that relied on the
79other yielding functions should be updated to use 
80cpu_boost_interleave() instead, as it does not have the same negative
81side effects on time management. [Aaron Giles]
82 
83Changed video_frame_update() internally to accept a debug parameter
84which forces updates and does not meddle with synchronization/time
85accountiing. [Aaron Giles]
86 
87Some more internal improvements to the midzeus driver. [Aaron Giles]
88 
89Removed the burgeoning list of architecture optimization options.
90Instead, if you want to make a build optimized for a specific 
91architecture, you explicitly specify the options in a new ARCHOPTS
92variable. You can control the name of the final executable via the
93existing PREFIX and SUFFIX variables, which are now documented.
94[Aaron Giles]
95 
96MSVC-based builds now automatically get a 'v' prefix unless otherwise
97specified. [Aaron Giles]
98 
99 
100 
101New games added or promoted from NOT_WORKING status
102---------------------------------------------------
103Maze Invaders (prototype) [Aaron Giles]
104Guts 'n Glory (prototype) [Aaron Giles]
105Jumbo Ozaki Super Masters Golf [Sonikos]
106 
107 
108 
109New clones added
110----------------
111Sky Kid (Manufactured by Sipem) [Corrado Tomaselli]
112Next Fase (bootleg of Phoenix) [David Haywood]
113Hang-On (Rev A) [Tony Beason]
114Shooting Master (set 2, 8751 315-5159a) [Kevin Eshbach]
115Super Burger Time (World, set 2) [Patrik Styrnell]
src/osd/winui/help/reshelp.h
r0r1368
1// Include the Microsoft Developer Studio generated Help ID include file.
2//
3#include "..\resource.hm"
4#include "mame32.hm"
src/osd/winui/help/mameui.hhp
r0r1368
1[OPTIONS]
2Binary Index=No
3Compatibility=1.1 or later
4Compiled file=MameUI.chm
5Contents file=mameui.hhc
6Default Window=Baseline
7Default topic=.\html\mameUI_changes.txt
8Display compile progress=No
9Full text search stop list file=stoplist.stp
10Full-text search=Yes
11Index file=mameui.hhk
12Language=0x409 English (United States)
13Title=MameUI Help
14 
15[WINDOWS]
16Baseline="MameUI Help","mameUI.hhc",,"html\mameUI_changes.txt",,,,,,0x22520,260,0x300c,[100,100,974,615],,,,,,,0
17 
18 
19[TEXT POPUPS]
20cntx_help.txt
21reshelp.h
22 
23[INFOTYPES]
24 
src/osd/winui/help/mameui.hhc
r0r1368
1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<HTML>
3<HEAD>
4<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
5<!-- Sitemap 1.0 -->
6</HEAD><BODY>
7<OBJECT type="text/site properties">
8   <param name="Window Styles" value="0x800625">
9   <param name="ImageType" value="Folder">
10<param name="Font" value="Tahoma,8,0">
11</OBJECT>
12<UL>
13   <LI> <OBJECT type="text/sitemap">
14      <param name="Name" value="MameUI Overview &amp; History">
15      <param name="Local" value="html\mameui_overview.htm">
16      </OBJECT>
17   <LI> <OBJECT type="text/sitemap">
18      <param name="Name" value="MameUI Changes">
19      <param name="Local" value="html\mameui_whatsnew32.htm">
20      </OBJECT>
21   <LI> <OBJECT type="text/sitemap">
22      <param name="Name" value="MameUI Installation">
23      </OBJECT>
24   <UL>
25      <LI> <OBJECT type="text/sitemap">
26         <param name="Name" value="System Requirements">
27         <param name="Local" value="html\mameui_systemreq.htm">
28         </OBJECT>
29      <LI> <OBJECT type="text/sitemap">
30         <param name="Name" value="Download Locations">
31         <param name="Local" value="html\mameUI_download.htm">
32         </OBJECT>
33      <LI> <OBJECT type="text/sitemap">
34         <param name="Name" value="Installation Procedures">
35         <param name="Local" value="html\mameUI_installprocedures.htm">
36         </OBJECT>
37      <LI> <OBJECT type="text/sitemap">
38         <param name="Name" value="Art and Support Files">
39         <param name="Local" value="html\mameUI_art.htm">
40         </OBJECT>
41   </UL>
42   <LI> <OBJECT type="text/sitemap">
43      <param name="Name" value="MameUI Usage">
44      </OBJECT>
45   <UL>
46      <LI> <OBJECT type="text/sitemap">
47         <param name="Name" value="MameUI Suggested Settings">
48         <param name="Local" value="html\mameui_settings.htm">
49         </OBJECT>
50      <LI> <OBJECT type="text/sitemap">
51         <param name="Name" value="Playing a Game &amp; Internal Controls">
52         <param name="Local" value="html\mameui_playing.htm">
53         </OBJECT>
54      <LI> <OBJECT type="text/sitemap">
55         <param name="Name" value="Toolbar, Status Bar, &amp; Windows">
56         <param name="Local" value="html\mameui_visual_elements.htm">
57         </OBJECT>
58      <LI> <OBJECT type="text/sitemap">
59         <param name="Name" value="File Menu">
60         <param name="Local" value="html\mameui_filemenu.htm">
61         </OBJECT>
62      <UL>
63         <LI> <OBJECT type="text/sitemap">
64            <param name="Name" value="Game Properties">
65            <param name="Local" value="html\mameui_properties.htm">
66            </OBJECT>
67      </UL>
68      <LI> <OBJECT type="text/sitemap">
69         <param name="Name" value="View Menu">
70         <param name="Local" value="html\mameui_viewmenu.htm">
71         </OBJECT>
72      <LI> <OBJECT type="text/sitemap">
73         <param name="Name" value="Options Menu">
74         <param name="Local" value="html\mameui_optionsmenu.htm">
75         </OBJECT>
76      <UL>
77         <LI> <OBJECT type="text/sitemap">
78            <param name="Name" value="Game Properties">
79            <param name="Local" value="html\mameui_properties.htm">
80            </OBJECT>
81      </UL>
82      <LI> <OBJECT type="text/sitemap">
83         <param name="Name" value="Help Menu">
84         <param name="Local" value="html\mameui_help.htm">
85         </OBJECT>
86   </UL>
87   <LI> <OBJECT type="text/sitemap">
88      <param name="Name" value="MameUI Troubleshooting">
89      <param name="Local" value="html\mameui_support.htm">
90      </OBJECT>
91   <LI> <OBJECT type="text/sitemap">
92      <param name="Name" value="MameUI Credits &amp; Resources">
93      <param name="Local" value="html\mameui_credits.htm">
94      </OBJECT>
95   <LI> <OBJECT type="text/sitemap">
96      <param name="Name" value="Game Changes">
97      <param name="Local" value="html\mameui_changes.txt">
98      <param name="New" value="1">
99      </OBJECT>
100   <LI> <OBJECT type="text/sitemap">
101      <param name="Name" value="Mame Documents">
102      </OBJECT>
103   <UL>
104      <LI> <OBJECT type="text/sitemap">
105         <param name="Name" value="Mame License">
106         <param name="Local" value="docs\Mame License.htm">
107         </OBJECT>
108      <LI> <OBJECT type="text/sitemap">
109         <param name="Name" value="Mame Terms of Use">
110         <param name="Local" value="docs\Mame Statement of Purpose.htm">
111         </OBJECT>
112      <LI> <OBJECT type="text/sitemap">
113         <param name="Name" value="Mame Release Notes">
114         <param name="Local" value="docs\whatsnew.txt">
115         </OBJECT>
116      <LI> <OBJECT type="text/sitemap">
117         <param name="Name" value="Mame Configuration &amp; Usage">
118         <param name="Local" value="docs\Command Line Settings.htm">
119         </OBJECT>
120   </UL>
121</UL>
122</BODY></HTML>
src/osd/winui/res/mame32.manifest
r1367r1368
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3<assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="MAME32" type="win32" />
4<description>Multiple Arcade Machine Emulator with built in user interface</description>
5<dependency>
6<dependentAssembly>
7<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"/>
8</dependentAssembly>
9</dependency>
10</assembly>
src/osd/winui/res/mame32.ico
src/osd/winui/res/mameui.manifest
r0r1368
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MAMEUI" type="win32" />
4<description>Multiple Arcade Machine Emulator with built in user interface</description>
5<dependency>
6<dependentAssembly>
7<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
8</dependentAssembly>
9</dependency>
10</assembly>
src/osd/winui/res/mameui.ico
src/osd/winui/dirwatch.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14#ifndef DIRWATCHER_H
15#define DIRWATCHER_H
16
1317typedef struct DirWatcher *PDIRWATCHER;
1418
1519PDIRWATCHER DirWatcher_Init(HWND hwndTarget, UINT nMessage);
1620BOOL DirWatcher_Watch(PDIRWATCHER pWatcher, WORD nIndex, LPCSTR pszPathList, BOOL bWatchSubtrees);
1721void DirWatcher_Free(PDIRWATCHER pWatcher);
22
23#endif
src/osd/winui/layout.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213
1314/***************************************************************************
1415
r1367r1368
1718  MAME specific TreeView definitions (and maybe more in the future)
1819
1920***************************************************************************/
20
21// standard windows headers
2122#define WIN32_LEAN_AND_MEAN
2223#include <windows.h>
2324#include <windowsx.h>
2425#include <shellapi.h>
2526#include <commctrl.h>
27
28// standard C headers
2629#include <stdio.h>  /* for sprintf */
2730#include <stdlib.h> /* For malloc and free */
2831#include <string.h>
2932
33// MAME/MAMEUI headers
3034#include "bitmask.h"
3135#include "treeview.h"
32#include "m32util.h"
36#include "mui_util.h"
3337#include "resource.h"
3438#include "directories.h"
35#include "m32opts.h"
39#include "mui_opts.h"
3640#include "splitters.h"
3741#include "help.h"
38#include "audit32.h"
39#include "screenshot.h"
40#include "win32ui.h"
42#include "mui_audit.h"
43#include "winui.h"
4144#include "properties.h"
4245
4346static BOOL FilterAvailable(int driver_index);
r1367r1368
125128
126129const MAMEHELPINFO g_helpInfo[] =
127130{
128   { ID_HELP_CONTENTS,      TRUE,   MAME32HELP "::/html/mame32_overview.htm" },
129   { ID_HELP_WHATS_NEW32,   TRUE,   MAME32HELP "::/html/mame32_changes.txt" },
130   { ID_HELP_TROUBLE,      TRUE,   MAME32HELP "::/html/mame32_support.htm" },
131   { ID_HELP_CONTENTS,      TRUE,   MAMEUIHELP "::/html/mameui_overview.htm" },
132   { ID_HELP_WHATS_NEWUI,   TRUE,   MAMEUIHELP "::/html/mameui_changes.txt" },
133   { ID_HELP_TROUBLE,      TRUE,   MAMEUIHELP "::/html/mameui_support.htm" },
131134   { ID_HELP_RELEASE,      FALSE,   "windows.txt" },
132   { ID_HELP_WHATS_NEW,   TRUE,   MAME32HELP "::/docs/whatsnew.txt" },
135   { ID_HELP_WHATS_NEW,   TRUE,   MAMEUIHELP "::/docs/whatsnew.txt" },
133136   { -1 }
134137};
135138
src/osd/winui/dxdecode.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
1112 ***************************************************************************/
1213
14// standard windows headers
15#define WIN32_LEAN_AND_MEAN
1316#include <windows.h>
1417#include <ddraw.h>
18
19// standard C headers
1520#include <stdio.h>
21
22// MAME/MAMEUI headers
1623#include "directinput.h"
1724#include "dxdecode.h"
1825
r1367r1368
170177   {   DIERR_EFFECTPLAYING,                "DIERR_EFFECTPLAYING" },
171178//   {   DIERR_UNPLUGGED,                    "DIERR_UNPLUGGED" },
172179
173   {   E_NOINTERFACE,                      "E_NOINTERFACE" },
180   {   E_NOINTERFACE,                      "E_NOINTERFACE" }
174181
175182};
176183
src/osd/winui/mkhelp.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14/***************************************************************************
15
316    mkhelp.c
417
518    Simple resource HIDC to Help entry tool.
src/osd/winui/winui.mak
r1367r1368
22#
33#   winui.mak
44#
5#   winui (Mame32) makefile
5#   winui (MameUI) makefile
66#
77#   Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
88#   Visit http://mamedev.org for licensing and usage restrictions.
r1367r1368
4242
4343
4444#-------------------------------------------------
45# append "32" to the emulator name
45# append "ui" to the emulator name
4646#-------------------------------------------------
4747
48EMULATOR = $(FULLNAME)32$(EXE)
48ifdef PTR64
49EMULATOR = $(FULLNAME)UI64$(EXE)
50else
51EMULATOR = $(FULLNAME)UI32$(EXE)
52endif
4953
5054
51
5255#-------------------------------------------------
5356# object and source roots
5457#-------------------------------------------------
r1367r1368
142145   @echo Compiling $<...
143146   @cl.exe /nologo /O1 -D_CRT_SECURE_NO_DEPRECATE -c $< /Fo$@
144147
148PDBFILES = $(EMULATOR:.exe=.pdb) $(TOOLS:.exe=.pdb)
149
150clean-pdb:
151   @echo Deleting $(PDBFILES)...
152   $(RM) $(PDBFILES)
153
154clean: clean-pdb
155
145156endif
146157
147158
r1367r1368
259270
260271# add UI objs
261272OSDOBJS += \
262   $(UIOBJ)/m32util.o \
273   $(UIOBJ)/mui_util.o \
263274   $(UIOBJ)/directinput.o \
264275   $(UIOBJ)/dijoystick.o \
265276   $(UIOBJ)/directdraw.o \
266277   $(UIOBJ)/directories.o \
267   $(UIOBJ)/audit32.o \
278   $(UIOBJ)/mui_audit.o \
268279   $(UIOBJ)/columnedit.o \
269280   $(UIOBJ)/screenshot.o \
270281   $(UIOBJ)/treeview.o \
r1367r1368
278289   $(UIOBJ)/help.o \
279290   $(UIOBJ)/history.o \
280291   $(UIOBJ)/dialogs.o \
281   $(UIOBJ)/m32opts.o \
292   $(UIOBJ)/mui_opts.o \
282293   $(UIOBJ)/layout.o \
283294   $(UIOBJ)/datafile.o \
284295   $(UIOBJ)/dirwatch.o \
285   $(UIOBJ)/win32ui.o \
296   $(UIOBJ)/winui.o \
286297   $(UIOBJ)/helpids.o \
287298
288299
r1367r1368
297308endif
298309
299310# add our UI resources
300RESFILE += $(UIOBJ)/mame32.res
311RESFILE += $(UIOBJ)/mameui.res
301312
302313$(LIBOSD): $(OSDOBJS)
303314
304EMUMAIN = $(UIOBJ)/m32main.o
315# The : is important! It prevents the dependency above from including mui_main.o in its target!
316LIBOSD := $(UIOBJ)/mui_main.o $(LIBOSD)
305317
306318
307319
r1367r1368
323335# rules for creating helpids.c
324336#-------------------------------------------------
325337
326$(UISRC)/helpids.c : $(UIOBJ)/mkhelp$(EXE) $(UISRC)/resource.h $(UISRC)/resource.hm $(UISRC)/mame32.rc
327   $(UIOBJ)/mkhelp$(EXE) $(UISRC)/mame32.rc >$@
338$(UISRC)/helpids.c : $(UIOBJ)/mkhelp$(EXE) $(UISRC)/resource.h $(UISRC)/resource.hm $(UISRC)/mameui.rc
339   $(UIOBJ)/mkhelp$(EXE) $(UISRC)/mameui.rc >$@
328340
329341# rule to build the generator
330342$(UIOBJ)/mkhelp$(EXE): $(UIOBJ)/mkhelp.o $(LIBOCORE)
r1367r1368
361373# generic rule for the resource compiler for UI
362374#-------------------------------------------------
363375
364$(UIOBJ)/mame32.res: $(UISRC)/mame32.rc $(UIOBJ)/mamevers.rc
365   @echo Compiling mame32 resources $<...
376$(UIOBJ)/mameui.res: $(UISRC)/mameui.rc $(UIOBJ)/mamevers.rc
377   @echo Compiling mameui resources $<...
366378   $(RC) $(RCDEFS) $(RCFLAGS) -o $@ -i $<
367379
368380
r1367r1368
371383# rules for resource file
372384#-------------------------------------------------
373385
374$(UIOBJ)/mame32.res: $(UISRC)/mame32.rc $(UIOBJ)/mamevers.rc
386#$(UIOBJ)/mameui.res: $(UISRC)/mameui.rc $(UIOBJ)/mamevers.rc
375387
376388$(UIOBJ)/mamevers.rc: $(VERINFO) $(SRC)/version.c
377389   @echo Emitting $@...
src/osd/winui/dialogs.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213
1314/***************************************************************************
1415
r1367r1368
2627#endif
2728#endif
2829
30// standard windows headers
2931#include <windows.h>
3032#include <windowsx.h>
3133#include <shellapi.h>
3234#include <commctrl.h>
3335#include <commdlg.h>
36
37// standard C headers
3438#include <string.h>
3539#include <tchar.h>
3640
41// MAMEUI headers
3742#include "bitmask.h"
3843#include "treeview.h"
39#include "m32util.h"
4044#include "resource.h"
41#include "directories.h"
42#include "m32opts.h"
43#include "splitters.h"
45#include "mui_opts.h"
4446#include "help.h"
45#include "audit32.h"
46#include "screenshot.h"
47#include "mame32.h"
48#include "properties.h"
49#include "dialogs.h"
47#include "winui.h"
48#include "properties.h"  // For GetHelpIDs
49
50// MAME headers
5051#include "strconv.h"
5152#include "winutf8.h"
5253
r1367r1368
9798
9899   case WM_HELP:
99100      /* User clicked the ? from the upper right on a control */
100      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
101      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
101102      break;
102103
103104   case WM_CONTEXTMENU:
104      HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
105      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
105106
106107      break;
107108
r1367r1368
117118         {
118119
119120            TCHAR temp[400];
120            _tcscpy(temp, TEXT(MAME32NAME));
121            _tcscpy(temp, TEXT(MAMEUINAME));
121122            _tcscat(temp, TEXT(" will now reset the following\n"));
122123            _tcscat(temp, TEXT("to the default settings:\n\n"));
123124
r1367r1368
132133               _tcscat(temp, TEXT("User interface settings\n\n"));
133134               _tcscat(temp, TEXT("Resetting the User Interface options\n"));
134135               _tcscat(temp, TEXT("requires exiting "));
135               _tcscat(temp, TEXT(MAME32NAME));
136               _tcscat(temp, TEXT(MAMEUINAME));
136137               _tcscat(temp, TEXT(".\n"));
137138            }
138139            _tcscat(temp, TEXT("\nDo you wish to continue?"));
r1367r1368
247248
248249   case WM_HELP:
249250      /* User clicked the ? from the upper right on a control */
250      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
251      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
251252      break;
252253
253254   case WM_CONTEXTMENU:
254      HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
255      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
255256      break;
256257   case WM_HSCROLL:
257258      HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll);
r1367r1368
505506   }
506507   case WM_HELP:
507508      // User clicked the ? from the upper right on a control
508      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP,
509      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP,
509510                HH_TP_HELP_WM_HELP, GetHelpIDs());
510511      break;
511512
512513   case WM_CONTEXTMENU:
513      HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
514      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
514515      break;
515516
516517   case WM_COMMAND:
r1367r1368
714715   HWND hEdit;
715716
716717   const char *directx_help =
717      MAME32NAME " requires DirectX version 3 or later, which is a set of operating\r\n"
718      MAMEUINAME " requires DirectX version 3 or later, which is a set of operating\r\n"
718719      "system extensions by Microsoft for Windows 9x, NT and 2000.\r\n\r\n"
719720      "Visit Microsoft's DirectX web page at http://www.microsoft.com/directx\r\n"
720      "download DirectX, install it, and then run " MAME32NAME " again.\r\n";
721      "download DirectX, install it, and then run " MAMEUINAME " again.\r\n";
721722
722723   switch (Msg)
723724   {
src/osd/winui/file.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/dxdecode.h
r1367r1368
1/* Copyright 1998 Invasion Games.  All Rights Reserved.  Do NOT distribute. */
1/***************************************************************************
22
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
314/* dxdecode.h for client */
415
516/* Main header file for dxdecode.cpp */
src/osd/winui/dialogs.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/osd/winui/mui_util.c
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14/***************************************************************************
15
16  mui_util.c
17
18 ***************************************************************************/
19
20// standard windows headers
21#define WIN32_LEAN_AND_MEAN
22#include <windows.h>
23#include <shellapi.h>
24#include <shlwapi.h>
25
26// standard C headers
27#include <assert.h>
28#include <stdio.h>
29#include <tchar.h>
30
31// MAME/MAMEUI headers
32#include "unzip.h"
33#include "sound/samples.h"
34#include "winutf8.h"
35#include "strconv.h"
36#include "winui.h"
37#include "mui_util.h"
38
39
40/***************************************************************************
41   function prototypes
42 ***************************************************************************/
43
44/***************************************************************************
45   External variables
46 ***************************************************************************/
47
48/***************************************************************************
49   Internal structures
50 ***************************************************************************/
51static struct DriversInfo
52{
53   BOOL isClone;
54   BOOL isBroken;
55   BOOL isHarddisk;
56   BOOL hasOptionalBIOS;
57   BOOL isStereo;
58   BOOL isMultiMon;
59   BOOL isVector;
60   BOOL usesRoms;
61   BOOL usesSamples;
62   BOOL usesTrackball;
63   BOOL usesLightGun;
64   BOOL supportsSaveState;
65   BOOL isVertical;
66} *drivers_info = NULL;
67
68
69/***************************************************************************
70   External functions
71 ***************************************************************************/
72
73/*
74   ErrorMsg
75*/
76void __cdecl ErrorMsg(const char* fmt, ...)
77{
78   static FILE*   pFile = NULL;
79   DWORD         dwWritten;
80   char         buf[5000];
81   char         buf2[5000];
82   va_list       va;
83
84   va_start(va, fmt);
85
86   vsprintf(buf, fmt, va);
87
88   win_message_box_utf8(GetActiveWindow(), buf, MAMEUINAME, MB_OK | MB_ICONERROR);
89
90   strcpy(buf2, MAMEUINAME ": ");
91   strcat(buf2,buf);
92   strcat(buf2, "\n");
93
94   WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf2, strlen(buf2), &dwWritten, NULL);
95
96   if (pFile == NULL)
97      pFile = fopen("debug.txt", "wt");
98
99   if (pFile != NULL)
100   {
101      fprintf(pFile, "%s", buf2);
102      fflush(pFile);
103   }
104
105   va_end(va);
106}
107
108void __cdecl dprintf(const char* fmt, ...)
109{
110   char    buf[5000];
111   va_list va;
112
113   va_start(va, fmt);
114
115   _vsnprintf(buf,sizeof(buf),fmt,va);
116
117   win_output_debug_string_utf8(buf);
118
119   va_end(va);
120}
121
122UINT GetDepth(HWND hWnd)
123{
124   UINT   nBPP;
125   HDC    hDC;
126
127   hDC = GetDC(hWnd);
128   
129   nBPP = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
130
131   ReleaseDC(hWnd, hDC);
132
133   return nBPP;
134}
135
136/*
137 * Return TRUE if comctl32.dll is version 4.71 or greater
138 * otherwise return FALSE.
139 */
140LONG GetCommonControlVersion()
141{
142   HMODULE hModule = GetModuleHandle(TEXT("comctl32"));
143
144   if (hModule)
145   {
146      FARPROC lpfnICCE = GetProcAddress(hModule, "InitCommonControlsEx");
147
148      if (NULL != lpfnICCE)
149      {
150         FARPROC lpfnDLLI = GetProcAddress(hModule, "DllInstall");
151
152         if (NULL != lpfnDLLI)
153         {
154            /* comctl 4.71 or greater */
155
156            // see if we can find out exactly
157           
158            DLLGETVERSIONPROC pDllGetVersion;
159            pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hModule, "DllGetVersion");
160
161            /* Because some DLLs might not implement this function, you
162               must test for it explicitly. Depending on the particular
163               DLL, the lack of a DllGetVersion function can be a useful
164               indicator of the version. */
165
166            if(pDllGetVersion)
167            {
168               DLLVERSIONINFO dvi;
169               HRESULT hr;
170
171               ZeroMemory(&dvi, sizeof(dvi));
172               dvi.cbSize = sizeof(dvi);
173
174               hr = (*pDllGetVersion)(&dvi);
175
176               if (SUCCEEDED(hr))
177               {
178                  return PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
179               }
180            }
181            return PACKVERSION(4,71);
182         }
183         return PACKVERSION(4,7);
184      }
185      return PACKVERSION(4,0);
186   }
187   /* DLL not found */
188   return PACKVERSION(0,0);
189}
190
191void DisplayTextFile(HWND hWnd, const char *cName)
192{
193   HINSTANCE hErr;
194   LPCTSTR     msg = 0;
195   LPTSTR    tName;
196   
197   tName = tstring_from_utf8(cName);
198   if( !tName )
199      return;
200
201   hErr = ShellExecute(hWnd, NULL, tName, NULL, NULL, SW_SHOWNORMAL);
202   if ((FPTR)hErr > 32)
203   {
204      free(tName);
205      return;
206   }
207
208   switch((FPTR)hErr)
209   {
210   case 0:
211      msg = TEXT("The operating system is out of memory or resources.");
212      break;
213
214   case ERROR_FILE_NOT_FOUND:
215      msg = TEXT("The specified file was not found.");
216      break;
217
218   case SE_ERR_NOASSOC :
219      msg = TEXT("There is no application associated with the given filename extension.");
220      break;
221
222   case SE_ERR_OOM :
223      msg = TEXT("There was not enough memory to complete the operation.");
224      break;
225
226   case SE_ERR_PNF :
227      msg = TEXT("The specified path was not found.");
228      break;
229
230   case SE_ERR_SHARE :
231      msg = TEXT("A sharing violation occurred.");
232      break;
233
234   default:
235      msg = TEXT("Unknown error.");
236   }
237 
238   MessageBox(NULL, msg, tName, MB_OK);
239   
240   free(tName);
241}
242
243char* MyStrStrI(const char* pFirst, const char* pSrch)
244{
245   char* cp = (char*)pFirst;
246   char* s1;
247   char* s2;
248   
249   while (*cp)
250   {
251      s1 = cp;
252      s2 = (char*)pSrch;
253     
254      while (*s1 && *s2 && !mame_strnicmp(s1, s2, 1))
255         s1++, s2++;
256     
257      if (!*s2)
258         return cp;
259     
260      cp++;
261   }
262   return NULL;
263}
264
265char * ConvertToWindowsNewlines(const char *source)
266{
267   static char buf[40000];
268   char *dest;
269
270   dest = buf;
271   while (*source != 0)
272   {
273      if (*source == '\n')
274      {
275         *dest++ = '\r';
276         *dest++ = '\n';
277      }
278      else
279         *dest++ = *source;
280      source++;
281   }
282   *dest = 0;
283   return buf;
284}
285
286/* Lop off path and extention from a source file name
287 * This assumes their is a pathname passed to the function
288 * like src\drivers\blah.c
289 */
290const char * GetDriverFilename(int nIndex)
291{
292   static char tmp[40];
293   char *ptmp;
294
295   const char *s = drivers[nIndex]->source_file;
296
297   tmp[0] = '\0';
298
299   ptmp = strrchr(s, '\\');
300   if (ptmp == NULL)
301      ptmp = strrchr(s, '/');
302   if (ptmp == NULL)
303      return s;
304
305   ptmp++;
306   strcpy(tmp,ptmp);
307   return tmp;
308}
309
310static struct DriversInfo* GetDriversInfo(int driver_index)
311{
312   if (drivers_info == NULL)
313   {
314      int ndriver, i;
315      drivers_info = malloc(sizeof(struct DriversInfo) * driver_list_get_count(drivers));
316      for (ndriver = 0; ndriver < driver_list_get_count(drivers); ndriver++)
317      {
318         const game_driver *gamedrv = drivers[ndriver];
319         struct DriversInfo *gameinfo = &drivers_info[ndriver];
320         const rom_entry *region, *rom;
321         machine_config drv;
322         const input_port_entry *input_ports;
323         int speakernum, num_speakers;
324         gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1);
325         gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0);
326         gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0);
327         gameinfo->isHarddisk = FALSE;
328         gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE;
329         for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
330         {
331            if (ROMREGION_ISDISKDATA(region))
332               gameinfo->isHarddisk = TRUE;
333         }
334         gameinfo->hasOptionalBIOS = FALSE;
335         if (gamedrv->rom != NULL)
336         {
337            for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++)
338            {
339               if (ROMENTRY_ISSYSTEM_BIOS(rom))
340               {
341                  gameinfo->hasOptionalBIOS = TRUE;
342                  break;
343               }
344            }
345         }
346         expand_machine_driver(gamedrv->drv, &drv);
347
348         num_speakers = 0;
349         for (speakernum = 0; speakernum < MAX_SPEAKER; speakernum++)
350            if (drv.speaker[speakernum].tag != NULL)
351               num_speakers++;
352
353         gameinfo->isStereo = (num_speakers > 1);
354         //gameinfo->isMultiMon = ((drv.video_attributes & VIDEO_DUAL_MONITOR) != 0);
355         // Was removed from Core
356         gameinfo->isMultiMon = 0;
357         gameinfo->isVector = ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0);
358         gameinfo->usesRoms = FALSE;
359         for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
360            for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
361            {
362               gameinfo->usesRoms = TRUE;
363               break;
364            }
365         gameinfo->usesSamples = FALSE;
366         
367         if (HAS_SAMPLES || HAS_VLM5030)
368         {
369            for (i = 0; drv.sound[i].type && i < MAX_SOUND; i++)
370            {
371               const char **samplenames = NULL;
372               
373#if (HAS_SAMPLES || HAS_VLM5030)
374               for( i = 0; drv.sound[i].type && i < MAX_SOUND; i++ )
375               {
376#if (HAS_SAMPLES)
377                  if( drv.sound[i].type == SOUND_SAMPLES )
378                     samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames;
379#endif
380               }
381#endif
382               if (samplenames != 0 && samplenames[0] != 0)
383               {
384                  gameinfo->usesSamples = TRUE;
385                  break;
386               }
387            }
388         }
389
390         gameinfo->usesTrackball = FALSE;
391         gameinfo->usesLightGun = FALSE;
392         if (gamedrv->ipt != NULL)
393         {
394            begin_resource_tracking();
395            input_ports = input_port_allocate(gamedrv->ipt, NULL);
396            while (1)
397            {
398               UINT32 type;
399               type = input_ports->type;
400               if (type == IPT_END)
401                  break;
402               if (type == IPT_DIAL || type == IPT_PADDLE ||
403                  type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y ||
404                  type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y)
405                  gameinfo->usesTrackball = TRUE;
406               if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y)
407                  gameinfo->usesLightGun = TRUE;
408               input_ports++;
409            }
410            end_resource_tracking();
411         }
412      }
413   }
414   return &drivers_info[driver_index];
415}
416
417BOOL DriverIsClone(int driver_index)
418{
419    return GetDriversInfo(driver_index)->isClone;
420}
421
422BOOL DriverIsBroken(int driver_index)
423{
424   return GetDriversInfo(driver_index)->isBroken;
425}
426
427BOOL DriverIsHarddisk(int driver_index)
428{
429   return GetDriversInfo(driver_index)->isHarddisk;
430}
431
432BOOL DriverIsBios(int driver_index)
433{
434   BOOL bBios = FALSE;
435   if( !( (drivers[driver_index]->flags & GAME_IS_BIOS_ROOT ) == 0)   )
436      bBios = TRUE;
437   return bBios;
438}
439
440
441BOOL DriverHasOptionalBIOS(int driver_index)
442{
443   return GetDriversInfo(driver_index)->hasOptionalBIOS;
444}
445
446BOOL DriverIsStereo(int driver_index)
447{
448   return GetDriversInfo(driver_index)->isStereo;
449}
450BOOL DriverIsMultiMon(int driver_index)
451{
452   return GetDriversInfo(driver_index)->isMultiMon;
453}
454
455BOOL DriverIsVector(int driver_index)
456{
457   return GetDriversInfo(driver_index)->isVector;
458}
459
460BOOL DriverUsesRoms(int driver_index)
461{
462   return GetDriversInfo(driver_index)->usesRoms;
463}
464
465BOOL DriverUsesSamples(int driver_index)
466{
467   return GetDriversInfo(driver_index)->usesSamples;
468}
469
470BOOL DriverUsesTrackball(int driver_index)
471{
472   return GetDriversInfo(driver_index)->usesTrackball;
473}
474
475BOOL DriverUsesLightGun(int driver_index)
476{
477   return GetDriversInfo(driver_index)->usesLightGun;
478}
479
480BOOL DriverSupportsSaveState(int driver_index)
481{
482   return GetDriversInfo(driver_index)->supportsSaveState;
483}
484
485BOOL DriverIsVertical(int driver_index) {
486   return GetDriversInfo(driver_index)->isVertical;
487}
488
489void FlushFileCaches(void)
490{
491   zip_file_cache_clear();
492}
493
494void FreeIfAllocated(char **s)
495{
496   if (*s)
497      free(*s);
498   *s = NULL;
499}
500
501BOOL StringIsSuffixedBy(const char *s, const char *suffix)
502{
503   return (strlen(s) > strlen(suffix)) && (strcmp(s + strlen(s) - strlen(suffix), suffix) == 0);
504}
505
506/***************************************************************************
507   Win32 wrappers
508 ***************************************************************************/
509
510BOOL SafeIsAppThemed(void)
511{
512   BOOL bResult = FALSE;
513   HMODULE hThemes;
514   BOOL (WINAPI *pfnIsAppThemed)(void);
515   
516   hThemes = LoadLibrary(TEXT("uxtheme.dll"));
517   if (hThemes != NULL)
518   {
519      pfnIsAppThemed = (BOOL (WINAPI *)(void)) GetProcAddress(hThemes, "IsAppThemed");
520      if (pfnIsAppThemed != NULL)
521         bResult = pfnIsAppThemed();
522      FreeLibrary(hThemes);
523   }
524   return bResult;
525
526}
527
528
529
530//============================================================
531//  win_extract_icon_utf8
532//============================================================
533
534HICON win_extract_icon_utf8(HINSTANCE inst, const char* exefilename, UINT iconindex)
535{
536   HICON icon = 0;
537   TCHAR* t_exefilename = tstring_from_utf8(exefilename);
538   if( !t_exefilename )
539      return icon;
540   
541   icon = ExtractIcon(inst, t_exefilename, iconindex);
542   
543   free(t_exefilename);
544   
545   return icon;
546}
547
548
549
550//============================================================
551//  win_tstring_strdup
552//============================================================
553
554TCHAR* win_tstring_strdup(LPCTSTR str)
555{
556   TCHAR *cpy = NULL;
557   if (str != NULL)
558   {
559      cpy = malloc((_tcslen(str) + 1) * sizeof(TCHAR));
560      if (cpy != NULL)
561         _tcscpy(cpy, str);
562   }
563   return cpy;
564}
565
566//============================================================
567//  win_create_file_utf8
568//============================================================
569
570HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD sharemode,
571                        LPSECURITY_ATTRIBUTES securityattributes, DWORD creationdisposition,
572                        DWORD flagsandattributes, HANDLE templatehandle)
573{
574   HANDLE result = 0;
575   TCHAR* t_filename = tstring_from_utf8(filename);
576   if( !t_filename )
577      return result;
578   
579   result = CreateFile(t_filename, desiredmode, sharemode, securityattributes, creationdisposition,
580                  flagsandattributes, templatehandle);
581
582   free(t_filename);
583                 
584   return result;
585}
586
587//============================================================
588//  win_get_current_directory_utf8
589//============================================================
590
591DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer)
592{
593   DWORD result = 0;
594   TCHAR* t_buffer = NULL;
595   char* utf8_buffer = NULL;
596   
597   if( bufferlength > 0 ) {
598      t_buffer = malloc((bufferlength * sizeof(TCHAR)) + 1);
599      if( !t_buffer )
600         return result;
601   }
602   
603   result = GetCurrentDirectory(bufferlength, t_buffer);
604   
605   if( bufferlength > 0 ) {
606      utf8_buffer = utf8_from_tstring(t_buffer);
607      if( !utf8_buffer ) {
608         free(t_buffer);
609         return result;
610      }
611   }
612     
613   strncpy(buffer, utf8_buffer, bufferlength);
614   
615   if( utf8_buffer )
616      free(utf8_buffer);
617   
618   if( t_buffer )
619      free(t_buffer);
620   
621   return result;
622}
623
624//============================================================
625//  win_find_first_file_utf8
626//============================================================
627
628HANDLE win_find_first_file_utf8(const char* filename, LPWIN32_FIND_DATA findfiledata)
629{
630   HANDLE result = 0;
631   TCHAR* t_filename = tstring_from_utf8(filename);
632   if( !t_filename )
633      return result;
634   
635   result = FindFirstFile(t_filename, findfiledata);
636   
637   free(t_filename);
638   
639   return result;
640}
src/osd/winui/help.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
10   
11***************************************************************************/
1211
12 ***************************************************************************/
13
1314/***************************************************************************
1415
1516  help.c
r1367r1368
1819   
1920***************************************************************************/
2021
22// standard windows headers
2123#define WIN32_LEAN_AND_MEAN
2224#include <windows.h>
25
26// MAME/MAMEUI headers
2327#include "help.h"
2428
2529typedef HWND (WINAPI *HtmlHelpProc)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData);
r1367r1368
6771void HelpExit(void)
6872{
6973   HelpFunction(NULL, NULL, HH_CLOSE_ALL, 0);
70   HelpFunction(NULL, NULL, HH_UNINITIALIZE, (DWORD)g_dwCookie);
74   HelpFunction(NULL, NULL, HH_UNINITIALIZE, (DWORD_PTR)&g_dwCookie);
7175
7276   g_dwCookie  = 0;
7377   g_pHtmlHelp = NULL;
src/osd/winui/directdraw.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
1819 
1920 ***************************************************************************/
2021
22// standard windows headers
2123#define WIN32_LEAN_AND_MEAN
22
2324#include <windows.h>
2425
26// standard C headers
2527#include <ddraw.h>
2628#include <tchar.h>
2729
28#include "m32util.h"
29#include "screenshot.h"
30#include "mame32.h"
31#include "dxdecode.h"
30// MAME/MAMEUI headers
31#include "winui.h"
3232#include "directdraw.h"
33#include "mui_util.h" // For ErrorMsg
34#include "dxdecode.h" // For DirectXDecodeError
3335
3436/***************************************************************************
3537   function prototypes
src/osd/winui/treeview.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213
1314/***************************************************************************
1415
15  TreeView.c
16  treeview.c
1617
1718  TreeView support routines - MSH 11/19/1998
1819
1920***************************************************************************/
2021
22// standard windows headers
2123#define WIN32_LEAN_AND_MEAN
2224#include <windows.h>
2325#include <windowsx.h>
2426#include <shellapi.h>
2527#include <commctrl.h>
26#include <stdio.h>  /* for sprintf */
27#include <stdlib.h> /* For malloc and free */
28#include <ctype.h> /* For tolower */
28
29// standard C headers
30#include <stdio.h>  // for sprintf
31#include <stdlib.h> // For malloc and free
32#include <ctype.h> // For tolower
2933#include <string.h>
3034#include <sys/stat.h>
3135#include <sys/types.h>
36
3237#ifdef _MSC_VER
3338#include <direct.h>
3439#endif
3540#include <tchar.h>
41#include <io.h>
3642
37#include <io.h>
38#include <driver.h>
43// MAME/MAMEUI headers
44#include "driver.h"
3945#include "hash.h"
40#include "m32util.h"
46#include "mui_util.h"
4147#include "bitmask.h"
42#include "screenshot.h"
43#include "mame32.h"
48#include "winui.h"
4449#include "treeview.h"
4550#include "resource.h"
46#include "m32opts.h"
47#include "properties.h"
48#include "help.h"
51#include "mui_opts.h"
4952#include "dialogs.h"
5053#include "winutf8.h"
5154#include "strconv.h"
r1367r1368
22342237      char buf[500];
22352238      snprintf(buf,ARRAY_LENGTH(buf),"Error while renaming custom file %s to %s",
22362239             filename,new_filename);
2237      win_message_box_utf8(GetMainWindow(), buf, MAME32NAME, MB_OK | MB_ICONERROR);
2240      win_message_box_utf8(GetMainWindow(), buf, MAMEUINAME, MB_OK | MB_ICONERROR);
22382241   }
22392242   return retval;
22402243}
r1367r1368
22442247    if ((lpFolder->m_dwFlags & F_CUSTOM) == 0)
22452248   {
22462249       win_message_box_utf8(GetMainWindow(),"Unable to add game to non-custom folder",
2247               MAME32NAME,MB_OK | MB_ICONERROR);
2250               MAMEUINAME,MB_OK | MB_ICONERROR);
22482251      return;
22492252   }
22502253
r1367r1368
22612264    if ((lpFolder->m_dwFlags & F_CUSTOM) == 0)
22622265   {
22632266       win_message_box_utf8(GetMainWindow(),"Unable to remove game from non-custom folder",
2264               MAME32NAME,MB_OK | MB_ICONERROR);
2267               MAMEUINAME,MB_OK | MB_ICONERROR);
22652268      return;
22662269   }
22672270
r1367r1368
23032306
23042307   if (extra_folder == NULL || root_folder == NULL)
23052308   {
2306      MessageBox(GetMainWindow(), TEXT("Error finding custom file name to save"), TEXT(MAME32NAME), MB_OK | MB_ICONERROR);
2309      MessageBox(GetMainWindow(), TEXT("Error finding custom file name to save"), TEXT(MAMEUINAME), MB_OK | MB_ICONERROR);
23072310      return FALSE;
23082311   }
23092312    /* "folder\title.ini" */
r1367r1368
23752378   {
23762379      char buf[500];
23772380      snprintf(buf,ARRAY_LENGTH(buf),"Error while saving custom file %s",fname);
2378      win_message_box_utf8(GetMainWindow(), buf, MAME32NAME, MB_OK | MB_ICONERROR);
2381      win_message_box_utf8(GetMainWindow(), buf, MAMEUINAME, MB_OK | MB_ICONERROR);
23792382   }
23802383   return !error;
23812384}
src/osd/winui/winui.c
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14 /***************************************************************************
15
16  winui.c
17
18  Win32 GUI code.
19
20  Created 8/12/97 by Christopher Kirmse (ckirmse@ricochet.net)
21  Additional code November 1997 by Jeff Miller (miller@aa.net)
22  More July 1998 by Mike Haaland (mhaaland@hypertech.com)
23  Added Spitters/Property Sheets/Removed Tabs/Added Tree Control in
24  Nov/Dec 1998 - Mike Haaland
25
26***************************************************************************/
27
28// standard windows headers
29#define WIN32_LEAN_AND_MEAN
30#define _WIN32_IE 0x0500
31#include <windows.h>
32#include <windowsx.h>
33#include <shellapi.h>
34#include <commctrl.h>
35#include <wingdi.h>
36
37// standard C headers
38#include <stdio.h>
39#include <ctype.h>
40#include <io.h>
41#include <fcntl.h>
42#include <dlgs.h>
43#include <string.h>
44#include <sys/stat.h>
45#include <time.h>
46#include <tchar.h>
47
48
49// MAME/MAMEUI headers
50#include "driver.h"
51#include "osdepend.h"
52#include "unzip.h"
53#include "winutf8.h"
54#include "strconv.h"
55#include "input.h"
56#include "window.h"
57#include "winmain.h"
58
59#include "resource.h"
60#include "resource.hm"
61
62#include "winui.h"
63#include "mui_util.h"
64#include "mui_audit.h"
65#include "directories.h"
66#include "mui_opts.h"
67#include "properties.h"
68#include "columnedit.h"
69#include "picker.h"
70#include "tabview.h"
71#include "bitmask.h"
72#include "treeview.h"
73#include "splitters.h"
74#include "dirwatch.h"
75#include "help.h"
76#include "history.h"
77#include "dialogs.h"
78#include "directdraw.h"
79#include "directinput.h"
80#include "dijoystick.h"     /* For DIJoystick avalibility. */
81
82#ifdef MESS
83#include "messui.h"
84#include "messopts.h"
85#endif // MESS
86
87#ifdef _MSC_VER
88#define snprintf _snprintf
89#endif
90
91#ifndef LVS_EX_LABELTIP
92#define LVS_EX_LABELTIP         0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
93#endif // LVS_EX_LABELTIP
94
95// fix warning: cast does not match function type
96#if defined(__GNUC__) && defined(ListView_CreateDragImage)
97#undef ListView_CreateDragImage
98#endif
99
100#ifndef ListView_CreateDragImage
101#define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
102    (HIMAGELIST)(LRESULT)(int)SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
103#endif // ListView_CreateDragImage
104
105#ifndef TreeView_EditLabel
106#define TreeView_EditLabel(w, i) \
107    SNDMSG(w,TVM_EDITLABEL,0,(LPARAM)(i))
108#endif // TreeView_EditLabel
109
110#ifndef HDF_SORTUP
111#define HDF_SORTUP 0x400
112#endif // HDF_SORTUP
113
114#ifndef HDF_SORTDOWN
115#define HDF_SORTDOWN 0x200
116#endif // HDF_SORTDOWN
117
118#ifndef LVM_SETBKIMAGEA
119#define LVM_SETBKIMAGEA         (LVM_FIRST + 68)
120#endif // LVM_SETBKIMAGEA
121
122#ifndef LVM_SETBKIMAGEW
123#define LVM_SETBKIMAGEW         (LVM_FIRST + 138)
124#endif // LVM_SETBKIMAGEW
125
126#ifndef LVM_GETBKIMAGEA
127#define LVM_GETBKIMAGEA         (LVM_FIRST + 69)
128#endif // LVM_GETBKIMAGEA
129
130#ifndef LVM_GETBKIMAGEW
131#define LVM_GETBKIMAGEW         (LVM_FIRST + 139)
132#endif // LVM_GETBKIMAGEW
133
134#ifndef LVBKIMAGE
135
136typedef struct tagLVBKIMAGEA
137{
138   ULONG ulFlags;
139   HBITMAP hbm;
140   LPSTR pszImage;
141   UINT cchImageMax;
142   int xOffsetPercent;
143   int yOffsetPercent;
144} LVBKIMAGEA, *LPLVBKIMAGEA;
145
146typedef struct tagLVBKIMAGEW
147{
148   ULONG ulFlags;
149   HBITMAP hbm;
150   LPWSTR pszImage;
151   UINT cchImageMax;
152   int xOffsetPercent;
153   int yOffsetPercent;
154} LVBKIMAGEW, *LPLVBKIMAGEW;
155
156#ifdef UNICODE
157#define LVBKIMAGE               LVBKIMAGEW
158#define LPLVBKIMAGE             LPLVBKIMAGEW
159#define LVM_SETBKIMAGE          LVM_SETBKIMAGEW
160#define LVM_GETBKIMAGE          LVM_GETBKIMAGEW
161#else
162#define LVBKIMAGE               LVBKIMAGEA
163#define LPLVBKIMAGE             LPLVBKIMAGEA
164#define LVM_SETBKIMAGE          LVM_SETBKIMAGEA
165#define LVM_GETBKIMAGE          LVM_GETBKIMAGEA
166#endif
167#endif
168
169#ifndef LVBKIF_SOURCE_NONE
170#define LVBKIF_SOURCE_NONE      0x00000000
171#endif // LVBKIF_SOURCE_NONE
172
173#ifndef LVBKIF_SOURCE_HBITMAP
174#define LVBKIF_SOURCE_HBITMAP   0x00000001
175#endif
176
177#ifndef LVBKIF_SOURCE_URL
178#define LVBKIF_SOURCE_URL       0x00000002
179#endif // LVBKIF_SOURCE_URL
180
181#ifndef LVBKIF_SOURCE_MASK
182#define LVBKIF_SOURCE_MASK      0x00000003
183#endif // LVBKIF_SOURCE_MASK
184
185#ifndef LVBKIF_STYLE_NORMAL
186#define LVBKIF_STYLE_NORMAL     0x00000000
187#endif // LVBKIF_STYLE_NORMAL
188
189#ifndef LVBKIF_STYLE_TILE
190#define LVBKIF_STYLE_TILE       0x00000010
191#endif // LVBKIF_STYLE_TILE
192
193#ifndef LVBKIF_STYLE_MASK
194#define LVBKIF_STYLE_MASK       0x00000010
195#endif // LVBKIF_STYLE_MASK
196
197#ifndef ListView_SetBkImage
198#define ListView_SetBkImage(hwnd, plvbki) \
199    (BOOL)SNDMSG((hwnd), LVM_SETBKIMAGE, 0, (LPARAM)(plvbki))
200#endif // ListView_SetBkImage
201
202#ifndef ListView_GetBkImage
203#define ListView_GetBkImage(hwnd, plvbki) \
204    (BOOL)SNDMSG((hwnd), LVM_GETBKIMAGE, 0, (LPARAM)(plvbki))
205#endif // ListView_GetBkImage
206
207#define MM_PLAY_GAME (WM_APP + 15000)
208
209#define JOYGUI_MS 100
210
211#define JOYGUI_TIMER 1
212#define SCREENSHOT_TIMER 2
213#define GAMEWND_TIMER 3
214
215/* Max size of a sub-menu */
216#define DBU_MIN_WIDTH  292
217#define DBU_MIN_HEIGHT 190
218
219int MIN_WIDTH  = DBU_MIN_WIDTH;
220int MIN_HEIGHT = DBU_MIN_HEIGHT;
221
222/* Max number of bkground picture files */
223#define MAX_BGFILES 100
224
225#ifndef LVS_EX_LABELTIP
226#define LVS_EX_LABELTIP         0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
227#endif
228
229#define NO_FOLDER -1
230#define STATESAVE_VERSION 1
231
232/***************************************************************************
233 externally defined global variables
234 ***************************************************************************/
235extern const ICONDATA g_iconData[];
236extern const TCHAR g_szPlayGameString[];
237extern const char g_szGameCountString[];
238
239typedef struct _play_options play_options;
240struct _play_options
241{
242   const char *record;         // OPTION_RECORD
243   const char *playback;      // OPTION_PLAYBACK
244   const char *state;         // OPTION_STATE
245   const char *wavwrite;      // OPTION_WAVWRITE
246   const char *mngwrite;      // OPTION_MNGWRITE
247};
248
249/***************************************************************************
250    function prototypes
251 ***************************************************************************/
252
253static BOOL             Win32UI_init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
254static void             Win32UI_exit(void);
255
256static BOOL             PumpMessage(void);
257static BOOL             OnIdle(HWND hWnd);
258static void             OnSize(HWND hwnd, UINT state, int width, int height);
259static LRESULT CALLBACK MameWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
260
261static void             SetView(int menu_id);
262static void             ResetListView(void);
263static void             UpdateGameList(BOOL bUpdateRomAudit, BOOL bUpdateSampleAudit);
264static void             DestroyIcons(void);
265static void             ReloadIcons(void);
266static void             PollGUIJoystick(void);
267//static void             PressKey(HWND hwnd,UINT vk);
268static BOOL             MameCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify);
269static void             KeyboardKeyDown(int syskey, int vk_code, int special);
270static void             KeyboardKeyUp(int syskey, int vk_code, int special);
271static void             KeyboardStateClear(void);
272
273static void             UpdateStatusBar(void);
274//static BOOL             PickerHitTest(HWND hWnd);
275static BOOL             TreeViewNotify(NMHDR *nm);
276
277static void             ResetBackground(char *szFile);
278static void            RandomSelectBackground(void);
279static void             LoadBackgroundBitmap(void);
280static void             PaintBackgroundImage(HWND hWnd, HRGN hRgn, int x, int y);
281
282static int CLIB_DECL    DriverDataCompareFunc(const void *arg1,const void *arg2);
283static int              GamePicker_Compare(HWND hwndPicker, int index1, int index2, int sort_subitem);
284
285static void             DisableSelection(void);
286static void             EnableSelection(int nGame);
287
288static HICON         GetSelectedPickItemIcon(void);
289static void             SetRandomPickItem(void);
290static void            PickColor(COLORREF *cDefault);
291
292static LPTREEFOLDER     GetSelectedFolder(void);
293static HICON         GetSelectedFolderIcon(void);
294
295static LRESULT CALLBACK HistoryWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
296static LRESULT CALLBACK PictureFrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
297static LRESULT CALLBACK PictureWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
298static INT_PTR CALLBACK LanguageDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
299
300static BOOL             SelectLanguageFile(HWND hWnd, TCHAR* filename);
301static void             MamePlayRecordGame(void);
302static void             MamePlayBackGame(void);
303static void             MamePlayRecordWave(void);
304static void             MamePlayRecordMNG(void);
305static void            MameLoadState(void);
306static void             MamePlayGameWithOptions(int nGame, const play_options *playopts);
307static BOOL             GameCheck(void);
308static BOOL             FolderCheck(void);
309
310static void             ToggleScreenShot(void);
311static void             AdjustMetrics(void);
312//static void             EnablePlayOptions(int nIndex, core_options *o);
313
314/* Icon routines */
315static DWORD            GetShellLargeIconSize(void);
316static DWORD            GetShellSmallIconSize(void);
317static void             CreateIcons(void);
318static int              GetIconForDriver(int nItem);
319static void             AddDriverIcon(int nItem,int default_icon_index);
320
321// Context Menu handlers
322static void             UpdateMenu(HMENU hMenu);
323static void             InitTreeContextMenu(HMENU hTreeMenu);
324static void             InitBodyContextMenu(HMENU hBodyContextMenu);
325static void             ToggleShowFolder(int folder);
326static BOOL             HandleTreeContextMenu( HWND hWnd, WPARAM wParam, LPARAM lParam);
327static BOOL             HandleScreenShotContextMenu( HWND hWnd, WPARAM wParam, LPARAM lParam);
328static void            GamePicker_OnHeaderContextMenu(POINT pt, int nColumn);
329static void            GamePicker_OnBodyContextMenu(POINT pt);
330
331static void             InitListView(void);
332/* Re/initialize the ListView header columns */
333static void             ResetColumnDisplay(BOOL first_time);
334
335static void             CopyToolTipText (LPTOOLTIPTEXT lpttt);
336
337static void             ProgressBarShow(void);
338static void             ProgressBarHide(void);
339static void             ResizeProgressBar(void);
340static void             ProgressBarStep(void);
341static void             ProgressBarStepParam(int iGameIndex, int nGameCount);
342
343static HWND             InitProgressBar(HWND hParent);
344static HWND             InitToolbar(HWND hParent);
345static HWND             InitStatusBar(HWND hParent);
346
347static LRESULT          Statusbar_MenuSelect (HWND hwnd, WPARAM wParam, LPARAM lParam);
348
349static void             UpdateHistory(void);
350
351
352void RemoveCurrentGameCustomFolder(void);
353void RemoveGameCustomFolder(int driver_index);
354
355void BeginListViewDrag(NM_LISTVIEW *pnmv);
356void MouseMoveListViewDrag(POINTS pt);
357void ButtonUpListViewDrag(POINTS p);
358
359void CalculateBestScreenShotRect(HWND hWnd, RECT *pRect, BOOL restrict_height);
360
361BOOL MouseHasBeenMoved(void);
362void SwitchFullScreenMode(void);
363
364/***************************************************************************
365    External variables
366 ***************************************************************************/
367
368/***************************************************************************
369    Internal structures
370 ***************************************************************************/
371
372/*
373 * These next two structs represent how the icon information
374 * is stored in an ICO file.
375 */
376typedef struct
377{
378   BYTE    bWidth;               /* Width of the image */
379   BYTE    bHeight;              /* Height of the image (times 2) */
380   BYTE    bColorCount;          /* Number of colors in image (0 if >=8bpp) */
381   BYTE    bReserved;            /* Reserved */
382   WORD    wPlanes;              /* Color Planes */
383   WORD    wBitCount;            /* Bits per pixel */
384   DWORD   dwBytesInRes;         /* how many bytes in this resource? */
385   DWORD   dwImageOffset;        /* where in the file is this image */
386} ICONDIRENTRY, *LPICONDIRENTRY;
387
388typedef struct
389{
390   UINT            Width, Height, Colors; /* Width, Height and bpp */
391   LPBYTE          lpBits;                /* ptr to DIB bits */
392   DWORD           dwNumBytes;            /* how many bytes? */
393   LPBITMAPINFO    lpbi;                  /* ptr to header */
394   LPBYTE          lpXOR;                 /* ptr to XOR image bits */
395   LPBYTE          lpAND;                 /* ptr to AND image bits */
396} ICONIMAGE, *LPICONIMAGE;
397
398/* Which edges of a control are anchored to the corresponding side of the parent window */
399#define RA_LEFT     0x01
400#define RA_RIGHT    0x02
401#define RA_TOP      0x04
402#define RA_BOTTOM   0x08
403#define RA_ALL      0x0F
404
405#define RA_END  0
406#define RA_ID   1
407#define RA_HWND 2
408
409typedef struct
410{
411   int         type;       /* Either RA_ID or RA_HWND, to indicate which member of u is used; or RA_END
412                        to signify last entry */
413   union                   /* Can identify a child window by control id or by handle */
414   {
415      int     id;         /* Window control id */
416      HWND    hwnd;       /* Window handle */
417   } u;
418   BOOL      setfont;   /* Do we set this item's font? */
419   int         action;     /* What to do when control is resized */
420   void        *subwindow; /* Points to a Resize structure for this subwindow; NULL if none */
421} ResizeItem;
422
423typedef struct
424{
425   RECT        rect;       /* Client rect of window; must be initialized before first resize */
426   ResizeItem* items;      /* Array of subitems to be resized */
427} Resize;
428
429static void ResizeWindow(HWND hParent, Resize *r);
430static void SetAllWindowsFont(HWND hParent, const Resize *r, HFONT hFont, BOOL bRedraw);
431
432/* List view Icon defines */
433#define LG_ICONMAP_WIDTH    GetSystemMetrics(SM_CXICON)
434#define LG_ICONMAP_HEIGHT   GetSystemMetrics(SM_CYICON)
435#define ICONMAP_WIDTH       GetSystemMetrics(SM_CXSMICON)
436#define ICONMAP_HEIGHT      GetSystemMetrics(SM_CYSMICON)
437
438typedef struct tagPOPUPSTRING
439{
440   HMENU hMenu;
441   UINT uiString;
442} POPUPSTRING;
443
444#define MAX_MENUS 3
445
446#define SPLITTER_WIDTH   4
447#define MIN_VIEW_WIDTH   10
448
449// Struct needed for Game Window Communication
450
451typedef struct
452{
453   LPPROCESS_INFORMATION ProcessInfo;
454   HWND hwndFound;
455} FINDWINDOWHANDLE;
456
457/***************************************************************************
458    Internal variables
459 ***************************************************************************/
460
461static HWND   hMain  = NULL;
462static HACCEL hAccel = NULL;
463
464static HWND hwndList  = NULL;
465static HWND hTreeView = NULL;
466static HWND hProgWnd  = NULL;
467static HWND hTabCtrl  = NULL;
468
469static HINSTANCE hInst = NULL;
470
471static HFONT hFont = NULL;     /* Font for list view */
472
473static int optionfolder_count = 0;
474
475/* global data--know where to send messages */
476static BOOL in_emulation;
477
478/* idle work at startup */
479static BOOL idle_work;
480
481/* object pool in use */
482static object_pool *mameui_pool;
483
484static int  game_index;
485static int  progBarStep;
486
487static BOOL bDoGameCheck = FALSE;
488
489/* Tree control variables */
490static BOOL bShowTree      = 1;
491static BOOL bShowToolBar   = 1;
492static BOOL bShowStatusBar = 1;
493static BOOL bShowTabCtrl   = 1;
494static BOOL bProgressShown = FALSE;
495static BOOL bListReady     = FALSE;
496
497#define   WM_MAME32_FILECHANGED   (WM_USER + 0)
498#define   WM_MAME32_AUDITGAME      (WM_USER + 1)
499
500static PDIRWATCHER s_pWatcher;
501
502/* use a joystick subsystem in the gui? */
503static struct OSDJoystick* g_pJoyGUI = NULL;
504
505/* store current keyboard state (in internal codes) here */
506static input_code keyboard_state[ 2048 ]; /* __code_max #defines the number of internal key_codes */
507
508/* search */
509static char g_SearchText[256];
510/* table copied from windows/inputs.c */
511// table entry indices
512#define MAME_KEY      0
513#define DI_KEY         1
514#define VIRTUAL_KEY      2
515#define ASCII_KEY      3
516
517// master keyboard translation table
518static const int win_key_trans_table[][4] =
519{
520   // MAME key             dinput key          virtual key     ascii
521   { ITEM_ID_ESC,          DIK_ESCAPE,         VK_ESCAPE,       27 },
522   { ITEM_ID_1,          DIK_1,            '1',         '1' },
523   { ITEM_ID_2,          DIK_2,            '2',         '2' },
524   { ITEM_ID_3,          DIK_3,            '3',         '3' },
525   { ITEM_ID_4,          DIK_4,            '4',         '4' },
526   { ITEM_ID_5,          DIK_5,            '5',         '5' },
527   { ITEM_ID_6,          DIK_6,            '6',         '6' },
528   { ITEM_ID_7,          DIK_7,            '7',         '7' },
529   { ITEM_ID_8,          DIK_8,            '8',         '8' },
530   { ITEM_ID_9,          DIK_9,            '9',         '9' },
531   { ITEM_ID_0,          DIK_0,            '0',         '0' },
532   { ITEM_ID_BACKSPACE,   DIK_BACK,          VK_BACK,       8 },
533   { ITEM_ID_TAB,          DIK_TAB,          VK_TAB,       9 },
534   { ITEM_ID_Q,          DIK_Q,            'Q',         'Q' },
535   { ITEM_ID_W,          DIK_W,            'W',         'W' },
536   { ITEM_ID_E,          DIK_E,            'E',         'E' },
537   { ITEM_ID_R,          DIK_R,            'R',         'R' },
538   { ITEM_ID_T,          DIK_T,            'T',         'T' },
539   { ITEM_ID_Y,          DIK_Y,            'Y',         'Y' },
540   { ITEM_ID_U,          DIK_U,            'U',         'U' },
541   { ITEM_ID_I,          DIK_I,            'I',         'I' },
542   { ITEM_ID_O,          DIK_O,            'O',         'O' },
543   { ITEM_ID_P,          DIK_P,            'P',         'P' },
544   { ITEM_ID_OPENBRACE,   DIK_LBRACKET,       VK_OEM_4,      '[' },
545   { ITEM_ID_CLOSEBRACE,   DIK_RBRACKET,       VK_OEM_6,      ']' },
546   { ITEM_ID_ENTER,       DIK_RETURN,       VK_RETURN,       13 },
547   { ITEM_ID_LCONTROL,    DIK_LCONTROL,       VK_LCONTROL,    0 },
548   { ITEM_ID_A,          DIK_A,            'A',         'A' },
549   { ITEM_ID_S,          DIK_S,            'S',         'S' },
550   { ITEM_ID_D,          DIK_D,            'D',         'D' },
551   { ITEM_ID_F,          DIK_F,            'F',         'F' },
552   { ITEM_ID_G,          DIK_G,            'G',         'G' },
553   { ITEM_ID_H,          DIK_H,            'H',         'H' },
554   { ITEM_ID_J,          DIK_J,            'J',         'J' },
555   { ITEM_ID_K,          DIK_K,            'K',         'K' },
556   { ITEM_ID_L,          DIK_L,            'L',         'L' },
557   { ITEM_ID_COLON,       DIK_SEMICOLON,      VK_OEM_1,      ';' },
558   { ITEM_ID_QUOTE,       DIK_APOSTROPHE,      VK_OEM_7,      '\'' },
559   { ITEM_ID_TILDE,       DIK_GRAVE,          VK_OEM_3,      '`' },
560   { ITEM_ID_LSHIFT,       DIK_LSHIFT,       VK_LSHIFT,       0 },
561   { ITEM_ID_BACKSLASH,   DIK_BACKSLASH,       VK_OEM_5,      '\\' },
562   { ITEM_ID_Z,          DIK_Z,            'Z',         'Z' },
563   { ITEM_ID_X,          DIK_X,            'X',         'X' },
564   { ITEM_ID_C,          DIK_C,            'C',         'C' },
565   { ITEM_ID_V,          DIK_V,            'V',         'V' },
566   { ITEM_ID_B,          DIK_B,            'B',         'B' },
567   { ITEM_ID_N,          DIK_N,            'N',         'N' },
568   { ITEM_ID_M,          DIK_M,            'M',         'M' },
569   { ITEM_ID_SLASH,       DIK_SLASH,          VK_OEM_2,      '/' },
570   { ITEM_ID_RSHIFT,       DIK_RSHIFT,       VK_RSHIFT,       0 },
571   { ITEM_ID_ASTERISK,    DIK_MULTIPLY,       VK_MULTIPLY,   '*' },
572   { ITEM_ID_LALT,       DIK_LMENU,          VK_LMENU,       0 },
573   { ITEM_ID_SPACE,       DIK_SPACE,          VK_SPACE,      ' ' },
574   { ITEM_ID_CAPSLOCK,    DIK_CAPITAL,       VK_CAPITAL,    0 },
575   { ITEM_ID_F1,          DIK_F1,            VK_F1,          0 },
576   { ITEM_ID_F2,          DIK_F2,            VK_F2,          0 },
577   { ITEM_ID_F3,          DIK_F3,            VK_F3,          0 },
578   { ITEM_ID_F4,          DIK_F4,            VK_F4,          0 },
579   { ITEM_ID_F5,          DIK_F5,            VK_F5,          0 },
580   { ITEM_ID_F6,          DIK_F6,            VK_F6,          0 },
581   { ITEM_ID_F7,          DIK_F7,            VK_F7,          0 },
582   { ITEM_ID_F8,          DIK_F8,            VK_F8,          0 },
583   { ITEM_ID_F9,          DIK_F9,            VK_F9,          0 },
584   { ITEM_ID_F10,          DIK_F10,         VK_F10,       0 },
585   { ITEM_ID_NUMLOCK,       DIK_NUMLOCK,      VK_NUMLOCK,    0 },
586   { ITEM_ID_SCRLOCK,       DIK_SCROLL,         VK_SCROLL,       0 },
587   { ITEM_ID_7_PAD,       DIK_NUMPAD7,      VK_NUMPAD7,    0 },
588   { ITEM_ID_8_PAD,       DIK_NUMPAD8,      VK_NUMPAD8,    0 },
589   { ITEM_ID_9_PAD,       DIK_NUMPAD9,      VK_NUMPAD9,    0 },
590   { ITEM_ID_MINUS_PAD,   DIK_SUBTRACT,      VK_SUBTRACT,    0 },
591   { ITEM_ID_4_PAD,       DIK_NUMPAD4,      VK_NUMPAD4,    0 },
592   { ITEM_ID_5_PAD,       DIK_NUMPAD5,      VK_NUMPAD5,    0 },
593   { ITEM_ID_6_PAD,       DIK_NUMPAD6,      VK_NUMPAD6,    0 },
594   { ITEM_ID_PLUS_PAD,    DIK_ADD,         VK_ADD,       0 },
595   { ITEM_ID_1_PAD,       DIK_NUMPAD1,      VK_NUMPAD1,    0 },
596   { ITEM_ID_2_PAD,       DIK_NUMPAD2,      VK_NUMPAD2,    0 },
597   { ITEM_ID_3_PAD,       DIK_NUMPAD3,      VK_NUMPAD3,    0 },
598   { ITEM_ID_0_PAD,       DIK_NUMPAD0,      VK_NUMPAD0,    0 },
599   { ITEM_ID_DEL_PAD,       DIK_DECIMAL,      VK_DECIMAL,    0 },
600   { ITEM_ID_F11,          DIK_F11,         VK_F11,       0 },
601   { ITEM_ID_F12,          DIK_F12,         VK_F12,       0 },
602   { ITEM_ID_F13,          DIK_F13,         VK_F13,       0 },
603   { ITEM_ID_F14,          DIK_F14,         VK_F14,       0 },
604   { ITEM_ID_F15,          DIK_F15,         VK_F15,       0 },
605   { ITEM_ID_ENTER_PAD,   DIK_NUMPADENTER,   VK_RETURN,       0 },
606   { ITEM_ID_RCONTROL,    DIK_RCONTROL,      VK_RCONTROL,    0 },
607   { ITEM_ID_SLASH_PAD,   DIK_DIVIDE,         VK_DIVIDE,       0 },
608   { ITEM_ID_PRTSCR,       DIK_SYSRQ,          0,             0 },
609   { ITEM_ID_RALT,       DIK_RMENU,         VK_RMENU,       0 },
610   { ITEM_ID_HOME,       DIK_HOME,         VK_HOME,       0 },
611   { ITEM_ID_UP,          DIK_UP,            VK_UP,          0 },
612   { ITEM_ID_PGUP,       DIK_PRIOR,         VK_PRIOR,       0 },
613   { ITEM_ID_LEFT,       DIK_LEFT,         VK_LEFT,       0 },
614   { ITEM_ID_RIGHT,       DIK_RIGHT,         VK_RIGHT,       0 },
615   { ITEM_ID_END,          DIK_END,         VK_END,       0 },
616   { ITEM_ID_DOWN,       DIK_DOWN,         VK_DOWN,       0 },
617   { ITEM_ID_PGDN,       DIK_NEXT,         VK_NEXT,       0 },
618   { ITEM_ID_INSERT,       DIK_INSERT,         VK_INSERT,       0 },
619   { ITEM_ID_DEL,          DIK_DELETE,         VK_DELETE,       0 },
620   { ITEM_ID_LWIN,       DIK_LWIN,         VK_LWIN,       0 },
621   { ITEM_ID_RWIN,       DIK_RWIN,         VK_RWIN,       0 },
622   { ITEM_ID_MENU,       DIK_APPS,         VK_APPS,       0 },
623   { ITEM_ID_PAUSE,       DIK_PAUSE,         VK_PAUSE,      0 },
624   { ITEM_ID_CANCEL,      0,               VK_CANCEL,      0 },
625};
626
627
628
629typedef struct
630{
631   char      name[40];       // functionality name (optional)
632   input_seq   is;            // the input sequence (the keys pressed)
633   UINT      func_id;        // the identifier
634   input_seq* (*getiniptr)(void);// pointer to function to get the value from .ini file
635} GUISequence;
636
637static GUISequence GUISequenceControl[]=
638{
639   {"gui_key_up",                SEQ_DEF_0,    ID_UI_UP,           Get_ui_key_up },
640   {"gui_key_down",              SEQ_DEF_0,    ID_UI_DOWN,         Get_ui_key_down },
641   {"gui_key_left",              SEQ_DEF_0,    ID_UI_LEFT,         Get_ui_key_left },
642   {"gui_key_right",             SEQ_DEF_0,    ID_UI_RIGHT,        Get_ui_key_right },
643   {"gui_key_start",             SEQ_DEF_0,    ID_UI_START,        Get_ui_key_start },
644   {"gui_key_pgup",              SEQ_DEF_0,    ID_UI_PGUP,         Get_ui_key_pgup },
645   {"gui_key_pgdwn",             SEQ_DEF_0,    ID_UI_PGDOWN,       Get_ui_key_pgdwn },
646   {"gui_key_home",              SEQ_DEF_0,    ID_UI_HOME,         Get_ui_key_home },
647   {"gui_key_end",               SEQ_DEF_0,    ID_UI_END,          Get_ui_key_end },
648   {"gui_key_ss_change",         SEQ_DEF_0,    IDC_SSFRAME,        Get_ui_key_ss_change },
649   {"gui_key_history_up",        SEQ_DEF_0,    ID_UI_HISTORY_UP,   Get_ui_key_history_up },
650   {"gui_key_history_down",      SEQ_DEF_0,    ID_UI_HISTORY_DOWN, Get_ui_key_history_down },
651   
652   {"gui_key_context_filters",    SEQ_DEF_0,    ID_CONTEXT_FILTERS,       Get_ui_key_context_filters },
653   {"gui_key_select_random",      SEQ_DEF_0,    ID_CONTEXT_SELECT_RANDOM, Get_ui_key_select_random },
654   {"gui_key_game_audit",         SEQ_DEF_0,    ID_GAME_AUDIT,            Get_ui_key_game_audit },
655   {"gui_key_game_properties",    SEQ_DEF_0,    ID_GAME_PROPERTIES,       Get_ui_key_game_properties },
656   {"gui_key_help_contents",      SEQ_DEF_0,    ID_HELP_CONTENTS,         Get_ui_key_help_contents },
657   {"gui_key_update_gamelist",    SEQ_DEF_0,    ID_UPDATE_GAMELIST,       Get_ui_key_update_gamelist },
658   {"gui_key_view_folders",       SEQ_DEF_0,    ID_VIEW_FOLDERS,          Get_ui_key_view_folders },
659   {"gui_key_view_fullscreen",    SEQ_DEF_0,    ID_VIEW_FULLSCREEN,       Get_ui_key_view_fullscreen },
660   {"gui_key_view_pagetab",       SEQ_DEF_0,    ID_VIEW_PAGETAB,          Get_ui_key_view_pagetab },
661   {"gui_key_view_picture_area",  SEQ_DEF_0,    ID_VIEW_PICTURE_AREA,     Get_ui_key_view_picture_area },
662   {"gui_key_view_status",        SEQ_DEF_0,    ID_VIEW_STATUS,           Get_ui_key_view_status },
663   {"gui_key_view_toolbars",      SEQ_DEF_0,    ID_VIEW_TOOLBARS,         Get_ui_key_view_toolbars },
664
665   {"gui_key_view_tab_cabinet",     SEQ_DEF_0,  ID_VIEW_TAB_CABINET,       Get_ui_key_view_tab_cabinet },
666   {"gui_key_view_tab_cpanel",      SEQ_DEF_0,  ID_VIEW_TAB_CONTROL_PANEL, Get_ui_key_view_tab_cpanel },
667   {"gui_key_view_tab_flyer",       SEQ_DEF_0,  ID_VIEW_TAB_FLYER,         Get_ui_key_view_tab_flyer },
668   {"gui_key_view_tab_history",     SEQ_DEF_0,  ID_VIEW_TAB_HISTORY,       Get_ui_key_view_tab_history },
669   {"gui_key_view_tab_marquee",     SEQ_DEF_0,  ID_VIEW_TAB_MARQUEE,       Get_ui_key_view_tab_marquee },
670   {"gui_key_view_tab_screenshot",  SEQ_DEF_0,  ID_VIEW_TAB_SCREENSHOT,    Get_ui_key_view_tab_screenshot },
671   {"gui_key_view_tab_title",       SEQ_DEF_0,  ID_VIEW_TAB_TITLE,         Get_ui_key_view_tab_title },
672   {"gui_key_view_tab_pcb",         SEQ_DEF_0,  ID_VIEW_TAB_PCB,          Get_ui_key_view_tab_pcb },
673   {"gui_key_quit",                 SEQ_DEF_0,  ID_FILE_EXIT,              Get_ui_key_quit },
674};
675
676
677#define NUM_GUI_SEQUENCES (sizeof(GUISequenceControl) / sizeof(GUISequenceControl[0]))
678
679
680static UINT    lastColumnClick   = 0;
681static WNDPROC g_lpHistoryWndProc = NULL;
682static WNDPROC g_lpPictureFrameWndProc = NULL;
683static WNDPROC g_lpPictureWndProc = NULL;
684
685static POPUPSTRING popstr[MAX_MENUS + 1];
686
687/* Tool and Status bar variables */
688static HWND hStatusBar = 0;
689static HWND hToolBar   = 0;
690
691/* Column Order as Displayed */
692static BOOL oldControl = FALSE;
693static BOOL xpControl = FALSE;
694
695/* Used to recalculate the main window layout */
696static int  bottomMargin;
697static int  topMargin;
698static int  have_history = FALSE;
699
700static BOOL have_selection = FALSE;
701
702static HBITMAP hMissing_bitmap;
703
704/* Icon variables */
705static HIMAGELIST   hLarge = NULL;
706static HIMAGELIST   hSmall = NULL;
707static HIMAGELIST   hHeaderImages = NULL;
708static int          *icon_index = NULL; /* for custom per-game icons */
709
710static TBBUTTON tbb[] =
711{
712   {0, ID_VIEW_FOLDERS,    TBSTATE_ENABLED, TBSTYLE_CHECK,      {0, 0}, 0, 0},
713   {1, ID_VIEW_PICTURE_AREA,TBSTATE_ENABLED, TBSTYLE_CHECK,      {0, 0}, 0, 1},
714   {0, 0,                  TBSTATE_ENABLED, TBSTYLE_SEP,        {0, 0}, 0, 0},
715   {2, ID_VIEW_LARGE_ICON, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 2},
716   {3, ID_VIEW_SMALL_ICON, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 3},
717   {4, ID_VIEW_LIST_MENU,  TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 4},
718   {5, ID_VIEW_DETAIL,     TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 5},
719   {6, ID_VIEW_GROUPED, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, {0, 0}, 0, 6},
720   {0, 0,                  TBSTATE_ENABLED, TBSTYLE_SEP,        {0, 0}, 0, 0},
721   {7, ID_HELP_ABOUT,      TBSTATE_ENABLED, TBSTYLE_BUTTON,     {0, 0}, 0, 7},
722   {8, ID_HELP_CONTENTS,   TBSTATE_ENABLED, TBSTYLE_BUTTON,     {0, 0}, 0, 8}
723};
724
725#define NUM_TOOLBUTTONS (sizeof(tbb) / sizeof(tbb[0]))
726
727#define NUM_TOOLTIPS 8
728
729static const TCHAR szTbStrings[NUM_TOOLTIPS + 1][30] =
730{
731   TEXT("Toggle Folder List"),
732   TEXT("Toggle Screen Shot"),
733   TEXT("Large Icons"),
734   TEXT("Small Icons"),
735   TEXT("List"),
736   TEXT("Details"),
737   TEXT("Grouped"),
738   TEXT("About"),
739   TEXT("Help")
740};
741
742static const int CommandToString[] =
743{
744   ID_VIEW_FOLDERS,
745   ID_VIEW_PICTURE_AREA,
746   ID_VIEW_LARGE_ICON,
747   ID_VIEW_SMALL_ICON,
748   ID_VIEW_LIST_MENU,
749   ID_VIEW_DETAIL,
750   ID_VIEW_GROUPED,
751   ID_HELP_ABOUT,
752   ID_HELP_CONTENTS,
753   -1
754};
755
756static const int s_nPickers[] =
757{
758   IDC_LIST
759#ifdef MESS
760   ,IDC_SWLIST
761#endif
762};
763
764/* How to resize main window */
765static ResizeItem main_resize_items[] =
766{
767   { RA_HWND, { 0 },            FALSE, RA_LEFT  | RA_RIGHT  | RA_TOP,     NULL },
768   { RA_HWND, { 0 },            FALSE, RA_LEFT  | RA_RIGHT  | RA_BOTTOM,  NULL },
769   { RA_ID,   { IDC_DIVIDER },  FALSE, RA_LEFT  | RA_RIGHT  | RA_TOP,     NULL },
770   { RA_ID,   { IDC_TREE },     TRUE,   RA_LEFT  | RA_BOTTOM | RA_TOP,     NULL },
771   { RA_ID,   { IDC_LIST },     TRUE,   RA_ALL,                            NULL },
772   { RA_ID,   { IDC_SPLITTER }, FALSE,   RA_LEFT  | RA_BOTTOM | RA_TOP,     NULL },
773   { RA_ID,   { IDC_SPLITTER2 },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
774   { RA_ID,   { IDC_SSFRAME },  FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
775   { RA_ID,   { IDC_SSPICTURE },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
776   { RA_ID,   { IDC_HISTORY },  TRUE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
777   { RA_ID,   { IDC_SSTAB },    FALSE,   RA_RIGHT | RA_TOP,                 NULL },
778#ifdef MESS
779   { RA_ID,   { IDC_SWLIST },    TRUE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
780   { RA_ID,   { IDC_SPLITTER3 },FALSE,   RA_RIGHT | RA_BOTTOM | RA_TOP,     NULL },
781#endif /* MESS */
782   { RA_END,  { 0 },            FALSE, 0,                                 NULL }
783};
784
785static Resize main_resize = { {0, 0, 0, 0}, main_resize_items };
786
787/* last directory for common file dialogs */
788TCHAR last_directory[MAX_PATH];
789
790/* system-wide window message sent out with an ATOM of the current game name
791   each time it changes */
792static UINT g_mame32_message = 0;
793static BOOL g_bDoBroadcast   = FALSE;
794
795static BOOL use_gui_romloading = FALSE;
796
797static BOOL g_listview_dragging = FALSE;
798HIMAGELIST himl_drag;
799int game_dragged; /* which game started the drag */
800HTREEITEM prev_drag_drop_target; /* which tree view item we're currently highlighting */
801
802static BOOL g_in_treeview_edit = FALSE;
803
804typedef struct
805{
806    const char *name;
807    int index;
808} driver_data_type;
809static driver_data_type *sorted_drivers;
810
811/***************************************************************************
812    Global variables
813 ***************************************************************************/
814
815/* Background Image handles also accessed from TreeView.c */
816static HPALETTE         hPALbg   = 0;
817static HBITMAP          hBackground  = 0;
818static MYBITMAPINFO     bmDesc;
819
820/* List view Column text */
821LPCTSTR column_names[COLUMN_MAX] =
822{
823#ifdef MESS
824   TEXT("System"),
825#else
826   TEXT("Game"),
827#endif
828   TEXT("Screen"),
829   //TEXT("ROMs"),
830   TEXT("Samples"),
831   TEXT("Directory"),
832   TEXT("Type"),
833   TEXT("Trackball"),
834   TEXT("Played"),
835   TEXT("Manufacturer"),
836   TEXT("Year"),
837   TEXT("Clone Of"),
838   TEXT("Source"),
839   TEXT("Play Time")
840};
841
842/***************************************************************************
843    Message Macros
844 ***************************************************************************/
845
846#ifndef StatusBar_GetItemRect
847#define StatusBar_GetItemRect(hWnd, iPart, lpRect) \
848    SendMessage(hWnd, SB_GETRECT, (WPARAM) iPart, (LPARAM) (LPRECT) lpRect)
849#endif
850
851#ifndef ToolBar_CheckButton
852#define ToolBar_CheckButton(hWnd, idButton, fCheck) \
853    SendMessage(hWnd, TB_CHECKBUTTON, (WPARAM)idButton, (LPARAM)MAKELONG(fCheck, 0))
854#endif
855
856/***************************************************************************
857    External functions
858 ***************************************************************************/
859#if 0
860static void CopyOptions(core_options *pDestOpts, core_options *pSourceOpts)
861{
862   options_enumerator *enumerator;
863   const char *option_name;
864   const char *option_value;
865
866   enumerator = options_enumerator_begin(pSourceOpts);
867   if (enumerator != NULL)
868   {
869      while((option_name = options_enumerator_next(enumerator)) != NULL)
870      {
871         option_value = options_get_string(pSourceOpts, option_name);
872         if (option_value != NULL)
873         {
874            dprintf("CopyOptions(): Copying %s = \"%s\"\n", option_name, option_value);
875            options_set_string(pDestOpts, option_name, option_value, OPTION_PRIORITY_CMDLINE);
876         }
877      }
878      options_enumerator_free(enumerator);
879   }
880}
881
882static BOOL WaitWithMessageLoop(HANDLE hEvent)
883{
884   DWORD dwRet;
885   MSG   msg;
886
887   while (1)
888   {
889      dwRet = MsgWaitForMultipleObjects(1, &hEvent, FALSE, INFINITE, QS_ALLINPUT);
890
891      if (dwRet == WAIT_OBJECT_0)
892         return TRUE;
893
894      if (dwRet != WAIT_OBJECT_0 + 1)
895         break;
896
897      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
898      {
899         TranslateMessage(&msg);
900         DispatchMessage(&msg);
901         if (WaitForSingleObject(hEvent, 0) == WAIT_OBJECT_0)
902            return TRUE;
903      }
904   }
905   return FALSE;
906}
907#endif
908
909static DWORD RunMAME(int nGameIndex, const play_options *playopts)
910{
911   time_t start, end;
912   double elapsedtime;
913   DWORD dwExitCode = 0;
914   int i;
915   core_options *mame_opts;
916
917   // set up MAME options
918   mame_opts = mame_options_init(mame_win_options);
919
920   // Tell mame were to get the INIs
921   options_set_string(mame_opts, OPTION_INIPATH, GetIniDir(), OPTION_PRIORITY_CMDLINE);
922
923#ifdef MESS
924   // add MESS specific device options
925   mess_add_device_options(mame_opts, drivers[nGameIndex]);
926#endif // MESS
927
928   // set any specified play options
929   if (playopts != NULL)
930   {
931      if (playopts->record != NULL)
932         options_set_string(mame_opts, OPTION_RECORD, playopts->record, OPTION_PRIORITY_CMDLINE);
933      if (playopts->playback != NULL)
934         options_set_string(mame_opts, OPTION_PLAYBACK, playopts->playback, OPTION_PRIORITY_CMDLINE);
935      if (playopts->state != NULL)
936         options_set_string(mame_opts, OPTION_STATE, playopts->state, OPTION_PRIORITY_CMDLINE);
937      if (playopts->wavwrite != NULL)
938         options_set_string(mame_opts, OPTION_WAVWRITE, playopts->wavwrite, OPTION_PRIORITY_CMDLINE);
939      if (playopts->mngwrite != NULL)
940         options_set_string(mame_opts, OPTION_MNGWRITE, playopts->mngwrite, OPTION_PRIORITY_CMDLINE);
941   }
942
943   // Mame will parse all the needed .ini files.
944
945   // prepare MAME32 to run the game
946   ShowWindow(hMain, SW_HIDE);
947
948   for (i = 0; i < ARRAY_LENGTH(s_nPickers); i++)
949      Picker_ClearIdle(GetDlgItem(hMain, s_nPickers[i]));
950
951   // run the emulation
952   options_set_string(mame_opts, OPTION_GAMENAME, drivers[nGameIndex]->name, OPTION_PRIORITY_CMDLINE);
953   // Time the game run.
954   time(&start);
955   mame_execute(mame_opts);
956   // Calc the duration
957   time(&end);
958   elapsedtime = end - start;
959   // Increment our playtime.
960   IncrementPlayTime(nGameIndex, elapsedtime);
961   // the emulation is complete; continue
962   for (i = 0; i < ARRAY_LENGTH(s_nPickers); i++)
963      Picker_ResetIdle(GetDlgItem(hMain, s_nPickers[i]));
964   ShowWindow(hMain, SW_SHOW);
965   SetForegroundWindow(hMain);
966
967   return dwExitCode;
968}
969
970int MameUIMain(HINSTANCE    hInstance,
971                   LPSTR        lpCmdLine,
972                   int          nCmdShow)
973{
974   dprintf("MAMEUI starting\n");
975
976   use_gui_romloading = TRUE;
977
978   if (__argc != 1)
979   {
980      /* Rename main because gcc will use it instead of WinMain even with -mwindows */
981      extern int /*DECL_SPEC*/ utf8_main(int, char**);
982      exit(utf8_main(__argc, __argv));
983   }
984   if (!Win32UI_init(hInstance, lpCmdLine, nCmdShow))
985      return 1;
986
987   // pump message, but quit on WM_QUIT
988   while(PumpMessage())
989      ;
990
991   Win32UI_exit();
992   return 0;
993}
994
995
996HWND GetMainWindow(void)
997{
998   return hMain;
999}
1000
1001HWND GetTreeView(void)
1002{
1003   return hTreeView;
1004}
1005
1006HIMAGELIST GetLargeImageList(void)
1007{
1008   return hLarge;
1009}
1010
1011HIMAGELIST GetSmallImageList(void)
1012{
1013   return hSmall;
1014}
1015
1016object_pool *GetMameUIMemoryPool(void)
1017{
1018   return mameui_pool;
1019}
1020
1021void GetRealColumnOrder(int order[])
1022{
1023   int tmpOrder[COLUMN_MAX];
1024   int nColumnMax;
1025   int i;
1026
1027   nColumnMax = Picker_GetNumColumns(hwndList);
1028
1029   /* Get the Column Order and save it */
1030   if (!oldControl)
1031   {
1032      ListView_GetColumnOrderArray(hwndList, nColumnMax, tmpOrder);
1033
1034      for (i = 0; i < nColumnMax; i++)
1035      {
1036         order[i] = Picker_GetRealColumnFromViewColumn(hwndList, tmpOrder[i]);
1037      }
1038   }
1039}
1040
1041/*
1042 * PURPOSE: Format raw data read from an ICO file to an HICON
1043 * PARAMS:  PBYTE ptrBuffer  - Raw data from an ICO file
1044 *          UINT nBufferSize - Size of buffer ptrBuffer
1045 * RETURNS: HICON - handle to the icon, NULL for failure
1046 * History: July '95 - Created
1047 *          March '00- Seriously butchered from MSDN for mine own
1048 *          purposes, sayeth H0ek.
1049 */
1050HICON FormatICOInMemoryToHICON(PBYTE ptrBuffer, UINT nBufferSize)
1051{
1052   ICONIMAGE           IconImage;
1053   LPICONDIRENTRY      lpIDE = NULL;
1054   UINT                nNumImages;
1055   UINT                nBufferIndex = 0;
1056   HICON               hIcon = NULL;
1057
1058   /* Is there a WORD? */
1059   if (nBufferSize < sizeof(WORD))
1060   {
1061      return NULL;
1062   }
1063
1064   /* Was it 'reserved' ?    (ie 0) */
1065   if ((WORD)(ptrBuffer[nBufferIndex]) != 0)
1066   {
1067      return NULL;
1068   }
1069
1070   nBufferIndex += sizeof(WORD);
1071
1072   /* Is there a WORD? */
1073   if (nBufferSize - nBufferIndex < sizeof(WORD))
1074   {
1075      return NULL;
1076   }
1077
1078   /* Was it type 1? */
1079   if ((WORD)(ptrBuffer[nBufferIndex]) != 1)
1080   {
1081      return NULL;
1082   }
1083
1084   nBufferIndex += sizeof(WORD);
1085
1086   /* Is there a WORD? */
1087   if (nBufferSize - nBufferIndex < sizeof(WORD))
1088   {
1089      return NULL;
1090   }
1091
1092   /* Then that's the number of images in the ICO file */
1093   nNumImages = (WORD)(ptrBuffer[nBufferIndex]);
1094
1095   /* Is there at least one icon in the file? */
1096   if ( nNumImages < 1 )
1097   {
1098      return NULL;
1099   }
1100
1101   nBufferIndex += sizeof(WORD);
1102
1103   /* Is there enough space for the icon directory entries? */
1104   if ((nBufferIndex + nNumImages * sizeof(ICONDIRENTRY)) > nBufferSize)
1105   {
1106      return NULL;
1107   }
1108
1109   /* Assign icon directory entries from buffer */
1110   lpIDE = (LPICONDIRENTRY)(&ptrBuffer[nBufferIndex]);
1111   nBufferIndex += nNumImages * sizeof (ICONDIRENTRY);
1112
1113   IconImage.dwNumBytes = lpIDE->dwBytesInRes;
1114
1115   /* Seek to beginning of this image */
1116   if ( lpIDE->dwImageOffset > nBufferSize )
1117   {
1118      return NULL;
1119   }
1120
1121   nBufferIndex = lpIDE->dwImageOffset;
1122
1123   /* Read it in */
1124   if ((nBufferIndex + lpIDE->dwBytesInRes) > nBufferSize)
1125   {
1126      return NULL;
1127   }
1128
1129   IconImage.lpBits = &ptrBuffer[nBufferIndex];
1130   nBufferIndex += lpIDE->dwBytesInRes;
1131#if 0  // Not sure we want odd sized icons.
1132   hIcon = CreateIconFromResourceEx(IconImage.lpBits, IconImage.dwNumBytes, TRUE, 0x00030000,
1133         (*(LPBITMAPINFOHEADER)(IconImage.lpBits)).biWidth, (*(LPBITMAPINFOHEADER)(IconImage.lpBits)).biHeight/2, 0 );
1134#endif
1135   /* It failed, odds are good we're on NT so try the non-Ex way */
1136   if (hIcon == NULL)
1137   {
1138      /* We would break on NT if we try with a 16bpp image */
1139      if (((LPBITMAPINFO)IconImage.lpBits)->bmiHeader.biBitCount != 16)
1140      {
1141         hIcon = CreateIconFromResource(IconImage.lpBits, IconImage.dwNumBytes, TRUE, 0x00030000);
1142      }
1143   }
1144   return hIcon;
1145}
1146
1147HICON LoadIconFromFile(const char *iconname)
1148{
1149   HICON hIcon = 0;
1150   struct stat file_stat;
1151   char tmpStr[MAX_PATH];
1152   char tmpIcoName[MAX_PATH];
1153   const char* sDirName = GetImgDir();
1154   PBYTE bufferPtr;
1155   zip_error ziperr;
1156   zip_file *zip;
1157   const zip_file_header *entry;
1158
1159   sprintf(tmpStr, "%s/%s.ico", GetIconsDir(), iconname);
1160   if (stat(tmpStr, &file_stat) != 0
1161   || (hIcon = win_extract_icon_utf8(hInst, tmpStr, 0)) == 0)
1162   {
1163      sprintf(tmpStr, "%s/%s.ico", sDirName, iconname);
1164      if (stat(tmpStr, &file_stat) != 0
1165      || (hIcon = win_extract_icon_utf8(hInst, tmpStr, 0)) == 0)
1166      {
1167         sprintf(tmpStr, "%s/icons.zip", GetIconsDir());
1168         sprintf(tmpIcoName, "%s.ico", iconname);
1169
1170         ziperr = zip_file_open(tmpStr, &zip);
1171         if (ziperr == ZIPERR_NONE)
1172         {
1173            entry = zip_file_first_file(zip);
1174            while(!hIcon && entry)
1175            {
1176               if (!mame_stricmp(entry->filename, tmpIcoName))
1177               {
1178                  bufferPtr = malloc(entry->uncompressed_length);
1179                  if (bufferPtr)
1180                  {
1181                     ziperr = zip_file_decompress(zip, bufferPtr, entry->uncompressed_length);
1182                     if (ziperr == ZIPERR_NONE)
1183                     {
1184                        hIcon = FormatICOInMemoryToHICON(bufferPtr, entry->uncompressed_length);
1185                     }
1186                     free(bufferPtr);
1187                  }
1188               }
1189               entry = zip_file_next_file(zip);
1190            }
1191            zip_file_close(zip);
1192         }
1193      }
1194   }
1195   return hIcon;
1196}
1197
1198/* Return the number of folders with options */
1199int GetNumOptionFolders()
1200{
1201   return optionfolder_count;
1202}
1203
1204/* Return the number of folders with options */
1205void SetNumOptionFolders(int count)
1206{
1207   optionfolder_count = count;
1208}
1209
1210/* search */
1211const char * GetSearchText(void)
1212{
1213   return g_SearchText;
1214}
1215
1216
1217/* Sets the treeview and listviews sizes in accordance with their visibility and the splitters */
1218static void ResizeTreeAndListViews(BOOL bResizeHidden)
1219{
1220   int i;
1221   int nLastWidth = 0;
1222   int nLastWidth2 = 0;
1223   int nLeftWindowWidth = 0;
1224   RECT rect;
1225   BOOL bVisible;
1226   int nLastOverlap = -1;
1227
1228   /* Size the List Control in the Picker */
1229   GetClientRect(hMain, &rect);
1230
1231   if (bShowStatusBar)
1232      rect.bottom -= bottomMargin;
1233   if (bShowToolBar)
1234      rect.top += topMargin;
1235
1236   /* Tree control */
1237   ShowWindow(GetDlgItem(hMain, IDC_TREE), bShowTree ? SW_SHOW : SW_HIDE);
1238
1239   for (i = 0; g_splitterInfo[i].nSplitterWindow; i++)
1240   {
1241      bVisible = GetWindowLong(GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow), GWL_STYLE) & WS_VISIBLE ? TRUE : FALSE;
1242      if (bResizeHidden || bVisible)
1243      {
1244         nLeftWindowWidth = nSplitterOffset[i] - SPLITTER_WIDTH/2 - nLastWidth;
1245
1246         /* special case for the rightmost pane when the screenshot is gone */
1247         if (!GetShowScreenShot() && !g_splitterInfo[i+1].nSplitterWindow)
1248            nLeftWindowWidth = rect.right - nLastWidth;
1249
1250         /* woah?  are we overlapping ourselves? */
1251         if (nLeftWindowWidth < MIN_VIEW_WIDTH)
1252         {
1253            nLastOverlap = i;
1254            nLastWidth = nLastWidth2;
1255            nLeftWindowWidth = nSplitterOffset[i] - MIN_VIEW_WIDTH - (SPLITTER_WIDTH*3/2) - nLastWidth;
1256            i--;
1257         }
1258
1259         MoveWindow(GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow), nLastWidth, rect.top + 2,
1260            nLeftWindowWidth, (rect.bottom - rect.top) - 4 , TRUE);
1261
1262         MoveWindow(GetDlgItem(hMain, g_splitterInfo[i].nSplitterWindow), nSplitterOffset[i], rect.top + 2,
1263            SPLITTER_WIDTH, (rect.bottom - rect.top) - 4, TRUE);
1264      }
1265
1266      if (bVisible)
1267      {
1268         nLastWidth2 = nLastWidth;
1269         nLastWidth += nLeftWindowWidth + SPLITTER_WIDTH;
1270      }
1271   }
1272}
1273
1274/* Adjust the list view and screenshot button based on GetShowScreenShot() */
1275void UpdateScreenShot(void)
1276{
1277   RECT rect;
1278   int  nWidth;
1279   RECT fRect;
1280   POINT p = {0, 0};
1281
1282   /* first time through can't do this stuff */
1283   if (hwndList == NULL)
1284      return;
1285
1286   /* Size the List Control in the Picker */
1287   GetClientRect(hMain, &rect);
1288
1289   if (bShowStatusBar)
1290      rect.bottom -= bottomMargin;
1291   if (bShowToolBar)
1292      rect.top += topMargin;
1293
1294   if (GetShowScreenShot())
1295   {
1296      nWidth = nSplitterOffset[GetSplitterCount() - 1];
1297      CheckMenuItem(GetMenu(hMain),ID_VIEW_PICTURE_AREA, MF_CHECKED);
1298      ToolBar_CheckButton(hToolBar, ID_VIEW_PICTURE_AREA, MF_CHECKED);
1299   }
1300   else
1301   {
1302      nWidth = rect.right;
1303      CheckMenuItem(GetMenu(hMain),ID_VIEW_PICTURE_AREA, MF_UNCHECKED);
1304      ToolBar_CheckButton(hToolBar, ID_VIEW_PICTURE_AREA, MF_UNCHECKED);
1305   }
1306
1307   ResizeTreeAndListViews(FALSE);
1308
1309   FreeScreenShot();
1310
1311   if (have_selection)
1312   {
1313#ifdef MESS
1314      if (!g_szSelectedItem[0] || !LoadScreenShotEx(Picker_GetSelectedItem(hwndList), g_szSelectedItem,
1315         TabView_GetCurrentTab(hTabCtrl)))
1316#endif
1317      // load and set image, or empty it if we don't have one
1318      LoadScreenShot(Picker_GetSelectedItem(hwndList), TabView_GetCurrentTab(hTabCtrl));
1319   }
1320
1321   // figure out if we have a history or not, to place our other windows properly
1322   UpdateHistory();
1323
1324   // setup the picture area
1325
1326   if (GetShowScreenShot())
1327   {
1328      DWORD dwStyle;
1329      DWORD dwStyleEx;
1330      BOOL showing_history;
1331
1332      ClientToScreen(hMain, &p);
1333      GetWindowRect(GetDlgItem(hMain, IDC_SSFRAME), &fRect);
1334      OffsetRect(&fRect, -p.x, -p.y);
1335
1336      // show history on this tab IFF
1337      // - we have history for the game
1338      // - we're on the first tab
1339      // - we DON'T have a separate history tab
1340      showing_history = (have_history && (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() || GetHistoryTab() == TAB_ALL ) &&
1341                     GetShowTab(TAB_HISTORY) == FALSE);
1342      CalculateBestScreenShotRect(GetDlgItem(hMain, IDC_SSFRAME), &rect,showing_history);
1343         
1344      dwStyle   = GetWindowLong(GetDlgItem(hMain, IDC_SSPICTURE), GWL_STYLE);
1345      dwStyleEx = GetWindowLong(GetDlgItem(hMain, IDC_SSPICTURE), GWL_EXSTYLE);
1346         
1347      AdjustWindowRectEx(&rect, dwStyle, FALSE, dwStyleEx);
1348      MoveWindow(GetDlgItem(hMain, IDC_SSPICTURE),
1349               fRect.left  + rect.left,
1350               fRect.top   + rect.top,
1351               rect.right  - rect.left,
1352               rect.bottom - rect.top,
1353               TRUE);
1354     
1355      ShowWindow(GetDlgItem(hMain,IDC_SSPICTURE),
1356               (TabView_GetCurrentTab(hTabCtrl) != TAB_HISTORY) ? SW_SHOW : SW_HIDE);
1357      ShowWindow(GetDlgItem(hMain,IDC_SSFRAME),SW_SHOW);
1358      ShowWindow(GetDlgItem(hMain,IDC_SSTAB),bShowTabCtrl ? SW_SHOW : SW_HIDE);
1359
1360      InvalidateRect(GetDlgItem(hMain,IDC_SSPICTURE),NULL,FALSE);
1361   }
1362   else
1363   {
1364      ShowWindow(GetDlgItem(hMain,IDC_SSPICTURE),SW_HIDE);
1365      ShowWindow(GetDlgItem(hMain,IDC_SSFRAME),SW_HIDE);
1366      ShowWindow(GetDlgItem(hMain,IDC_SSTAB),SW_HIDE);
1367   }
1368
1369}
1370
1371void ResizePickerControls(HWND hWnd)
1372{
1373   RECT frameRect;
1374   RECT rect, sRect;
1375   int  nListWidth, nScreenShotWidth;
1376   static BOOL firstTime = TRUE;
1377   int  doSSControls = TRUE;
1378   int i, nSplitterCount;
1379
1380   nSplitterCount = GetSplitterCount();
1381
1382   /* Size the List Control in the Picker */
1383   GetClientRect(hWnd, &rect);
1384
1385   /* Calc the display sizes based on g_splitterInfo */
1386   if (firstTime)
1387   {
1388      RECT rWindow;
1389
1390      for (i = 0; i < nSplitterCount; i++)
1391         nSplitterOffset[i] = rect.right * g_splitterInfo[i].dPosition;
1392
1393      GetWindowRect(hStatusBar, &rWindow);
1394      bottomMargin = rWindow.bottom - rWindow.top;
1395      GetWindowRect(hToolBar, &rWindow);
1396      topMargin = rWindow.bottom - rWindow.top;
1397      /*buttonMargin = (sRect.bottom + 4); */
1398
1399      firstTime = FALSE;
1400   }
1401   else
1402   {
1403      doSSControls = GetShowScreenShot();
1404   }
1405
1406   if (bShowStatusBar)
1407      rect.bottom -= bottomMargin;
1408
1409   if (bShowToolBar)
1410      rect.top += topMargin;
1411
1412   MoveWindow(GetDlgItem(hWnd, IDC_DIVIDER), rect.left, rect.top - 4, rect.right, 2, TRUE);
1413
1414   ResizeTreeAndListViews(TRUE);
1415
1416   nListWidth = nSplitterOffset[nSplitterCount-1];
1417   nScreenShotWidth = (rect.right - nListWidth) - 4;
1418
1419   /* Screen shot Page tab control */
1420   if (bShowTabCtrl)
1421   {
1422      MoveWindow(GetDlgItem(hWnd, IDC_SSTAB), nListWidth + 4, rect.top + 2,
1423         nScreenShotWidth - 2, rect.top + 20, doSSControls);
1424      rect.top += 20;
1425   }
1426
1427   /* resize the Screen shot frame */
1428   MoveWindow(GetDlgItem(hWnd, IDC_SSFRAME), nListWidth + 4, rect.top + 2,
1429      nScreenShotWidth - 2, (rect.bottom - rect.top) - 4, doSSControls);
1430
1431   /* The screen shot controls */
1432   GetClientRect(GetDlgItem(hWnd, IDC_SSFRAME), &frameRect);
1433
1434   /* Text control - game history */
1435   sRect.left = nListWidth + 14;
1436   sRect.right = sRect.left + (nScreenShotWidth - 22);
1437
1438   
1439   if (GetShowTab(TAB_HISTORY))
1440   {
1441      // We're using the new mode, with the history filling the entire tab (almost)
1442      sRect.top = rect.top + 14;
1443      sRect.bottom = (rect.bottom - rect.top) - 30;   
1444   }
1445   else
1446   {
1447      // We're using the original mode, with the history beneath the SS picture
1448      sRect.top = rect.top + 264;
1449      sRect.bottom = (rect.bottom - rect.top) - 278;
1450   }
1451
1452   MoveWindow(GetDlgItem(hWnd, IDC_HISTORY),
1453      sRect.left, sRect.top,
1454      sRect.right - sRect.left, sRect.bottom, doSSControls);
1455
1456   /* the other screen shot controls will be properly placed in UpdateScreenshot() */
1457
1458}
1459
1460char *ModifyThe(const char *str)
1461{
1462   static int  bufno = 0;
1463   static char buffer[4][255];
1464
1465   if (strncmp(str, "The ", 4) == 0)
1466   {
1467      char *s, *p;
1468      char temp[255];
1469
1470      strcpy(temp, &str[4]);
1471
1472      bufno = (bufno + 1) % 4;
1473
1474      s = buffer[bufno];
1475
1476      /* Check for version notes in parens */
1477      p = strchr(temp, '(');
1478      if (p)
1479      {
1480         p[-1] = '\0';
1481      }
1482
1483      strcpy(s, temp);
1484      strcat(s, ", The");
1485
1486      if (p)
1487      {
1488         strcat(s, " ");
1489         strcat(s, p);
1490      }
1491
1492      return s;
1493   }
1494   return (char *)str;
1495}
1496
1497HBITMAP GetBackgroundBitmap(void)
1498{
1499   return hBackground;
1500}
1501
1502HPALETTE GetBackgroundPalette(void)
1503{
1504   return hPALbg;
1505}
1506
1507MYBITMAPINFO * GetBackgroundInfo(void)
1508{
1509   return &bmDesc;
1510}
1511
1512BOOL GetUseOldControl(void)
1513{
1514   return oldControl;
1515}
1516
1517BOOL GetUseXPControl(void)
1518{
1519   return xpControl;
1520}
1521
1522int GetMinimumScreenShotWindowWidth(void)
1523{
1524   BITMAP bmp;
1525   GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
1526
1527   return bmp.bmWidth + 6; // 6 is for a little breathing room
1528}
1529
1530
1531int GetDriverIndex(const game_driver *driver)
1532{
1533   return GetGameNameIndex(driver->name);
1534}
1535
1536int GetParentIndex(const game_driver *driver)
1537{
1538   return GetGameNameIndex(driver->parent);
1539}
1540
1541int GetParentRomSetIndex(const game_driver *driver)
1542{
1543   int nParentIndex = GetGameNameIndex(driver->parent);
1544
1545   if( nParentIndex >= 0)
1546   {
1547      if ((drivers[nParentIndex]->flags & GAME_IS_BIOS_ROOT) == 0)
1548         return nParentIndex;
1549   }
1550
1551   return -1;
1552}
1553
1554int GetGameNameIndex(const char *name)
1555{
1556   driver_data_type *driver_index_info;
1557   driver_data_type key;
1558   key.name = name;
1559
1560   // uses our sorted array of driver names to get the index in log time
1561   driver_index_info = bsearch(&key,sorted_drivers,driver_list_get_count(drivers),sizeof(driver_data_type),
1562                        DriverDataCompareFunc);
1563
1564   if (driver_index_info == NULL)
1565      return -1;
1566
1567   return driver_index_info->index;
1568
1569}
1570
1571int GetIndexFromSortedIndex(int sorted_index)
1572{
1573   return sorted_drivers[sorted_index].index;
1574}
1575
1576/***************************************************************************
1577    Internal functions
1578 ***************************************************************************/
1579
1580// used for our sorted array of game names
1581int CLIB_DECL DriverDataCompareFunc(const void *arg1,const void *arg2)
1582{
1583    return strcmp( ((driver_data_type *)arg1)->name, ((driver_data_type *)arg2)->name );
1584}
1585
1586static void ResetBackground(char *szFile)
1587{
1588   char szDestFile[MAX_PATH];
1589
1590   /* The MAME core load the .png file first, so we only need replace this file */
1591   sprintf(szDestFile, "%s\\bkground.png", GetBgDir());
1592   win_set_file_attributes_utf8(szDestFile, FILE_ATTRIBUTE_NORMAL);
1593   win_copy_file_utf8(szFile, szDestFile, FALSE);
1594}
1595
1596static void RandomSelectBackground(void)
1597{
1598   struct _finddata_t c_file;
1599   long hFile;
1600   char szFile[MAX_PATH];
1601   int count=0;
1602   const char *szDir=GetBgDir();
1603   char *buf=malloc(_MAX_FNAME * MAX_BGFILES);
1604
1605   if (buf == NULL)
1606      return;
1607
1608   sprintf(szFile, "%s\\*.bmp", szDir);
1609   hFile = _findfirst(szFile, &c_file);
1610   if (hFile != -1L)
1611   {
1612      int Done = 0;
1613      while (!Done && count < MAX_BGFILES)
1614      {
1615         memcpy(buf + count * _MAX_FNAME, c_file.name, _MAX_FNAME);
1616         count++;
1617         Done = _findnext(hFile, &c_file);
1618      }
1619      _findclose(hFile);
1620   }
1621   sprintf(szFile, "%s\\*.png", szDir);
1622   hFile = _findfirst(szFile, &c_file);
1623   if (hFile != -1L)
1624   {
1625      int Done = 0;
1626      while (!Done && count < MAX_BGFILES)
1627      {
1628         memcpy(buf + count * _MAX_FNAME, c_file.name, _MAX_FNAME);
1629         count++;
1630         Done = _findnext(hFile, &c_file);
1631      }
1632      _findclose(hFile);
1633   }
1634
1635   if (count)
1636   {
1637#ifdef rand
1638#undef rand
1639#endif
1640
1641      srand( (unsigned)time( NULL ) );
1642      sprintf(szFile, "%s\\%s", szDir, buf + (rand() % count) * _MAX_FNAME);
1643      ResetBackground(szFile);
1644   }
1645
1646   free(buf);
1647}
1648
1649void SetMainTitle(void)
1650{
1651   char version[50];
1652   char buffer[100];
1653
1654   sscanf(build_version,"%s",version);
1655   snprintf(buffer, ARRAY_LENGTH(buffer), "%s %s", MAMEUINAME, version);
1656   win_set_window_text_utf8(hMain,buffer);
1657}
1658
1659static void winui_output_error(void *param, const char *format, va_list argptr)
1660{
1661   char buffer[1024];
1662
1663   // if we are in fullscreen mode, go to windowed mode
1664   if ((video_config.windowed == 0) && (win_window_list != NULL))
1665      winwindow_toggle_full_screen();
1666
1667   vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr);
1668   win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, APPNAME, MB_OK);
1669}
1670
1671static void memory_error(const char *message)
1672{
1673   win_message_box_utf8(hMain, message, APPNAME, MB_OK);
1674   exit(-1);
1675}
1676
1677static BOOL Win32UI_init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
1678{
1679   extern int mame_validitychecks(int game);
1680   WNDCLASS   wndclass;
1681   RECT      rect;
1682   int i, nSplitterCount;
1683   extern FOLDERDATA g_folderData[];
1684   extern FILTER_ITEM g_filterList[];
1685   extern const char *history_filename;
1686   extern const char *mameinfo_filename;
1687   LONG common_control_version = GetCommonControlVersion();
1688   int validity_failed = 0;
1689   TCHAR* t_inpdir;
1690   LONG_PTR l;
1691
1692   dprintf("about to init options\n");
1693   if (!OptionsInit())
1694      return FALSE;
1695   dprintf("options loaded\n");
1696
1697   srand((unsigned)time(NULL));
1698
1699   // output errors to message boxes
1700   mame_set_output_channel(OUTPUT_CHANNEL_ERROR, winui_output_error, NULL, NULL, NULL);
1701
1702   // create the memory pool
1703   mameui_pool = pool_alloc(memory_error);
1704
1705   // custom per-game icons
1706   icon_index = pool_malloc(mameui_pool, sizeof(int) * driver_list_get_count(drivers));
1707   memset(icon_index, '\0', sizeof(int) * driver_list_get_count(drivers));
1708
1709   // sorted list of drivers by name
1710   sorted_drivers = (driver_data_type *) pool_malloc(mameui_pool, sizeof(driver_data_type) * driver_list_get_count(drivers));
1711   memset(sorted_drivers, '\0', sizeof(driver_data_type) * driver_list_get_count(drivers));
1712   for (i = 0; i < driver_list_get_count(drivers); i++)
1713   {
1714      sorted_drivers[i].name = drivers[i]->name;
1715      sorted_drivers[i].index = i;
1716   }
1717   qsort(sorted_drivers, driver_list_get_count(drivers), sizeof(driver_data_type), DriverDataCompareFunc);
1718
1719   // set up window class
1720   wndclass.style         = CS_HREDRAW | CS_VREDRAW;
1721   wndclass.lpfnWndProc   = MameWindowProc;
1722   wndclass.cbClsExtra    = 0;
1723   wndclass.cbWndExtra    = DLGWINDOWEXTRA;
1724   wndclass.hInstance      = hInstance;
1725   wndclass.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAMEUI_ICON));
1726   wndclass.hCursor      = NULL;
1727   wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
1728   wndclass.lpszMenuName  = MAKEINTRESOURCE(IDR_UI_MENU);
1729   wndclass.lpszClassName = TEXT("MainClass");
1730
1731   RegisterClass(&wndclass);
1732
1733#ifdef MESS
1734   DevView_RegisterClass();
1735#endif //MESS
1736
1737   InitCommonControls();
1738
1739   // Are we using an Old comctl32.dll?
1740   dprintf("common controlversion %i %i",common_control_version >> 16,
1741         common_control_version & 0xffff);
1742         
1743   oldControl = (common_control_version < PACKVERSION(4,71));
1744   xpControl = (common_control_version >= PACKVERSION(6,0));
1745   if (oldControl)
1746   {
1747      char buf[] = MAMEUINAME " has detected an old version of comctl32.dll\n\n"
1748                "Game Properties, many configuration options and\n"
1749                "features are not available without an updated DLL\n\n"
1750                "Please install the common control update found at:\n\n"
1751                "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp\n\n"
1752                "Would you like to continue without using the new features?\n";
1753
1754      if (IDNO == win_message_box_utf8(0, buf, MAMEUINAME " Outdated comctl32.dll Warning", MB_YESNO | MB_ICONWARNING))
1755         return FALSE;
1756    }
1757
1758   g_mame32_message = RegisterWindowMessage(TEXT("MAME32"));
1759   g_bDoBroadcast = GetBroadcast();
1760
1761   HelpInit();
1762   
1763   t_inpdir = tstring_from_utf8(GetInpDir());
1764   if( ! t_inpdir )
1765      return FALSE;
1766
1767   _tcscpy(last_directory,t_inpdir);
1768   free(t_inpdir);
1769   hMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, NULL);
1770   if (hMain == NULL)
1771   {
1772      dprintf("error creating main dialog, aborting");
1773      return FALSE;
1774   }
1775
1776   s_pWatcher = DirWatcher_Init(hMain, WM_MAME32_FILECHANGED);
1777   if (s_pWatcher)
1778   {
1779      DirWatcher_Watch(s_pWatcher, 0, GetRomDirs(), TRUE);
1780      DirWatcher_Watch(s_pWatcher, 1, GetSampleDirs(), TRUE);
1781   }
1782
1783   SetMainTitle();
1784   hTabCtrl = GetDlgItem(hMain, IDC_SSTAB);
1785   
1786   {
1787      struct TabViewOptions opts;
1788
1789      static struct TabViewCallbacks s_tabviewCallbacks =
1790      {
1791         GetShowTabCtrl,         // pfnGetShowTabCtrl
1792         SetCurrentTab,         // pfnSetCurrentTab
1793         GetCurrentTab,         // pfnGetCurrentTab
1794         SetShowTab,            // pfnSetShowTab
1795         GetShowTab,            // pfnGetShowTab
1796
1797         GetImageTabShortName,   // pfnGetTabShortName
1798         GetImageTabLongName,   // pfnGetTabLongName
1799         UpdateScreenShot      // pfnOnSelectionChanged
1800      };
1801
1802      memset(&opts, 0, sizeof(opts));
1803      opts.pCallbacks = &s_tabviewCallbacks;
1804      opts.nTabCount = MAX_TAB_TYPES;
1805
1806      if (!SetupTabView(hTabCtrl, &opts))
1807         return FALSE;
1808   }
1809
1810   /* subclass history window */
1811   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_HISTORY), GWLP_WNDPROC);
1812   g_lpHistoryWndProc = (WNDPROC)l;
1813   SetWindowLongPtr(GetDlgItem(hMain, IDC_HISTORY), GWLP_WNDPROC, (LONG_PTR)HistoryWndProc);
1814
1815   /* subclass picture frame area */
1816   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_SSFRAME), GWLP_WNDPROC);
1817   g_lpPictureFrameWndProc = (WNDPROC)l;
1818   SetWindowLongPtr(GetDlgItem(hMain, IDC_SSFRAME), GWLP_WNDPROC, (LONG_PTR)PictureFrameWndProc);
1819
1820   /* subclass picture area */
1821   l = GetWindowLongPtr(GetDlgItem(hMain, IDC_SSPICTURE), GWLP_WNDPROC);
1822   g_lpPictureWndProc = (WNDPROC)l;
1823   SetWindowLongPtr(GetDlgItem(hMain, IDC_SSPICTURE), GWLP_WNDPROC, (LONG_PTR)PictureWndProc);
1824
1825   /* Load the pic for the default screenshot. */
1826   hMissing_bitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT));
1827
1828   /* Stash hInstance for later use */
1829   hInst = hInstance;
1830
1831   hToolBar   = InitToolbar(hMain);
1832   hStatusBar = InitStatusBar(hMain);
1833   hProgWnd   = InitProgressBar(hStatusBar);
1834
1835   main_resize_items[0].u.hwnd = hToolBar;
1836   main_resize_items[1].u.hwnd = hStatusBar;
1837
1838   /* In order to handle 'Large Fonts' as the Windows
1839    * default setting, we need to make the dialogs small
1840    * enough to fit in our smallest window size with
1841    * large fonts, then resize the picker, tab and button
1842    * controls to fill the window, no matter which font
1843    * is currently set.  This will still look like bad
1844    * if the user uses a bigger default font than 125%
1845    * (Large Fonts) on the Windows display setting tab.
1846    *
1847    * NOTE: This has to do with Windows default font size
1848    * settings, NOT our picker font size.
1849    */
1850
1851   GetClientRect(hMain, &rect);
1852
1853   hTreeView = GetDlgItem(hMain, IDC_TREE);
1854   hwndList  = GetDlgItem(hMain, IDC_LIST);
1855
1856   history_filename = mame_strdup(GetHistoryFileName());
1857   mameinfo_filename = mame_strdup(GetMAMEInfoFileName());
1858
1859   if (!InitSplitters())
1860      return FALSE;
1861
1862   nSplitterCount = GetSplitterCount();
1863   for (i = 0; i < nSplitterCount; i++)
1864   {
1865      HWND hWnd;
1866      HWND hWndLeft;
1867      HWND hWndRight;
1868
1869      hWnd = GetDlgItem(hMain, g_splitterInfo[i].nSplitterWindow);
1870      hWndLeft = GetDlgItem(hMain, g_splitterInfo[i].nLeftWindow);
1871      hWndRight = GetDlgItem(hMain, g_splitterInfo[i].nRightWindow);
1872
1873      AddSplitter(hWnd, hWndLeft, hWndRight, g_splitterInfo[i].pfnAdjust);
1874   }
1875
1876   /* Initial adjustment of controls on the Picker window */
1877   ResizePickerControls(hMain);
1878
1879   TabView_UpdateSelection(hTabCtrl);
1880
1881   bDoGameCheck = GetGameCheck();
1882   idle_work    = TRUE;
1883   game_index   = 0;
1884
1885   bShowTree      = GetShowFolderList();
1886   bShowToolBar   = GetShowToolBar();
1887   bShowStatusBar = GetShowStatusBar();
1888   bShowTabCtrl   = GetShowTabCtrl();
1889
1890   CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
1891   ToolBar_CheckButton(hToolBar, ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
1892   CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
1893   ShowWindow(hToolBar, (bShowToolBar) ? SW_SHOW : SW_HIDE);
1894   CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
1895   ShowWindow(hStatusBar, (bShowStatusBar) ? SW_SHOW : SW_HIDE);
1896   CheckMenuItem(GetMenu(hMain), ID_VIEW_PAGETAB, (bShowTabCtrl) ? MF_CHECKED : MF_UNCHECKED);
1897
1898   if (oldControl)
1899   {
1900      EnableMenuItem(GetMenu(hMain), ID_CUSTOMIZE_FIELDS, MF_GRAYED);
1901      EnableMenuItem(GetMenu(hMain), ID_GAME_PROPERTIES,   MF_GRAYED);
1902      EnableMenuItem(GetMenu(hMain), ID_OPTIONS_DEFAULTS, MF_GRAYED);
1903   }
1904
1905   /* Init DirectDraw */
1906   if (!DirectDraw_Initialize())
1907   {
1908      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIRECTX), NULL, DirectXDialogProc);
1909      return FALSE;
1910   }
1911
1912   if (GetRandomBackground())
1913      RandomSelectBackground();
1914
1915   LoadBackgroundBitmap();
1916
1917   dprintf("about to init tree");
1918   InitTree(g_folderData, g_filterList);
1919   dprintf("did init tree");
1920
1921   /* Initialize listview columns */
1922#ifdef MESS
1923   InitMessPicker();
1924#endif
1925   InitListView();
1926   SetFocus(hwndList);
1927
1928   /* Reset the font */
1929   {
1930      LOGFONT logfont;
1931
1932      GetListFont(&logfont);
1933      hFont = CreateFontIndirect(&logfont);
1934      if (hFont != NULL)
1935         SetAllWindowsFont(hMain, &main_resize, hFont, FALSE);
1936   }
1937
1938   /* Init DirectInput */
1939   if (!DirectInputInitialize())
1940   {
1941      DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIRECTX), NULL, DirectXDialogProc);
1942      return FALSE;
1943   }
1944
1945   AdjustMetrics();
1946   UpdateScreenShot();
1947
1948   hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_TAB_KEYS));
1949
1950   /* clear keyboard state */
1951   KeyboardStateClear();
1952
1953   for (i = 0; i < NUM_GUI_SEQUENCES; i++)
1954   {
1955      input_seq *is1;
1956      input_seq *is2;
1957      is1 = &(GUISequenceControl[i].is);
1958      is2 = GUISequenceControl[i].getiniptr();
1959      // FIXME
1960      //input_seq_copy(is1, is2);
1961      //dprintf("seq =%s is: %4i %4i %4i %4i\n",GUISequenceControl[i].name, (*is1)[0], (*is1)[1], (*is1)[2], (*is1)[3]);
1962   }
1963
1964   if (GetJoyGUI() == TRUE)
1965   {
1966      g_pJoyGUI = &DIJoystick;
1967      if (g_pJoyGUI->init() != 0)
1968         g_pJoyGUI = NULL;
1969      else
1970         SetTimer(hMain, JOYGUI_TIMER, JOYGUI_MS, NULL);
1971   }
1972   else
1973      g_pJoyGUI = NULL;
1974
1975   if (GetHideMouseOnStartup())
1976   {   
1977      /*  For some reason the mouse is centered when a game is exited, which of
1978         course causes a WM_MOUSEMOVE event that shows the mouse. So we center
1979         it now, before the startup coords are initilized, and that way the mouse
1980         will still be hidden when exiting from a game (i hope) :)
1981      */     
1982      SetCursorPos(GetSystemMetrics(SM_CXSCREEN)/2,GetSystemMetrics(SM_CYSCREEN)/2);
1983     
1984      // Then hide it
1985      ShowCursor(FALSE);
1986   }
1987
1988   dprintf("about to show window\n");
1989
1990   nCmdShow = GetWindowState();
1991   if (nCmdShow == SW_HIDE || nCmdShow == SW_MINIMIZE || nCmdShow == SW_SHOWMINIMIZED)
1992   {
1993      nCmdShow = SW_RESTORE;
1994   }
1995
1996   if (GetRunFullScreen())
1997   {
1998      LONG lMainStyle;
1999
2000      // Remove menu
2001      SetMenu(hMain,NULL);
2002
2003      // Frameless dialog (fake fullscreen)
2004      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
2005      lMainStyle = lMainStyle & (WS_BORDER ^ 0xffffffff);
2006      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
2007
2008      nCmdShow = SW_MAXIMIZE;
2009   }
2010
2011   ShowWindow(hMain, nCmdShow);
2012
2013   
2014   switch (GetViewMode())
2015   {
2016   case VIEW_LARGE_ICONS :
2017      SetView(ID_VIEW_LARGE_ICON);
2018      break;
2019   case VIEW_SMALL_ICONS :
2020      SetView(ID_VIEW_SMALL_ICON);
2021      break;
2022   case VIEW_INLIST :
2023      SetView(ID_VIEW_LIST_MENU);
2024      break;
2025   case VIEW_REPORT :
2026      SetView(ID_VIEW_DETAIL);
2027      break;
2028   case VIEW_GROUPED :
2029   default :
2030      SetView(ID_VIEW_GROUPED);
2031      break;
2032   }
2033
2034   if (GetCycleScreenshot() > 0)
2035   {
2036      SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL); //scale to Seconds
2037   }
2038
2039   if (validity_failed)
2040   {
2041      win_message_box_utf8(hMain, MAMENAME " has failed its validity checks.  The GUI will "
2042         "still work, but emulations will fail to execute", MAMENAME, MB_OK);
2043   }
2044
2045   return TRUE;
2046}
2047
2048
2049static void Win32UI_exit()
2050{
2051    if (g_bDoBroadcast == TRUE)
2052    {
2053        ATOM a = GlobalAddAtom(TEXT(""));
2054        SendMessage(HWND_BROADCAST, g_mame32_message, a, a);
2055        GlobalDeleteAtom(a);
2056    }
2057
2058   if (g_pJoyGUI != NULL)
2059      g_pJoyGUI->exit();
2060
2061   /* Free GDI resources */
2062
2063   if (hMissing_bitmap)
2064   {
2065      DeleteObject(hMissing_bitmap);
2066      hMissing_bitmap = NULL;
2067   }
2068
2069   if (hBackground)
2070   {
2071      DeleteObject(hBackground);
2072      hBackground = NULL;
2073   }
2074   
2075   if (hPALbg)
2076   {
2077      DeleteObject(hPALbg);
2078      hPALbg = NULL;
2079   }
2080   
2081   if (hFont)
2082   {
2083      DeleteObject(hFont);
2084      hFont = NULL;
2085   }
2086   
2087   DestroyIcons();
2088
2089   DestroyAcceleratorTable(hAccel);
2090
2091   DirectInputClose();
2092   DirectDraw_Close();
2093
2094   SetSavedFolderID(GetCurrentFolderID());
2095
2096   SaveOptions();
2097
2098   FreeFolders();
2099
2100    /* DestroyTree(hTreeView); */
2101
2102   FreeScreenShot();
2103
2104   OptionsExit();
2105
2106   HelpExit();
2107
2108   pool_free(mameui_pool);
2109   mameui_pool = NULL;
2110}
2111
2112static LRESULT CALLBACK MameWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
2113{
2114   MINMAXINFO   *mminfo;
2115   int       i;
2116   TCHAR szClass[128];
2117
2118   switch (message)
2119   {
2120   case WM_CTLCOLORSTATIC:
2121      if (hBackground && (HWND)lParam == GetDlgItem(hMain, IDC_HISTORY))
2122      {
2123         static HBRUSH hBrush=0;
2124         HDC hDC=(HDC)wParam;
2125         LOGBRUSH lb;
2126
2127         if (hBrush)
2128            DeleteObject(hBrush);
2129         lb.lbStyle  = BS_HOLLOW;
2130         hBrush = CreateBrushIndirect(&lb);
2131         SetBkMode(hDC, TRANSPARENT);
2132         SetTextColor(hDC, GetListFontColor());
2133         return (LRESULT) hBrush;
2134      }
2135      break;
2136
2137   case WM_INITDIALOG:
2138      /* Initialize info for resizing subitems */
2139      GetClientRect(hWnd, &main_resize.rect);
2140      return TRUE;
2141
2142   case WM_SETFOCUS:
2143      SetFocus(hwndList);
2144      break;
2145
2146   case WM_SETTINGCHANGE:
2147      AdjustMetrics();
2148      return 0;
2149
2150   case WM_SIZE:
2151      OnSize(hWnd, wParam, LOWORD(lParam), HIWORD(wParam));
2152      return TRUE;
2153
2154   case WM_MENUSELECT:
2155      return Statusbar_MenuSelect(hWnd, wParam, lParam);
2156
2157   case MM_PLAY_GAME:
2158      MamePlayGame();
2159      return TRUE;
2160
2161   case WM_INITMENUPOPUP:
2162      UpdateMenu(GetMenu(hWnd));
2163      break;
2164
2165   case WM_CONTEXTMENU:
2166      if (HandleTreeContextMenu(hWnd, wParam, lParam)
2167      ||   HandleScreenShotContextMenu(hWnd, wParam, lParam))
2168         return FALSE;
2169      break;
2170
2171   case WM_COMMAND:
2172      return MameCommand(hWnd,(int)(LOWORD(wParam)),(HWND)(lParam),(UINT)HIWORD(wParam));
2173
2174   case WM_GETMINMAXINFO:
2175      /* Don't let the window get too small; it can break resizing */
2176      mminfo = (MINMAXINFO *) lParam;
2177      mminfo->ptMinTrackSize.x = MIN_WIDTH;
2178      mminfo->ptMinTrackSize.y = MIN_HEIGHT;
2179      return 0;
2180
2181   case WM_TIMER:
2182      switch (wParam)
2183      {
2184      case JOYGUI_TIMER:
2185         PollGUIJoystick();
2186         break;
2187      case SCREENSHOT_TIMER:
2188         TabView_CalculateNextTab(hTabCtrl);
2189         UpdateScreenShot();
2190         TabView_UpdateSelection(hTabCtrl);
2191         break;
2192      default:
2193         break;
2194      }
2195      return TRUE;
2196
2197   case WM_CLOSE:
2198      {
2199         /* save current item */
2200         RECT rect;
2201         AREA area;
2202         int nItem;
2203         WINDOWPLACEMENT wndpl;
2204         UINT state;
2205
2206         wndpl.length = sizeof(WINDOWPLACEMENT);
2207         GetWindowPlacement(hMain, &wndpl);
2208         state = wndpl.showCmd;
2209
2210         /* Restore the window before we attempt to save parameters,
2211          * This fixed the lost window on startup problem, among other problems
2212          */
2213         if (state == SW_MINIMIZE || state == SW_SHOWMINIMIZED || state == SW_MAXIMIZE)
2214         {
2215            if( wndpl.flags & WPF_RESTORETOMAXIMIZED || state == SW_MAXIMIZE)
2216               state = SW_MAXIMIZE;
2217            else
2218            {
2219               state = SW_RESTORE;
2220               ShowWindow(hWnd, SW_RESTORE);
2221            }
2222         }
2223         for (i = 0; i < GetSplitterCount(); i++)
2224            SetSplitterPos(i, nSplitterOffset[i]);
2225         SetWindowState(state);
2226
2227         for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
2228            Picker_SaveColumnWidths(GetDlgItem(hMain, s_nPickers[i]));
2229
2230         GetWindowRect(hWnd, &rect);
2231         area.x      = rect.left;
2232         area.y      = rect.top;
2233         area.width   = rect.right  - rect.left;
2234         area.height = rect.bottom - rect.top;
2235         SetWindowArea(&area);
2236
2237         /* Save the users current game options and default game */
2238         nItem = Picker_GetSelectedItem(hwndList);
2239         SetDefaultGame(ModifyThe(drivers[nItem]->name));
2240
2241         /* hide window to prevent orphan empty rectangles on the taskbar */
2242         /* ShowWindow(hWnd,SW_HIDE); */
2243            DestroyWindow( hWnd );
2244
2245         /* PostQuitMessage(0); */
2246         break;
2247      }
2248
2249   case WM_DESTROY:
2250        PostQuitMessage(0);
2251      return 0;
2252
2253   case WM_LBUTTONDOWN:
2254      OnLButtonDown(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2255      break;
2256
2257      /*
2258        Check to see if the mouse has been moved by the user since
2259        startup. I'd like this checking to be done only in the
2260        main WinProc (here), but somehow the WM_MOUSEDOWN messages
2261        are eaten up before they reach MameWindowProc. That's why
2262        there is one check for each of the subclassed windows too.
2263   
2264        POSSIBLE BUGS:
2265        I've included this check in the subclassed windows, but a
2266        mose move in either the title bar, the menu, or the
2267        toolbar will not generate a WM_MOUSEOVER message. At least
2268        not one that I know how to pick up. A solution could maybe
2269        be to subclass those too, but that's too much work :)
2270      */
2271     
2272   case WM_MOUSEMOVE:
2273   {
2274      if (MouseHasBeenMoved())
2275         ShowCursor(TRUE);
2276     
2277      if (g_listview_dragging)
2278         MouseMoveListViewDrag(MAKEPOINTS(lParam));
2279      else
2280         /* for splitters */
2281         OnMouseMove(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2282      break;
2283   }
2284
2285   case WM_LBUTTONUP:
2286       if (g_listview_dragging)
2287          ButtonUpListViewDrag(MAKEPOINTS(lParam));
2288      else
2289         /* for splitters */
2290         OnLButtonUp(hWnd, (UINT)wParam, MAKEPOINTS(lParam));
2291      break;
2292
2293   case WM_NOTIFY:
2294      /* Where is this message intended to go */
2295      {
2296         LPNMHDR lpNmHdr = (LPNMHDR)lParam;
2297
2298         /* Fetch tooltip text */
2299         if (lpNmHdr->code == TTN_NEEDTEXT)
2300         {
2301            LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)lParam;
2302            CopyToolTipText(lpttt);
2303         }
2304
2305         if (lpNmHdr->hwndFrom == hTreeView)
2306            return TreeViewNotify(lpNmHdr);
2307
2308         GetClassName(lpNmHdr->hwndFrom, szClass, sizeof(szClass) / sizeof(szClass[0]));
2309         if (!_tcscmp(szClass, TEXT("SysListView32")))
2310            return Picker_HandleNotify(lpNmHdr);   
2311         if (!_tcscmp(szClass, TEXT("SysTabControl32")))
2312            return TabView_HandleNotify(lpNmHdr);
2313      }
2314      break;
2315
2316   case WM_DRAWITEM:
2317      {
2318         LPDRAWITEMSTRUCT lpDis = (LPDRAWITEMSTRUCT)lParam;
2319
2320         GetClassName(lpDis->hwndItem, szClass, sizeof(szClass) / sizeof(szClass[0]));
2321         if (!_tcscmp(szClass, TEXT("SysListView32")))
2322            Picker_HandleDrawItem(GetDlgItem(hMain, lpDis->CtlID), lpDis);
2323      }
2324      break;
2325
2326   case WM_MEASUREITEM :
2327   {
2328      LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
2329
2330      // tell the list view that each row (item) should be just taller than our font
2331
2332      //DefWindowProc(hWnd, message, wParam, lParam);
2333      //dprintf("default row height calculation gives %u\n",lpmis->itemHeight);
2334
2335      TEXTMETRIC tm;
2336      HDC hDC = GetDC(NULL);
2337      HFONT hFontOld = (HFONT)SelectObject(hDC,hFont);
2338
2339      GetTextMetrics(hDC,&tm);
2340     
2341      lpmis->itemHeight = tm.tmHeight + tm.tmExternalLeading + 1;
2342      if (lpmis->itemHeight < 17)
2343         lpmis->itemHeight = 17;
2344      //dprintf("we would do %u\n",tm.tmHeight + tm.tmExternalLeading + 1);
2345      SelectObject(hDC,hFontOld);
2346      ReleaseDC(NULL,hDC);
2347
2348      return TRUE;
2349   }
2350
2351   case WM_MAME32_FILECHANGED:
2352      {
2353         char szFileName[32];
2354         char *s;
2355         int nGameIndex;
2356         int (*pfnGetAuditResults)(int driver_index) = NULL;
2357         void (*pfnSetAuditResults)(int driver_index, int audit_results) = NULL;
2358
2359         switch(HIWORD(wParam))
2360         {
2361            case 0:
2362               pfnGetAuditResults = GetRomAuditResults;
2363               pfnSetAuditResults = SetRomAuditResults;
2364               break;
2365
2366            case 1:
2367               pfnGetAuditResults = GetSampleAuditResults;
2368               pfnSetAuditResults = SetSampleAuditResults;
2369               break;
2370         }
2371
2372         if (pfnGetAuditResults && pfnSetAuditResults)
2373         {
2374            int nParentIndex = -1;
2375
2376            snprintf(szFileName, sizeof(szFileName), "%s", (LPCSTR) lParam);
2377            s = strchr(szFileName, '.');
2378            if (s)
2379               *s = '\0';
2380            s = strchr(szFileName, '\\');
2381            if (s)
2382               *s = '\0';
2383
2384            for (nGameIndex = 0; drivers[nGameIndex]; nGameIndex++)
2385            {
2386               for (nParentIndex = nGameIndex; nGameIndex == -1; nParentIndex = GetParentIndex(drivers[nParentIndex]))
2387               {
2388                  if (!mame_stricmp(drivers[nParentIndex]->name, szFileName))
2389                  {
2390                     if (pfnGetAuditResults(nGameIndex) != UNKNOWN)
2391                     {
2392                        pfnSetAuditResults(nGameIndex, UNKNOWN);
2393                        PostMessage(hMain, WM_MAME32_AUDITGAME, wParam, nGameIndex);
2394                     }
2395                     break;
2396                  }
2397               }
2398            }
2399         }
2400      }
2401      break;
2402
2403   case WM_MAME32_AUDITGAME:
2404      {
2405         LV_FINDINFO lvfi;
2406         int nGameIndex;
2407
2408         nGameIndex = lParam;
2409
2410         switch(HIWORD(wParam))
2411         {
2412            case 0:
2413               MameUIVerifyRomSet(nGameIndex);
2414               break;
2415            case 1:
2416               MameUIVerifySampleSet(nGameIndex);
2417               break;
2418         }
2419
2420         memset(&lvfi, 0, sizeof(lvfi));
2421         lvfi.flags   = LVFI_PARAM;
2422         lvfi.lParam = nGameIndex;
2423
2424         i = ListView_FindItem(hwndList, -1, &lvfi);
2425         if (i != -1)
2426         {
2427            ListView_RedrawItems(hwndList, i, i);
2428         }
2429      }
2430      break;
2431
2432   default:
2433
2434      break;
2435   }
2436
2437   return DefWindowProc(hWnd, message, wParam, lParam);
2438}
2439
2440static int HandleKeyboardGUIMessage(HWND hWnd, UINT message, UINT wParam, LONG lParam)
2441{
2442   switch (message)
2443   {
2444      case WM_CHAR: /* List-View controls use this message for searching the items "as user types" */
2445         //MessageBox(NULL,"wm_char message arrived","TitleBox",MB_OK);
2446         return TRUE;
2447
2448      case WM_KEYDOWN:
2449         KeyboardKeyDown(0, wParam, lParam);
2450         return TRUE;
2451
2452      case WM_KEYUP:
2453         KeyboardKeyUp(0, wParam, lParam);
2454         return TRUE;
2455
2456      case WM_SYSKEYDOWN:
2457         KeyboardKeyDown(1, wParam, lParam);
2458         return TRUE;
2459
2460      case WM_SYSKEYUP:
2461         KeyboardKeyUp(1, wParam, lParam);
2462         return TRUE;
2463   }
2464
2465   return FALSE;   /* message not processed */
2466}
2467
2468static BOOL PumpMessage()
2469{
2470   MSG msg;
2471
2472   if (!GetMessage(&msg, NULL, 0, 0))
2473    {
2474      return FALSE;
2475    }
2476
2477   if (IsWindow(hMain))
2478   {
2479      BOOL absorbed_key = FALSE;
2480      if (GetKeyGUI())
2481         absorbed_key = HandleKeyboardGUIMessage(msg.hwnd, msg.message,
2482                                       msg.wParam, msg.lParam);
2483      else
2484         absorbed_key = TranslateAccelerator(hMain, hAccel, &msg);
2485
2486      if (!absorbed_key)
2487      {
2488         if (!IsDialogMessage(hMain, &msg))
2489         {
2490            TranslateMessage(&msg);
2491            DispatchMessage(&msg);
2492         }
2493      }
2494   }
2495
2496   return TRUE;
2497}
2498
2499static BOOL FolderCheck(void)
2500{
2501   
2502   char *pDescription = NULL;
2503   int nGameIndex = 0;
2504   int i=0;
2505   int iStep = 0;
2506   LV_FINDINFO lvfi;
2507   int nCount = ListView_GetItemCount(hwndList);
2508   BOOL changed = FALSE;
2509
2510   MSG msg;
2511   for(i=0; i<nCount;i++)
2512   {
2513      LV_ITEM lvi;
2514
2515      lvi.iItem = i;
2516      lvi.iSubItem = 0;
2517      lvi.mask    = LVIF_PARAM;
2518      ListView_GetItem(hwndList, &lvi);
2519      nGameIndex  = lvi.lParam;
2520      SetRomAuditResults(nGameIndex, UNKNOWN);
2521      SetSampleAuditResults(nGameIndex, UNKNOWN);
2522   }
2523   if( nCount > 0)
2524      ProgressBarShow();
2525   else
2526      return FALSE;
2527   if( nCount < 100 )
2528      iStep = 100 / nCount;
2529   else
2530      iStep = nCount/100;
2531   UpdateListView();
2532   UpdateWindow(hMain);
2533   for(i=0; i<nCount;i++)
2534   {
2535      LV_ITEM lvi;
2536
2537      lvi.iItem = i;
2538      lvi.iSubItem = 0;
2539      lvi.mask    = LVIF_PARAM;
2540      ListView_GetItem(hwndList, &lvi);
2541      nGameIndex  = lvi.lParam;
2542      if (GetRomAuditResults(nGameIndex) == UNKNOWN)
2543      {
2544         MameUIVerifyRomSet(nGameIndex);
2545         changed = TRUE;
2546      }
2547
2548      if (GetSampleAuditResults(nGameIndex) == UNKNOWN)
2549      {
2550         MameUIVerifySampleSet(nGameIndex);
2551         changed = TRUE;
2552      }
2553
2554      lvfi.flags   = LVFI_PARAM;
2555      lvfi.lParam = nGameIndex;
2556
2557      i = ListView_FindItem(hwndList, -1, &lvfi);
2558      if (changed && i != -1);
2559      {
2560         ListView_RedrawItems(hwndList, i, i);
2561         while( PeekMessage( &msg, hwndList, 0, 0, PM_REMOVE ) != 0)
2562         {
2563            TranslateMessage(&msg);
2564            DispatchMessage(&msg);
2565         }
2566      }
2567      changed = FALSE;
2568      if ((i % iStep) == 0)
2569         ProgressBarStepParam(i, nCount);
2570   }
2571   ProgressBarHide();
2572   pDescription = ModifyThe(drivers[Picker_GetSelectedItem(hwndList)]->description);
2573   SetStatusBarText(0, pDescription);
2574   UpdateStatusBar();
2575   return TRUE;
2576}
2577
2578static BOOL GameCheck(void)
2579{
2580   LV_FINDINFO lvfi;
2581   int i;
2582   BOOL changed = FALSE;
2583
2584   if (game_index == 0)
2585      ProgressBarShow();
2586
2587   if (game_index >= driver_list_get_count(drivers))
2588   {
2589      bDoGameCheck = FALSE;
2590      ProgressBarHide();
2591      ResetWhichGamesInFolders();
2592      return FALSE;
2593   }
2594
2595   if (GetRomAuditResults(game_index) == UNKNOWN)
2596   {
2597      MameUIVerifyRomSet(game_index);
2598      changed = TRUE;
2599   }
2600
2601   if (GetSampleAuditResults(game_index) == UNKNOWN)
2602   {
2603      MameUIVerifySampleSet(game_index);
2604      changed = TRUE;
2605   }
2606
2607   lvfi.flags   = LVFI_PARAM;
2608   lvfi.lParam = game_index;
2609
2610   i = ListView_FindItem(hwndList, -1, &lvfi);
2611   if (changed && i != -1);
2612      ListView_RedrawItems(hwndList, i, i);
2613   if ((game_index % progBarStep) == 0)
2614      ProgressBarStep();
2615   game_index++;
2616
2617   return changed;
2618}
2619
2620static BOOL OnIdle(HWND hWnd)
2621{
2622   static int bFirstTime = TRUE;
2623   static int bResetList = TRUE;
2624
2625   char *pDescription;
2626   int driver_index;
2627
2628   if (bFirstTime)
2629   {
2630      bResetList = FALSE;
2631      bFirstTime = FALSE;
2632   }
2633   if (bDoGameCheck)
2634   {
2635      bResetList |= GameCheck();
2636      return idle_work;
2637   }
2638   // NPW 17-Jun-2003 - Commenting this out because it is redundant
2639   // and it causes the game to reset back to the original game after an F5
2640   // refresh
2641   //driver_index = GetGameNameIndex(GetDefaultGame());
2642   //SetSelectedPickItem(driver_index);
2643
2644   // in case it's not found, get it back
2645   driver_index = Picker_GetSelectedItem(hwndList);
2646
2647   pDescription = ModifyThe(drivers[driver_index]->description);
2648   SetStatusBarText(0, pDescription);
2649   idle_work = FALSE;
2650   UpdateStatusBar();
2651   bFirstTime = TRUE;
2652
2653   if (!idle_work)
2654      PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, TRUE),(LPARAM)NULL);
2655   return idle_work;
2656}
2657
2658static void OnSize(HWND hWnd, UINT nState, int nWidth, int nHeight)
2659{
2660   static BOOL firstTime = TRUE;
2661
2662   if (nState != SIZE_MAXIMIZED && nState != SIZE_RESTORED)
2663      return;
2664
2665   ResizeWindow(hWnd, &main_resize);
2666   ResizeProgressBar();
2667   if (firstTime == FALSE)
2668      OnSizeSplitter(hMain);
2669   //firstTime = FALSE;
2670   /* Update the splitters structures as appropriate */
2671   RecalcSplitters();
2672   if (firstTime == FALSE)
2673      ResizePickerControls(hMain);
2674   firstTime = FALSE;
2675   UpdateScreenShot();
2676}
2677
2678
2679
2680static HWND GetResizeItemWindow(HWND hParent, const ResizeItem *ri)
2681{
2682   HWND hControl;
2683   if (ri->type == RA_ID)
2684      hControl = GetDlgItem(hParent, ri->u.id);
2685   else
2686      hControl = ri->u.hwnd;
2687   return hControl;
2688}
2689
2690
2691
2692static void SetAllWindowsFont(HWND hParent, const Resize *r, HFONT hTheFont, BOOL bRedraw)
2693{
2694   int i;
2695   HWND hControl;
2696
2697   for (i = 0; r->items[i].type != RA_END; i++)
2698   {
2699      if (r->items[i].setfont)
2700      {
2701         hControl = GetResizeItemWindow(hParent, &r->items[i]);
2702         SetWindowFont(hControl, hTheFont, bRedraw);
2703      }
2704   }
2705}
2706
2707
2708
2709static void ResizeWindow(HWND hParent, Resize *r)
2710{
2711   int cmkindex = 0, dx, dy, dx1, dtempx;
2712   HWND hControl;
2713   RECT parent_rect, rect;
2714   ResizeItem *ri;
2715   POINT p = {0, 0};
2716
2717   if (hParent == NULL)
2718      return;
2719
2720   /* Calculate change in width and height of parent window */
2721   GetClientRect(hParent, &parent_rect);
2722   //dx = parent_rect.right - r->rect.right;
2723   dtempx = parent_rect.right - r->rect.right;
2724   dy = parent_rect.bottom - r->rect.bottom;
2725   dx = dtempx/2;
2726   dx1 = dtempx - dx;
2727   ClientToScreen(hParent, &p);
2728
2729   while (r->items[cmkindex].type != RA_END)
2730   {
2731      ri = &r->items[cmkindex];
2732      if (ri->type == RA_ID)
2733         hControl = GetDlgItem(hParent, ri->u.id);
2734      else
2735         hControl = ri->u.hwnd;
2736
2737      if (hControl == NULL)
2738      {
2739         cmkindex++;
2740         continue;
2741      }
2742
2743      /* Get control's rectangle relative to parent */
2744      GetWindowRect(hControl, &rect);
2745      OffsetRect(&rect, -p.x, -p.y);
2746
2747      if (!(ri->action & RA_LEFT))
2748         rect.left += dx;
2749
2750      if (!(ri->action & RA_TOP))
2751         rect.top += dy;
2752
2753      if (ri->action & RA_RIGHT)
2754         rect.right += dx;
2755
2756      if (ri->action & RA_BOTTOM)
2757         rect.bottom += dy;
2758
2759      MoveWindow(hControl, rect.left, rect.top,
2760               (rect.right - rect.left),
2761               (rect.bottom - rect.top), TRUE);
2762
2763      /* Take care of subcontrols, if appropriate */
2764      if (ri->subwindow != NULL)
2765         ResizeWindow(hControl, ri->subwindow);
2766
2767      cmkindex++;
2768   }
2769
2770   /* Record parent window's new location */
2771   memcpy(&r->rect, &parent_rect, sizeof(RECT));
2772}
2773
2774static void ProgressBarShow()
2775{
2776   RECT rect;
2777   int  widths[2] = {150, -1};
2778
2779   if (driver_list_get_count(drivers) < 100)
2780      progBarStep = 100 / driver_list_get_count(drivers);
2781   else
2782      progBarStep = (driver_list_get_count(drivers) / 100);
2783
2784   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)2, (LPARAM)(LPINT)widths);
2785   SendMessage(hProgWnd, PBM_SETRANGE, 0, (LPARAM)MAKELONG(0, driver_list_get_count(drivers)));
2786   SendMessage(hProgWnd, PBM_SETSTEP, (WPARAM)progBarStep, 0);
2787   SendMessage(hProgWnd, PBM_SETPOS, 0, 0);
2788
2789   StatusBar_GetItemRect(hStatusBar, 1, &rect);
2790
2791   MoveWindow(hProgWnd, rect.left, rect.top,
2792            rect.right - rect.left,
2793            rect.bottom - rect.top, TRUE);
2794
2795   bProgressShown = TRUE;
2796}
2797
2798static void ProgressBarHide()
2799{
2800   RECT rect;
2801   int  widths[4];
2802   HDC  hDC;
2803   SIZE size;
2804   int  numParts = 4;
2805
2806   if (hProgWnd == NULL)
2807   {
2808      return;
2809   }
2810
2811   hDC = GetDC(hProgWnd);
2812
2813   ShowWindow(hProgWnd, SW_HIDE);
2814
2815   GetTextExtentPoint32(hDC, TEXT("MMX"), 3, &size);
2816   widths[3] = size.cx;
2817   GetTextExtentPoint32(hDC, TEXT("MMMM games"), 10, &size);
2818   widths[2] = size.cx;
2819   //Just specify 24 instead of 30, gives us sufficient space to display the message, and saves some space
2820   GetTextExtentPoint32(hDC, TEXT("Screen flip support is missing"), 24, &size);
2821   widths[1] = size.cx;
2822
2823   ReleaseDC(hProgWnd, hDC);
2824
2825   widths[0] = -1;
2826   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)1, (LPARAM)(LPINT)widths);
2827   StatusBar_GetItemRect(hStatusBar, 0, &rect);
2828
2829   widths[0] = (rect.right - rect.left) - (widths[1] + widths[2] + widths[3]);
2830   widths[1] += widths[0];
2831   widths[2] += widths[1];
2832   widths[3] = -1;
2833
2834   SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)numParts, (LPARAM)(LPINT)widths);
2835   UpdateStatusBar();
2836
2837   bProgressShown = FALSE;
2838}
2839
2840static void ResizeProgressBar()
2841{
2842   if (bProgressShown)
2843   {
2844      RECT rect;
2845      int  widths[2] = {150, -1};
2846
2847      SendMessage(hStatusBar, SB_SETPARTS, (WPARAM)2, (LPARAM)(LPINT)widths);
2848      StatusBar_GetItemRect(hStatusBar, 1, &rect);
2849      MoveWindow(hProgWnd, rect.left, rect.top,
2850               rect.right  - rect.left,
2851               rect.bottom - rect.top, TRUE);
2852   }
2853   else
2854   {
2855      ProgressBarHide();
2856   }
2857}
2858
2859static void ProgressBarStepParam(int iGameIndex, int nGameCount)
2860{
2861   SetStatusBarTextF(0, "Game search %d%% complete",
2862         ((iGameIndex + 1) * 100) / nGameCount);
2863   if (iGameIndex == 0)
2864      ShowWindow(hProgWnd, SW_SHOW);
2865   SendMessage(hProgWnd, PBM_STEPIT, 0, 0);
2866}
2867
2868static void ProgressBarStep()
2869{
2870   ProgressBarStepParam(game_index, driver_list_get_count(drivers));
2871}
2872
2873static HWND InitProgressBar(HWND hParent)
2874{
2875   RECT rect;
2876
2877   StatusBar_GetItemRect(hStatusBar, 0, &rect);
2878
2879   rect.left += 150;
2880
2881   return CreateWindowEx(WS_EX_STATICEDGE,
2882         PROGRESS_CLASS,
2883         TEXT("Progress Bar"),
2884         WS_CHILD | PBS_SMOOTH,
2885         rect.left,
2886         rect.top,
2887         rect.right   - rect.left,
2888         rect.bottom - rect.top,
2889         hParent,
2890         NULL,
2891         hInst,
2892         NULL);
2893}
2894
2895static void CopyToolTipText(LPTOOLTIPTEXT lpttt)
2896{
2897   int   i;
2898   int   iButton = lpttt->hdr.idFrom;
2899   static TCHAR String[1024];
2900   BOOL bConverted = FALSE;
2901   TCHAR* t_gameinfostatus;
2902
2903   /* Map command ID to string index */
2904   for (i = 0; CommandToString[i] != -1; i++)
2905   {
2906      if (CommandToString[i] == iButton)
2907      {
2908         iButton = i;
2909         bConverted = TRUE;
2910         break;
2911      }
2912   }
2913   if( bConverted )
2914   {
2915      /* Check for valid parameter */
2916      if(iButton > NUM_TOOLTIPS)
2917      {
2918         _tcscpy(String,TEXT("Invalid Button Index"));
2919      }
2920      else
2921      {
2922         _tcscpy(String,szTbStrings[iButton]);
2923      }
2924   }
2925   else if ( iButton <= 2 )
2926   {
2927      //Statusbar
2928      SendMessage(lpttt->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 200);
2929      if( iButton != 1)
2930         SendMessage(hStatusBar, SB_GETTEXT, (WPARAM)iButton, (LPARAM)&String );
2931      else {
2932         //for first pane we get the Status directly, to get the line breaks
2933         t_gameinfostatus = tstring_from_utf8( GameInfoStatus(Picker_GetSelectedItem(hwndList), FALSE));
2934         if( !t_gameinfostatus )
2935            return;
2936         _tcscpy(String, t_gameinfostatus);
2937         free(t_gameinfostatus);
2938      }
2939   }
2940   else
2941      _tcscpy(String,TEXT("Invalid Button Index"));
2942
2943   lpttt->lpszText = String;
2944}
2945
2946static HWND InitToolbar(HWND hParent)
2947{
2948   HWND hToolBar = CreateToolbarEx(hParent,
2949                     WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
2950                     CCS_TOP | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
2951                     1,
2952                     8,
2953                     hInst,
2954                     IDB_TOOLBAR,
2955                     tbb,
2956                     NUM_TOOLBUTTONS,
2957                     16,
2958                     16,
2959                     0,
2960                     0,
2961                     sizeof(TBBUTTON));
2962   RECT rect;
2963   int idx;
2964   int iPosX, iPosY, iHeight;
2965
2966   // get Edit Control position
2967   idx = SendMessage(hToolBar, TB_BUTTONCOUNT, (WPARAM)0, (LPARAM)0) - 1;
2968   SendMessage(hToolBar, TB_GETITEMRECT, (WPARAM)idx, (LPARAM)&rect);
2969   iPosX = rect.right + 10;
2970   iPosY = rect.top + 1;
2971   iHeight = rect.bottom - rect.top - 2;
2972
2973   // create Edit Control
2974   win_create_window_ex_utf8( 0L, "Edit", SEARCH_PROMPT, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT,
2975               iPosX, iPosY, 200, iHeight, hToolBar, (HMENU)ID_TOOLBAR_EDIT, hInst, NULL );
2976
2977   return hToolBar;
2978}
2979
2980static HWND InitStatusBar(HWND hParent)
2981{
2982   HMENU hMenu = GetMenu(hParent);
2983
2984   popstr[0].hMenu    = 0;
2985   popstr[0].uiString = 0;
2986   popstr[1].hMenu    = hMenu;
2987   popstr[1].uiString = IDS_UI_FILE;
2988   popstr[2].hMenu    = GetSubMenu(hMenu, 1);
2989   popstr[2].uiString = IDS_VIEW_TOOLBAR;
2990   popstr[3].hMenu    = 0;
2991   popstr[3].uiString = 0;
2992
2993   return CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
2994                       CCS_BOTTOM | SBARS_SIZEGRIP | SBT_TOOLTIPS,
2995                       TEXT("Ready"),
2996                       hParent,
2997                       2);
2998}
2999
3000
3001static LRESULT Statusbar_MenuSelect(HWND hwnd, WPARAM wParam, LPARAM lParam)
3002{
3003   UINT  fuFlags   = (UINT)HIWORD(wParam);
3004   HMENU hMainMenu = NULL;
3005   int   iMenu    = 0;
3006
3007   /* Handle non-system popup menu descriptions. */
3008   if (  (fuFlags & MF_POPUP)
3009   &&   (!(fuFlags & MF_SYSMENU)))
3010   {
3011      for (iMenu = 1; iMenu < MAX_MENUS; iMenu++)
3012      {
3013         if ((HMENU)lParam == popstr[iMenu].hMenu)
3014         {
3015            hMainMenu = (HMENU)lParam;
3016            break ;
3017         }
3018      }
3019   }
3020
3021   if (hMainMenu)
3022   {
3023      /* Display helpful text in status bar */
3024      MenuHelp(WM_MENUSELECT, wParam, lParam, hMainMenu, hInst,
3025             hStatusBar, (UINT *)&popstr[iMenu]);
3026   }
3027   else
3028   {
3029      UINT nZero = 0;
3030      MenuHelp(WM_MENUSELECT, wParam, lParam, NULL, hInst,
3031             hStatusBar, &nZero);
3032   }
3033
3034   return 0;
3035}
3036
3037static void UpdateStatusBar()
3038{
3039   LPTREEFOLDER lpFolder = GetCurrentFolder();
3040   int        games_shown = 0;
3041   int        i = -1;
3042
3043   if (!lpFolder)
3044      return;
3045
3046   while (1)
3047   {
3048      i = FindGame(lpFolder,i+1);
3049      if (i == -1)
3050         break;
3051
3052      if (!GameFiltered(i, lpFolder->m_dwFlags))
3053         games_shown++;
3054   }
3055
3056   /* Show number of games in the current 'View' in the status bar */
3057   SetStatusBarTextF(2, g_szGameCountString, games_shown);
3058
3059   i = Picker_GetSelectedItem(hwndList);
3060
3061   if (games_shown == 0)
3062      DisableSelection();
3063   else
3064   {
3065      const char* pStatus = GameInfoStatus(i, FALSE);
3066      SetStatusBarText(1, pStatus);
3067   }
3068}
3069
3070static void UpdateHistory(void)
3071{
3072   HDC hDC;
3073   RECT rect;
3074   TEXTMETRIC     tm ;
3075   int nLines, nLineHeight;
3076   //DWORD dwStyle = GetWindowLong(GetDlgItem(hMain, IDC_HISTORY), GWL_STYLE);
3077   have_history = FALSE;
3078
3079   if (GetSelectedPick() >= 0)
3080   {
3081      char *histText = GetGameHistory(Picker_GetSelectedItem(hwndList));
3082
3083      have_history = (histText && histText[0]) ? TRUE : FALSE;
3084      win_set_window_text_utf8(GetDlgItem(hMain, IDC_HISTORY), histText);
3085   }
3086
3087   if (have_history && GetShowScreenShot()
3088      && ((TabView_GetCurrentTab(hTabCtrl) == TAB_HISTORY) ||
3089         (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ||
3090         (TAB_ALL == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ))
3091   {
3092      Edit_GetRect(GetDlgItem(hMain, IDC_HISTORY),&rect);
3093      nLines = Edit_GetLineCount(GetDlgItem(hMain, IDC_HISTORY) );
3094      hDC = GetDC(GetDlgItem(hMain, IDC_HISTORY));
3095      GetTextMetrics (hDC, &tm);
3096      nLineHeight = tm.tmHeight - tm.tmInternalLeading;
3097      if( ( (rect.bottom - rect.top) / nLineHeight) < (nLines) )
3098      {
3099         //more than one Page, so show Scrollbar
3100         SetScrollRange(GetDlgItem(hMain, IDC_HISTORY), SB_VERT, 0, nLines, TRUE);
3101      }
3102      else
3103      {
3104         //hide Scrollbar
3105         SetScrollRange(GetDlgItem(hMain, IDC_HISTORY),SB_VERT, 0, 0, TRUE);
3106
3107      }
3108       ShowWindow(GetDlgItem(hMain, IDC_HISTORY), SW_SHOW);
3109   }
3110   else
3111      ShowWindow(GetDlgItem(hMain, IDC_HISTORY), SW_HIDE);
3112
3113}
3114
3115
3116static void DisableSelection()
3117{
3118   MENUITEMINFO   mmi;
3119   HMENU         hMenu = GetMenu(hMain);
3120   BOOL         prev_have_selection = have_selection;
3121
3122   mmi.cbSize      = sizeof(mmi);
3123   mmi.fMask      = MIIM_TYPE;
3124   mmi.fType      = MFT_STRING;
3125   mmi.dwTypeData = (TCHAR *) TEXT("&Play");
3126   mmi.cch       = _tcslen(mmi.dwTypeData);
3127   SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mmi);
3128
3129   EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_GRAYED);
3130   EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_GRAYED);
3131   EnableMenuItem(hMenu, ID_GAME_PROPERTIES,      MF_GRAYED);
3132
3133   SetStatusBarText(0, "No Selection");
3134   SetStatusBarText(1, "");
3135   SetStatusBarText(3, "");
3136
3137   have_selection = FALSE;
3138
3139   if (prev_have_selection != have_selection)
3140      UpdateScreenShot();
3141}
3142
3143static void EnableSelection(int nGame)
3144{
3145   TCHAR         buf[200];
3146   const char *   pText;
3147   MENUITEMINFO   mmi;
3148   HMENU         hMenu = GetMenu(hMain);
3149   TCHAR*          t_description;
3150
3151#ifdef MESS
3152   MyFillSoftwareList(nGame, FALSE);
3153#endif
3154
3155   t_description = tstring_from_utf8(ConvertAmpersandString(ModifyThe(drivers[nGame]->description)));
3156   if( !t_description )
3157      return;
3158
3159   _sntprintf(buf, sizeof(buf) / sizeof(buf[0]), g_szPlayGameString, t_description);
3160   mmi.cbSize      = sizeof(mmi);
3161   mmi.fMask      = MIIM_TYPE;
3162   mmi.fType      = MFT_STRING;
3163   mmi.dwTypeData = buf;
3164   mmi.cch       = _tcslen(mmi.dwTypeData);
3165   SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mmi);
3166
3167   pText = ModifyThe(drivers[nGame]->description);
3168   SetStatusBarText(0, pText);
3169   /* Add this game's status to the status bar */
3170   pText = GameInfoStatus(nGame, FALSE);
3171   SetStatusBarText(1, pText);
3172   SetStatusBarText(3, "");
3173
3174   /* If doing updating game status and the game name is NOT pacman.... */
3175
3176   EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_ENABLED);
3177   EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_ENABLED);
3178
3179   if (!oldControl)
3180      EnableMenuItem(hMenu, ID_GAME_PROPERTIES, MF_ENABLED);
3181
3182   if (bProgressShown && bListReady == TRUE)
3183   {
3184      SetDefaultGame(ModifyThe(drivers[nGame]->name));
3185   }
3186   have_selection = TRUE;
3187
3188   UpdateScreenShot();
3189
3190   free(t_description);
3191}
3192
3193static void PaintBackgroundImage(HWND hWnd, HRGN hRgn, int x, int y)
3194{
3195   RECT      rcClient;
3196   HRGN      rgnBitmap;
3197   HPALETTE   hPAL;
3198   HDC       hDC = GetDC(hWnd);
3199   int       i, j;
3200   HDC       htempDC;
3201   HBITMAP    oldBitmap;
3202
3203   /* x and y are offsets within the background image that should be at 0,0 in hWnd */
3204
3205   /* So we don't paint over the control's border */
3206   GetClientRect(hWnd, &rcClient);
3207
3208   htempDC = CreateCompatibleDC(hDC);
3209   oldBitmap = SelectObject(htempDC, hBackground);
3210
3211   if (hRgn == NULL)
3212   {
3213      /* create a region of our client area */
3214      rgnBitmap = CreateRectRgnIndirect(&rcClient);
3215      SelectClipRgn(hDC, rgnBitmap);
3216      DeleteObject(rgnBitmap);
3217   }
3218   else
3219   {
3220      /* use the passed in region */
3221      SelectClipRgn(hDC, hRgn);
3222   }
3223
3224   hPAL = GetBackgroundPalette();
3225   if (hPAL == NULL)
3226      hPAL = CreateHalftonePalette(hDC);
3227
3228   if (GetDeviceCaps(htempDC, RASTERCAPS) & RC_PALETTE && hPAL != NULL)
3229   {
3230      SelectPalette(htempDC, hPAL, FALSE);
3231      RealizePalette(htempDC);
3232   }
3233
3234   for (i = rcClient.left-x; i < rcClient.right; i += bmDesc.bmWidth)
3235      for (j = rcClient.top-y; j < rcClient.bottom; j += bmDesc.bmHeight)
3236         BitBlt(hDC, i, j, bmDesc.bmWidth, bmDesc.bmHeight, htempDC, 0, 0, SRCCOPY);
3237   
3238   SelectObject(htempDC, oldBitmap);
3239   DeleteDC(htempDC);
3240   
3241   if (GetBackgroundPalette() == NULL)
3242   {
3243      DeleteObject(hPAL);
3244      hPAL = NULL;
3245   }
3246
3247   ReleaseDC(hWnd, hDC);
3248}
3249
3250static LPCSTR GetCloneParentName(int nItem)
3251{
3252   int nParentIndex = -1;
3253
3254   if (DriverIsClone(nItem) == TRUE)
3255   {
3256      nParentIndex = GetParentIndex(drivers[nItem]);
3257      if( nParentIndex >= 0)
3258         return ModifyThe(drivers[nParentIndex]->description);
3259   }
3260   return "";
3261}
3262
3263#if 0
3264static BOOL PickerHitTest(HWND hWnd)
3265{
3266   RECT         rect;
3267   POINTS         p;
3268   DWORD         res = GetMessagePos();
3269   LVHITTESTINFO   htInfo;
3270
3271   ZeroMemory(&htInfo,sizeof(LVHITTESTINFO));
3272   p = MAKEPOINTS(res);
3273   GetWindowRect(hWnd, &rect);
3274   htInfo.pt.x = p.x - rect.left;
3275   htInfo.pt.y = p.y - rect.top;
3276   ListView_HitTest(hWnd, &htInfo);
3277
3278   return (! (htInfo.flags & LVHT_NOWHERE));
3279}
3280#endif
3281
3282static BOOL TreeViewNotify(LPNMHDR nm)
3283{
3284   switch (nm->code)
3285   {
3286   case TVN_SELCHANGED :
3287   {
3288      HTREEITEM hti = TreeView_GetSelection(hTreeView);
3289      TVITEM     tvi;
3290
3291      tvi.mask  = TVIF_PARAM | TVIF_HANDLE;
3292      tvi.hItem = hti;
3293     
3294      if (TreeView_GetItem(hTreeView, &tvi))
3295      {
3296         SetCurrentFolder((LPTREEFOLDER)tvi.lParam);
3297         if (bListReady)
3298         {
3299            ResetListView();
3300            UpdateScreenShot();
3301         }
3302      }
3303      return TRUE;
3304   }
3305   case TVN_BEGINLABELEDIT :
3306   {
3307      TV_DISPINFO *ptvdi = (TV_DISPINFO *)nm;
3308      LPTREEFOLDER folder = (LPTREEFOLDER)ptvdi->item.lParam;
3309
3310      if (folder->m_dwFlags & F_CUSTOM)
3311      {
3312         // user can edit custom folder names
3313         g_in_treeview_edit = TRUE;
3314         return FALSE;
3315      }
3316      // user can't edit built in folder names
3317      return TRUE;
3318   }
3319   case TVN_ENDLABELEDIT :
3320   {
3321      TV_DISPINFO *ptvdi = (TV_DISPINFO *)nm;
3322      LPTREEFOLDER folder = (LPTREEFOLDER)ptvdi->item.lParam;
3323      char* szText;
3324      BOOL result;
3325
3326      g_in_treeview_edit = FALSE;
3327
3328      if (ptvdi->item.pszText == NULL || _tcslen(ptvdi->item.pszText) == 0)
3329         return FALSE;
3330         
3331      szText = utf8_from_tstring(ptvdi->item.pszText);
3332      if( !szText )
3333         return FALSE;
3334
3335      result = TryRenameCustomFolder(folder,szText);
3336     
3337      free(szText);
3338     
3339      return result;
3340   }
3341   }
3342   return FALSE;
3343}
3344
3345
3346
3347static void GamePicker_OnHeaderContextMenu(POINT pt, int nColumn)
3348{
3349   // Right button was clicked on header
3350   HMENU hMenuLoad;
3351   HMENU hMenu;
3352
3353   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_HEADER));
3354   hMenu = GetSubMenu(hMenuLoad, 0);
3355   lastColumnClick = nColumn;
3356   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hMain,NULL);
3357
3358   DestroyMenu(hMenuLoad);
3359}
3360
3361
3362
3363char* ConvertAmpersandString(const char *s)
3364{
3365   /* takes a string and changes any ampersands to double ampersands,
3366      for setting text of window controls that don't allow us to disable
3367      the ampersand underlining.
3368    */
3369   /* returns a static buffer--use before calling again */
3370
3371   static char buf[200];
3372   char *ptr;
3373
3374   ptr = buf;
3375   while (*s)
3376   {
3377      if (*s == '&')
3378         *ptr++ = *s;
3379      *ptr++ = *s++;
3380   }
3381   *ptr = 0;
3382
3383   return buf;
3384}
3385
3386static int GUI_seq_pressed(const input_seq *seq)
3387{
3388   int codenum;
3389   int res = 1;
3390   int invert = 0;
3391   int count = 0;
3392
3393   for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
3394   {
3395      input_code code = seq->code[codenum];
3396
3397      switch (code)
3398      {
3399         case SEQCODE_OR :
3400            if (res && count)
3401               return 1;
3402            res = 1;
3403            count = 0;
3404            break;
3405         case SEQCODE_NOT :
3406            invert = !invert;
3407            break;
3408         default:
3409            if (res)
3410            {
3411               int pressed = keyboard_state[code];
3412               if ((pressed != 0) == invert)
3413                  res = 0;
3414            }
3415            invert = 0;
3416            ++count;
3417      }
3418   }
3419   return res && count;
3420}
3421
3422static void check_for_GUI_action(void)
3423{
3424   int i;
3425
3426   for (i = 0; i < NUM_GUI_SEQUENCES; i++)
3427   {
3428      input_seq *is = &(GUISequenceControl[i].is);
3429
3430      if (GUI_seq_pressed(is))
3431      {
3432         dprintf("seq =%s pressed\n", GUISequenceControl[i].name);
3433         switch (GUISequenceControl[i].func_id)
3434         {
3435         case ID_GAME_AUDIT:
3436         case ID_GAME_PROPERTIES:
3437         case ID_CONTEXT_FILTERS:
3438         case ID_UI_START:
3439            KeyboardStateClear(); /* beacuse whe won't receive KeyUp mesage when we loose focus */
3440            break;
3441         default:
3442            break;
3443         }
3444         SendMessage(hMain, WM_COMMAND, GUISequenceControl[i].func_id, 0);
3445      }
3446   }
3447}
3448
3449static void KeyboardStateClear(void)
3450{
3451   memset(keyboard_state, 0, sizeof(keyboard_state));
3452   dprintf("keyboard gui state cleared.\n");
3453}
3454
3455
3456static void KeyboardKeyDown(int syskey, int vk_code, int special)
3457{
3458   int i, found = 0;
3459   input_code icode = 0;
3460   int special_code = (special >> 24) & 1;
3461   int scancode = (special>>16) & 0xff;
3462
3463   if ((vk_code==VK_MENU) || (vk_code==VK_CONTROL) || (vk_code==VK_SHIFT))
3464   {
3465      found = 1;
3466
3467      /* a hack for right shift - it's better to use Direct X for keyboard input it seems......*/
3468      if (vk_code==VK_SHIFT)
3469         if (scancode>0x30) /* on my keyboard left shift scancode is 0x2a, right shift is 0x36 */
3470            special_code = 1;
3471
3472      if (special_code) /* right hand keys */
3473      {
3474         switch(vk_code)
3475         {
3476         case VK_MENU:
3477            icode = KEYCODE_RALT;
3478            break;
3479         case VK_CONTROL:
3480            icode = KEYCODE_RCONTROL;
3481            break;
3482         case VK_SHIFT:
3483            icode = KEYCODE_RSHIFT;
3484            break;
3485         }
3486      }
3487      else /* left hand keys */
3488      {
3489         switch(vk_code)
3490         {
3491         case VK_MENU:
3492            icode = KEYCODE_LALT;
3493            break;
3494         case VK_CONTROL:
3495            icode = KEYCODE_LCONTROL;
3496            break;
3497         case VK_SHIFT:
3498            icode = KEYCODE_LSHIFT;
3499            break;
3500         }
3501      }
3502   }
3503   else
3504   {
3505      for (i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++)
3506      {
3507         if ( vk_code == win_key_trans_table[i][VIRTUAL_KEY])
3508         {
3509            icode = win_key_trans_table[i][MAME_KEY];
3510            found = 1;
3511            break;
3512         }
3513      }
3514   }
3515   if (!found)
3516   {
3517      dprintf("VK_code pressed not found =  %i\n",vk_code);
3518      //MessageBox(NULL,"keydown message arrived not processed","TitleBox",MB_OK);
3519      return;
3520   }
3521   dprintf("VK_code pressed found =  %i, sys=%i, mame_keycode=%i special=%08x\n", vk_code, syskey, icode, special);
3522   keyboard_state[icode] = 1;
3523   check_for_GUI_action();
3524}
3525
3526static void KeyboardKeyUp(int syskey, int vk_code, int special)
3527{
3528   int i, found = 0;
3529   input_code icode = 0;
3530   int special_code = (special >> 24) & 1;
3531   int scancode = (special>>16) & 0xff;
3532
3533   if ((vk_code==VK_MENU) || (vk_code==VK_CONTROL) || (vk_code==VK_SHIFT))
3534   {
3535      found = 1;
3536
3537      /* a hack for right shift - it's better to use Direct X for keyboard input it seems......*/
3538      if (vk_code==VK_SHIFT)
3539         if (scancode>0x30) /* on my keyboard left shift scancode is 0x2a, right shift is 0x36 */
3540            special_code = 1;
3541
3542      if (special_code) /* right hand keys */
3543      {
3544         switch(vk_code)
3545         {
3546         case VK_MENU:
3547            icode = KEYCODE_RALT;
3548            break;
3549         case VK_CONTROL:
3550            icode = KEYCODE_RCONTROL;
3551            break;
3552         case VK_SHIFT:
3553            icode = KEYCODE_RSHIFT;
3554            break;
3555         }
3556      }
3557      else /* left hand keys */
3558      {
3559         switch(vk_code)
3560         {
3561         case VK_MENU:
3562            icode = KEYCODE_LALT;
3563            break;
3564         case VK_CONTROL:
3565            icode = KEYCODE_LCONTROL;
3566            break;
3567         case VK_SHIFT:
3568            icode = KEYCODE_LSHIFT;
3569            break;
3570         }
3571      }
3572   }
3573   else
3574   {
3575      for (i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++)
3576      {
3577         if (vk_code == win_key_trans_table[i][VIRTUAL_KEY])
3578         {
3579            icode = win_key_trans_table[i][MAME_KEY];
3580            found = 1;
3581            break;
3582         }
3583      }
3584   }
3585   if (!found)
3586   {
3587      dprintf("VK_code released not found =  %i",vk_code);
3588      //MessageBox(NULL,"keyup message arrived not processed","TitleBox",MB_OK);
3589      return;
3590   }
3591   keyboard_state[icode] = 0;
3592   dprintf("VK_code released found=  %i, sys=%i, mame_keycode=%i special=%08x\n", vk_code, syskey, icode, special );
3593   check_for_GUI_action();
3594}
3595
3596static void PollGUIJoystick()
3597{
3598   // For the exec timer, will keep track of how long the button has been pressed 
3599   static int exec_counter = 0;
3600   const char* exec_command;
3601   TCHAR* t_exec_command;
3602 
3603   if (in_emulation)
3604      return;
3605
3606   if (g_pJoyGUI == NULL)
3607      return;
3608
3609   g_pJoyGUI->poll_joysticks();
3610
3611
3612   // User pressed UP
3613   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyUp(0), GetUIJoyUp(1), GetUIJoyUp(2),GetUIJoyUp(3))))
3614   {
3615      SendMessage(hMain, WM_COMMAND, ID_UI_UP, 0);
3616   }
3617   
3618   // User pressed DOWN
3619   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyDown(0), GetUIJoyDown(1), GetUIJoyDown(2),GetUIJoyDown(3))))
3620   {
3621      SendMessage(hMain, WM_COMMAND, ID_UI_DOWN, 0);
3622   }
3623   
3624   // User pressed LEFT
3625   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyLeft(0), GetUIJoyLeft(1), GetUIJoyLeft(2),GetUIJoyLeft(3))))
3626   {
3627      SendMessage(hMain, WM_COMMAND, ID_UI_LEFT, 0);
3628   }
3629
3630   // User pressed RIGHT
3631   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyRight(0), GetUIJoyRight(1), GetUIJoyRight(2),GetUIJoyRight(3))))
3632   {
3633      SendMessage(hMain, WM_COMMAND, ID_UI_RIGHT, 0);
3634   }
3635
3636   // User pressed START GAME
3637   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyStart(0), GetUIJoyStart(1), GetUIJoyStart(2),GetUIJoyStart(3))))
3638   {
3639      SendMessage(hMain, WM_COMMAND, ID_UI_START, 0);
3640   }
3641
3642   // User pressed PAGE UP
3643   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyPageUp(0), GetUIJoyPageUp(1), GetUIJoyPageUp(2),GetUIJoyPageUp(3))))
3644   {
3645      SendMessage(hMain, WM_COMMAND, ID_UI_PGUP, 0);
3646   }
3647
3648   // User pressed PAGE DOWN
3649   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyPageDown(0), GetUIJoyPageDown(1), GetUIJoyPageDown(2),GetUIJoyPageDown(3))))
3650   {
3651      SendMessage(hMain, WM_COMMAND, ID_UI_PGDOWN, 0);
3652   }
3653
3654   // User pressed HOME
3655   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHome(0), GetUIJoyHome(1), GetUIJoyHome(2),GetUIJoyHome(3))))
3656   {
3657      SendMessage(hMain, WM_COMMAND, ID_UI_HOME, 0);
3658   }
3659
3660   // User pressed END
3661   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyEnd(0), GetUIJoyEnd(1), GetUIJoyEnd(2),GetUIJoyEnd(3))))
3662   {
3663      SendMessage(hMain, WM_COMMAND, ID_UI_END, 0);
3664   }
3665
3666   // User pressed CHANGE SCREENSHOT
3667   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoySSChange(0), GetUIJoySSChange(1), GetUIJoySSChange(2),GetUIJoySSChange(3))))
3668   {
3669      SendMessage(hMain, WM_COMMAND, IDC_SSFRAME, 0);
3670   }
3671   
3672   // User pressed SCROLL HISTORY UP
3673   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHistoryUp(0), GetUIJoyHistoryUp(1), GetUIJoyHistoryUp(2),GetUIJoyHistoryUp(3))))
3674   {
3675      SendMessage(hMain, WM_COMMAND, ID_UI_HISTORY_UP, 0);
3676   }
3677   
3678   // User pressed SCROLL HISTORY DOWN
3679   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyHistoryDown(0), GetUIJoyHistoryDown(1), GetUIJoyHistoryDown(2),GetUIJoyHistoryDown(3))))
3680   {
3681      SendMessage(hMain, WM_COMMAND, ID_UI_HISTORY_DOWN, 0);
3682   }
3683 
3684  // User pressed EXECUTE COMMANDLINE
3685   if (g_pJoyGUI->is_joy_pressed(JOYCODE(GetUIJoyExec(0), GetUIJoyExec(1), GetUIJoyExec(2),GetUIJoyExec(3))))
3686   {
3687      if (++exec_counter >= GetExecWait()) // Button has been pressed > exec timeout
3688      {
3689         PROCESS_INFORMATION pi;
3690         STARTUPINFO si;
3691         
3692         // Reset counter
3693         exec_counter = 0;
3694
3695         ZeroMemory( &si, sizeof(si) );
3696         ZeroMemory( &pi, sizeof(pi) );
3697         si.dwFlags = STARTF_FORCEONFEEDBACK;
3698         si.cb = sizeof(si);
3699         
3700         exec_command = GetExecCommand();
3701         t_exec_command = tstring_from_utf8(exec_command);
3702         if( !t_exec_command )
3703            return;
3704         CreateProcess(NULL, t_exec_command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
3705         
3706         free(t_exec_command);
3707
3708         // We will not wait for the process to finish cause it might be a background task
3709         // The process won't get closed when MAME32 closes either.
3710
3711         // But close the handles cause we won't need them anymore. Will not close process.
3712         CloseHandle(pi.hProcess);
3713         CloseHandle(pi.hThread);
3714      }
3715   }
3716   else
3717   {
3718      // Button has been released within the timeout period, reset the counter
3719      exec_counter = 0;
3720   }
3721}
3722
3723#if 0
3724static void PressKey(HWND hwnd, UINT vk)
3725{
3726   SendMessage(hwnd, WM_KEYDOWN, vk, 0);
3727   SendMessage(hwnd, WM_KEYUP,   vk, 0xc0000000);
3728}
3729#endif
3730
3731static void SetView(int menu_id)
3732{
3733   BOOL force_reset = FALSE;
3734   int i;
3735
3736   // first uncheck previous menu item, check new one
3737   CheckMenuRadioItem(GetMenu(hMain), ID_VIEW_LARGE_ICON, ID_VIEW_GROUPED, menu_id, MF_CHECKED);
3738   ToolBar_CheckButton(hToolBar, menu_id, MF_CHECKED);
3739
3740   if (Picker_GetViewID(hwndList) == VIEW_GROUPED || menu_id == ID_VIEW_GROUPED)
3741   {
3742      // this changes the sort order, so redo everything
3743      force_reset = TRUE;
3744   }
3745
3746   for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
3747      Picker_SetViewID(GetDlgItem(hMain, s_nPickers[i]), menu_id - ID_VIEW_LARGE_ICON);
3748
3749   if (force_reset)
3750   {
3751      for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
3752         Picker_Sort(GetDlgItem(hMain, s_nPickers[i]));
3753   }
3754}
3755
3756static void ResetListView()
3757{
3758   int    i;
3759   int    current_game;
3760   LV_ITEM lvi;
3761   BOOL   no_selection = FALSE;
3762   LPTREEFOLDER lpFolder = GetCurrentFolder();
3763
3764   if (!lpFolder)
3765    {
3766      return;
3767    }
3768
3769   /* If the last folder was empty, no_selection is TRUE */
3770   if (have_selection == FALSE)
3771    {
3772      no_selection = TRUE;
3773    }
3774
3775   current_game = Picker_GetSelectedItem(hwndList);
3776
3777   SetWindowRedraw(hwndList,FALSE);
3778
3779   ListView_DeleteAllItems(hwndList);
3780
3781   // hint to have it allocate it all at once
3782   ListView_SetItemCount(hwndList,driver_list_get_count(drivers));
3783
3784   lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
3785   lvi.stateMask = 0;
3786
3787   i = -1;
3788
3789   do
3790   {
3791      /* Add the games that are in this folder */
3792      if ((i = FindGame(lpFolder, i + 1)) != -1)
3793      {
3794         if (GameFiltered(i, lpFolder->m_dwFlags))
3795            continue;
3796
3797         lvi.iItem    = i;
3798         lvi.iSubItem = 0;
3799         lvi.lParam    = i;
3800         lvi.pszText  = LPSTR_TEXTCALLBACK;
3801         lvi.iImage    = I_IMAGECALLBACK;
3802         ListView_InsertItem(hwndList, &lvi);
3803      }
3804   } while (i != -1);
3805
3806   Picker_Sort(hwndList);
3807
3808   if (bListReady)
3809   {
3810       /* If last folder was empty, select the first item in this folder */
3811       if (no_selection)
3812          Picker_SetSelectedPick(hwndList, 0);
3813      else
3814          Picker_SetSelectedItem(hwndList, current_game);
3815   }
3816
3817   /*RS Instead of the Arrange Call that was here previously on all Views
3818       We now need to set the ViewMode for SmallIcon again,
3819       for an explanation why, see SetView*/
3820   if (GetViewMode() == VIEW_SMALL_ICONS)
3821      SetView(ID_VIEW_SMALL_ICON);
3822
3823   SetWindowRedraw(hwndList, TRUE);
3824
3825   UpdateStatusBar();
3826
3827}
3828
3829static void UpdateGameList(BOOL bUpdateRomAudit, BOOL bUpdateSampleAudit)
3830{
3831   int i;
3832
3833   for (i = 0; i < driver_list_get_count(drivers); i++)
3834   {
3835      if (bUpdateRomAudit && DriverUsesRoms(i))
3836         SetRomAuditResults(i, UNKNOWN);
3837      if (bUpdateSampleAudit && DriverUsesSamples(i))
3838         SetSampleAuditResults(i, UNKNOWN);
3839   }
3840
3841   idle_work    = TRUE;
3842   bDoGameCheck = TRUE;
3843   game_index    = 0;
3844
3845   ReloadIcons();
3846
3847   // Let REFRESH also load new background if found
3848   LoadBackgroundBitmap();
3849   InvalidateRect(hMain,NULL,TRUE);
3850   Picker_ResetIdle(hwndList);
3851}
3852
3853UINT_PTR CALLBACK CFHookProc(
3854  HWND hdlg,      // handle to dialog box
3855  UINT uiMsg,     // message identifier
3856  WPARAM wParam,  // message parameter
3857  LPARAM lParam   // message parameter
3858)
3859{
3860   int iIndex, i;
3861   COLORREF cCombo, cList;
3862   switch (uiMsg)
3863   {
3864      case WM_INITDIALOG:
3865         SendDlgItemMessage(hdlg, cmb4, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom"));
3866         iIndex = SendDlgItemMessage(hdlg, cmb4, CB_GETCOUNT, 0, 0);
3867         cList = GetListFontColor();
3868         SendDlgItemMessage(hdlg, cmb4, CB_SETITEMDATA,(WPARAM)iIndex-1,(LPARAM)cList );
3869         for( i = 0; i< iIndex; i++)
3870         {
3871            cCombo = SendDlgItemMessage(hdlg, cmb4, CB_GETITEMDATA,(WPARAM)i,0 );
3872            if( cList == cCombo)
3873            {
3874               SendDlgItemMessage(hdlg, cmb4, CB_SETCURSEL,(WPARAM)i,0 );
3875               break;
3876            }
3877         }
3878         break;
3879      case WM_COMMAND:
3880         if( LOWORD(wParam) == cmb4)
3881         {
3882            switch (HIWORD(wParam))
3883            {
3884               case CBN_SELCHANGE:  // The color ComboBox changed selection
3885                  iIndex = (int)SendDlgItemMessage(hdlg, cmb4,
3886                                         CB_GETCURSEL, 0, 0L);
3887                  if( iIndex == SendDlgItemMessage(hdlg, cmb4, CB_GETCOUNT, 0, 0)-1)
3888                  {
3889                     //Custom color selected
3890                      cList = GetListFontColor();
3891                      PickColor(&cList);
3892                     SendDlgItemMessage(hdlg, cmb4, CB_DELETESTRING, iIndex, 0);
3893                     SendDlgItemMessage(hdlg, cmb4, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom"));
3894                     SendDlgItemMessage(hdlg, cmb4, CB_SETITEMDATA,(WPARAM)iIndex,(LPARAM)cList);
3895                     SendDlgItemMessage(hdlg, cmb4, CB_SETCURSEL,(WPARAM)iIndex,0 );
3896                     return TRUE;
3897                  }
3898            }
3899         }
3900         break;
3901   }
3902   return FALSE;
3903}
3904
3905static void PickFont(void)
3906{
3907   LOGFONT font;
3908   CHOOSEFONT cf;
3909   TCHAR szClass[128];
3910   HWND hWnd;
3911
3912   GetListFont(&font);
3913   font.lfQuality = DEFAULT_QUALITY;
3914
3915   cf.lStructSize = sizeof(CHOOSEFONT);
3916   cf.hwndOwner   = hMain;
3917   cf.lpLogFont   = &font;
3918   cf.lpfnHook = &CFHookProc;
3919   cf.rgbColors   = GetListFontColor();
3920   cf.Flags      = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_EFFECTS | CF_ENABLEHOOK;
3921   if (!ChooseFont(&cf))
3922      return;
3923
3924   SetListFont(&font);
3925   if (hFont != NULL)
3926      DeleteObject(hFont);
3927   hFont = CreateFontIndirect(&font);
3928   if (hFont != NULL)
3929   {
3930      COLORREF textColor = cf.rgbColors;
3931
3932      if (textColor == RGB(255,255,255))
3933      {
3934         textColor = RGB(240, 240, 240);
3935      }
3936
3937      SetAllWindowsFont(hMain, &main_resize, hFont, TRUE);
3938
3939      hWnd = GetWindow(hMain, GW_CHILD);
3940      while(hWnd)
3941      {
3942         if (GetClassName(hWnd, szClass, sizeof(szClass) / sizeof(szClass[0])))
3943         {
3944            if (!_tcscmp(szClass, TEXT("SysListView32")))
3945            {
3946               ListView_SetTextColor(hWnd, textColor);
3947            }
3948            else if (!_tcscmp(szClass, TEXT("SysTreeView32")))
3949            {
3950               TreeView_SetTextColor(hTreeView, textColor);
3951            }
3952         }
3953         hWnd = GetWindow(hWnd, GW_HWNDNEXT);
3954      }
3955      SetListFontColor(cf.rgbColors);
3956      ResetListView();
3957   }
3958}
3959
3960static void PickColor(COLORREF *cDefault)
3961{
3962    CHOOSECOLOR cc;
3963    COLORREF choice_colors[16];
3964    int i;
3965   
3966    for (i=0;i<16;i++)
3967       choice_colors[i] = GetCustomColor(i);
3968 
3969    cc.lStructSize = sizeof(CHOOSECOLOR);
3970    cc.hwndOwner   = hMain;
3971    cc.rgbResult   = *cDefault;
3972    cc.lpCustColors = choice_colors;
3973    cc.Flags       = CC_ANYCOLOR | CC_RGBINIT | CC_SOLIDCOLOR;
3974    if (!ChooseColor(&cc))
3975       return;
3976    for (i=0;i<16;i++)
3977       SetCustomColor(i,choice_colors[i]);
3978    *cDefault = cc.rgbResult;
3979}
3980 
3981static void PickCloneColor(void)
3982{
3983    COLORREF cClonecolor;
3984    cClonecolor = GetListCloneColor();
3985    PickColor( &cClonecolor);
3986    SetListCloneColor(cClonecolor);
3987    InvalidateRect(hwndList,NULL,FALSE);
3988}
3989 
3990static BOOL MameCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify)
3991{
3992   int i;
3993   LPTREEFOLDER folder;
3994   char* t_szFile;
3995   
3996   switch (id)
3997   {
3998   case ID_FILE_PLAY:
3999      MamePlayGame();
4000      return TRUE;
4001
4002   case ID_FILE_PLAY_RECORD:
4003      MamePlayRecordGame();
4004      return TRUE;
4005
4006   case ID_FILE_PLAY_BACK:
4007      MamePlayBackGame();
4008      return TRUE;
4009
4010   case ID_FILE_PLAY_RECORD_WAVE:
4011      MamePlayRecordWave();
4012      return TRUE;
4013
4014   case ID_FILE_PLAY_RECORD_MNG:
4015      MamePlayRecordMNG();
4016      return TRUE;
4017
4018   case ID_FILE_LOADSTATE :
4019      MameLoadState();
4020      return TRUE;
4021
4022   case ID_FILE_AUDIT:
4023      AuditDialog(hMain);
4024      ResetWhichGamesInFolders();
4025      ResetListView();
4026      SetFocus(hwndList);
4027      return TRUE;
4028
4029   case ID_FILE_EXIT:
4030      PostMessage(hMain, WM_CLOSE, 0, 0);
4031      return TRUE;
4032
4033   case ID_VIEW_LARGE_ICON:
4034      SetView(ID_VIEW_LARGE_ICON);
4035      return TRUE;
4036
4037   case ID_VIEW_SMALL_ICON:
4038      SetView(ID_VIEW_SMALL_ICON);
4039      ResetListView();
4040      return TRUE;
4041
4042   case ID_VIEW_LIST_MENU:
4043      SetView(ID_VIEW_LIST_MENU);
4044      return TRUE;
4045
4046   case ID_VIEW_DETAIL:
4047      SetView(ID_VIEW_DETAIL);
4048      return TRUE;
4049
4050   case ID_VIEW_GROUPED:
4051      SetView(ID_VIEW_GROUPED);
4052      return TRUE;
4053
4054   /* Arrange Icons submenu */
4055   case ID_VIEW_BYGAME:
4056      SetSortReverse(FALSE);
4057      SetSortColumn(COLUMN_GAMES);
4058      Picker_Sort(hwndList);
4059      break;
4060
4061   case ID_VIEW_BYDIRECTORY:
4062      SetSortReverse(FALSE);
4063      SetSortColumn(COLUMN_DIRECTORY);
4064      Picker_Sort(hwndList);
4065      break;
4066
4067   case ID_VIEW_BYMANUFACTURER:
4068      SetSortReverse(FALSE);
4069      SetSortColumn(COLUMN_MANUFACTURER);
4070      Picker_Sort(hwndList);
4071      break;
4072
4073   case ID_VIEW_BYTIMESPLAYED:
4074      SetSortReverse(FALSE);
4075      SetSortColumn(COLUMN_PLAYED);
4076      Picker_Sort(hwndList);
4077      break;
4078
4079   case ID_VIEW_BYTYPE:
4080      SetSortReverse(FALSE);
4081      SetSortColumn(COLUMN_TYPE);
4082      Picker_Sort(hwndList);
4083      break;
4084
4085   case ID_VIEW_BYYEAR:
4086      SetSortReverse(FALSE);
4087      SetSortColumn(COLUMN_YEAR);
4088      Picker_Sort(hwndList);
4089      break;
4090
4091   case ID_VIEW_FOLDERS:
4092      bShowTree = !bShowTree;
4093      SetShowFolderList(bShowTree);
4094      CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
4095      ToolBar_CheckButton(hToolBar, ID_VIEW_FOLDERS, (bShowTree) ? MF_CHECKED : MF_UNCHECKED);
4096      UpdateScreenShot();
4097      break;
4098
4099   case ID_VIEW_TOOLBARS:
4100      bShowToolBar = !bShowToolBar;
4101      SetShowToolBar(bShowToolBar);
4102      CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
4103      ToolBar_CheckButton(hToolBar, ID_VIEW_TOOLBARS, (bShowToolBar) ? MF_CHECKED : MF_UNCHECKED);
4104      ShowWindow(hToolBar, (bShowToolBar) ? SW_SHOW : SW_HIDE);
4105      ResizePickerControls(hMain);
4106      UpdateScreenShot();
4107      break;
4108
4109   case ID_VIEW_STATUS:
4110      bShowStatusBar = !bShowStatusBar;
4111      SetShowStatusBar(bShowStatusBar);
4112      CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
4113      ToolBar_CheckButton(hToolBar, ID_VIEW_STATUS, (bShowStatusBar) ? MF_CHECKED : MF_UNCHECKED);
4114      ShowWindow(hStatusBar, (bShowStatusBar) ? SW_SHOW : SW_HIDE);
4115      ResizePickerControls(hMain);
4116      UpdateScreenShot();
4117      break;
4118
4119   case ID_VIEW_PAGETAB:
4120      bShowTabCtrl = !bShowTabCtrl;
4121      SetShowTabCtrl(bShowTabCtrl);
4122      ShowWindow(hTabCtrl, (bShowTabCtrl) ? SW_SHOW : SW_HIDE);
4123      ResizePickerControls(hMain);
4124      UpdateScreenShot();
4125      InvalidateRect(hMain,NULL,TRUE);
4126      break;
4127
4128      /*
4129        Switches to fullscreen mode. No check mark handeling
4130        for this item cause in fullscreen mode the menu won't
4131        be visible anyways.
4132      */   
4133   case ID_VIEW_FULLSCREEN:
4134      SwitchFullScreenMode();
4135      break;
4136
4137   case ID_TOOLBAR_EDIT:
4138      {
4139         char buf[256];
4140
4141         win_get_window_text_utf8(hwndCtl, buf, sizeof(buf));
4142         switch (codeNotify)
4143         {
4144         case EN_CHANGE:
4145            //put search routine here first, add a 200ms timer later.
4146            if ((!_stricmp(buf, SEARCH_PROMPT) && !_stricmp(g_SearchText, "")) ||
4147                (!_stricmp(g_SearchText, SEARCH_PROMPT) && !_stricmp(buf, "")))
4148            {
4149               strcpy(g_SearchText, buf);
4150            }
4151            else
4152            {
4153               strcpy(g_SearchText, buf);
4154               ResetListView();
4155            }
4156            break;
4157         case EN_SETFOCUS:
4158            if (!_stricmp(buf, SEARCH_PROMPT))
4159               win_set_window_text_utf8(hwndCtl, "");
4160            break;
4161         case EN_KILLFOCUS:
4162            if (strlen(buf) == 0)
4163               win_set_window_text_utf8(hwndCtl, SEARCH_PROMPT);
4164            break;
4165         }
4166      }
4167      break;
4168
4169   case ID_GAME_AUDIT:
4170      InitGameAudit(0);
4171      if (!oldControl)
4172      {
4173         InitPropertyPageToPage(hInst, hwnd, GetSelectedPickItemIcon(), OPTIONS_GAME, -1, Picker_GetSelectedItem(hwndList), AUDIT_PAGE);
4174      }
4175      /* Just in case the toggle MMX on/off */
4176      UpdateStatusBar();
4177      break;
4178
4179   /* ListView Context Menu */
4180   case ID_CONTEXT_ADD_CUSTOM:
4181   {
4182       int  nResult;
4183
4184      nResult = DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_CUSTOM_FILE),
4185                         hMain,AddCustomFileDialogProc,Picker_GetSelectedItem(hwndList));
4186      SetFocus(hwndList);
4187      break;
4188   }
4189
4190   case ID_CONTEXT_REMOVE_CUSTOM:
4191   {
4192       RemoveCurrentGameCustomFolder();
4193      break;
4194   }
4195
4196   /* Tree Context Menu */
4197   case ID_CONTEXT_FILTERS:
4198      if (DialogBox(GetModuleHandle(NULL),
4199         MAKEINTRESOURCE(IDD_FILTERS), hMain, FilterDialogProc) == TRUE)
4200         ResetListView();
4201      SetFocus(hwndList);
4202      return TRUE;
4203
4204      // ScreenShot Context Menu
4205      // select current tab
4206   case ID_VIEW_TAB_SCREENSHOT :
4207   case ID_VIEW_TAB_FLYER :
4208   case ID_VIEW_TAB_CABINET :
4209   case ID_VIEW_TAB_MARQUEE :
4210   case ID_VIEW_TAB_TITLE :
4211   case ID_VIEW_TAB_CONTROL_PANEL :
4212   case ID_VIEW_TAB_PCB :
4213   case ID_VIEW_TAB_HISTORY:
4214      if (id == ID_VIEW_TAB_HISTORY && GetShowTab(TAB_HISTORY) == FALSE)
4215         break;
4216
4217      TabView_SetCurrentTab(hTabCtrl, id - ID_VIEW_TAB_SCREENSHOT);
4218      UpdateScreenShot();
4219      TabView_UpdateSelection(hTabCtrl);
4220      break;
4221
4222      // toggle tab's existence
4223   case ID_TOGGLE_TAB_SCREENSHOT :
4224   case ID_TOGGLE_TAB_FLYER :
4225   case ID_TOGGLE_TAB_CABINET :
4226   case ID_TOGGLE_TAB_MARQUEE :
4227   case ID_TOGGLE_TAB_TITLE :
4228   case ID_TOGGLE_TAB_CONTROL_PANEL :
4229   case ID_TOGGLE_TAB_PCB :
4230   case ID_TOGGLE_TAB_HISTORY :
4231   {
4232      int toggle_flag = id - ID_TOGGLE_TAB_SCREENSHOT;
4233
4234      if (AllowedToSetShowTab(toggle_flag,!GetShowTab(toggle_flag)) == FALSE)
4235      {
4236         // attempt to hide the last tab
4237         // should show error dialog? hide picture area? or ignore?
4238         break;
4239      }
4240
4241      SetShowTab(toggle_flag,!GetShowTab(toggle_flag));
4242
4243      TabView_Reset(hTabCtrl);
4244
4245      if (TabView_GetCurrentTab(hTabCtrl) == toggle_flag && GetShowTab(toggle_flag) == FALSE)
4246      {
4247         // we're deleting the tab we're on, so go to the next one
4248         TabView_CalculateNextTab(hTabCtrl);
4249      }
4250
4251
4252      // Resize the controls in case we toggled to another history
4253      // mode (and the history control needs resizing).
4254
4255      ResizePickerControls(hMain);
4256      UpdateScreenShot();
4257   
4258      TabView_UpdateSelection(hTabCtrl);
4259
4260      break;
4261   }
4262
4263   /* Header Context Menu */
4264   case ID_SORT_ASCENDING:
4265      SetSortReverse(FALSE);
4266      SetSortColumn(Picker_GetRealColumnFromViewColumn(hwndList, lastColumnClick));
4267      Picker_Sort(hwndList);
4268      break;
4269
4270   case ID_SORT_DESCENDING:
4271      SetSortReverse(TRUE);
4272      SetSortColumn(Picker_GetRealColumnFromViewColumn(hwndList, lastColumnClick));
4273      Picker_Sort(hwndList);
4274      break;
4275
4276   case ID_CUSTOMIZE_FIELDS:
4277      if (DialogBox(GetModuleHandle(NULL),
4278         MAKEINTRESOURCE(IDD_COLUMNS), hMain, ColumnDialogProc) == TRUE)
4279         ResetColumnDisplay(FALSE);
4280      SetFocus(hwndList);
4281      return TRUE;
4282
4283   /* View Menu */
4284   case ID_VIEW_LINEUPICONS:
4285      if( codeNotify == FALSE)
4286         ResetListView();
4287      else
4288      {
4289         /*it was sent after a refresh (F5) was done, we only reset the View if "available" is the selected folder
4290           as it doesn't affect the others*/
4291         folder = GetSelectedFolder();
4292         if( folder )
4293         {
4294            if (folder->m_nFolderId == FOLDER_AVAILABLE )
4295               ResetListView();
4296
4297         }
4298      }
4299      break;
4300
4301   case ID_GAME_PROPERTIES:
4302      if (!oldControl)
4303      {
4304         folder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
4305         InitPropertyPage(hInst, hwnd, GetSelectedPickItemIcon(), OPTIONS_GAME, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4306#ifdef MESS
4307         {
4308            extern BOOL g_bModifiedSoftwarePaths;
4309            if (g_bModifiedSoftwarePaths) {
4310               g_bModifiedSoftwarePaths = FALSE;
4311               MessUpdateSoftwareList();
4312            }
4313         }
4314#endif
4315      }
4316      /* Just in case the toggle MMX on/off */
4317      UpdateStatusBar();
4318      break;
4319
4320   case ID_FOLDER_PROPERTIES:
4321      if (!oldControl)
4322      {
4323         folder = GetSelectedFolder();
4324         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), (folder->m_nFolderId == FOLDER_VECTOR) ? OPTIONS_VECTOR : OPTIONS_SOURCE, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4325         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4326      }
4327      /* Just in case the toggle MMX on/off */
4328      UpdateStatusBar();
4329      break;
4330
4331   case ID_FOLDER_SOURCEPROPERTIES:
4332      if (!oldControl)
4333      {
4334         folder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
4335         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), (folder->m_nFolderId == FOLDER_VECTOR) ? OPTIONS_VECTOR : OPTIONS_SOURCE , folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4336         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4337      }
4338      /* Just in case the toggle MMX on/off */
4339      UpdateStatusBar();
4340      break;
4341
4342   case ID_FOLDER_VECTORPROPERTIES:
4343      if (!oldControl)
4344      {
4345         folder = GetFolderByID( FOLDER_VECTOR );
4346         InitPropertyPage(hInst, hwnd, GetSelectedFolderIcon(), OPTIONS_VECTOR, folder->m_nFolderId, Picker_GetSelectedItem(hwndList));
4347         //SaveFolderOptions(folder->m_nFolderId, Picker_GetSelectedItem(hwndList) );
4348      }
4349      /* Just in case the toggle MMX on/off */
4350      UpdateStatusBar();
4351      break;
4352
4353   case ID_FOLDER_AUDIT:
4354      FolderCheck();
4355      /* Just in case the toggle MMX on/off */
4356      UpdateStatusBar();
4357      break;
4358
4359   case ID_VIEW_PICTURE_AREA :
4360      ToggleScreenShot();
4361      break;
4362
4363   case ID_UPDATE_GAMELIST:
4364      UpdateGameList(TRUE, TRUE);
4365      break;
4366
4367   case ID_OPTIONS_FONT:
4368      PickFont();
4369      return TRUE;
4370
4371   case ID_OPTIONS_CLONE_COLOR:
4372      PickCloneColor();
4373      return TRUE;
4374
4375   case ID_OPTIONS_DEFAULTS:
4376      /* Check the return value to see if changes were applied */
4377      if (!oldControl)
4378      {
4379         InitDefaultPropertyPage(hInst, hwnd);
4380         SaveDefaultOptions();
4381      }
4382      SetFocus(hwndList);
4383      return TRUE;
4384
4385   case ID_OPTIONS_DIR:
4386      {
4387         int  nResult;
4388         BOOL bUpdateRoms;
4389         BOOL bUpdateSamples;
4390#ifdef MESS
4391         BOOL bUpdateSoftware;
4392#endif
4393
4394         nResult = DialogBox(GetModuleHandle(NULL),
4395                        MAKEINTRESOURCE(IDD_DIRECTORIES),
4396                        hMain,
4397                        DirectoriesDialogProc);
4398
4399         SaveDefaultOptions();
4400
4401         bUpdateRoms    = ((nResult & DIRDLG_ROMS)    == DIRDLG_ROMS)   ? TRUE : FALSE;
4402         bUpdateSamples = ((nResult & DIRDLG_SAMPLES) == DIRDLG_SAMPLES) ? TRUE : FALSE;
4403#ifdef MESS
4404         bUpdateSoftware = ((nResult & DIRDLG_SOFTWARE) == DIRDLG_SOFTWARE) ? TRUE : FALSE;
4405
4406         if (bUpdateSoftware)
4407            MessUpdateSoftwareList();
4408#endif /* MESS */
4409
4410         if (s_pWatcher)
4411         {
4412            if (bUpdateRoms)
4413               DirWatcher_Watch(s_pWatcher, 0, GetRomDirs(), TRUE);
4414            if (bUpdateSamples)
4415               DirWatcher_Watch(s_pWatcher, 1, GetSampleDirs(), TRUE);
4416         }
4417
4418         /* update game list */
4419         if (bUpdateRoms == TRUE || bUpdateSamples == TRUE)
4420            UpdateGameList(bUpdateRoms, bUpdateSamples);
4421
4422         SetFocus(hwndList);
4423      }
4424      return TRUE;
4425
4426   case ID_OPTIONS_RESET_DEFAULTS:
4427      if (DialogBox(GetModuleHandle(NULL),
4428                 MAKEINTRESOURCE(IDD_RESET), hMain, ResetDialogProc) == TRUE)
4429        {
4430         // these may have been changed
4431         SaveDefaultOptions();
4432         DestroyWindow(hwnd);
4433         PostQuitMessage(0);
4434      } else {
4435         ResetListView();
4436         SetFocus(hwndList);
4437      }
4438      return TRUE;
4439
4440   case ID_OPTIONS_INTERFACE:
4441      DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_INTERFACE_OPTIONS),
4442              hMain, InterfaceDialogProc);
4443      SaveDefaultOptions();
4444
4445      KillTimer(hMain, SCREENSHOT_TIMER);
4446      if( GetCycleScreenshot() > 0)
4447      {
4448         SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL ); // Scale to seconds
4449      }
4450
4451      return TRUE;
4452
4453   case ID_OPTIONS_BG:
4454      {
4455         OPENFILENAME OpenFileName;
4456         static TCHAR szFile[MAX_PATH] = TEXT("\0");
4457         TCHAR*       t_bgdir = tstring_from_utf8(GetBgDir());
4458         if( !t_bgdir )
4459            return FALSE;
4460
4461         OpenFileName.lStructSize       = sizeof(OPENFILENAME);
4462         OpenFileName.hwndOwner         = hMain;
4463         OpenFileName.hInstance         = 0;
4464         OpenFileName.lpstrFilter       = TEXT("Image Files (*.png, *.bmp)\0*.PNG;*.BMP\0");
4465         OpenFileName.lpstrCustomFilter = NULL;
4466         OpenFileName.nMaxCustFilter    = 0;
4467         OpenFileName.nFilterIndex      = 1;
4468         OpenFileName.lpstrFile         = szFile;
4469         OpenFileName.nMaxFile          = sizeof(szFile);
4470         OpenFileName.lpstrFileTitle    = NULL;
4471         OpenFileName.nMaxFileTitle     = 0;
4472         OpenFileName.lpstrInitialDir   = t_bgdir;
4473         OpenFileName.lpstrTitle        = TEXT("Select a Background Image");
4474         OpenFileName.nFileOffset       = 0;
4475         OpenFileName.nFileExtension    = 0;
4476         OpenFileName.lpstrDefExt       = NULL;
4477         OpenFileName.lCustData         = 0;                                                 
4478         OpenFileName.lpfnHook          = NULL;
4479         OpenFileName.lpTemplateName    = NULL;                                   
4480         OpenFileName.Flags             = OFN_NOCHANGEDIR | OFN_SHOWHELP | OFN_EXPLORER;
4481
4482         if (GetOpenFileName(&OpenFileName))
4483         {
4484            t_szFile = utf8_from_tstring(szFile);
4485            if( !t_szFile )
4486               return FALSE;
4487            ResetBackground(t_szFile);
4488            LoadBackgroundBitmap();
4489            InvalidateRect(hMain, NULL, TRUE);
4490            free(t_bgdir);
4491            free(t_szFile);
4492            return TRUE;
4493         }
4494         free(t_bgdir);
4495      }
4496      break;
4497
4498   case ID_OPTIONS_LANGUAGE:
4499      DialogBox(GetModuleHandle(NULL),
4500              MAKEINTRESOURCE(IDD_LANGUAGE),
4501              hMain,
4502              LanguageDialogProc);
4503      return TRUE;
4504
4505   case ID_HELP_ABOUT:
4506      DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUT),
4507              hMain, AboutDialogProc);
4508      SetFocus(hwndList);
4509      return TRUE;
4510
4511   case IDOK :
4512      /* cmk -- might need to check more codes here, not sure */
4513      if (codeNotify != EN_CHANGE && codeNotify != EN_UPDATE)
4514      {
4515         /* enter key */
4516         if (g_in_treeview_edit)
4517         {
4518            TreeView_EndEditLabelNow(hTreeView, FALSE);
4519            return TRUE;
4520         }
4521         else
4522            if (have_selection)
4523               MamePlayGame();
4524      }
4525      break;
4526
4527   case IDCANCEL : /* esc key */
4528      if (g_in_treeview_edit)
4529         TreeView_EndEditLabelNow(hTreeView, TRUE);
4530      break;
4531
4532   case IDC_PLAY_GAME :
4533      if (have_selection)
4534         MamePlayGame();
4535      break;
4536
4537   case ID_UI_START:
4538      SetFocus(hwndList);
4539      MamePlayGame();
4540      break;
4541
4542   case ID_UI_UP:
4543      Picker_SetSelectedPick(hwndList, GetSelectedPick() - 1);
4544       break;
4545
4546   case ID_UI_DOWN:
4547      Picker_SetSelectedPick(hwndList, GetSelectedPick() + 1);
4548       break;
4549
4550   case ID_UI_PGUP:
4551      Picker_SetSelectedPick(hwndList, GetSelectedPick() - ListView_GetCountPerPage(hwndList));
4552       break;
4553
4554   case ID_UI_PGDOWN:
4555      if ( (GetSelectedPick() + ListView_GetCountPerPage(hwndList)) < ListView_GetItemCount(hwndList) )
4556         Picker_SetSelectedPick(hwndList,  GetSelectedPick() + ListView_GetCountPerPage(hwndList) );
4557      else
4558         Picker_SetSelectedPick(hwndList,  ListView_GetItemCount(hwndList)-1 );
4559       break;
4560
4561   case ID_UI_HOME:
4562      Picker_SetSelectedPick(hwndList, 0);
4563       break;
4564
4565   case ID_UI_END:
4566      Picker_SetSelectedPick(hwndList,  ListView_GetItemCount(hwndList)-1 );
4567      break;
4568   case ID_UI_LEFT:
4569      /* hmmmmm..... */
4570      SendMessage(hwndList,WM_HSCROLL, SB_LINELEFT, 0);
4571       break;
4572
4573   case ID_UI_RIGHT:
4574      /* hmmmmm..... */
4575      SendMessage(hwndList,WM_HSCROLL, SB_LINERIGHT, 0);
4576       break;
4577   case ID_UI_HISTORY_UP:
4578      /* hmmmmm..... */
4579      {
4580         HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
4581         SendMessage(hHistory, EM_SCROLL, SB_PAGEUP, 0);
4582      }
4583       break;
4584
4585   case ID_UI_HISTORY_DOWN:
4586      /* hmmmmm..... */
4587      {
4588         HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
4589         SendMessage(hHistory, EM_SCROLL, SB_PAGEDOWN, 0);
4590      }
4591       break;
4592
4593   case IDC_SSFRAME:
4594      TabView_CalculateNextTab(hTabCtrl);
4595      UpdateScreenShot();
4596      TabView_UpdateSelection(hTabCtrl);
4597      break;
4598
4599   case ID_CONTEXT_SELECT_RANDOM:
4600      SetRandomPickItem();
4601      break;
4602
4603   case ID_CONTEXT_RESET_PLAYTIME:
4604      ResetPlayTime( Picker_GetSelectedItem(hwndList) );
4605      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
4606      break;
4607
4608   case ID_CONTEXT_RESET_PLAYCOUNT:
4609      ResetPlayCount( Picker_GetSelectedItem(hwndList) );
4610      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
4611      break;
4612
4613   case ID_CONTEXT_RENAME_CUSTOM :
4614      TreeView_EditLabel(hTreeView,TreeView_GetSelection(hTreeView));
4615      break;
4616
4617   default:
4618      if (id >= ID_CONTEXT_SHOW_FOLDER_START && id < ID_CONTEXT_SHOW_FOLDER_END)
4619      {
4620         ToggleShowFolder(id - ID_CONTEXT_SHOW_FOLDER_START);
4621         break;
4622      }
4623      for (i = 0; g_helpInfo[i].nMenuItem > 0; i++)
4624      {
4625         if (g_helpInfo[i].nMenuItem == id)
4626         {
4627            if (g_helpInfo[i].bIsHtmlHelp)
4628               HelpFunction(hMain, g_helpInfo[i].lpFile, HH_DISPLAY_TOPIC, 0);
4629            else
4630               DisplayTextFile(hMain, g_helpInfo[i].lpFile);
4631            return FALSE;
4632         }
4633      }
4634#ifdef MESS
4635      return MessCommand(hwnd, id, hwndCtl, codeNotify);
4636#else
4637      break;
4638#endif
4639   }
4640
4641   return FALSE;
4642}
4643
4644static void LoadBackgroundBitmap()
4645{
4646   HGLOBAL hDIBbg;
4647   char*   pFileName = 0;
4648
4649   if (hBackground)
4650   {
4651      DeleteObject(hBackground);
4652      hBackground = 0;
4653   }
4654
4655   if (hPALbg)
4656   {
4657      DeleteObject(hPALbg);
4658      hPALbg = 0;
4659   }
4660
4661   /* Pick images based on number of colors avaliable. */
4662   if (GetDepth(hwndList) <= 8)
4663   {
4664      pFileName = (char *)"bkgnd16";
4665      /*nResource = IDB_BKGROUND16;*/
4666   }
4667   else
4668   {
4669      pFileName = (char *)"bkground";
4670      /*nResource = IDB_BKGROUND;*/
4671   }
4672
4673   if (LoadDIB(pFileName, &hDIBbg, &hPALbg, BACKGROUND))
4674   {
4675      HDC hDC = GetDC(hwndList);
4676      hBackground = DIBToDDB(hDC, hDIBbg, &bmDesc);
4677      GlobalFree(hDIBbg);
4678      ReleaseDC(hwndList, hDC);
4679   }
4680}
4681
4682static void ResetColumnDisplay(BOOL first_time)
4683{
4684   int driver_index;
4685
4686   if (!first_time)
4687      Picker_ResetColumnDisplay(hwndList);
4688
4689   ResetListView();
4690
4691   driver_index = GetGameNameIndex(GetDefaultGame());
4692   Picker_SetSelectedItem(hwndList, driver_index);
4693}
4694
4695int GamePicker_GetItemImage(HWND hwndPicker, int nItem)
4696{
4697   return GetIconForDriver(nItem);
4698}
4699
4700const TCHAR *GamePicker_GetItemString(HWND hwndPicker, int nItem, int nColumn,
4701   TCHAR *pszBuffer, UINT nBufferLength)
4702{
4703   const TCHAR *s = NULL;
4704   const char* utf8_s = NULL;
4705   char playtime_buf[256];
4706
4707   switch(nColumn)
4708   {
4709      case COLUMN_GAMES:
4710         /* Driver description */
4711         utf8_s = ModifyThe(drivers[nItem]->description);
4712         break;
4713      case COLUMN_ORIENTATION:
4714         utf8_s = DriverIsVertical(nItem) ? "Vertical" : "Horizontal";
4715         break;
4716#if 0
4717      case COLUMN_ROMS:
4718         /* Has Roms */
4719         utf8_s = GetAuditString(GetRomAuditResults(nItem));
4720         break;
4721#endif
4722      case COLUMN_SAMPLES:
4723         /* Samples */
4724         if (DriverUsesSamples(nItem))
4725            utf8_s = GetAuditString(GetSampleAuditResults(nItem));
4726         break;
4727
4728      case COLUMN_DIRECTORY:
4729         /* Driver name (directory) */
4730         utf8_s = drivers[nItem]->name;
4731         break;
4732
4733      case COLUMN_SRCDRIVERS:
4734         /* Source drivers */
4735         utf8_s = GetDriverFilename(nItem);
4736         break;
4737
4738      case COLUMN_PLAYTIME:
4739         /* Source drivers */
4740         GetTextPlayTime(nItem, playtime_buf);
4741         utf8_s = playtime_buf;
4742         break;
4743
4744      case COLUMN_TYPE:
4745        {
4746            machine_config drv;
4747            expand_machine_driver(drivers[nItem]->drv,&drv);
4748
4749         /* Vector/Raster */
4750         if (drv.video_attributes & VIDEO_TYPE_VECTOR)
4751            s = TEXT("Vector");
4752         else
4753            s = TEXT("Raster");
4754         break;
4755        }
4756      case COLUMN_TRACKBALL:
4757         /* Trackball */
4758         if (DriverUsesTrackball(nItem))
4759            s = TEXT("Yes");
4760         else
4761            s = TEXT("No");
4762         break;
4763
4764      case COLUMN_PLAYED:
4765         /* times played */
4766         _sntprintf(pszBuffer, nBufferLength, TEXT("%i"), GetPlayCount(nItem));
4767         s = pszBuffer;
4768         break;
4769
4770      case COLUMN_MANUFACTURER:
4771         /* Manufacturer */
4772         utf8_s = drivers[nItem]->manufacturer;
4773         break;
4774
4775      case COLUMN_YEAR:
4776         /* Year */
4777         utf8_s = drivers[nItem]->year;
4778         break;
4779
4780      case COLUMN_CLONE:
4781         utf8_s = GetCloneParentName(nItem);
4782         break;
4783   }
4784   
4785   if( utf8_s )
4786   {
4787      TCHAR* t_s = tstring_from_utf8(utf8_s);
4788      if( !t_s )
4789         return s;
4790     
4791      _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s);     
4792      free(t_s);
4793     
4794      s = pszBuffer;
4795   }
4796   
4797   return s;
4798}
4799
4800static void GamePicker_LeavingItem(HWND hwndPicker, int nItem)
4801{
4802   // leaving item
4803   // printf("leaving %s\n",drivers[nItem]->name);
4804}
4805
4806static void GamePicker_EnteringItem(HWND hwndPicker, int nItem)
4807{
4808   TCHAR* t_description;
4809   ATOM a;
4810   // printf("entering %s\n",drivers[nItem]->name);
4811   if (g_bDoBroadcast == TRUE)
4812   {
4813      t_description = tstring_from_utf8(drivers[nItem]->description);
4814      if( !t_description )
4815         return;
4816      a = GlobalAddAtom(t_description);
4817      SendMessage(HWND_BROADCAST, g_mame32_message, a, a);
4818      GlobalDeleteAtom(a);
4819      free(t_description);
4820   }
4821
4822   EnableSelection(nItem);
4823#ifdef MESS
4824   MessReadMountedSoftware(nItem);
4825#endif
4826}
4827
4828static int GamePicker_FindItemParent(HWND hwndPicker, int nItem)
4829{
4830   return GetParentRomSetIndex(drivers[nItem]);
4831}
4832
4833/* Initialize the Picker and List controls */
4834static void InitListView()
4835{
4836   LVBKIMAGE bki;
4837   TCHAR path[MAX_PATH];
4838   TCHAR* t_bgdir;
4839
4840   static const struct PickerCallbacks s_gameListCallbacks =
4841   {
4842      SetSortColumn,            /* pfnSetSortColumn */
4843      GetSortColumn,            /* pfnGetSortColumn */
4844      SetSortReverse,            /* pfnSetSortReverse */
4845      GetSortReverse,            /* pfnGetSortReverse */
4846      SetViewMode,            /* pfnSetViewMode */
4847      GetViewMode,            /* pfnGetViewMode */
4848      SetColumnWidths,         /* pfnSetColumnWidths */
4849      GetColumnWidths,         /* pfnGetColumnWidths */
4850      SetColumnOrder,            /* pfnSetColumnOrder */
4851      GetColumnOrder,            /* pfnGetColumnOrder */
4852      SetColumnShown,            /* pfnSetColumnShown */
4853      GetColumnShown,            /* pfnGetColumnShown */
4854      GetOffsetClones,         /* pfnGetOffsetChildren */
4855
4856      GamePicker_Compare,         /* pfnCompare */
4857      MamePlayGame,            /* pfnDoubleClick */
4858      GamePicker_GetItemString,   /* pfnGetItemString */
4859      GamePicker_GetItemImage,   /* pfnGetItemImage */
4860      GamePicker_LeavingItem,      /* pfnLeavingItem */
4861      GamePicker_EnteringItem,   /* pfnEnteringItem */
4862      BeginListViewDrag,         /* pfnBeginListViewDrag */
4863      GamePicker_FindItemParent,   /* pfnFindItemParent */
4864      OnIdle,                     /* pfnIdle */
4865      GamePicker_OnHeaderContextMenu,   /* pfnOnHeaderContextMenu */
4866      GamePicker_OnBodyContextMenu   /* pfnOnBodyContextMenu */
4867   };
4868
4869   struct PickerOptions opts;
4870
4871   // subclass the list view
4872   memset(&opts, 0, sizeof(opts));
4873   opts.pCallbacks = &s_gameListCallbacks;
4874   opts.nColumnCount = COLUMN_MAX;
4875   opts.ppszColumnNames = column_names;
4876   SetupPicker(hwndList, &opts);
4877
4878   ListView_SetTextBkColor(hwndList, CLR_NONE);
4879   ListView_SetBkColor(hwndList, CLR_NONE);
4880   t_bgdir = tstring_from_utf8(GetBgDir());
4881   if( !t_bgdir )
4882      return;
4883   _stprintf(path, TEXT("%s\\bkground.png"), t_bgdir);
4884   bki.ulFlags = LVBKIF_SOURCE_URL | LVBKIF_STYLE_TILE;
4885   bki.pszImage = path;
4886   if( hBackground )   
4887      ListView_SetBkImage(hwndList, &bki);
4888
4889   CreateIcons();
4890
4891   ResetColumnDisplay(TRUE);
4892
4893   // Allow selection to change the default saved game
4894   bListReady = TRUE;
4895   free(t_bgdir);
4896}
4897
4898static void AddDriverIcon(int nItem,int default_icon_index)
4899{
4900   HICON hIcon = 0;
4901   int nParentIndex = -1;
4902
4903   /* if already set to rom or clone icon, we've been here before */
4904   if (icon_index[nItem] == 1 || icon_index[nItem] == 3)
4905      return;
4906
4907   hIcon = LoadIconFromFile((char *)drivers[nItem]->name);
4908   if (hIcon == NULL)
4909   {
4910      nParentIndex = GetParentIndex(drivers[nItem]);
4911      if( nParentIndex >= 0)
4912      {
4913         hIcon = LoadIconFromFile((char *)drivers[nParentIndex]->name);
4914         nParentIndex = GetParentIndex(drivers[nParentIndex]);
4915         if (hIcon == NULL && nParentIndex >= 0)
4916            hIcon = LoadIconFromFile((char *)drivers[nParentIndex]->name);
4917      }
4918   }
4919
4920   if (hIcon != NULL)
4921   {
4922      int nIconPos = ImageList_AddIcon(hSmall, hIcon);
4923      ImageList_AddIcon(hLarge, hIcon);
4924      if (nIconPos != -1)
4925         icon_index[nItem] = nIconPos;
4926   }
4927   if (icon_index[nItem] == 0)
4928      icon_index[nItem] = default_icon_index;
4929}
4930
4931static void DestroyIcons(void)
4932{
4933   if (hSmall != NULL)
4934   {
4935      ImageList_Destroy(hSmall);
4936      hSmall = NULL;
4937   }
4938
4939   if (icon_index != NULL)
4940   {
4941      int i;
4942      for (i=0;i<driver_list_get_count(drivers);i++)
4943         icon_index[i] = 0; // these are indices into hSmall
4944   }
4945
4946   if (hLarge != NULL)
4947   {
4948      ImageList_Destroy(hLarge);
4949      hLarge = NULL;
4950   }
4951
4952   if (hHeaderImages != NULL)
4953   {
4954      ImageList_Destroy(hHeaderImages);
4955      hHeaderImages = NULL;
4956   }
4957
4958}
4959
4960static void ReloadIcons(void)
4961{
4962   HICON hIcon;
4963   INT i;
4964
4965   // clear out all the images
4966   ImageList_RemoveAll(hSmall);
4967   ImageList_RemoveAll(hLarge);
4968
4969   if (icon_index != NULL)
4970   {
4971      for (i=0;i<driver_list_get_count(drivers);i++)
4972         icon_index[i] = 0; // these are indices into hSmall
4973   }
4974
4975   for (i = 0; g_iconData[i].icon_name; i++)
4976   {
4977      hIcon = LoadIconFromFile((char *) g_iconData[i].icon_name);
4978      if (hIcon == NULL)
4979         hIcon = LoadIcon(hInst, MAKEINTRESOURCE(g_iconData[i].resource));
4980
4981      ImageList_AddIcon(hSmall, hIcon);
4982      ImageList_AddIcon(hLarge, hIcon);
4983   }
4984}
4985
4986static DWORD GetShellLargeIconSize(void)
4987{
4988   DWORD  dwSize, dwLength = 512, dwType = REG_SZ;
4989   TCHAR  szBuffer[512];
4990   HKEY   hKey;
4991
4992   /* Get the Key */
4993   RegOpenKey(HKEY_CURRENT_USER, TEXT("Control Panel\\desktop\\WindowMetrics"), &hKey);
4994   /* Save the last size */
4995   RegQueryValueEx(hKey, TEXT("Shell Icon Size"), NULL, &dwType, (LPBYTE)szBuffer, &dwLength);
4996   dwSize = _ttol(szBuffer);
4997   if (dwSize < 32)
4998      dwSize = 32;
4999
5000   if (dwSize > 48)
5001      dwSize = 48;
5002
5003   /* Clean up */
5004   RegCloseKey(hKey);
5005   return dwSize;
5006}
5007
5008static DWORD GetShellSmallIconSize(void)
5009{
5010   DWORD dwSize = ICONMAP_WIDTH;
5011
5012   if (dwSize < 48)
5013   {
5014      if (dwSize < 32)
5015         dwSize = 16;
5016      else
5017         dwSize = 32;
5018   }
5019   else
5020   {
5021      dwSize = 48;
5022   }
5023   return dwSize;
5024}
5025
5026// create iconlist for Listview control
5027static void CreateIcons(void)
5028{
5029   DWORD dwLargeIconSize = GetShellLargeIconSize();
5030   HICON hIcon;
5031   int icon_count;
5032   DWORD dwStyle;
5033   int i;
5034
5035   icon_count = 0;
5036   while(g_iconData[icon_count].icon_name)
5037      icon_count++;
5038
5039   // the current window style affects the sizing of the rows when changing
5040   // between list views, so put it in small icon mode temporarily while we associate
5041   // our image list
5042   //
5043   // using large icon mode instead kills the horizontal scrollbar when doing
5044   // full refresh, which seems odd (it should recreate the scrollbar when
5045   // set back to report mode, for example, but it doesn't).
5046
5047   dwStyle = GetWindowLong(hwndList,GWL_STYLE);
5048   SetWindowLong(hwndList,GWL_STYLE,(dwStyle & ~LVS_TYPEMASK) | LVS_ICON);
5049
5050   hSmall = ImageList_Create(GetShellSmallIconSize(),GetShellSmallIconSize(),
5051                       ILC_COLORDDB | ILC_MASK, icon_count, icon_count + 5000);
5052   hLarge = ImageList_Create(dwLargeIconSize, dwLargeIconSize,
5053                       ILC_COLORDDB | ILC_MASK, icon_count, icon_count + 5000);
5054
5055   if (NULL == hSmall || NULL == hLarge) {
5056      win_message_box_utf8(hwndList, "Cannot allocate Icon lists", "Allocation error - Exiting", IDOK);
5057      PostQuitMessage(0);
5058   }
5059
5060   ReloadIcons();
5061
5062   // Associate the image lists with the list view control.
5063   (void)ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL);
5064   (void)ListView_SetImageList(hwndList, hLarge, LVSIL_NORMAL);
5065
5066   // restore our view
5067   SetWindowLong(hwndList,GWL_STYLE,dwStyle);
5068
5069#ifdef MESS
5070   CreateMessIcons();
5071#endif
5072
5073   // Now set up header specific stuff
5074   hHeaderImages = ImageList_Create(8,8,ILC_COLORDDB | ILC_MASK,2,2);
5075   hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_HEADER_UP));
5076   ImageList_AddIcon(hHeaderImages,hIcon);
5077   hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_HEADER_DOWN));
5078   ImageList_AddIcon(hHeaderImages,hIcon);
5079
5080   for (i = 0; i < sizeof(s_nPickers) / sizeof(s_nPickers[0]); i++)
5081      Picker_SetHeaderImageList(GetDlgItem(hMain, s_nPickers[i]), hHeaderImages);
5082}
5083
5084
5085
5086static int GamePicker_Compare(HWND hwndPicker, int index1, int index2, int sort_subitem)
5087{
5088   int value = 0;  /* Default to 0, for unknown case */
5089   const char *name1 = NULL;
5090   const char *name2 = NULL;
5091   int nTemp1, nTemp2;
5092
5093#ifdef DEBUG
5094   if (strcmp(drivers[index1]->name,"1941") == 0 && strcmp(drivers[index2]->name,"1942") == 0)
5095   {
5096      dprintf("comparing 1941, 1942");
5097   }
5098
5099   if (strcmp(drivers[index1]->name,"1942") == 0 && strcmp(drivers[index2]->name,"1941") == 0)
5100   {
5101      dprintf("comparing 1942, 1941");
5102   }
5103#endif
5104
5105   switch (sort_subitem)
5106   {
5107   case COLUMN_GAMES:
5108      return mame_stricmp(ModifyThe(drivers[index1]->description),
5109                  ModifyThe(drivers[index2]->description));
5110      break;
5111
5112   case COLUMN_ORIENTATION:
5113      nTemp1 = DriverIsVertical(index1) ? 1 : 0;
5114      nTemp2 = DriverIsVertical(index2) ? 1 : 0;
5115      value = nTemp1 - nTemp2;
5116      break;
5117#if 0
5118   case COLUMN_ROMS:
5119      nTemp1 = GetRomAuditResults(index1);
5120      nTemp2 = GetRomAuditResults(index2);
5121
5122      if (IsAuditResultKnown(nTemp1) == FALSE && IsAuditResultKnown(nTemp2) == FALSE)
5123         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5124
5125      if (IsAuditResultKnown(nTemp1) == FALSE)
5126      {
5127         value = 1;
5128         break;
5129      }
5130
5131      if (IsAuditResultKnown(nTemp2) == FALSE)
5132      {
5133         value = -1;
5134         break;
5135      }
5136
5137      // ok, both are known
5138      if (IsAuditResultYes(nTemp1) && IsAuditResultYes(nTemp2))
5139         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5140     
5141      if (IsAuditResultNo(nTemp1) && IsAuditResultNo(nTemp2))
5142         return GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5143
5144      if (IsAuditResultYes(nTemp1) && IsAuditResultNo(nTemp2))
5145         value = -1;
5146      else
5147         value = 1;
5148      break;
5149#endif
5150   case COLUMN_SAMPLES:
5151      nTemp1 = -1;
5152      if (DriverUsesSamples(index1))
5153      {
5154         int audit_result = GetSampleAuditResults(index1);
5155         if (IsAuditResultKnown(audit_result))
5156         {
5157            if (IsAuditResultYes(audit_result))
5158               nTemp1 = 1;
5159            else
5160               nTemp1 = 0;
5161         }
5162         else
5163            nTemp1 = 2;
5164      }
5165
5166      nTemp2 = -1;
5167      if (DriverUsesSamples(index2))
5168      {
5169         int audit_result = GetSampleAuditResults(index1);
5170         if (IsAuditResultKnown(audit_result))
5171         {
5172            if (IsAuditResultYes(audit_result))
5173               nTemp2 = 1;
5174            else
5175               nTemp2 = 0;
5176         }
5177         else
5178            nTemp2 = 2;
5179      }
5180      value = nTemp2 - nTemp1;
5181      break;
5182
5183   case COLUMN_DIRECTORY:
5184      value = mame_stricmp(drivers[index1]->name, drivers[index2]->name);
5185      break;
5186
5187      case COLUMN_SRCDRIVERS:
5188      value = mame_stricmp(drivers[index1]->source_file, drivers[index2]->source_file);
5189      break;
5190
5191   case COLUMN_PLAYTIME:
5192      value = GetPlayTime(index1) - GetPlayTime(index2);
5193      break;
5194
5195   case COLUMN_TYPE:
5196    {
5197        machine_config drv1,drv2;
5198        expand_machine_driver(drivers[index1]->drv,&drv1);
5199        expand_machine_driver(drivers[index2]->drv,&drv2);
5200
5201      value = (drv1.video_attributes & VIDEO_TYPE_VECTOR) -
5202            (drv2.video_attributes & VIDEO_TYPE_VECTOR);
5203      break;
5204    }
5205   case COLUMN_TRACKBALL:
5206      value = DriverUsesTrackball(index1) - DriverUsesTrackball(index2);
5207      break;
5208
5209   case COLUMN_PLAYED:
5210      value = GetPlayCount(index1) - GetPlayCount(index2);
5211      break;
5212
5213   case COLUMN_MANUFACTURER:
5214      value = mame_stricmp(drivers[index1]->manufacturer, drivers[index2]->manufacturer);
5215      break;
5216
5217   case COLUMN_YEAR:
5218      value = mame_stricmp(drivers[index1]->year, drivers[index2]->year);
5219      break;
5220
5221   case COLUMN_CLONE:
5222      name1 = GetCloneParentName(index1);
5223      name2 = GetCloneParentName(index2);
5224
5225      if (*name1 == '\0')
5226         name1 = NULL;
5227      if (*name2 == '\0')
5228         name2 = NULL;
5229
5230      if (NULL == name1 && NULL == name2)
5231         value = 0;
5232      else if (name2 == NULL)
5233         value = -1;
5234      else if (name1 == NULL)
5235         value = 1;
5236      else
5237         value = mame_stricmp(name1, name2);
5238      break;
5239   }
5240
5241   // Handle same comparisons here
5242   if (0 == value && COLUMN_GAMES != sort_subitem)
5243   {
5244      value = GamePicker_Compare(hwndPicker, index1, index2, COLUMN_GAMES);
5245   }
5246#ifdef DEBUG
5247   if ((strcmp(drivers[index1]->name,"1941") == 0 && strcmp(drivers[index2]->name,"1942") == 0) ||
5248      (strcmp(drivers[index1]->name,"1942") == 0 && strcmp(drivers[index2]->name,"1941") == 0))
5249      dprintf("result: %i",value);
5250#endif
5251
5252   return value;
5253}
5254
5255int GetSelectedPick()
5256{
5257   /* returns index of listview selected item */
5258   /* This will return -1 if not found */
5259   return ListView_GetNextItem(hwndList, -1, LVIS_SELECTED | LVIS_FOCUSED);
5260}
5261
5262static HICON GetSelectedPickItemIcon()
5263{
5264   LV_ITEM lvi;
5265
5266   lvi.iItem = GetSelectedPick();
5267   lvi.iSubItem = 0;
5268   lvi.mask = LVIF_IMAGE;
5269   ListView_GetItem(hwndList, &lvi);
5270
5271   return ImageList_GetIcon(hLarge, lvi.iImage, ILD_TRANSPARENT);
5272}
5273
5274static void SetRandomPickItem()
5275{
5276   int nListCount;
5277
5278   nListCount = ListView_GetItemCount(hwndList);
5279
5280   if (nListCount > 0)
5281   {
5282      Picker_SetSelectedPick(hwndList, rand() % nListCount);
5283   }
5284}
5285
5286BOOL CommonFileDialog(common_file_dialog_proc cfd, char *filename, int filetype)
5287{
5288   BOOL success;
5289   OPENFILENAME of;
5290   TCHAR* t_filename;
5291   TCHAR* t_statedir = 0;
5292   TCHAR* t_artdir = 0;
5293   TCHAR t_filename_buffer[MAX_PATH]  = {0, };
5294   char *utf8_filename;
5295
5296   // convert the filename to UTF-8 and copy into buffer
5297   t_filename = tstring_from_utf8(filename);
5298   if (t_filename != NULL)
5299   {
5300      _sntprintf(t_filename_buffer, ARRAY_LENGTH(t_filename_buffer), TEXT("%s"), t_filename);
5301      free(t_filename);
5302   }
5303
5304   of.lStructSize       = sizeof(of);
5305   of.hwndOwner         = hMain;
5306   of.hInstance         = NULL;
5307   switch (filetype)
5308   {
5309   case FILETYPE_INPUT_FILES :
5310      of.lpstrFilter   = TEXT(MAMENAME " input files (*.inp,*.zip)\0*.inp;*.zip\0All files (*.*)\0*.*\0");
5311      break;
5312   case FILETYPE_SAVESTATE_FILES :
5313      of.lpstrFilter   = TEXT(MAMENAME " savestate files (*.sta)\0*.sta;\0All files (*.*)\0*.*\0");
5314      break;
5315   case FILETYPE_WAVE_FILES :
5316      of.lpstrFilter   = TEXT("sounds (*.wav)\0*.wav;\0All files (*.*)\0*.*\0");
5317      break;
5318   case FILETYPE_MNG_FILES :
5319      of.lpstrFilter   = TEXT("videos (*.mng)\0*.mng;\0All files (*.*)\0*.*\0");
5320      break;
5321   case FILETYPE_EFFECT_FILES :
5322      of.lpstrFilter   = TEXT("effects (*.png)\0*.png;\0All files (*.*)\0*.*\0");
5323      break;
5324   }
5325   of.lpstrCustomFilter = NULL;
5326   of.nMaxCustFilter    = 0;
5327   of.nFilterIndex      = 1;
5328   of.lpstrFile         = t_filename_buffer;
5329   of.nMaxFile          = ARRAY_LENGTH(t_filename_buffer);
5330   of.lpstrFileTitle    = NULL;
5331   of.nMaxFileTitle     = 0;
5332   if (filetype == FILETYPE_SAVESTATE_FILES)
5333   {
5334      t_statedir = tstring_from_utf8(GetStateDir());
5335      if( !t_statedir )
5336         return FALSE;
5337
5338      of.lpstrInitialDir = t_statedir;
5339   }
5340   else
5341   {
5342      if (filetype == FILETYPE_EFFECT_FILES)
5343      {
5344         t_artdir = tstring_from_utf8(GetArtDir());
5345         if( !t_artdir )
5346            return FALSE;
5347
5348         of.lpstrInitialDir = t_artdir;
5349      }
5350      else
5351         of.lpstrInitialDir = last_directory;
5352   }
5353   of.lpstrTitle        = NULL;
5354   of.Flags             = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
5355   of.nFileOffset       = 0;
5356   of.nFileExtension    = 0;
5357   switch (filetype)
5358   {
5359   case FILETYPE_INPUT_FILES :
5360      of.lpstrDefExt       = TEXT("inp");
5361      break;
5362   case FILETYPE_SAVESTATE_FILES :
5363      of.lpstrDefExt       = TEXT("sta");
5364      break;
5365   case FILETYPE_WAVE_FILES :
5366      of.lpstrDefExt       = TEXT("wav");
5367      break;
5368   case FILETYPE_MNG_FILES :
5369      of.lpstrDefExt       = TEXT("mng");
5370      break;
5371   case FILETYPE_EFFECT_FILES :
5372      of.lpstrDefExt       = TEXT("png");
5373      break;
5374   }
5375   of.lCustData         = 0;
5376   of.lpfnHook          = NULL;
5377   of.lpTemplateName    = NULL;
5378
5379   success = cfd(&of);
5380   if (success)
5381   {
5382      //dprintf("got filename %s nFileExtension %u\n",filename,of.nFileExtension);
5383      /*GetDirectory(filename,last_directory,sizeof(last_directory));*/
5384   }
5385   
5386   if( t_artdir )
5387      free(t_artdir);
5388   if( t_statedir )
5389      free(t_statedir);
5390
5391   utf8_filename = utf8_from_tstring(t_filename_buffer);
5392   if (utf8_filename != NULL)
5393   {
5394      snprintf(filename, MAX_PATH, "%s", utf8_filename);
5395   }
5396
5397   return success;
5398}
5399
5400static BOOL SelectLanguageFile(HWND hWnd, TCHAR* filename)
5401{
5402   OPENFILENAME of;
5403
5404   of.lStructSize       = sizeof(of);
5405   of.hwndOwner         = hWnd;
5406   of.hInstance         = NULL;
5407   of.lpstrFilter       = TEXT(MAMENAME " Language files (*.lng)\0*.lng\0");
5408   of.lpstrCustomFilter = NULL;
5409   of.nMaxCustFilter    = 0;
5410   of.nFilterIndex      = 1;
5411   of.lpstrFile         = filename;
5412   of.nMaxFile          = MAX_PATH;
5413   of.lpstrFileTitle    = NULL;
5414   of.nMaxFileTitle     = 0;
5415   of.lpstrInitialDir   = NULL;
5416   of.lpstrTitle        = NULL;
5417   of.Flags             = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
5418   of.nFileOffset       = 0;
5419   of.nFileExtension    = 0;
5420   of.lpstrDefExt       = TEXT("lng");
5421   of.lCustData         = 0;
5422   of.lpfnHook          = NULL;
5423   of.lpTemplateName    = NULL;
5424
5425   return GetOpenFileName(&of);
5426}
5427
5428static INT_PTR CALLBACK LanguageDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
5429{
5430   TCHAR pLangFile[MAX_PATH];
5431   DWORD dwHelpIDs[] = { IDC_LANGUAGECHECK, HIDC_LANGUAGECHECK,
5432                    IDC_LANGUAGEEDIT,  HIDC_LANGUAGEEDIT,
5433                    0, 0};
5434   char* utf8_LangFile;
5435
5436   switch (Msg)
5437   {
5438   case WM_INITDIALOG:
5439      {
5440         const char* pLang = GetLanguage();
5441         if (pLang == NULL || *pLang == '\0')
5442         {
5443            win_set_window_text_utf8(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), "");
5444            Button_SetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK), FALSE);
5445            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   FALSE);
5446            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), FALSE);
5447         }
5448         else
5449         {
5450            win_set_window_text_utf8(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLang);
5451            Button_SetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK), TRUE);
5452            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   TRUE);
5453            EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), TRUE);
5454         }
5455
5456         return TRUE;
5457      }
5458
5459   case WM_HELP:
5460      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, (DWORD_PTR)dwHelpIDs);
5461      break;
5462
5463   case WM_CONTEXTMENU:
5464      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, (DWORD_PTR)dwHelpIDs);
5465      break;
5466
5467   case WM_COMMAND:
5468      switch (GET_WM_COMMAND_ID(wParam, lParam))
5469      {
5470      case IDOK:
5471         Edit_GetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile, MAX_PATH);
5472         utf8_LangFile = utf8_from_tstring(pLangFile);
5473         if( !utf8_LangFile )
5474            return FALSE;
5475         SetLanguage(utf8_LangFile);
5476         free(utf8_LangFile);
5477
5478      case IDCANCEL:
5479         EndDialog(hDlg, 0);
5480         return TRUE;
5481
5482      case IDC_LANGUAGECHECK:
5483      {
5484         BOOL bCheck = Button_GetCheck(GetDlgItem(hDlg, IDC_LANGUAGECHECK));
5485         EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEEDIT),   bCheck);
5486         EnableWindow(GetDlgItem(hDlg, IDC_LANGUAGEBROWSE), bCheck);
5487         if (bCheck == FALSE)
5488            Edit_SetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), TEXT(""));
5489         return TRUE;
5490      }
5491
5492      case IDC_LANGUAGEBROWSE:
5493         Edit_GetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile, MAX_PATH);
5494         if (SelectLanguageFile(hDlg, pLangFile) == TRUE)
5495            Edit_SetText(GetDlgItem(hDlg, IDC_LANGUAGEEDIT), pLangFile);
5496         break;
5497      }
5498      break;
5499   }
5500   return 0;
5501}
5502
5503void SetStatusBarText(int part_index, const char *message)
5504{
5505   TCHAR* t_message = tstring_from_utf8(message);
5506   if( !t_message )
5507      return;
5508   SendMessage(hStatusBar, SB_SETTEXT, (WPARAM) part_index, (LPARAM)(LPCTSTR) win_tstring_strdup(t_message));
5509   free(t_message);
5510}
5511
5512void SetStatusBarTextF(int part_index, const char *fmt, ...)
5513{
5514   char buf[256];
5515   va_list va;
5516
5517   va_start(va, fmt);
5518   vsprintf(buf, fmt, va);
5519   va_end(va);
5520
5521   SetStatusBarText(part_index, buf);
5522}
5523
5524static void CLIB_DECL MameMessageBox(const char *fmt, ...)
5525{
5526   char buf[2048];
5527   va_list va;
5528
5529   va_start(va, fmt);
5530   vsprintf(buf, fmt, va);
5531   win_message_box_utf8(GetMainWindow(), buf, MAMEUINAME, MB_OK | MB_ICONERROR);
5532   va_end(va);
5533}
5534
5535static void MamePlayBackGame()
5536{
5537   int nGame;
5538   char filename[MAX_PATH];
5539
5540   *filename = 0;
5541
5542   nGame = Picker_GetSelectedItem(hwndList);
5543   if (nGame != -1)
5544      strcpy(filename, drivers[nGame]->name);
5545
5546   if (CommonFileDialog(GetOpenFileName, filename, FILETYPE_INPUT_FILES))
5547   {
5548      file_error fileerr;
5549      mame_file* pPlayBack;
5550      char drive[_MAX_DRIVE];
5551      char dir[_MAX_DIR];
5552      char bare_fname[_MAX_FNAME];
5553      char ext[_MAX_EXT];
5554
5555      char path[MAX_PATH];
5556      char fname[MAX_PATH];
5557      play_options playopts;
5558
5559      _splitpath(filename, drive, dir, bare_fname, ext);
5560
5561      sprintf(path,"%s%s",drive,dir);
5562      sprintf(fname,"%s%s",bare_fname,ext);
5563      if (path[strlen(path)-1] == '\\')
5564         path[strlen(path)-1] = 0; // take off trailing back slash
5565
5566      fileerr = mame_fopen_options(MameUIGlobal(), SEARCHPATH_INPUTLOG, fname, OPEN_FLAG_READ, &pPlayBack);
5567      if (fileerr != FILERR_NONE)
5568      {
5569         MameMessageBox("Could not open '%s' as a valid input file.", filename);
5570         return;
5571      }
5572
5573      // check for game name embedded in .inp header
5574      if (pPlayBack)
5575      {
5576         inp_header input_header;
5577
5578         // read playback header
5579         mame_fread(pPlayBack, &input_header, sizeof(inp_header));
5580
5581         if (!isalnum(input_header.name[0])) // If first byte is not alpha-numeric
5582            mame_fseek(pPlayBack, 0, SEEK_SET); // old .inp file - no header
5583         else
5584         {
5585            int i;
5586            for (i = 0; drivers[i] != 0; i++) // find game and play it
5587            {
5588               if (strcmp(drivers[i]->name, input_header.name) == 0)
5589               {
5590                  nGame = i;
5591                  break;
5592               }
5593            }
5594         }
5595      }
5596      mame_fclose(pPlayBack);
5597
5598      memset(&playopts, 0, sizeof(playopts));
5599      playopts.playback = fname;
5600      MamePlayGameWithOptions(nGame, &playopts);
5601   }
5602}
5603
5604static void MameLoadState()
5605{
5606   int nGame;
5607   char filename[MAX_PATH];
5608   char selected_filename[MAX_PATH];
5609   play_options playopts;
5610
5611   *filename = 0;
5612
5613   nGame = Picker_GetSelectedItem(hwndList);
5614   if (nGame != -1)
5615   {
5616      strcpy(filename, drivers[nGame]->name);
5617      strcpy(selected_filename, drivers[nGame]->name);
5618   }
5619   if (CommonFileDialog(GetOpenFileName, filename, FILETYPE_SAVESTATE_FILES))
5620   {
5621      mame_file* pSaveState;
5622      char drive[_MAX_DRIVE];
5623      char dir[_MAX_DIR];
5624      char ext[_MAX_EXT];
5625
5626      char path[MAX_PATH];
5627      char fname[MAX_PATH];
5628      char bare_fname[_MAX_FNAME];
5629      char *state_fname;
5630      int rc;
5631
5632      _splitpath(filename, drive, dir, bare_fname, ext);
5633
5634      // parse path
5635      sprintf(path,"%s%s",drive,dir);
5636      sprintf(fname,"%s%s",bare_fname,ext);
5637      if (path[strlen(path)-1] == '\\')
5638         path[strlen(path)-1] = 0; // take off trailing back slash
5639
5640#ifdef MESS
5641      {
5642         state_fname = filename;
5643      }
5644#else // !MESS
5645      {
5646         char *cPos=0;
5647         int  iPos=0;
5648         char romname[MAX_PATH];
5649
5650         cPos = strchr(bare_fname, '-' );
5651         iPos = cPos ? cPos - bare_fname : strlen(bare_fname);
5652         strncpy(romname, bare_fname, iPos );
5653         romname[iPos] = '\0';
5654         if( strcmp(selected_filename,romname) != 0 )
5655         {
5656            MameMessageBox("'%s' is not a valid savestate file for game '%s'.", filename, selected_filename);
5657            return;
5658         }
5659         state_fname = fname;
5660      }
5661#endif // MESS
5662
5663      mame_fopen_options(MameUIGlobal(), SEARCHPATH_STATE, state_fname, OPEN_FLAG_READ, &pSaveState);
5664      if (pSaveState == NULL)
5665      {
5666         MameMessageBox("Could not open '%s' as a valid savestate file.", filename);
5667         return;
5668      }
5669
5670      // call the MAME core function to check the save state file
5671      rc = state_save_check_file(pSaveState, selected_filename, TRUE, MameMessageBox);
5672      mame_fclose(pSaveState);
5673      if (rc)
5674         return;
5675
5676      memset(&playopts, 0, sizeof(playopts));
5677#ifdef MESS
5678      playopts.state = state_fname;
5679#else
5680      {
5681         char *cPos;
5682         cPos = strrchr(bare_fname, '-' );
5683         cPos = cPos+1;
5684         if( strlen(cPos) >0)
5685         {
5686            playopts.state = cPos;
5687         }
5688      }
5689#endif
5690
5691      MamePlayGameWithOptions(nGame, &playopts);
5692   }
5693}
5694
5695static void MamePlayRecordGame()
5696{
5697   int  nGame;
5698   char filename[MAX_PATH];
5699   *filename = 0;
5700
5701   nGame = Picker_GetSelectedItem(hwndList);
5702   strcpy(filename, drivers[nGame]->name);
5703
5704   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_INPUT_FILES))
5705   {
5706      char drive[_MAX_DRIVE];
5707      char dir[_MAX_DIR];
5708      char fname[_MAX_FNAME];
5709      char ext[_MAX_EXT];
5710      char path[MAX_PATH];
5711      play_options playopts;
5712
5713      _splitpath(filename, drive, dir, fname, ext);
5714
5715      sprintf(path,"%s%s",drive,dir);
5716      if (path[strlen(path)-1] == '\\')
5717         path[strlen(path)-1] = 0; // take off trailing back slash
5718
5719      memset(&playopts, 0, sizeof(playopts));
5720      playopts.record = fname;
5721      MamePlayGameWithOptions(nGame, &playopts);
5722   }
5723}
5724
5725void MamePlayGame(void)
5726{
5727   int nGame;
5728   play_options playopts;
5729
5730   nGame = Picker_GetSelectedItem(hwndList);
5731
5732   memset(&playopts, 0, sizeof(playopts));
5733   MamePlayGameWithOptions(nGame, &playopts);
5734}
5735
5736static void MamePlayRecordWave()
5737{
5738   int  nGame;
5739   char filename[MAX_PATH];
5740   play_options playopts;
5741
5742   nGame = Picker_GetSelectedItem(hwndList);
5743   strcpy(filename, drivers[nGame]->name);
5744
5745   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_WAVE_FILES))
5746   {
5747      memset(&playopts, 0, sizeof(playopts));
5748      playopts.wavwrite = filename;
5749      MamePlayGameWithOptions(nGame, &playopts);
5750   }   
5751}
5752
5753static void MamePlayRecordMNG()
5754{
5755   int  nGame;
5756   char filename[MAX_PATH] = { 0, };
5757   play_options playopts;
5758
5759   nGame = Picker_GetSelectedItem(hwndList);
5760   strcpy(filename, drivers[nGame]->name);
5761
5762   if (CommonFileDialog(GetSaveFileName, filename, FILETYPE_MNG_FILES))
5763   {
5764      memset(&playopts, 0, sizeof(playopts));
5765      playopts.mngwrite = filename;
5766      MamePlayGameWithOptions(nGame, &playopts);
5767   }   
5768}
5769
5770static void MamePlayGameWithOptions(int nGame, const play_options *playopts)
5771{
5772   DWORD dwExitCode;
5773
5774#ifdef MESS
5775   if (!MessApproveImageList(hMain, nGame))
5776      return;
5777#endif
5778
5779   if (g_pJoyGUI != NULL)
5780      KillTimer(hMain, JOYGUI_TIMER);
5781   if (GetCycleScreenshot() > 0)
5782      KillTimer(hMain, SCREENSHOT_TIMER);
5783
5784   in_emulation = TRUE;
5785
5786   dwExitCode = RunMAME(nGame, playopts);
5787   if (dwExitCode == 0)
5788   {
5789      IncrementPlayCount(nGame);
5790      ListView_RedrawItems(hwndList, GetSelectedPick(), GetSelectedPick());
5791   }
5792   else
5793   {
5794      ShowWindow(hMain, SW_SHOW);
5795   }
5796
5797   in_emulation = FALSE;
5798
5799   // re-sort if sorting on # of times played
5800   if (GetSortColumn() == COLUMN_PLAYED)
5801      Picker_Sort(hwndList);
5802
5803   UpdateStatusBar();
5804
5805   ShowWindow(hMain, SW_SHOW);
5806   SetFocus(hwndList);
5807
5808   if (g_pJoyGUI != NULL)
5809      SetTimer(hMain, JOYGUI_TIMER, JOYGUI_MS, NULL);
5810   if (GetCycleScreenshot() > 0)
5811      SetTimer(hMain, SCREENSHOT_TIMER, GetCycleScreenshot()*1000, NULL); //scale to seconds
5812}
5813
5814/* Toggle ScreenShot ON/OFF */
5815static void ToggleScreenShot(void)
5816{
5817   BOOL showScreenShot = GetShowScreenShot();
5818
5819   SetShowScreenShot((showScreenShot) ? FALSE : TRUE);
5820   UpdateScreenShot();
5821
5822   /* Redraw list view */
5823   if (hBackground != NULL && showScreenShot)
5824      InvalidateRect(hwndList, NULL, FALSE);
5825}
5826
5827static void AdjustMetrics(void)
5828{
5829   HDC hDC;
5830   TEXTMETRIC tm;
5831   int xtraX, xtraY;
5832   AREA area;
5833   int  offX, offY;
5834   int  maxX, maxY;
5835   COLORREF textColor;
5836   TCHAR szClass[128];
5837   HWND hWnd;
5838
5839   /* WM_SETTINGCHANGE also */
5840   xtraX  = GetSystemMetrics(SM_CXFIXEDFRAME); /* Dialog frame width */
5841   xtraY  = GetSystemMetrics(SM_CYFIXEDFRAME); /* Dialog frame height */
5842   xtraY += GetSystemMetrics(SM_CYMENUSIZE);   /* Menu height */
5843   xtraY += GetSystemMetrics(SM_CYCAPTION);   /* Caption Height */
5844   maxX   = GetSystemMetrics(SM_CXSCREEN);    /* Screen Width */
5845   maxY   = GetSystemMetrics(SM_CYSCREEN);    /* Screen Height */
5846
5847   hDC = GetDC(hMain);
5848   GetTextMetrics (hDC, &tm);
5849
5850   /* Convert MIN Width/Height from Dialog Box Units to pixels. */
5851   MIN_WIDTH  = (int)((tm.tmAveCharWidth / 4.0) * DBU_MIN_WIDTH)  + xtraX;
5852   MIN_HEIGHT = (int)((tm.tmHeight      / 8.0) * DBU_MIN_HEIGHT) + xtraY;
5853   ReleaseDC(hMain, hDC);
5854
5855   if ((textColor = GetListFontColor()) == RGB(255, 255, 255))
5856      textColor = RGB(240, 240, 240);
5857
5858   hWnd = GetWindow(hMain, GW_CHILD);
5859   while(hWnd)
5860   {
5861      if (GetClassName(hWnd, szClass, sizeof(szClass) / sizeof(szClass[0])))
5862      {
5863         if (!_tcscmp(szClass, TEXT("SysListView32")))
5864         {
5865            ListView_SetBkColor(hWnd, GetSysColor(COLOR_WINDOW));
5866            ListView_SetTextColor(hWnd, textColor);
5867         }
5868         else if (!_tcscmp(szClass, TEXT("SysTreeView32")))
5869         {
5870            TreeView_SetBkColor(hTreeView, GetSysColor(COLOR_WINDOW));
5871            TreeView_SetTextColor(hTreeView, textColor);
5872         }
5873      }
5874      hWnd = GetWindow(hWnd, GW_HWNDNEXT);
5875   }
5876
5877   GetWindowArea(&area);
5878
5879   offX = area.x + area.width;
5880   offY = area.y + area.height;
5881
5882   if (offX > maxX)
5883   {
5884      offX = maxX;
5885      area.x = (offX - area.width > 0) ? (offX - area.width) : 0;
5886   }
5887   if (offY > maxY)
5888   {
5889      offY = maxY;
5890      area.y = (offY - area.height > 0) ? (offY - area.height) : 0;
5891   }
5892
5893   SetWindowArea(&area);
5894   SetWindowPos(hMain, 0, area.x, area.y, area.width, area.height, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
5895}
5896
5897#if 0
5898/* Adjust options - tune them to the currently selected game */
5899static void EnablePlayOptions(int nIndex, core_options *o)
5900{
5901}
5902#endif
5903
5904int FindIconIndex(int nIconResource)
5905{
5906   int i;
5907   for(i = 0; g_iconData[i].icon_name; i++)
5908   {
5909      if (g_iconData[i].resource == nIconResource)
5910         return i;
5911   }
5912   return -1;
5913}
5914
5915int FindIconIndexByName(const char *icon_name)
5916{
5917   int i;
5918   for (i = 0; g_iconData[i].icon_name; i++)
5919   {
5920      if (!strcmp(g_iconData[i].icon_name, icon_name))
5921         return i;
5922   }
5923   return -1;
5924}
5925
5926static int GetIconForDriver(int nItem)
5927{
5928   int iconRoms = 1;
5929
5930   if (DriverUsesRoms(nItem))
5931   {
5932      int audit_result = GetRomAuditResults(nItem);
5933      if (IsAuditResultKnown(audit_result) == FALSE)
5934         return 2;
5935#ifdef SHOW_MISSING_ROMS_ICON
5936      if (IsAuditResultYes(audit_result))
5937         iconRoms = 1;
5938      else
5939         iconRoms = 0;
5940#endif
5941   }
5942
5943   // iconRoms is now either 0 (no roms), 1 (roms), or 2 (unknown)
5944
5945   /* these are indices into icon_names, which maps into our image list
5946    * also must match IDI_WIN_NOROMS + iconRoms
5947     */
5948
5949   // Show Red-X if the ROMs are present and flagged as NOT WORKING
5950   if (iconRoms == 1 && DriverIsBroken(nItem))
5951      iconRoms = FindIconIndex(IDI_WIN_REDX);
5952
5953   // show clone icon if we have roms and game is working
5954   if (iconRoms == 1 && DriverIsClone(nItem))
5955      iconRoms = FindIconIndex(IDI_WIN_CLONE);
5956
5957   // if we have the roms, then look for a custom per-game icon to override
5958   if (iconRoms == 1 || iconRoms == 3)
5959   {
5960      if (icon_index[nItem] == 0)
5961         AddDriverIcon(nItem,iconRoms);
5962      iconRoms = icon_index[nItem];
5963   }
5964
5965   return iconRoms;
5966}
5967
5968static BOOL HandleTreeContextMenu(HWND hWnd, WPARAM wParam, LPARAM lParam)
5969{
5970   HMENU hTreeMenu;
5971   HMENU hMenu;
5972   TVHITTESTINFO hti;
5973   POINT pt;
5974
5975   if ((HWND)wParam != GetDlgItem(hWnd, IDC_TREE))
5976      return FALSE;
5977
5978   pt.x = GET_X_LPARAM(lParam);
5979   pt.y = GET_Y_LPARAM(lParam);
5980   if (pt.x < 0 && pt.y < 0)
5981      GetCursorPos(&pt);
5982
5983   /* select the item that was right clicked or shift-F10'ed */
5984   hti.pt = pt;
5985   ScreenToClient(hTreeView,&hti.pt);
5986   (void)TreeView_HitTest(hTreeView,&hti);
5987   if ((hti.flags & TVHT_ONITEM) != 0)
5988      TreeView_SelectItem(hTreeView,hti.hItem);
5989
5990   hTreeMenu = LoadMenu(hInst,MAKEINTRESOURCE(IDR_CONTEXT_TREE));
5991
5992   InitTreeContextMenu(hTreeMenu);
5993
5994   hMenu = GetSubMenu(hTreeMenu, 0);
5995   
5996   UpdateMenu(hMenu);
5997
5998   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hWnd,NULL);
5999
6000   DestroyMenu(hTreeMenu);
6001
6002   return TRUE;
6003}
6004
6005
6006
6007static void GamePicker_OnBodyContextMenu(POINT pt)
6008{
6009   HMENU hMenuLoad;
6010   HMENU hMenu;
6011
6012   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_MENU));
6013   hMenu = GetSubMenu(hMenuLoad, 0);
6014   InitBodyContextMenu(hMenu);
6015   
6016   UpdateMenu(hMenu);
6017
6018   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hMain,NULL);
6019
6020   DestroyMenu(hMenuLoad);
6021}
6022
6023
6024
6025static BOOL HandleScreenShotContextMenu(HWND hWnd, WPARAM wParam, LPARAM lParam)
6026{
6027   HMENU hMenuLoad;
6028   HMENU hMenu;
6029   POINT pt;
6030
6031   if ((HWND)wParam != GetDlgItem(hWnd, IDC_SSPICTURE) && (HWND)wParam != GetDlgItem(hWnd, IDC_SSFRAME))
6032      return FALSE;
6033
6034   pt.x = GET_X_LPARAM(lParam);
6035   pt.y = GET_Y_LPARAM(lParam);
6036   if (pt.x < 0 && pt.y < 0)
6037      GetCursorPos(&pt);
6038
6039   hMenuLoad = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT_SCREENSHOT));
6040   hMenu = GetSubMenu(hMenuLoad, 0);
6041
6042   UpdateMenu(hMenu);
6043
6044   TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0,hWnd,NULL);
6045
6046   DestroyMenu(hMenuLoad);
6047
6048   return TRUE;
6049}
6050
6051static void UpdateMenu(HMENU hMenu)
6052{
6053   TCHAR         buf[200];
6054   MENUITEMINFO   mItem;
6055   int          nGame = Picker_GetSelectedItem(hwndList);
6056   LPTREEFOLDER lpFolder = GetCurrentFolder();
6057   int i;
6058   const char *pParent;
6059   TCHAR* t_description;
6060
6061   if (have_selection)
6062   {
6063      t_description = tstring_from_utf8(ConvertAmpersandString(ModifyThe(drivers[nGame]->description)));
6064      if( !t_description )
6065         return;
6066     
6067      _sntprintf(buf, ARRAY_LENGTH(buf), g_szPlayGameString, t_description);
6068
6069      mItem.cbSize    = sizeof(mItem);
6070      mItem.fMask     = MIIM_TYPE;
6071      mItem.fType     = MFT_STRING;
6072      mItem.dwTypeData = buf;
6073      mItem.cch       = _tcslen(mItem.dwTypeData);
6074
6075      SetMenuItemInfo(hMenu, ID_FILE_PLAY, FALSE, &mItem);
6076
6077      EnableMenuItem(hMenu, ID_CONTEXT_SELECT_RANDOM, MF_ENABLED);
6078     
6079      free(t_description);
6080   }
6081   else
6082   {
6083      EnableMenuItem(hMenu, ID_FILE_PLAY,          MF_GRAYED);
6084      EnableMenuItem(hMenu, ID_FILE_PLAY_RECORD,      MF_GRAYED);
6085      EnableMenuItem(hMenu, ID_GAME_PROPERTIES,      MF_GRAYED);
6086      EnableMenuItem(hMenu, ID_CONTEXT_SELECT_RANDOM, MF_GRAYED);
6087   }
6088
6089   if (oldControl)
6090   {
6091      EnableMenuItem(hMenu, ID_CUSTOMIZE_FIELDS, MF_GRAYED);
6092      EnableMenuItem(hMenu, ID_GAME_PROPERTIES,  MF_GRAYED);
6093      EnableMenuItem(hMenu, ID_OPTIONS_DEFAULTS, MF_GRAYED);
6094   }
6095
6096   if (lpFolder->m_dwFlags & F_CUSTOM)
6097   {
6098       EnableMenuItem(hMenu,ID_CONTEXT_REMOVE_CUSTOM,MF_ENABLED);
6099      EnableMenuItem(hMenu,ID_CONTEXT_RENAME_CUSTOM,MF_ENABLED);
6100   }
6101   else
6102   {
6103       EnableMenuItem(hMenu,ID_CONTEXT_REMOVE_CUSTOM,MF_GRAYED);
6104      EnableMenuItem(hMenu,ID_CONTEXT_RENAME_CUSTOM,MF_GRAYED);
6105   }
6106   pParent = GetFolderNameByID(lpFolder->m_nParent+1);
6107
6108   if (lpFolder->m_dwFlags & F_INIEDIT)
6109      EnableMenuItem(hMenu,ID_FOLDER_PROPERTIES,MF_ENABLED);
6110   else
6111      EnableMenuItem(hMenu,ID_FOLDER_PROPERTIES,MF_GRAYED);
6112
6113   CheckMenuRadioItem(hMenu, ID_VIEW_TAB_SCREENSHOT, ID_VIEW_TAB_HISTORY,
6114                  ID_VIEW_TAB_SCREENSHOT + TabView_GetCurrentTab(hTabCtrl), MF_BYCOMMAND);
6115
6116   // set whether we're showing the tab control or not
6117   if (bShowTabCtrl)
6118      CheckMenuItem(hMenu,ID_VIEW_PAGETAB,MF_BYCOMMAND | MF_CHECKED);
6119   else
6120      CheckMenuItem(hMenu,ID_VIEW_PAGETAB,MF_BYCOMMAND | MF_UNCHECKED);
6121
6122
6123   for (i=0;i<MAX_TAB_TYPES;i++)
6124   {
6125      // disable menu items for tabs we're not currently showing
6126      if (GetShowTab(i))
6127         EnableMenuItem(hMenu,ID_VIEW_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_ENABLED);
6128      else
6129         EnableMenuItem(hMenu,ID_VIEW_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_GRAYED);
6130
6131      // check toggle menu items
6132      if (GetShowTab(i))
6133         CheckMenuItem(hMenu, ID_TOGGLE_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_CHECKED);
6134      else
6135         CheckMenuItem(hMenu, ID_TOGGLE_TAB_SCREENSHOT + i,MF_BYCOMMAND | MF_UNCHECKED);
6136   }
6137
6138   for (i=0;i<MAX_FOLDERS;i++)
6139   {
6140      if (GetShowFolder(i))
6141         CheckMenuItem(hMenu,ID_CONTEXT_SHOW_FOLDER_START + i,MF_BYCOMMAND | MF_CHECKED);
6142      else
6143         CheckMenuItem(hMenu,ID_CONTEXT_SHOW_FOLDER_START + i,MF_BYCOMMAND | MF_UNCHECKED);
6144   }
6145
6146}
6147
6148void InitTreeContextMenu(HMENU hTreeMenu)
6149{
6150   MENUITEMINFO mii;
6151   HMENU hMenu;
6152   int i;
6153   extern FOLDERDATA g_folderData[];
6154
6155   ZeroMemory(&mii,sizeof(mii));
6156   mii.cbSize = sizeof(mii);
6157
6158   mii.wID = -1;
6159   mii.fMask = MIIM_SUBMENU | MIIM_ID;
6160
6161   hMenu = GetSubMenu(hTreeMenu, 0);
6162
6163   if (GetMenuItemInfo(hMenu,3,TRUE,&mii) == FALSE)
6164   {
6165      dprintf("can't find show folders context menu");
6166      return;
6167   }
6168
6169   if (mii.hSubMenu == NULL)
6170   {
6171      dprintf("can't find submenu for show folders context menu");
6172      return;
6173   }
6174
6175   hMenu = mii.hSubMenu;
6176   
6177   for (i=0;g_folderData[i].m_lpTitle != NULL;i++)
6178   {
6179      TCHAR* t_title = tstring_from_utf8(g_folderData[i].m_lpTitle);
6180      if( !t_title )
6181         return;
6182     
6183      mii.fMask = MIIM_TYPE | MIIM_ID;
6184      mii.fType = MFT_STRING;
6185      mii.dwTypeData = t_title;
6186      mii.cch = _tcslen(mii.dwTypeData);
6187      mii.wID = ID_CONTEXT_SHOW_FOLDER_START + g_folderData[i].m_nFolderId;
6188
6189
6190      // menu in resources has one empty item (needed for the submenu to setup properly)
6191      // so overwrite this one, append after
6192      if (i == 0)
6193         SetMenuItemInfo(hMenu,ID_CONTEXT_SHOW_FOLDER_START,FALSE,&mii);
6194      else
6195         InsertMenuItem(hMenu,i,FALSE,&mii);
6196         
6197      free(t_title);
6198   }
6199
6200}
6201
6202void InitBodyContextMenu(HMENU hBodyContextMenu)
6203{
6204   LPTREEFOLDER lpFolder;
6205   TCHAR tmp[30];
6206   MENUITEMINFO mii;
6207   ZeroMemory(&mii,sizeof(mii));
6208   mii.cbSize = sizeof(mii);
6209
6210   if (GetMenuItemInfo(hBodyContextMenu,ID_FOLDER_SOURCEPROPERTIES,FALSE,&mii) == FALSE)
6211   {
6212      dprintf("can't find show folders context menu");
6213      return;
6214   }
6215   lpFolder = GetFolderByName(FOLDER_SOURCE, GetDriverFilename(Picker_GetSelectedItem(hwndList)) );
6216   _sntprintf(tmp,ARRAY_LENGTH(tmp),TEXT("Properties for %s"),lpFolder->m_lptTitle );
6217   mii.fMask = MIIM_TYPE | MIIM_ID;
6218   mii.fType = MFT_STRING;
6219   mii.dwTypeData = tmp;
6220   mii.cch = _tcslen(mii.dwTypeData);
6221   mii.wID = ID_FOLDER_SOURCEPROPERTIES;
6222
6223
6224   // menu in resources has one default item
6225   // so overwrite this one
6226   SetMenuItemInfo(hBodyContextMenu,ID_FOLDER_SOURCEPROPERTIES,FALSE,&mii);
6227   if( ! DriverIsVector(Picker_GetSelectedItem(hwndList) ) )
6228      EnableMenuItem(hBodyContextMenu, ID_FOLDER_VECTORPROPERTIES, MF_GRAYED);
6229}
6230
6231
6232void ToggleShowFolder(int folder)
6233{
6234   int current_id = GetCurrentFolderID();
6235
6236   SetWindowRedraw(hwndList,FALSE);
6237
6238   SetShowFolder(folder,!GetShowFolder(folder));
6239
6240   ResetTreeViewFolders();
6241   SelectTreeViewFolder(current_id);
6242
6243   SetWindowRedraw(hwndList,TRUE);
6244}
6245
6246static LRESULT CALLBACK HistoryWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6247{
6248   if (hBackground)
6249   {
6250      switch (uMsg)
6251      {
6252       case WM_MOUSEMOVE:
6253      {
6254         if (MouseHasBeenMoved())
6255            ShowCursor(TRUE);
6256         break;
6257      }
6258   
6259      case WM_ERASEBKGND:
6260         return TRUE;
6261      case WM_PAINT:
6262      {
6263         POINT p = { 0, 0 };
6264           
6265         /* get base point of background bitmap */
6266         MapWindowPoints(hWnd,hTreeView,&p,1);
6267         PaintBackgroundImage(hWnd, NULL, p.x, p.y);
6268         /* to ensure our parent procedure repaints the whole client area */
6269         InvalidateRect(hWnd, NULL, FALSE);
6270         break;
6271      }
6272      }
6273   }
6274   return CallWindowProc(g_lpHistoryWndProc, hWnd, uMsg, wParam, lParam);
6275}
6276
6277static LRESULT CALLBACK PictureFrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6278{
6279   switch (uMsg)
6280   {
6281   case WM_MOUSEMOVE:
6282    {
6283      if (MouseHasBeenMoved())
6284         ShowCursor(TRUE);
6285      break;
6286    }
6287 
6288    case WM_NCHITTEST :
6289   {
6290      POINT pt;
6291      RECT  rect;
6292      HWND hHistory = GetDlgItem(hMain, IDC_HISTORY);
6293
6294      pt.x = LOWORD(lParam);
6295      pt.y = HIWORD(lParam);
6296      GetWindowRect(hHistory, &rect);
6297      // check if they clicked on the picture area (leave 6 pixel no man's land
6298      // by the history window to reduce mistaken clicks)
6299      // no more no man's land, the Cursor changes when Edit control is left, should be enough feedback
6300      if (have_history &&       
6301         ( ( (TabView_GetCurrentTab(hTabCtrl) == TAB_HISTORY) ||
6302          (TabView_GetCurrentTab(hTabCtrl) == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ||
6303         (TAB_ALL == GetHistoryTab() && GetShowTab(TAB_HISTORY) == FALSE) ) &&
6304//           (rect.top - 6) < pt.y && pt.y < (rect.bottom + 6) ) )
6305                 PtInRect( &rect, pt ) ) )
6306
6307      {
6308         return HTTRANSPARENT;
6309      }
6310      else
6311      {
6312         return HTCLIENT;
6313      }
6314   }
6315   break;
6316   case WM_CONTEXTMENU:
6317      if ( HandleScreenShotContextMenu(hWnd, wParam, lParam))
6318         return FALSE;
6319      break;
6320   }
6321
6322   if (hBackground)
6323   {
6324      switch (uMsg)
6325      {
6326      case WM_ERASEBKGND :
6327         return TRUE;
6328      case WM_PAINT :
6329      {
6330         RECT rect,nodraw_rect;
6331         HRGN region,nodraw_region;
6332         POINT p = { 0, 0 };
6333
6334         /* get base point of background bitmap */
6335         MapWindowPoints(hWnd,hTreeView,&p,1);
6336
6337         /* get big region */
6338         GetClientRect(hWnd,&rect);
6339         region = CreateRectRgnIndirect(&rect);
6340
6341         if (IsWindowVisible(GetDlgItem(hMain,IDC_HISTORY)))
6342         {
6343            /* don't draw over this window */
6344            GetWindowRect(GetDlgItem(hMain,IDC_HISTORY),&nodraw_rect);
6345            MapWindowPoints(HWND_DESKTOP,hWnd,(LPPOINT)&nodraw_rect,2);
6346            nodraw_region = CreateRectRgnIndirect(&nodraw_rect);
6347            CombineRgn(region,region,nodraw_region,RGN_DIFF);
6348            DeleteObject(nodraw_region);
6349         }
6350         if (IsWindowVisible(GetDlgItem(hMain,IDC_SSPICTURE)))
6351         {
6352            /* don't draw over this window */
6353            GetWindowRect(GetDlgItem(hMain,IDC_SSPICTURE),&nodraw_rect);
6354            MapWindowPoints(HWND_DESKTOP,hWnd,(LPPOINT)&nodraw_rect,2);
6355            nodraw_region = CreateRectRgnIndirect(&nodraw_rect);
6356            CombineRgn(region,region,nodraw_region,RGN_DIFF);
6357            DeleteObject(nodraw_region);
6358         }
6359
6360         PaintBackgroundImage(hWnd,region,p.x,p.y);
6361
6362         DeleteObject(region);
6363
6364         /* to ensure our parent procedure repaints the whole client area */
6365         InvalidateRect(hWnd, NULL, FALSE);
6366
6367         break;
6368      }
6369      }
6370   }
6371   return CallWindowProc(g_lpPictureFrameWndProc, hWnd, uMsg, wParam, lParam);
6372}
6373
6374static LRESULT CALLBACK PictureWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6375{
6376   switch (uMsg)
6377   {
6378   case WM_ERASEBKGND :
6379      return TRUE;
6380   case WM_PAINT :
6381   {
6382      PAINTSTRUCT ps;
6383      HDC   hdc,hdc_temp;
6384      RECT rect;
6385      HBITMAP old_bitmap;
6386
6387      int width,height;
6388
6389      RECT rect2;
6390      HBRUSH hBrush;
6391      HBRUSH holdBrush;
6392      HRGN region1, region2;
6393      int nBordersize;
6394      nBordersize = GetScreenshotBorderSize();
6395      hBrush = CreateSolidBrush(GetScreenshotBorderColor());
6396
6397      hdc = BeginPaint(hWnd,&ps);
6398
6399      hdc_temp = CreateCompatibleDC(hdc);
6400      if (ScreenShotLoaded())
6401      {
6402         width = GetScreenShotWidth();
6403         height = GetScreenShotHeight();
6404
6405         old_bitmap = SelectObject(hdc_temp,GetScreenShotHandle());
6406      }
6407      else
6408      {
6409         BITMAP bmp;
6410
6411         GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
6412         width = bmp.bmWidth;
6413         height = bmp.bmHeight;
6414
6415         old_bitmap = SelectObject(hdc_temp,hMissing_bitmap);
6416      }
6417
6418      GetClientRect(hWnd,&rect);
6419
6420      rect2 = rect;
6421      //Configurable Borders around images
6422      rect.bottom -= nBordersize;
6423      if( rect.bottom < 0)
6424         rect.bottom = rect2.bottom;
6425      rect.right -= nBordersize;
6426      if( rect.right < 0)
6427         rect.right = rect2.right;
6428      rect.top += nBordersize;
6429      if( rect.top > rect.bottom )
6430         rect.top = rect2.top;
6431      rect.left += nBordersize;
6432      if( rect.left > rect.right )
6433         rect.left = rect2.left;
6434      region1 = CreateRectRgnIndirect(&rect);
6435      region2 = CreateRectRgnIndirect(&rect2);
6436      CombineRgn(region2,region2,region1,RGN_DIFF);
6437      holdBrush = SelectObject(hdc, hBrush);
6438
6439      FillRgn(hdc,region2, hBrush );
6440      SelectObject(hdc, holdBrush);
6441      DeleteObject(hBrush);
6442
6443      SetStretchBltMode(hdc,STRETCH_HALFTONE);
6444      StretchBlt(hdc,nBordersize,nBordersize,rect.right-rect.left,rect.bottom-rect.top,
6445               hdc_temp,0,0,width,height,SRCCOPY);
6446      SelectObject(hdc_temp,old_bitmap);
6447      DeleteDC(hdc_temp);
6448
6449      EndPaint(hWnd,&ps);
6450
6451      return TRUE;
6452   }
6453   }
6454
6455   return CallWindowProc(g_lpPictureWndProc, hWnd, uMsg, wParam, lParam);
6456}
6457
6458void RemoveCurrentGameCustomFolder(void)
6459{
6460    RemoveGameCustomFolder(Picker_GetSelectedItem(hwndList));
6461}
6462
6463void RemoveGameCustomFolder(int driver_index)
6464{
6465    int i;
6466   TREEFOLDER **folders;
6467   int num_folders;
6468
6469   GetFolders(&folders,&num_folders);
6470   
6471   for (i=0;i<num_folders;i++)
6472   {
6473       if (folders[i]->m_dwFlags & F_CUSTOM && folders[i]->m_nFolderId == GetCurrentFolderID())
6474      {
6475          int current_pick_index;
6476
6477          RemoveFromCustomFolder(folders[i],driver_index);
6478
6479         if (driver_index == Picker_GetSelectedItem(hwndList))
6480         {
6481            /* if we just removed the current game,
6482              move the current selection so that when we rebuild the listview it
6483              leaves the cursor on next or previous one */
6484         
6485            current_pick_index = GetSelectedPick();
6486            Picker_SetSelectedPick(hwndList, GetSelectedPick() + 1);
6487            if (current_pick_index == GetSelectedPick()) /* we must have deleted the last item */
6488              Picker_SetSelectedPick(hwndList, GetSelectedPick() - 1);
6489         }
6490
6491         ResetListView();
6492         return;
6493      }
6494   }
6495   MessageBox(GetMainWindow(), TEXT("Error searching for custom folder"), TEXT(MAMEUINAME), MB_OK | MB_ICONERROR);
6496
6497}
6498
6499
6500void BeginListViewDrag(NM_LISTVIEW *pnmv)
6501{
6502    LV_ITEM lvi;
6503   POINT pt;
6504
6505   lvi.iItem = pnmv->iItem;
6506   lvi.mask    = LVIF_PARAM;
6507   ListView_GetItem(hwndList, &lvi);
6508
6509   game_dragged = lvi.lParam;
6510
6511   pt.x = 0;
6512   pt.y = 0;
6513
6514   /* Tell the list view control to create an image to use
6515      for dragging. */
6516    himl_drag = ListView_CreateDragImage(hwndList,pnmv->iItem,&pt);
6517 
6518    /* Start the drag operation. */
6519    ImageList_BeginDrag(himl_drag, 0, 0, 0);
6520
6521   pt = pnmv->ptAction;
6522   ClientToScreen(hwndList,&pt);
6523   ImageList_DragEnter(GetDesktopWindow(),pt.x,pt.y);
6524
6525    /* Hide the mouse cursor, and direct mouse input to the
6526      parent window. */
6527    SetCapture(hMain);
6528
6529   prev_drag_drop_target = NULL;
6530
6531    g_listview_dragging = TRUE;
6532
6533}
6534
6535void MouseMoveListViewDrag(POINTS p)
6536{
6537   HTREEITEM htiTarget;
6538   TV_HITTESTINFO tvht;
6539
6540   POINT pt;
6541   pt.x = p.x;
6542   pt.y = p.y;
6543
6544   ClientToScreen(hMain,&pt);
6545
6546   ImageList_DragMove(pt.x,pt.y);
6547
6548   MapWindowPoints(GetDesktopWindow(),hTreeView,&pt,1);
6549
6550   tvht.pt = pt;
6551   htiTarget = TreeView_HitTest(hTreeView,&tvht);
6552
6553   if (htiTarget != prev_drag_drop_target)
6554   {
6555      ImageList_DragShowNolock(FALSE);
6556      if (htiTarget != NULL)
6557         TreeView_SelectDropTarget(hTreeView,htiTarget);
6558      else
6559         TreeView_SelectDropTarget(hTreeView,NULL);
6560      ImageList_DragShowNolock(TRUE);
6561     
6562      prev_drag_drop_target = htiTarget;
6563   }
6564}
6565
6566void ButtonUpListViewDrag(POINTS p)
6567{
6568    POINT pt;
6569    HTREEITEM htiTarget;
6570   TV_HITTESTINFO tvht;
6571   TVITEM tvi;
6572   
6573   ReleaseCapture();
6574
6575    ImageList_DragLeave(hwndList);
6576    ImageList_EndDrag();
6577   ImageList_Destroy(himl_drag);
6578
6579   TreeView_SelectDropTarget(hTreeView,NULL);
6580
6581   g_listview_dragging = FALSE;
6582
6583   /* see where the game was dragged */
6584
6585   pt.x = p.x;
6586   pt.y = p.y;
6587
6588   MapWindowPoints(hMain,hTreeView,&pt,1);
6589
6590   tvht.pt = pt;
6591   htiTarget = TreeView_HitTest(hTreeView,&tvht);
6592   if (htiTarget == NULL)
6593   {
6594      LVHITTESTINFO lvhtti;
6595      LPTREEFOLDER folder;
6596      RECT rcList;
6597
6598      /* the user dragged a game onto something other than the treeview */
6599      /* try to remove if we're in a custom folder */
6600
6601      /* see if it was dragged within the list view; if so, ignore */
6602
6603      MapWindowPoints(hTreeView,hwndList,&pt,1);
6604      lvhtti.pt = pt;
6605      GetWindowRect(hwndList, &rcList);
6606      ClientToScreen(hwndList, &pt);
6607      if( PtInRect(&rcList, pt) != 0 )
6608         return;
6609
6610      folder = GetCurrentFolder();
6611      if (folder->m_dwFlags & F_CUSTOM)
6612      {
6613         /* dragged out of a custom folder, so let's remove it */
6614         RemoveCurrentGameCustomFolder();
6615      }
6616      return;
6617   }
6618
6619
6620   tvi.lParam = 0;
6621   tvi.mask  = TVIF_PARAM | TVIF_HANDLE;
6622   tvi.hItem = htiTarget;
6623
6624   if (TreeView_GetItem(hTreeView, &tvi))
6625   {
6626      LPTREEFOLDER folder = (LPTREEFOLDER)tvi.lParam;
6627      AddToCustomFolder(folder,game_dragged);
6628   }
6629
6630}
6631
6632static LPTREEFOLDER GetSelectedFolder(void)
6633{
6634   HTREEITEM htree;
6635   TVITEM tvi;
6636   htree = TreeView_GetSelection(hTreeView);
6637   if(htree != NULL)
6638   {
6639      tvi.hItem = htree;
6640      tvi.mask = TVIF_PARAM;
6641      TreeView_GetItem(hTreeView,&tvi);
6642      return (LPTREEFOLDER)tvi.lParam;
6643   }
6644   return NULL;
6645}
6646
6647static HICON GetSelectedFolderIcon(void)
6648{
6649   HTREEITEM htree;
6650   TVITEM tvi;
6651   HIMAGELIST hSmall_icon;
6652   LPTREEFOLDER folder;
6653   htree = TreeView_GetSelection(hTreeView);
6654
6655   if (htree != NULL)
6656   {
6657      tvi.hItem = htree;
6658      tvi.mask = TVIF_PARAM;
6659      TreeView_GetItem(hTreeView,&tvi);
6660     
6661      folder = (LPTREEFOLDER)tvi.lParam;
6662      //hSmall_icon = TreeView_GetImageList(hTreeView,(int)tvi.iImage);
6663      hSmall_icon = NULL;
6664      return ImageList_GetIcon(hSmall_icon, tvi.iImage, ILD_TRANSPARENT);
6665   }
6666   return NULL;
6667}
6668
6669/* Updates all currently displayed Items in the List with the latest Data*/
6670void UpdateListView(void)
6671{
6672   if( (GetViewMode() == VIEW_GROUPED) || (GetViewMode() == VIEW_DETAILS ) )
6673      ListView_RedrawItems(hwndList,ListView_GetTopIndex(hwndList),
6674                      ListView_GetTopIndex(hwndList)+ ListView_GetCountPerPage(hwndList) );
6675}
6676
6677void CalculateBestScreenShotRect(HWND hWnd, RECT *pRect, BOOL restrict_height)
6678{
6679   int    destX, destY;
6680   int    destW, destH;
6681   int      nBorder;
6682   RECT   rect;
6683   /* for scaling */       
6684   int x, y;
6685   int rWidth, rHeight;
6686   double scale;
6687   BOOL bReduce = FALSE;
6688
6689   GetClientRect(hWnd, &rect);
6690
6691   // Scale the bitmap to the frame specified by the passed in hwnd
6692   if (ScreenShotLoaded())
6693   {
6694      x = GetScreenShotWidth();
6695      y = GetScreenShotHeight();
6696   }
6697   else
6698   {
6699      BITMAP bmp;
6700      GetObject(hMissing_bitmap,sizeof(BITMAP),&bmp);
6701
6702      x = bmp.bmWidth;
6703      y = bmp.bmHeight;
6704   }
6705   rWidth   = (rect.right  - rect.left);
6706   rHeight = (rect.bottom - rect.top);
6707
6708   /* Limit the screen shot to max height of 264 */
6709   if (restrict_height == TRUE && rHeight > 264)
6710   {
6711      rect.bottom = rect.top + 264;
6712      rHeight = 264;
6713   }
6714
6715   /* If the bitmap does NOT fit in the screenshot area */
6716   if (x > rWidth - 10 || y > rHeight - 10)
6717   {
6718      rect.right   -= 10;
6719      rect.bottom -= 10;
6720      rWidth   -= 10;
6721      rHeight -= 10;
6722      bReduce = TRUE;
6723      /* Try to scale it properly */
6724      /*   assumes square pixels, doesn't consider aspect ratio */
6725      if (x > y)
6726         scale = (double)rWidth / x;
6727      else
6728         scale = (double)rHeight / y;
6729
6730      destW = (int)(x * scale);
6731      destH = (int)(y * scale);
6732
6733      /* If it's still too big, scale again */
6734      if (destW > rWidth || destH > rHeight)
6735      {
6736         if (destW > rWidth)
6737            scale = (double)rWidth   / destW;
6738         else
6739            scale = (double)rHeight / destH;
6740
6741         destW = (int)(destW * scale);
6742         destH = (int)(destH * scale);
6743      }
6744   }
6745   else
6746   {
6747      if (GetStretchScreenShotLarger())
6748      {
6749         rect.right   -= 10;
6750         rect.bottom -= 10;
6751         rWidth   -= 10;
6752         rHeight -= 10;
6753         bReduce = TRUE;
6754         // Try to scale it properly
6755         // assumes square pixels, doesn't consider aspect ratio
6756         if (x < y)
6757            scale = (double)rWidth / x;
6758         else
6759            scale = (double)rHeight / y;
6760         
6761         destW = (int)(x * scale);
6762         destH = (int)(y * scale);
6763         
6764         // If it's too big, scale again
6765         if (destW > rWidth || destH > rHeight)
6766         {
6767            if (destW > rWidth)
6768               scale = (double)rWidth   / destW;
6769            else
6770               scale = (double)rHeight / destH;
6771           
6772            destW = (int)(destW * scale);
6773            destH = (int)(destH * scale);
6774         }
6775      }
6776      else
6777      {
6778         // Use the bitmaps size if it fits
6779         destW = x;
6780         destH = y;
6781      }
6782
6783   }
6784
6785
6786   destX = ((rWidth  - destW) / 2);
6787   destY = ((rHeight - destH) / 2);
6788
6789   if (bReduce)
6790   {
6791      destX += 5;
6792      destY += 5;
6793   }
6794   nBorder = GetScreenshotBorderSize();
6795   if( destX > nBorder+1)
6796      pRect->left   = destX - nBorder;
6797   else
6798      pRect->left   = 2;
6799   if( destY > nBorder+1)
6800      pRect->top     = destY - nBorder;
6801   else
6802      pRect->top     = 2;
6803   if( rWidth >= destX + destW + nBorder)
6804      pRect->right  = destX + destW + nBorder;
6805   else
6806      pRect->right  = rWidth - pRect->left;
6807   if( rHeight >= destY + destH + nBorder)
6808      pRect->bottom = destY + destH + nBorder;
6809   else
6810      pRect->bottom = rHeight - pRect->top;
6811}
6812
6813/*
6814  Switches to either fullscreen or normal mode, based on the
6815  current mode.
6816
6817  POSSIBLE BUGS:
6818  Removing the menu might cause problems later if some
6819  function tries to poll info stored in the menu. Don't
6820  know if you've done that, but this was the only way I
6821  knew to remove the menu dynamically.
6822*/
6823
6824void SwitchFullScreenMode(void)
6825{
6826   LONG lMainStyle;
6827   
6828   if (GetRunFullScreen())
6829   {
6830      // Return to normal
6831
6832      // Restore the menu
6833      SetMenu(hMain, LoadMenu(hInst,MAKEINTRESOURCE(IDR_UI_MENU)));
6834     
6835      // Refresh the checkmarks
6836      CheckMenuItem(GetMenu(hMain), ID_VIEW_FOLDERS, GetShowFolderList() ? MF_CHECKED : MF_UNCHECKED);
6837      CheckMenuItem(GetMenu(hMain), ID_VIEW_TOOLBARS, GetShowToolBar() ? MF_CHECKED : MF_UNCHECKED);   
6838      CheckMenuItem(GetMenu(hMain), ID_VIEW_STATUS, GetShowStatusBar() ? MF_CHECKED : MF_UNCHECKED);
6839      CheckMenuItem(GetMenu(hMain), ID_VIEW_PAGETAB, GetShowTabCtrl() ? MF_CHECKED : MF_UNCHECKED);
6840     
6841      // Add frame to dialog again
6842      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
6843      lMainStyle = lMainStyle | WS_BORDER;
6844      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
6845     
6846      // Show the window maximized
6847      if( GetWindowState() == SW_MAXIMIZE )
6848      {
6849         ShowWindow(hMain, SW_NORMAL);
6850         ShowWindow(hMain, SW_MAXIMIZE);
6851      }
6852      else
6853         ShowWindow(hMain, SW_RESTORE);
6854
6855      SetRunFullScreen(FALSE);
6856   }
6857   else
6858   {
6859      // Set to fullscreen
6860     
6861      // Remove menu
6862      SetMenu(hMain,NULL);
6863
6864      // Frameless dialog (fake fullscreen)
6865      lMainStyle = GetWindowLong(hMain, GWL_STYLE);
6866      lMainStyle = lMainStyle & (WS_BORDER ^ 0xffffffff);
6867      SetWindowLong(hMain, GWL_STYLE, lMainStyle);
6868      if( IsMaximized(hMain) )
6869      {
6870         ShowWindow(hMain, SW_NORMAL);
6871         SetWindowState( SW_MAXIMIZE );
6872      }
6873      ShowWindow(hMain, SW_MAXIMIZE);
6874     
6875      SetRunFullScreen(TRUE);
6876   }
6877}
6878
6879/*
6880  Checks to see if the mouse has been moved since this func
6881  was first called (which is at startup). The reason for
6882  storing the startup coordinates of the mouse is that when
6883  a window is created it generates WM_MOUSEOVER events, even
6884  though the user didn't actually move the mouse. So we need
6885  to know when the WM_MOUSEOVER event is user-triggered.
6886
6887  POSSIBLE BUGS:
6888  Gets polled at every WM_MOUSEMOVE so it might cause lag,
6889  but there's probably another way to code this that's
6890  way better?
6891 
6892*/
6893
6894BOOL MouseHasBeenMoved(void)
6895{
6896    static int mouse_x = -1;
6897    static int mouse_y = -1;
6898   POINT p;
6899
6900   GetCursorPos(&p);
6901
6902    if (mouse_x == -1) // First time
6903    {
6904      mouse_x = p.x;
6905      mouse_y = p.y;
6906    }
6907   
6908   return (p.x != mouse_x || p.y != mouse_y);       
6909}
6910
6911/* End of source file */
src/osd/winui/mui_util.h
r0r1368
1/***************************************************************************
2
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
6
7  This file is part of MAMEUI, and may only be used, modified and
8  distributed under the terms of the MAME license, in "readme.txt".
9  By continuing to use, modify or distribute this file you indicate
10  that you have read the license and understand and accept it fully.
11
12 ***************************************************************************/
13
14#ifndef MUI_UTIL_H
15#define MUI_UTIL_H
16
17extern void __cdecl ErrorMsg(const char* fmt, ...);
18extern void __cdecl dprintf(const char* fmt, ...);
19
20extern UINT GetDepth(HWND hWnd);
21
22/* Open a text file */
23extern void DisplayTextFile(HWND hWnd, const char *cName);
24
25#define PACKVERSION(major,minor) MAKELONG(minor,major)
26
27/* Check for old version of comctl32.dll */
28extern LONG GetCommonControlVersion(void);
29
30extern char * MyStrStrI(const char* pFirst, const char* pSrch);
31extern char * ConvertToWindowsNewlines(const char *source);
32
33extern const char * GetDriverFilename(int nIndex);
34
35BOOL DriverIsClone(int driver_index);
36BOOL DriverIsBroken(int driver_index);
37BOOL DriverIsHarddisk(int driver_index);
38BOOL DriverHasOptionalBIOS(int driver_index);
39BOOL DriverIsStereo(int driver_index);
40BOOL DriverIsMultiMon(int driver_index);
41BOOL DriverIsVector(int driver_index);
42BOOL DriverIsBios(int driver_index);
43BOOL DriverUsesRoms(int driver_index);
44BOOL DriverUsesSamples(int driver_index);
45BOOL DriverUsesTrackball(int driver_index);
46BOOL DriverUsesLightGun(int driver_index);
47BOOL DriverSupportsSaveState(int driver_index);
48BOOL DriverIsVertical(int driver_index);
49
50void FlushFileCaches(void);
51
52void FreeIfAllocated(char **s);
53
54BOOL StringIsSuffixedBy(const char *s, const char *suffix);
55
56BOOL SafeIsAppThemed(void);
57
58HICON win_extract_icon_utf8(HINSTANCE inst, const char* exefilename, UINT iconindex);
59TCHAR* win_tstring_strdup(LPCTSTR str);
60HANDLE win_create_file_utf8(const char* filename, DWORD desiredmode, DWORD sharemode,
61                        LPSECURITY_ATTRIBUTES securityattributes, DWORD creationdisposition,
62                        DWORD flagsandattributes, HANDLE templatehandle);
63DWORD win_get_current_directory_utf8(DWORD bufferlength, char* buffer);
64HANDLE win_find_first_file_utf8(const char* filename, LPWIN32_FIND_DATA findfiledata);
65
66#endif /* MUI_UTIL_H */
67
src/osd/winui/properties.c
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
1011
11***************************************************************************/
12 ***************************************************************************/
1213 
1314/***************************************************************************
1415
r1367r1368
105106
106107***************************************************************************/
107108
109// standard windows headers
108110#define WIN32_LEAN_AND_MEAN
109111#include <windows.h>
110112#include <windowsx.h>
111113#include <commctrl.h>
112114#include <commdlg.h>
113115#include <ddraw.h>
116
117// standard C headers
114118#include <stdio.h>
115119#include <string.h>
116120#include <sys/stat.h>
117121#include <tchar.h>
118122
119#include <driver.h>
120#include <info.h>
123// MAME/MAMEUI headers
124#include "driver.h"
125#include "info.h"
121126#include "audit.h"
122#include "audit32.h"
123#include "bitmask.h"
124#include "m32opts.h"
125#include "file.h"
127#include "mui_audit.h"
128#include "mui_opts.h"
126129#include "resource.h"
127130#include "dijoystick.h"     /* For DIJoystick avalibility. */
128#include "m32util.h"
131#include "mui_util.h"
129132#include "directdraw.h"
130133#include "properties.h"
131#include "treeview.h"
132#include "win32ui.h"
133#include "screenshot.h"
134#include "mame32.h"
134#include "winui.h"
135135#include "datamap.h"
136136#include "help.h"
137#include "resource.hm"
138137#include "winmain.h"
139138#include "strconv.h"
140139#include "winutf8.h"
141#include "m32util.h"
142140
143141typedef HANDLE HTHEME;
144142
r1367r1368
434432   pshead.hInstance    = hInst;
435433   pshead.pszCaption   = TEXT("Default Game");
436434   pshead.nStartPage   = 0;
437   pshead.pszIcon      = MAKEINTRESOURCE(IDI_MAME32_ICON);
435   pshead.pszIcon      = MAKEINTRESOURCE(IDI_MAMEUI_ICON);
438436   pshead.ppsp         = pspage;
439437
440438   /* Create the Property sheet and display it */
r1367r1368
544542   pshead.dwFlags    = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_PROPTITLE;
545543   pshead.hInstance  = hInst;
546544   pshead.nStartPage = start_page;
547   pshead.pszIcon    = MAKEINTRESOURCE(IDI_MAME32_ICON);
545   pshead.pszIcon    = MAKEINTRESOURCE(IDI_MAMEUI_ICON);
548546   pshead.ppsp       = pspage;
549547
550548   /* Create the Property sheet and display it */
r1367r1368
13351333
13361334   case WM_HELP:
13371335      /* User clicked the ? from the upper right on a control */
1338      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
1336      HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
13391337      break;
13401338
13411339   case WM_CONTEXTMENU:
1342      HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
1340      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
13431341      break;
13441342
13451343   }
r1367r1368
22402238   datamap_set_trackbar_range(properties_datamap, IDC_JDZ,         0.00,  1.00, 0.05);
22412239   datamap_set_trackbar_range(properties_datamap, IDC_JSAT,        0.00,  1.00, 0.05);
22422240   datamap_set_trackbar_range(properties_datamap, IDC_SPEED,       0.00,  3.00, 0.01);
2241   datamap_set_trackbar_range(properties_datamap, IDC_BEAM,        0.10, 10.00, 0.10);       
22432242
22442243#ifdef MESS
22452244   // MESS specific stuff
src/osd/winui/help.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
r1367r1368
3334
3435extern const MAMEHELPINFO g_helpInfo[];
3536
36#if !defined(MAME32HELP)
37#define MAME32HELP "mame32.chm"
37#if !defined(MAMEUIHELP)
38#define MAMEUIHELP "mameui.chm"
3839#endif
3940
40#if !defined(MAME32CONTEXTHELP)
41#define MAME32CONTEXTHELP "mame32.chm::/cntx_help.txt"
41#if !defined(MAMEUICONTEXTHELP)
42#define MAMEUICONTEXTHELP "mameui.chm::/cntx_help.txt"
4243#endif
4344
4445extern int HelpInit(void);
src/osd/winui/directdraw.h
r1367r1368
11/***************************************************************************
22
3  M.A.M.E.32  -  Multiple Arcade Machine Emulator for Win32
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse
3  M.A.M.E.UI  -  Multiple Arcade Machine Emulator with User Interface
4  Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse,
5  Copyright (C) 2003-2007 Chris Kirmse and the MAME32/MAMEUI team.
56
6  This file is part of MAME32, and may only be used, modified and
7  This file is part of MAMEUI, and may only be used, modified and
78  distributed under the terms of the MAME license, in "readme.txt".
89  By continuing to use, modify or distribute this file you indicate
910  that you have read the license and understand and accept it fully.
src/mess/osd/windows/messlib.c
r1367r1368
3434   LPTSTR       lpCmdLine,
3535   int          nCmdShow)
3636{
37   extern int Mame32Main(HINSTANCE, LPTSTR, int);
38   return Mame32Main(hInstance, lpCmdLine, nCmdShow);
37   extern int MameUIMain(HINSTANCE, LPTSTR, int);
38   return MameUIMain(hInstance, lpCmdLine, nCmdShow);
3939}
src/mess/osd/windows/windows.mak
r1367r1368
88
99
1010# build the executable names
11FULLGUINAME = $(PREFIX)$(NAME)gui$(SUFFIX)$(DEBUGSUFFIX)
11FULLGUINAME = $(PREFIX)$(NAME)ui$(SUFFIX)$(DEBUGSUFFIX)
1212EMULATORCLI = $(FULLNAME)$(EXE)
1313EMULATORGUI = $(FULLGUINAME)$(EXE)
1414EMULATORDLL = $(FULLNAME)lib.dll
src/mess/osd/winui/mess32.rc
r1367r1368
1#include "resource.h"
2#include "resourcems.h"
3#include "windows.h"
4#include "commctrl.h"
5
6/////////////////////////////////////////////////////////////////////////////
7//
8// Dialog
9//
10
11IDD_PROP_SOFTWARE DIALOGEX 0, 0, 220, 220
12STYLE WS_CHILD | WS_CAPTION
13CAPTION "Software"
14FONT 8, "MS Sans Serif"
15BEGIN
16    ICON            IDI_WIN_FLOP,IDC_STATIC,20,10,20,20
17    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
18                    SS_NOPREFIX
19    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
20    LTEXT           "Additional directories:",IDC_STATIC,7,40,157,8
21    CONTROL         "List1",IDC_DIR_LIST,"SysListView32",LVS_REPORT |
22                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS |
23                    LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER |
24                    WS_TABSTOP,7,50,206,120
25    PUSHBUTTON      "Browse...",IDC_DIR_BROWSE,7,180,50,14
26    PUSHBUTTON      "Insert",IDC_DIR_INSERT,85,180,50,14
27    PUSHBUTTON      "Delete",IDC_DIR_DELETE,163,180,50,14
28END
29
30
31IDD_PROP_CONFIGURATION DIALOGEX 0, 0, 220, 220
32STYLE WS_CHILD | WS_CAPTION
33CAPTION "Configuration"
34FONT 8, "MS Sans Serif"
35BEGIN
36    ICON            IDI_MAME32_ICON,IDC_STATIC,20,10,20,20
37    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
38                    SS_NOPREFIX
39    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
40    LTEXT           "RAM size",IDC_RAM_CAPTION,20,50,50,10
41    COMBOBOX        IDC_RAM_COMBOBOX,70,50,100,76,CBS_DROPDOWNLIST | WS_VSCROLL |
42                    WS_TABSTOP
43END
44
45/////////////////////////////////////////////////////////////////////////////
46
47#include "mame32.rc"
src/mess/osd/winui/mess32ui.c
r1367r1368
1//============================================================
2//
3//   mess32ui.c - MESS extensions to src/ui/win32ui.c
4//
5//============================================================
6
7#define WIN32_LEAN_AND_MEAN
8#include <assert.h>
9#include <string.h>
10#include <windows.h>
11#include <shellapi.h>
12#include <commctrl.h>
13#include <commdlg.h>
14#include <wingdi.h>
15#include <winuser.h>
16#include <tchar.h>
17
18#include "screenshot.h"
19#include "bitmask.h"
20#include "mame32.h"
21#include "resourcems.h"
22#include "m32opts.h"
23#include "picker.h"
24#include "tabview.h"
25#include "m32util.h"
26#include "columnedit.h"
27#include "mess.h"
28#include "configms.h"
29#include "softwarepicker.h"
30#include "devview.h"
31#include "windows/window.h"
32#include "utils.h"
33#include "uitext.h"
34#include "strconv.h"
35#include "mess32ui.h"
36#include "winutf8.h"
37
38#define LOG_SOFTWARE   0
39
40#ifdef UNUSED_FUNCTION
41static int requested_device_type(char *tchar);
42#endif
43
44static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn);
45
46static LPCSTR SoftwareTabView_GetTabShortName(int tab);
47static LPCSTR SoftwareTabView_GetTabLongName(int tab);
48static void SoftwareTabView_OnSelectionChanged(void);
49static void SoftwareTabView_OnMoveSize(void);
50static void SetupSoftwareTabView(void);
51
52static LPCTSTR mess_column_names[] =
53{
54    TEXT("Software"),
55   TEXT("Goodname"),
56    TEXT("Manufacturer"),
57    TEXT("Year"),
58    TEXT("Playable"),
59   TEXT("CRC"),
60   TEXT("SHA-1"),
61   TEXT("MD5")
62};
63
64static int *mess_icon_index;
65
66static void MessOpenOtherSoftware(int iDevice);
67static void MessCreateDevice(int iDevice);
68static void MessRefreshPicker(int nGame);
69
70static int SoftwarePicker_GetItemImage(HWND hwndPicker, int nItem);
71static void SoftwarePicker_LeavingItem(HWND hwndSoftwarePicker, int nItem);
72static void SoftwarePicker_EnteringItem(HWND hwndSoftwarePicker, int nItem);
73
74static BOOL DevView_GetOpenFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength);
75static BOOL DevView_GetCreateFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength);
76static void DevView_SetSelectedSoftware(HWND hwndDevView, int nDriverIndex, const struct IODevice *dev, int nID, LPCTSTR pszFilename);
77static LPCTSTR DevView_GetSelectedSoftware(HWND hwndDevView, int nDriverIndex, const struct IODevice *dev, int nID, LPTSTR pszBuffer, UINT nBufferLength);
78
79#ifdef MAME_DEBUG
80static void MessTestsBegin(void);
81#endif /* MAME_DEBUG */
82
83char g_szSelectedItem[MAX_PATH];
84
85static int s_nGame;
86static BOOL s_bIgnoreSoftwarePickerNotifies;
87
88struct deviceentry
89{
90   int dev_type;
91   const char *icon_name;
92   const char *dlgname;
93};
94
95static const struct PickerCallbacks s_softwareListCallbacks =
96{
97   SetMessSortColumn,               // pfnSetSortColumn
98   GetMessSortColumn,               // pfnGetSortColumn
99   SetMessSortReverse,               // pfnSetSortReverse
100   GetMessSortReverse,               // pfnGetSortReverse
101   NULL,                        // pfnSetViewMode
102   GetViewMode,                  // pfnGetViewMode
103   SetMessColumnWidths,            // pfnSetColumnWidths
104   GetMessColumnWidths,            // pfnGetColumnWidths
105   SetMessColumnOrder,               // pfnSetColumnOrder
106   GetMessColumnOrder,               // pfnGetColumnOrder
107   SetMessColumnShown,               // pfnSetColumnShown
108   GetMessColumnShown,               // pfnGetColumnShown
109   NULL,                        // pfnGetOffsetChildren
110
111   NULL,                        // pfnCompare
112   MamePlayGame,                  // pfnDoubleClick
113   SoftwarePicker_GetItemString,      // pfnGetItemString
114   SoftwarePicker_GetItemImage,      // pfnGetItemImage
115   SoftwarePicker_LeavingItem,         // pfnLeavingItem
116   SoftwarePicker_EnteringItem,      // pfnEnteringItem
117   NULL,                        // pfnBeginListViewDrag
118   NULL,                        // pfnFindItemParent
119   SoftwarePicker_Idle,            // pfnIdle
120   SoftwarePicker_OnHeaderContextMenu,   // pfnOnHeaderContextMenu
121   NULL                        // pfnOnBodyContextMenu
122};
123
124
125
126static const struct TabViewCallbacks s_softwareTabViewCallbacks =
127{
128   NULL,                        // pfnGetShowTabCtrl
129   SetCurrentSoftwareTab,            // pfnSetCurrentTab
130   GetCurrentSoftwareTab,            // pfnGetCurrentTab
131   NULL,                        // pfnSetShowTab
132   NULL,                        // pfnGetShowTab
133
134   SoftwareTabView_GetTabShortName,   // pfnGetTabShortName
135   SoftwareTabView_GetTabLongName,      // pfnGetTabLongName
136
137   SoftwareTabView_OnSelectionChanged,   // pfnOnSelectionChanged
138   SoftwareTabView_OnMoveSize         // pfnOnMoveSize
139};
140
141
142
143// ------------------------------------------------------------------------
144// Image types
145//
146// IO_ZIP is used for ZIP files
147// IO_ALIAS is used for unknown types
148// IO_COUNT is used for bad files
149// ------------------------------------------------------------------------
150
151#define IO_ZIP      (IO_COUNT + 0)
152#define IO_BAD      (IO_COUNT + 1)
153#define IO_UNKNOWN   (IO_COUNT + 2)
154
155// TODO - We need to make icons for Cylinders, Punch Cards, and Punch Tape!
156static const struct deviceentry s_devices[] =
157{
158   { IO_CARTSLOT,   "roms",      "Cartridge images" },
159   { IO_FLOPPY,   "floppy",   "Floppy disk images" },
160   { IO_HARDDISK,   "hard",      "Hard disk images" },
161   { IO_CYLINDER,   NULL,      "Cylinders" },         
162   { IO_CASSETTE,   NULL,      "Cassette images" },
163   { IO_PUNCHCARD,   NULL,      "Punchcard images" },
164   { IO_PUNCHTAPE,   NULL,      "Punchtape images" },
165   { IO_PRINTER,   NULL,      "Printer Output" },
166   { IO_SERIAL,   NULL,      "Serial Output" },
167   { IO_PARALLEL,   NULL,      "Parallel Output" },
168   { IO_SNAPSHOT,   "snapshot",   "Snapshots" },
169   { IO_QUICKLOAD,   "snapshot",   "Quickloads" },
170   { IO_MEMCARD,   NULL,      "Memory cards" },
171   { IO_CDROM,      NULL,      "CD-ROM images" }
172};
173
174
175
176static void AssertValidDevice(int d)
177{
178   assert((sizeof(s_devices) / sizeof(s_devices[0])) == IO_COUNT);
179   assert(((d >= 0) && (d < IO_COUNT)) || (d == IO_UNKNOWN) || (d == IO_BAD) || (d == IO_ZIP));
180}
181
182
183
184static const struct deviceentry *lookupdevice(int d)
185{
186   assert(d >= 0);
187   assert(d < IO_COUNT);
188   AssertValidDevice(d);
189   return &s_devices[d];
190}
191
192
193
194// ------------------------------------------------------------------------
195#ifdef UNUSED_FUNCTION
196static int requested_device_type(char *tchar)
197{
198   int device = -1;
199   int i;
200
201    logerror("Requested device is %s\n", tchar);
202
203   if (*tchar == '-')
204   {
205      tchar++;
206
207      for (i = 1; i < IO_COUNT; i++)
208      {
209         if (!mame_stricmp(tchar, device_typename(i)) || !mame_stricmp(tchar, device_brieftypename(i)))
210         {
211            device = i;
212            break;
213         }
214      }
215   }
216
217   return device;
218}
219#endif
220
221
222// ------------------------------------------------------------------------
223// UI
224// ------------------------------------------------------------------------
225
226BOOL CreateMessIcons(void)
227{
228    int i;
229   HWND hwndSoftwareList;
230   HIMAGELIST hSmall;
231   HIMAGELIST hLarge;
232
233   // create the icon index, if we havn't already
234    if (!mess_icon_index)
235   {
236      mess_icon_index = pool_malloc(GetMame32MemoryPool(), driver_list_get_count(drivers) * IO_COUNT * sizeof(*mess_icon_index));
237    }
238
239    for (i = 0; i < (driver_list_get_count(drivers) * IO_COUNT); i++)
240        mess_icon_index[i] = 0;
241
242   // Associate the image lists with the list view control.
243   hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SWLIST);
244   hSmall = GetSmallImageList();
245   hLarge = GetLargeImageList();
246   (void)ListView_SetImageList(hwndSoftwareList, hSmall, LVSIL_SMALL);
247   (void)ListView_SetImageList(hwndSoftwareList, hLarge, LVSIL_NORMAL);
248   return TRUE;
249}
250
251
252
253static int GetMessIcon(int nGame, int nSoftwareType)
254{
255    int the_index;
256    int nIconPos = 0;
257    HICON hIcon = 0;
258    const game_driver *drv;
259    char buffer[32];
260   const char *iconname;
261
262   assert(nGame >= 0);
263   assert(nGame < driver_list_get_count(drivers));
264
265    if ((nSoftwareType >= 0) && (nSoftwareType < IO_COUNT))
266   {
267      iconname = device_brieftypename(nSoftwareType);
268        the_index = (nGame * IO_COUNT) + nSoftwareType;
269
270        nIconPos = mess_icon_index[the_index];
271        if (nIconPos >= 0)
272      {
273         for (drv = drivers[nGame]; drv; drv = driver_get_clone(drv))
274         {
275            _snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%s/%s", drv->name, iconname);
276            hIcon = LoadIconFromFile(buffer);
277            if (hIcon)
278               break;
279         }
280
281         if (hIcon)
282         {
283            nIconPos = ImageList_AddIcon(GetSmallImageList(), hIcon);
284            ImageList_AddIcon(GetLargeImageList(), hIcon);
285            if (nIconPos != -1)
286               mess_icon_index[the_index] = nIconPos;
287         }
288        }
289    }
290    return nIconPos;
291}
292
293
294#ifdef UNUSED_FUNCTION
295static void MessHashErrorProc(const char *message)
296{
297   SetStatusBarTextF(0, "Hash file: %s", message);
298}
299#endif
300
301
302static BOOL AddSoftwarePickerDirs(HWND hwndPicker, LPCSTR pszDirectories, LPCSTR pszSubDir)
303{
304   LPCSTR s;
305   LPSTR pszNewString;
306   char cSeparator = ';';
307   int nLength;
308
309   do
310   {
311      s = pszDirectories;
312      while(*s && (*s != cSeparator))
313         s++;
314
315      nLength = s - pszDirectories;
316      if (nLength > 0)
317      {
318         pszNewString = (LPSTR) alloca((nLength + 1 + (pszSubDir ? strlen(pszSubDir) + 1 : 0)));
319         memcpy(pszNewString, pszDirectories, nLength);
320         pszNewString[nLength] = '\0';
321
322         if (pszSubDir)
323         {
324            pszNewString[nLength++] = '\\';
325            strcpy(&pszNewString[nLength], pszSubDir);
326         }
327
328         if (!SoftwarePicker_AddDirectory(hwndPicker, pszNewString))
329            return FALSE;
330      }
331      pszDirectories = s + 1;
332   }
333   while(*s);
334   return TRUE;
335}
336
337
338
339void MyFillSoftwareList(int nGame, BOOL bForce)
340{
341   const game_driver *drv;
342   HWND hwndSoftwarePicker;
343   HWND hwndSoftwareDevView;
344   
345   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
346   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
347
348   // Set up the device view
349   DevView_SetDriver(hwndSoftwareDevView, nGame);
350
351   if (!bForce && (s_nGame == nGame))
352      return;
353   s_nGame = nGame;
354
355   // Set up the software picker
356   SoftwarePicker_Clear(hwndSoftwarePicker);
357   drv = drivers[nGame];
358   SoftwarePicker_SetDriver(hwndSoftwarePicker, drv);
359   while(drv)
360   {
361      AddSoftwarePickerDirs(hwndSoftwarePicker, GetSoftwareDirs(), drv->name);
362      drv = mess_next_compatible_driver(drv);
363   }
364   AddSoftwarePickerDirs(hwndSoftwarePicker, GetExtraSoftwarePaths(nGame), NULL);
365}
366
367
368
369void MessUpdateSoftwareList(void)
370{
371   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
372   MyFillSoftwareList(Picker_GetSelectedItem(hwndList), TRUE);
373}
374
375
376
377BOOL MessApproveImageList(HWND hParent, int nGame)
378{
379   int i, nPos, devindex;
380   const struct IODevice *devices;
381   const game_driver *pDriver;
382   char szMessage[256];
383   LPCSTR pszSoftware;
384   BOOL bResult = FALSE;
385
386   begin_resource_tracking();
387
388   pDriver = drivers[nGame];
389   devices = devices_allocate(pDriver);
390
391   nPos = 0;
392   for (devindex = 0; devices[devindex].type < IO_COUNT; devindex++)
393   {
394      // confirm any mandatory devices are loaded
395      if (devices[devindex].must_be_loaded)
396      {
397         for (i = 0; i < devices[devindex].count; i++)
398         {
399            pszSoftware = GetSelectedSoftware(nGame, &devices[devindex].devclass, i);
400            if (!pszSoftware || !*pszSoftware)
401            {
402               snprintf(szMessage, sizeof(szMessage) / sizeof(szMessage[0]),
403                  "System '%s' requires that device %s must have an image to load\n",
404                  pDriver->description,
405                  device_typename(devices[devindex].type));
406               goto done;
407            }
408         }
409      }
410
411      nPos += devices[devindex].count;
412   }
413   bResult = TRUE;
414
415done:
416   if (!bResult)
417   {
418      win_message_box_utf8(hParent, szMessage, MAME32NAME, MB_OK);
419   }
420
421   devices_free(devices);
422   return bResult;
423}
424
425
426
427// this is a wrapper call to wrap the idiosycracies of SetSelectedSoftware()
428static void InternalSetSelectedSoftware(int nGame, const device_class *devclass, int device_inst, const char *pszSoftware)
429{
430   if (!pszSoftware)
431      pszSoftware = "";
432
433   // only call SetSelectedSoftware() if this value is different
434   if (strcmp(GetSelectedSoftware(nGame, devclass, device_inst), pszSoftware))
435   {
436      SetSelectedSoftware(nGame, devclass, device_inst, pszSoftware);
437   }
438}
439
440
441
442// Places the specified image in the specified slot; nID = -1 means don't matter
443static void MessSpecifyImage(int nGame, const device_class *devclass, int nID, LPCSTR pszFilename)
444{
445   const struct IODevice *devices;
446   const struct IODevice *dev;
447   const char *s;
448   int i;
449
450   devices = devices_allocate(devclass->gamedrv);
451
452   for (dev = devices; dev->type < IO_COUNT; dev++)
453   {
454      if (dev->devclass.get_info == devclass->get_info)
455         break;
456   }
457
458   if (LOG_SOFTWARE)
459   {
460      dprintf("MessSpecifyImage(): nID=%d pszFilename='%s'\n", nID, pszFilename);
461   }
462
463   if (nID < 0)
464   {
465      // special case; first try to find existing image
466      for (i = 0; i < dev->count; i++)
467      {
468         s = GetSelectedSoftware(nGame, &dev->devclass, i);
469         if (s && !mame_stricmp(s, pszFilename))
470         {
471            nID = i;
472            break;
473         }
474      }
475   }
476
477   if (nID < 0)
478   {
479      // still not found?  locate an empty slot
480      for (i = 0; i < dev->count; i++)
481      {
482         s = GetSelectedSoftware(nGame, &dev->devclass, i);
483         if (!s || !*s || !mame_stricmp(s, pszFilename))
484         {
485            nID = i;
486            break;
487         }
488      }
489   }
490
491   if (nID >= 0)
492      InternalSetSelectedSoftware(nGame, &dev->devclass, nID, pszFilename);
493   else if (LOG_SOFTWARE)
494      dprintf("MessSpecifyImage(): Failed to place image '%s'\n", pszFilename);
495
496   devices_free(devices);
497}
498
499
500
501static void MessRemoveImage(int nGame, device_class devclass, LPCSTR pszFilename)
502{
503   int i, nPos;
504   const struct IODevice *devices;
505   const struct IODevice *dev;
506
507   if (devclass.gamedrv)
508   {
509      devices = devices_allocate(devclass.gamedrv);
510
511      nPos = 0;
512      for (dev = devices; dev->type < IO_COUNT; dev++)
513      {
514         if (dev->devclass.get_info == devclass.get_info)
515            break;
516         nPos += dev->count;
517      }
518
519      if (dev->type < IO_COUNT)
520      {
521         for (i = 0; i < dev->count; i++)
522         {
523            if (!mame_stricmp(pszFilename, GetSelectedSoftware(nGame, &dev->devclass, i)))
524            {
525               MessSpecifyImage(nGame, &devclass, i, NULL);
526               break;
527            }
528         }
529      }
530
531      devices_free(devices);
532   }
533}
534
535
536
537void MessReadMountedSoftware(int nGame)
538{
539   // First read stuff into device view
540   DevView_Refresh(GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW));
541
542   // Now read stuff into picker
543   MessRefreshPicker(nGame);
544}
545
546
547
548static void MessRefreshPicker(int nGame)
549{
550   HWND hwndSoftware;
551   int i, id;
552   LVFINDINFO lvfi;
553   const game_driver *pDriver;
554   const struct IODevice *pDeviceList;
555   const struct IODevice *pDevice;
556   LPCSTR pszSoftware;
557
558   hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST);
559   pDriver = drivers[nGame];
560   pDeviceList = devices_allocate(pDriver);
561   if (!pDeviceList)
562      goto done;
563
564   s_bIgnoreSoftwarePickerNotifies = TRUE;
565
566   // Now clear everything out; this may call back into us but it should not
567   // be problematic
568   ListView_SetItemState(hwndSoftware, -1, 0, LVIS_SELECTED);
569
570   for (pDevice = pDeviceList; pDevice->type < IO_COUNT; pDevice++)
571   {
572      for (id = 0; id < pDevice->count; id++)
573      {
574         pszSoftware = GetSelectedSoftware(nGame, &pDevice->devclass, id);
575         if (pszSoftware && *pszSoftware)
576         {
577            i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
578            if (i < 0)
579            {
580               SoftwarePicker_AddFile(hwndSoftware, pszSoftware);
581               i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
582            }
583            if (i >= 0)
584            {
585               memset(&lvfi, 0, sizeof(lvfi));
586               lvfi.flags = LVFI_PARAM;
587               lvfi.lParam = i;
588               i = ListView_FindItem(hwndSoftware, -1, &lvfi);
589               ListView_SetItemState(hwndSoftware, i, LVIS_SELECTED, LVIS_SELECTED);
590            }
591         }
592      }
593   }
594
595
596done:
597   devices_free(pDeviceList);
598   s_bIgnoreSoftwarePickerNotifies = FALSE;
599}
600
601
602
603void InitMessPicker(void)
604{
605   struct PickerOptions opts;
606   HWND hwndSoftware;
607
608   s_nGame = -1;
609   hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST);
610
611   memset(&opts, 0, sizeof(opts));
612   opts.pCallbacks = &s_softwareListCallbacks;
613   opts.nColumnCount = MESS_COLUMN_MAX;
614   opts.ppszColumnNames = mess_column_names;
615   SetupSoftwarePicker(hwndSoftware, &opts);
616
617   SetWindowLong(hwndSoftware, GWL_STYLE, GetWindowLong(hwndSoftware, GWL_STYLE)
618      | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED);
619
620   SetupSoftwareTabView();
621
622   {
623      static const struct DevViewCallbacks s_devViewCallbacks =
624      {
625         DevView_GetOpenFileName,
626         DevView_GetCreateFileName,
627         DevView_SetSelectedSoftware,
628         DevView_GetSelectedSoftware
629      };
630      DevView_SetCallbacks(GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW), &s_devViewCallbacks);
631   }
632}
633
634
635
636// ------------------------------------------------------------------------
637// Open others dialog
638// ------------------------------------------------------------------------
639
640typedef struct
641{
642   const struct IODevice *dev;
643    const char *ext;
644} mess_image_type;
645
646static BOOL CommonFileImageDialog(LPTSTR the_last_directory, common_file_dialog_proc cfd, LPTSTR filename, mess_image_type *imagetypes)
647{
648    BOOL success;
649    OPENFILENAME of;
650    char szFilter[2048];
651    LPSTR s;
652   const char *typname;
653    int i;
654    TCHAR* t_filter;
655    TCHAR* t_buffer;
656
657   s = szFilter;
658    *filename = 0;
659
660    // Common image types
661    strcpy(s, "Common image types");
662    s += strlen(s);
663    *(s++) = '|';
664    for (i = 0; imagetypes[i].ext; i++)
665   {
666        *(s++) = '*';
667        *(s++) = '.';
668        strcpy(s, imagetypes[i].ext);
669        s += strlen(s);
670        *(s++) = ';';
671    }
672    *(s++) = '|';
673
674    // All files
675    strcpy(s, "All files (*.*)");
676    s += strlen(s);
677    *(s++) = '|';
678    strcpy(s, "*.*");
679    s += strlen(s);
680    *(s++) = '|';
681
682    // The others
683    for (i = 0; imagetypes[i].ext; i++)
684   {
685      if (!imagetypes[i].dev)
686         typname = "Compressed images";
687      else
688         typname = lookupdevice(imagetypes[i].dev->type)->dlgname;
689
690        strcpy(s, typname);
691        s += strlen(s);
692        strcpy(s, " (*.");
693        s += strlen(s);
694        strcpy(s, imagetypes[i].ext);
695        s += strlen(s);
696        *(s++) = ')';
697        *(s++) = '|';
698        *(s++) = '*';
699        *(s++) = '.';
700        strcpy(s, imagetypes[i].ext);
701        s += strlen(s);
702        *(s++) = '|';
703    }
704    *(s++) = '|';
705   
706    t_buffer = tstring_from_utf8(szFilter);
707    if( !t_buffer )
708       return FALSE;
709
710   // convert a pipe-char delimited string into a NUL delimited string
711   t_filter = (LPTSTR) alloca((_tcslen(t_buffer) + 2) * sizeof(*t_filter));
712   for (i = 0; t_buffer[i] != '\0'; i++)
713      t_filter[i] = (t_buffer[i] != '|') ? t_buffer[i] : '\0';
714   t_filter[i++] = '\0';
715   t_filter[i++] = '\0';
716   free(t_buffer);
717
718    of.lStructSize = sizeof(of);
719    of.hwndOwner = GetMainWindow();
720    of.hInstance = NULL;
721    of.lpstrFilter = t_filter;
722    of.lpstrCustomFilter = NULL;
723    of.nMaxCustFilter = 0;
724    of.nFilterIndex = 1;
725    of.lpstrFile = filename;
726    of.nMaxFile = MAX_PATH;
727    of.lpstrFileTitle = NULL;
728    of.nMaxFileTitle = 0;
729    of.lpstrInitialDir = last_directory;
730    of.lpstrTitle = NULL;
731    of.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
732    of.nFileOffset = 0;
733    of.nFileExtension = 0;
734    of.lpstrDefExt = TEXT("rom");
735    of.lCustData = 0;
736    of.lpfnHook = NULL;
737    of.lpTemplateName = NULL;
738
739    success = cfd(&of);
740    if (success)
741    {
742        //GetDirectory(filename,last_directory,sizeof(last_directory));
743    }
744   
745    return success;
746}
747
748
749
750/* Specify IO_COUNT for type if you want all types */
751static void SetupImageTypes(const struct IODevice *devices, mess_image_type *types, int count, BOOL bZip, int type)
752{
753    int num_extensions = 0;
754   int devindex;
755
756   memset(types, 0, sizeof(*types) * count);
757    count--;
758
759    if (bZip)
760   {
761      types[num_extensions].ext = "zip";
762      types[num_extensions].dev = NULL;
763      num_extensions++;
764    }
765
766   if (devices != NULL)
767   {
768      for (devindex = 0; devices[devindex].type < IO_COUNT; devindex++)
769      {
770         if (devices[devindex].type != IO_PRINTER)
771         {
772            const char *ext = devices[devindex].file_extensions;
773            if (ext)
774            {
775               while(*ext)
776               {
777                  if ((type == IO_COUNT) || (type == devices[devindex].type))
778                  {
779                     if (num_extensions < count)
780                     {
781                        types[num_extensions].dev = &devices[devindex];
782                        types[num_extensions].ext = ext;
783                        num_extensions++;
784                     }
785                  }
786                  ext += strlen(ext) + 1;
787               }
788            }
789         }
790      }
791   }
792}
793
794
795
796static void MessSetupDevice(common_file_dialog_proc cfd, int iDevice)
797{
798   TCHAR filename[MAX_PATH];
799   mess_image_type imagetypes[64];
800   int nGame;
801   HWND hwndList;
802   char* utf8_filename;
803   const struct IODevice *devices;
804
805   begin_resource_tracking();
806
807   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
808   nGame = Picker_GetSelectedItem(hwndList);
809   devices = devices_allocate(drivers[nGame]);
810   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, iDevice);
811
812   if (CommonFileImageDialog(last_directory, cfd, filename, imagetypes))
813   {
814      utf8_filename = utf8_from_tstring(filename);
815      if( !utf8_filename )
816         return;
817      // TODO - this should go against InternalSetSelectedSoftware()
818      SoftwarePicker_AddFile(GetDlgItem(GetMainWindow(), IDC_SWLIST), utf8_filename);
819      free(utf8_filename);
820   }
821
822   if (devices != NULL)
823      devices_free(devices);
824}
825
826
827
828static void MessOpenOtherSoftware(int iDevice)
829{
830   MessSetupDevice(GetOpenFileName, iDevice);
831}
832
833
834
835static void MessCreateDevice(int iDevice)
836{
837   MessSetupDevice(GetSaveFileName, iDevice);
838}
839
840
841
842static BOOL DevView_GetOpenFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength)
843{
844   BOOL bResult;
845   mess_image_type imagetypes[64];
846   HWND hwndList;
847   int gamenum;
848   const struct IODevice *devices;
849
850   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
851   gamenum = Picker_GetSelectedItem(hwndList);
852   devices = devices_allocate(drivers[gamenum]);
853   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, dev->type);
854   bResult = CommonFileImageDialog(last_directory, GetOpenFileName, pszFilename, imagetypes);
855
856   if (devices != NULL)
857      devices_free(devices);
858   return bResult;
859}
860
861
862
863static BOOL DevView_GetCreateFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength)
864{
865   BOOL bResult;
866   mess_image_type imagetypes[64];
867   HWND hwndList;
868   int gamenum;
869   const struct IODevice *devices;
870
871   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
872   gamenum = Picker_GetSelectedItem(hwndList);
873   devices = devices_allocate(drivers[gamenum]);
874   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, dev->type);
875   bResult = CommonFileImageDialog(last_directory, GetSaveFileName, pszFilename, imagetypes);
876
877   if (devices != NULL)
878      devices_free(devices);
879   return bResult;
880}
881
882
883
884static void DevView_SetSelectedSoftware(HWND hwndDevView, int nGame,
885   const struct IODevice *dev, int nID, LPCTSTR pszFilename)
886{
887   char* utf8_filename = utf8_from_tstring(pszFilename);
888   if( !utf8_filename )
889      return;
890   MessSpecifyImage(nGame, &dev->devclass, nID, utf8_filename);
891   MessRefreshPicker(nGame);
892   free(utf8_filename);
893}
894
895
896
897static LPCTSTR DevView_GetSelectedSoftware(HWND hwndDevView, int nDriverIndex,
898   const struct IODevice *dev, int nID, LPTSTR pszBuffer, UINT nBufferLength)
899{
900   LPCTSTR t_buffer = NULL;
901   TCHAR* t_s;
902   LPCSTR s = GetSelectedSoftware(nDriverIndex, &dev->devclass, nID);
903   
904   t_s = tstring_from_utf8(s);
905   if( !t_s )
906      return t_buffer;
907   
908   _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s);
909   free(t_s);   
910   t_buffer = pszBuffer;
911   
912   return t_buffer;
913}
914
915
916
917// ------------------------------------------------------------------------
918// Software List Class
919// ------------------------------------------------------------------------
920
921static int SoftwarePicker_GetItemImage(HWND hwndPicker, int nItem)
922{
923    int nType;
924    int nIcon;
925   int nGame;
926   const char *icon_name;
927   HWND hwndGamePicker;
928   HWND hwndSoftwarePicker;
929
930   hwndGamePicker = GetDlgItem(GetMainWindow(), IDC_LIST);
931   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
932   nGame = Picker_GetSelectedItem(hwndGamePicker);
933    nType = SoftwarePicker_GetImageType(hwndSoftwarePicker, nItem);
934    nIcon = GetMessIcon(nGame, nType);
935    if (!nIcon)
936   {
937      if (nType < 0)
938         nType = IO_BAD;
939      switch(nType)
940      {
941         case IO_UNKNOWN:
942            // Unknowns
943            nIcon = FindIconIndex(IDI_WIN_UNKNOWN);
944            break;
945
946         case IO_BAD:
947         case IO_ZIP:
948            // Bad files
949            nIcon = FindIconIndex(IDI_WIN_REDX);
950            break;
951
952         default:
953            icon_name = lookupdevice(nType)->icon_name;
954            if (!icon_name)
955               icon_name = device_typename(nType);
956            nIcon = FindIconIndexByName(icon_name);
957            if (nIcon < 0)
958               nIcon = FindIconIndexByName("unknown");
959            break;
960      }
961    }
962    return nIcon;
963}
964
965
966
967static void SoftwarePicker_LeavingItem(HWND hwndSoftwarePicker, int nItem)
968{
969   int nGame;
970   device_class devclass;
971   LPCSTR pszFullName;
972   HWND hwndList;
973
974   if (!s_bIgnoreSoftwarePickerNotifies)
975   {
976      hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
977      nGame = Picker_GetSelectedItem(hwndList);
978      devclass = SoftwarePicker_LookupDevice(hwndSoftwarePicker, nItem);
979      pszFullName = SoftwarePicker_LookupFilename(hwndSoftwarePicker, nItem);
980
981      MessRemoveImage(nGame, devclass, pszFullName);
982   }
983}
984
985
986
987static void SoftwarePicker_EnteringItem(HWND hwndSoftwarePicker, int nItem)
988{
989   LPCSTR pszFullName;
990   LPCSTR pszName;
991   LPSTR s;
992   int nGame;
993   device_class devclass;
994   HWND hwndList;
995
996   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
997
998   if (!s_bIgnoreSoftwarePickerNotifies)
999   {
1000      nGame = Picker_GetSelectedItem(hwndList);
1001
1002      // Get the fullname and partialname for this file
1003      pszFullName = SoftwarePicker_LookupFilename(hwndSoftwarePicker, nItem);
1004      s = strchr(pszFullName, '\\');
1005      pszName = s ? s + 1 : pszFullName;
1006
1007      // Do the dirty work
1008      devclass = SoftwarePicker_LookupDevice(hwndSoftwarePicker, nItem);
1009      if (!devclass.gamedrv)
1010         return;
1011      MessSpecifyImage(nGame, &devclass, -1, pszFullName);
1012
1013      // Set up s_szSelecteItem, for the benefit of UpdateScreenShot()
1014      strncpyz(g_szSelectedItem, pszName, sizeof(g_szSelectedItem) / sizeof(g_szSelectedItem[0]));
1015      s = strrchr(g_szSelectedItem, '.');
1016      if (s)
1017         *s = '\0';
1018
1019      UpdateScreenShot();
1020   }
1021}
1022
1023
1024
1025// ------------------------------------------------------------------------
1026// Header context menu stuff
1027// ------------------------------------------------------------------------
1028
1029static HWND MyColumnDialogProc_hwndPicker;
1030static int *MyColumnDialogProc_order;
1031static int *MyColumnDialogProc_shown;
1032
1033static void MyGetRealColumnOrder(int *order)
1034{
1035   int i, nColumnCount;
1036   nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1037   for (i = 0; i < nColumnCount; i++)
1038      order[i] = Picker_GetRealColumnFromViewColumn(MyColumnDialogProc_hwndPicker, i);
1039}
1040
1041
1042
1043static void MyGetColumnInfo(int *order, int *shown)
1044{
1045   const struct PickerCallbacks *pCallbacks;
1046   pCallbacks = Picker_GetCallbacks(MyColumnDialogProc_hwndPicker);
1047   pCallbacks->pfnGetColumnOrder(order);
1048   pCallbacks->pfnGetColumnShown(shown);
1049}
1050
1051
1052
1053static void MySetColumnInfo(int *order, int *shown)
1054{
1055   const struct PickerCallbacks *pCallbacks;
1056   pCallbacks = Picker_GetCallbacks(MyColumnDialogProc_hwndPicker);
1057   pCallbacks->pfnSetColumnOrder(order);
1058   pCallbacks->pfnSetColumnShown(shown);
1059}
1060
1061
1062
1063static INT_PTR CALLBACK MyColumnDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
1064{
1065   INT_PTR result = 0;
1066   int nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1067   LPCTSTR *ppszColumnNames = Picker_GetColumnNames(MyColumnDialogProc_hwndPicker);
1068   
1069   result = InternalColumnDialogProc(hDlg, Msg, wParam, lParam, nColumnCount,
1070      MyColumnDialogProc_shown, MyColumnDialogProc_order, ppszColumnNames,
1071      MyGetRealColumnOrder, MyGetColumnInfo, MySetColumnInfo);
1072     
1073   return result;
1074}
1075
1076
1077
1078static BOOL RunColumnDialog(HWND hwndPicker)
1079{
1080   BOOL bResult;
1081   int nColumnCount;
1082
1083   MyColumnDialogProc_hwndPicker = hwndPicker;
1084   nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1085
1086   MyColumnDialogProc_order = alloca(nColumnCount * sizeof(int));
1087   MyColumnDialogProc_shown = alloca(nColumnCount * sizeof(int));
1088   bResult = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_COLUMNS), GetMainWindow(), MyColumnDialogProc);
1089   return bResult;
1090}
1091
1092
1093
1094static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn)
1095{
1096   HMENU hMenu;
1097   HMENU hMenuLoad;
1098   HWND hwndPicker;
1099   int nMenuItem;
1100
1101   hMenuLoad = LoadMenu(NULL, MAKEINTRESOURCE(IDR_CONTEXT_HEADER));
1102   hMenu = GetSubMenu(hMenuLoad, 0);
1103
1104   nMenuItem = (int) TrackPopupMenu(hMenu,
1105      TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
1106      pt.x,
1107      pt.y,
1108      0,
1109      GetMainWindow(),
1110      NULL);
1111
1112   DestroyMenu(hMenuLoad);
1113
1114   hwndPicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1115
1116   switch(nMenuItem) {
1117   case ID_SORT_ASCENDING:
1118      SetMessSortReverse(FALSE);
1119      SetMessSortColumn(Picker_GetRealColumnFromViewColumn(hwndPicker, nColumn));
1120      Picker_Sort(hwndPicker);
1121      break;
1122
1123   case ID_SORT_DESCENDING:
1124      SetMessSortReverse(TRUE);
1125      SetMessSortColumn(Picker_GetRealColumnFromViewColumn(hwndPicker, nColumn));
1126      Picker_Sort(hwndPicker);
1127      break;
1128
1129   case ID_CUSTOMIZE_FIELDS:
1130      if (RunColumnDialog(hwndPicker))
1131         Picker_ResetColumnDisplay(hwndPicker);
1132      break;
1133   }
1134}
1135
1136
1137
1138// ------------------------------------------------------------------------
1139// MessCommand
1140// ------------------------------------------------------------------------
1141
1142BOOL MessCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify)
1143{
1144   switch (id) {
1145   case ID_MESS_OPEN_SOFTWARE:
1146      MessOpenOtherSoftware(IO_COUNT);
1147      break;
1148
1149   case ID_MESS_CREATE_SOFTWARE:
1150      MessCreateDevice(IO_COUNT);
1151      break;
1152
1153#ifdef MAME_DEBUG
1154   case ID_MESS_RUN_TESTS:
1155      MessTestsBegin();
1156      break;
1157#endif /* MAME_DEBUG */
1158   }
1159   return FALSE;
1160}
1161
1162
1163
1164// ------------------------------------------------------------------------
1165// Software Tab View
1166// ------------------------------------------------------------------------
1167
1168static LPCSTR s_tabs[] =
1169{
1170   "picker\0Picker",
1171   "devview\0Device View"
1172};
1173
1174
1175
1176static LPCSTR SoftwareTabView_GetTabShortName(int tab)
1177{
1178   return s_tabs[tab];
1179}
1180
1181
1182
1183static LPCSTR SoftwareTabView_GetTabLongName(int tab)
1184{
1185   return s_tabs[tab] + strlen(s_tabs[tab]) + 1;
1186}
1187
1188
1189
1190static void SoftwareTabView_OnSelectionChanged(void)
1191{
1192   int nTab;
1193   HWND hwndSoftwarePicker;
1194   HWND hwndSoftwareDevView;
1195
1196   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1197   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
1198
1199   nTab = TabView_GetCurrentTab(GetDlgItem(GetMainWindow(), IDC_SWTAB));
1200
1201   switch(nTab)
1202   {
1203      case 0:
1204         ShowWindow(hwndSoftwarePicker, SW_SHOW);
1205         ShowWindow(hwndSoftwareDevView, SW_HIDE);
1206         break;
1207
1208      case 1:
1209         ShowWindow(hwndSoftwarePicker, SW_HIDE);
1210         ShowWindow(hwndSoftwareDevView, SW_SHOW);
1211         break;
1212   }
1213}
1214
1215
1216
1217static void SoftwareTabView_OnMoveSize(void)
1218{
1219   HWND hwndSoftwareTabView;
1220   HWND hwndSoftwarePicker;
1221   HWND hwndSoftwareDevView;
1222   RECT rMain, rSoftwareTabView, rClient, rTab;
1223
1224   hwndSoftwareTabView = GetDlgItem(GetMainWindow(), IDC_SWTAB);
1225   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1226   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
1227
1228   GetWindowRect(hwndSoftwareTabView, &rSoftwareTabView);
1229   GetClientRect(GetMainWindow(), &rMain);
1230   ClientToScreen(GetMainWindow(), &((POINT *) &rMain)[0]);
1231   ClientToScreen(GetMainWindow(), &((POINT *) &rMain)[1]);
1232
1233   // Calculate rClient from rSoftwareTabView in terms of rMain coordinates
1234   rClient.left = rSoftwareTabView.left - rMain.left;
1235   rClient.top = rSoftwareTabView.top - rMain.top;
1236   rClient.right = rSoftwareTabView.right - rMain.left;
1237   rClient.bottom = rSoftwareTabView.bottom - rMain.top;
1238
1239   // If the tabs are visible, then make sure that the tab view's tabs are
1240   // not being covered up
1241   if (GetWindowLong(hwndSoftwareTabView, GWL_STYLE) & WS_VISIBLE)
1242   {
1243      TabCtrl_GetItemRect(hwndSoftwareTabView, 0, &rTab);
1244      rClient.top += rTab.bottom - rTab.top + 4;
1245   }
1246
1247   /* Now actually move the controls */
1248   MoveWindow(hwndSoftwarePicker, rClient.left, rClient.top,
1249      rClient.right - rClient.left, rClient.bottom - rClient.top,
1250      TRUE);
1251   MoveWindow(hwndSoftwareDevView, rClient.left, rClient.top,
1252      rClient.right - rClient.left, rClient.bottom - rClient.top,
1253      TRUE);
1254}
1255
1256
1257
1258static void SetupSoftwareTabView(void)
1259{
1260   struct TabViewOptions opts;
1261
1262   memset(&opts, 0, sizeof(opts));
1263   opts.pCallbacks = &s_softwareTabViewCallbacks;
1264   opts.nTabCount = sizeof(s_tabs) / sizeof(s_tabs[0]);
1265
1266   SetupTabView(GetDlgItem(GetMainWindow(), IDC_SWTAB), &opts);
1267}
1268
1269
1270
1271void MessCopyDeviceOption(core_options *opts, const game_driver *gamedrv, const device_class *devclass, int device_index, int global_index)
1272{
1273   const char *dev_name;
1274   const char *opt_value;
1275
1276   dev_name = device_instancename(devclass, device_index);
1277   opt_value = options_get_string(opts, dev_name);
1278   options_set_string(mame_options(), dev_name, opt_value, OPTION_PRIORITY_CMDLINE);
1279}
1280
1281
1282
1283// ------------------------------------------------------------------------
1284// Mess32 Diagnostics
1285// ------------------------------------------------------------------------
1286
1287#ifdef MAME_DEBUG
1288
1289static int s_nOriginalPick;
1290static UINT_PTR s_nTestingTimer;
1291static BOOL s_bInTimerProc;
1292
1293static void MessTestsColumns(void)
1294{
1295   int i, j;
1296   int oldshown[MESS_COLUMN_MAX];
1297   int shown[MESS_COLUMN_MAX];
1298
1299   GetMessColumnShown(oldshown);
1300
1301   shown[0] = 1;
1302   for (i = 0; i < (1<<(MESS_COLUMN_MAX-1)); i++)
1303   {
1304      for (j = 1; j < MESS_COLUMN_MAX; j++)
1305         shown[j] = (i & (1<<(j-1))) ? 1 : 0;
1306
1307      SetMessColumnShown(shown);
1308      Picker_ResetColumnDisplay(GetDlgItem(GetMainWindow(), IDC_SWLIST));
1309   }
1310
1311   SetMessColumnShown(oldshown);
1312   Picker_ResetColumnDisplay(GetDlgItem(GetMainWindow(), IDC_SWLIST));
1313}
1314
1315
1316
1317
1318static void CALLBACK MessTestsTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
1319{
1320   int nNewGame;
1321   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
1322
1323   // if either of the pickers have further idle work to do, or we are
1324   // already in this timerproc, do not do anything
1325   if (s_bInTimerProc || Picker_IsIdling(hwndList)
1326      || Picker_IsIdling(GetDlgItem(GetMainWindow(), IDC_SWLIST)))
1327      return;
1328   s_bInTimerProc = TRUE;
1329
1330   nNewGame = GetSelectedPick() + 1;
1331
1332   if (nNewGame >= driver_list_get_count(drivers))
1333   {
1334      /* We are done */
1335      Picker_SetSelectedPick(hwndList, s_nOriginalPick);
1336
1337      KillTimer(NULL, s_nTestingTimer);
1338      s_nTestingTimer = 0;
1339
1340      win_message_box_utf8(GetMainWindow(), "Tests successfully completed!", MAME32NAME, MB_OK);
1341   }
1342   else
1343   {
1344//      MessTestsFlex(GetDlgItem(GetMainWindow(), IDC_SWLIST), drivers[Picker_GetSelectedItem(hwndList)]);
1345      Picker_SetSelectedPick(hwndList, nNewGame);
1346   }
1347   s_bInTimerProc = FALSE;
1348}
1349
1350
1351
1352static void MessTestsBegin(void)
1353{
1354   int nOriginalPick;
1355   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
1356
1357   nOriginalPick = GetSelectedPick();
1358
1359   // If we are not currently running tests, set up the timer and keep track
1360   // of the original selected pick item
1361   if (!s_nTestingTimer)
1362   {
1363      s_nTestingTimer = SetTimer(NULL, 0, 50, MessTestsTimerProc);
1364      if (!s_nTestingTimer)
1365         return;
1366      s_nOriginalPick = nOriginalPick;
1367   }
1368
1369   MessTestsColumns();
1370
1371   if (nOriginalPick == 0)
1372      Picker_SetSelectedPick(hwndList, 1);
1373   Picker_SetSelectedPick(hwndList, 0);
1374}
1375
1376
1377
1378#endif // MAME_DEBUG
src/mess/osd/winui/mess32ui.h
r1367r1368
1#ifndef __MESS32UI_H__
2#define __MESS32UI_H__
3
4#include "driver.h"
5#include "resourcems.h"
6#include "devview.h"
7#include "uitext.h"
8#include "options.h"
9
10extern char g_szSelectedItem[MAX_PATH];
11
12void InitMessPicker(void);
13void MessUpdateSoftwareList(void);
14void MyFillSoftwareList(int nGame, BOOL bForce);
15BOOL MessCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify);
16void MessReadMountedSoftware(int nGame);
17BOOL CreateMessIcons(void);
18BOOL MessApproveImageList(HWND hParent, int nDriver);
19
20void MessCopyDeviceOption(core_options *opts, const game_driver *gamedrv, const device_class *devclass, int device_index, int global_index);
21
22#endif // __MESS32UI_H__
src/mess/osd/winui/ms32util.c
r1367r1368
1#include "driver.h"
2#include "device.h"
3#include "ms32util.h"
4
5BOOL DriverIsComputer(int driver_index)
6{
7   return (drivers[driver_index]->flags & GAME_COMPUTER) != 0;
8}
9
10BOOL DriverIsModified(int driver_index)
11{
12   return (drivers[driver_index]->flags & GAME_COMPUTER_MODIFIED) != 0;
13}
14
15BOOL DriverUsesMouse(int driver_index)
16{
17   const input_port_entry *input_ports;
18   BOOL retval = FALSE;
19
20   if (drivers[driver_index]->ipt)
21   {
22      begin_resource_tracking();
23      input_ports = input_port_allocate(drivers[driver_index]->ipt, NULL);
24
25      while (input_ports->type != IPT_END)
26      {
27         if (input_ports->type == IPT_MOUSE_X || input_ports->type == IPT_MOUSE_Y)
28         {
29            retval = TRUE;
30            break;
31         }
32         input_ports++;
33      }
34
35      end_resource_tracking();
36   }
37
38   return retval;
39}
40
41BOOL DriverHasDevice(const game_driver *gamedrv, iodevice_t type)
42{
43   BOOL b;
44   const struct IODevice *devices;
45
46   devices = devices_allocate(gamedrv);
47   b = device_find(devices, IO_PRINTER) ? TRUE : FALSE;
48   devices_free(devices);
49   return b;
50}
51
52
src/mess/osd/winui/ms32util.h
r1367r1368
1#ifndef MS32UTIL_H
2#define MS32UTIL_H
3
4#include <windows.h>
5
6BOOL DriverIsComputer(int driver_index);
7BOOL DriverIsModified(int driver_index);
8BOOL DriverUsesMouse(int driver_index);
9BOOL DriverHasDevice(const game_driver *gamedrv, iodevice_t type);
10
11#endif /* MS32UTIL_H */
12
src/mess/osd/winui/cfgfile.c
r1367r1368
1515
1616#include "screenshot.h"
1717#include "bitmask.h"
18#include "mame32.h"
19#include "m32util.h"
18#include "mameui.h"
19#include "mui_util.h"
2020#include "resource.h"
2121#include "treeview.h"
2222#include "file.h"
r1367r1368
4444   switch(nSettingsFile & 0xF0000000)
4545   {
4646      case SETTINGS_FILE_UI:
47         _snprintf(buffer, bufsize, "%s", MAME32NAME "ui.ini");
47         _snprintf(buffer, bufsize, "%s", MAMEUINAME "ui.ini");
4848         break;
4949
5050      case SETTINGS_FILE_GLOBAL:
src/mess/osd/winui/messui.c
r0r1368
1//============================================================
2//
3//   messui.c - MESS extensions to src/osd/winui/winui.c
4//
5//============================================================
6
7#define WIN32_LEAN_AND_MEAN
8#include <assert.h>
9#include <string.h>
10#include <windows.h>
11#include <shellapi.h>
12#include <commctrl.h>
13#include <commdlg.h>
14#include <wingdi.h>
15#include <winuser.h>
16#include <tchar.h>
17
18#include "screenshot.h"
19#include "bitmask.h"
20#include "winui.h"
21#include "resourcems.h"
22#include "mui_opts.h"
23#include "picker.h"
24#include "tabview.h"
25#include "mui_util.h"
26#include "columnedit.h"
27#include "mess.h"
28#include "configms.h"
29#include "softwarepicker.h"
30#include "devview.h"
31#include "windows/window.h"
32#include "utils.h"
33#include "uitext.h"
34#include "strconv.h"
35#include "messui.h"
36#include "winutf8.h"
37
38#define LOG_SOFTWARE   0
39
40#ifdef UNUSED_FUNCTION
41static int requested_device_type(char *tchar);
42#endif
43
44static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn);
45
46static LPCSTR SoftwareTabView_GetTabShortName(int tab);
47static LPCSTR SoftwareTabView_GetTabLongName(int tab);
48static void SoftwareTabView_OnSelectionChanged(void);
49static void SoftwareTabView_OnMoveSize(void);
50static void SetupSoftwareTabView(void);
51
52static LPCTSTR mess_column_names[] =
53{
54    TEXT("Software"),
55   TEXT("Goodname"),
56    TEXT("Manufacturer"),
57    TEXT("Year"),
58    TEXT("Playable"),
59   TEXT("CRC"),
60   TEXT("SHA-1"),
61   TEXT("MD5")
62};
63
64static int *mess_icon_index;
65
66static void MessOpenOtherSoftware(int iDevice);
67static void MessCreateDevice(int iDevice);
68static void MessRefreshPicker(int nGame);
69
70static int SoftwarePicker_GetItemImage(HWND hwndPicker, int nItem);
71static void SoftwarePicker_LeavingItem(HWND hwndSoftwarePicker, int nItem);
72static void SoftwarePicker_EnteringItem(HWND hwndSoftwarePicker, int nItem);
73
74static BOOL DevView_GetOpenFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength);
75static BOOL DevView_GetCreateFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength);
76static void DevView_SetSelectedSoftware(HWND hwndDevView, int nDriverIndex, const struct IODevice *dev, int nID, LPCTSTR pszFilename);
77static LPCTSTR DevView_GetSelectedSoftware(HWND hwndDevView, int nDriverIndex, const struct IODevice *dev, int nID, LPTSTR pszBuffer, UINT nBufferLength);
78
79#ifdef MAME_DEBUG
80static void MessTestsBegin(void);
81#endif /* MAME_DEBUG */
82
83char g_szSelectedItem[MAX_PATH];
84
85static int s_nGame;
86static BOOL s_bIgnoreSoftwarePickerNotifies;
87
88struct deviceentry
89{
90   int dev_type;
91   const char *icon_name;
92   const char *dlgname;
93};
94
95static const struct PickerCallbacks s_softwareListCallbacks =
96{
97   SetMessSortColumn,               // pfnSetSortColumn
98   GetMessSortColumn,               // pfnGetSortColumn
99   SetMessSortReverse,               // pfnSetSortReverse
100   GetMessSortReverse,               // pfnGetSortReverse
101   NULL,                        // pfnSetViewMode
102   GetViewMode,                  // pfnGetViewMode
103   SetMessColumnWidths,            // pfnSetColumnWidths
104   GetMessColumnWidths,            // pfnGetColumnWidths
105   SetMessColumnOrder,               // pfnSetColumnOrder
106   GetMessColumnOrder,               // pfnGetColumnOrder
107   SetMessColumnShown,               // pfnSetColumnShown
108   GetMessColumnShown,               // pfnGetColumnShown
109   NULL,                        // pfnGetOffsetChildren
110
111   NULL,                        // pfnCompare
112   MamePlayGame,                  // pfnDoubleClick
113   SoftwarePicker_GetItemString,      // pfnGetItemString
114   SoftwarePicker_GetItemImage,      // pfnGetItemImage
115   SoftwarePicker_LeavingItem,         // pfnLeavingItem
116   SoftwarePicker_EnteringItem,      // pfnEnteringItem
117   NULL,                        // pfnBeginListViewDrag
118   NULL,                        // pfnFindItemParent
119   SoftwarePicker_Idle,            // pfnIdle
120   SoftwarePicker_OnHeaderContextMenu,   // pfnOnHeaderContextMenu
121   NULL                        // pfnOnBodyContextMenu
122};
123
124
125
126static const struct TabViewCallbacks s_softwareTabViewCallbacks =
127{
128   NULL,                        // pfnGetShowTabCtrl
129   SetCurrentSoftwareTab,            // pfnSetCurrentTab
130   GetCurrentSoftwareTab,            // pfnGetCurrentTab
131   NULL,                        // pfnSetShowTab
132   NULL,                        // pfnGetShowTab
133
134   SoftwareTabView_GetTabShortName,   // pfnGetTabShortName
135   SoftwareTabView_GetTabLongName,      // pfnGetTabLongName
136
137   SoftwareTabView_OnSelectionChanged,   // pfnOnSelectionChanged
138   SoftwareTabView_OnMoveSize         // pfnOnMoveSize
139};
140
141
142
143// ------------------------------------------------------------------------
144// Image types
145//
146// IO_ZIP is used for ZIP files
147// IO_ALIAS is used for unknown types
148// IO_COUNT is used for bad files
149// ------------------------------------------------------------------------
150
151#define IO_ZIP      (IO_COUNT + 0)
152#define IO_BAD      (IO_COUNT + 1)
153#define IO_UNKNOWN   (IO_COUNT + 2)
154
155// TODO - We need to make icons for Cylinders, Punch Cards, and Punch Tape!
156static const struct deviceentry s_devices[] =
157{
158   { IO_CARTSLOT,   "roms",      "Cartridge images" },
159   { IO_FLOPPY,   "floppy",   "Floppy disk images" },
160   { IO_HARDDISK,   "hard",      "Hard disk images" },
161   { IO_CYLINDER,   NULL,      "Cylinders" },         
162   { IO_CASSETTE,   NULL,      "Cassette images" },
163   { IO_PUNCHCARD,   NULL,      "Punchcard images" },
164   { IO_PUNCHTAPE,   NULL,      "Punchtape images" },
165   { IO_PRINTER,   NULL,      "Printer Output" },
166   { IO_SERIAL,   NULL,      "Serial Output" },
167   { IO_PARALLEL,   NULL,      "Parallel Output" },
168   { IO_SNAPSHOT,   "snapshot",   "Snapshots" },
169   { IO_QUICKLOAD,   "snapshot",   "Quickloads" },
170   { IO_MEMCARD,   NULL,      "Memory cards" },
171   { IO_CDROM,      NULL,      "CD-ROM images" }
172};
173
174
175
176static void AssertValidDevice(int d)
177{
178   assert((sizeof(s_devices) / sizeof(s_devices[0])) == IO_COUNT);
179   assert(((d >= 0) && (d < IO_COUNT)) || (d == IO_UNKNOWN) || (d == IO_BAD) || (d == IO_ZIP));
180}
181
182
183
184static const struct deviceentry *lookupdevice(int d)
185{
186   assert(d >= 0);
187   assert(d < IO_COUNT);
188   AssertValidDevice(d);
189   return &s_devices[d];
190}
191
192
193
194// ------------------------------------------------------------------------
195#ifdef UNUSED_FUNCTION
196static int requested_device_type(char *tchar)
197{
198   int device = -1;
199   int i;
200
201    logerror("Requested device is %s\n", tchar);
202
203   if (*tchar == '-')
204   {
205      tchar++;
206
207      for (i = 1; i < IO_COUNT; i++)
208      {
209         if (!mame_stricmp(tchar, device_typename(i)) || !mame_stricmp(tchar, device_brieftypename(i)))
210         {
211            device = i;
212            break;
213         }
214      }
215   }
216
217   return device;
218}
219#endif
220
221
222// ------------------------------------------------------------------------
223// UI
224// ------------------------------------------------------------------------
225
226BOOL CreateMessIcons(void)
227{
228    int i;
229   HWND hwndSoftwareList;
230   HIMAGELIST hSmall;
231   HIMAGELIST hLarge;
232
233   // create the icon index, if we havn't already
234    if (!mess_icon_index)
235   {
236      mess_icon_index = pool_malloc(GetMameUIMemoryPool(), driver_list_get_count(drivers) * IO_COUNT * sizeof(*mess_icon_index));
237    }
238
239    for (i = 0; i < (driver_list_get_count(drivers) * IO_COUNT); i++)
240        mess_icon_index[i] = 0;
241
242   // Associate the image lists with the list view control.
243   hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SWLIST);
244   hSmall = GetSmallImageList();
245   hLarge = GetLargeImageList();
246   (void)ListView_SetImageList(hwndSoftwareList, hSmall, LVSIL_SMALL);
247   (void)ListView_SetImageList(hwndSoftwareList, hLarge, LVSIL_NORMAL);
248   return TRUE;
249}
250
251
252
253static int GetMessIcon(int nGame, int nSoftwareType)
254{
255    int the_index;
256    int nIconPos = 0;
257    HICON hIcon = 0;
258    const game_driver *drv;
259    char buffer[32];
260   const char *iconname;
261
262   assert(nGame >= 0);
263   assert(nGame < driver_list_get_count(drivers));
264
265    if ((nSoftwareType >= 0) && (nSoftwareType < IO_COUNT))
266   {
267      iconname = device_brieftypename(nSoftwareType);
268        the_index = (nGame * IO_COUNT) + nSoftwareType;
269
270        nIconPos = mess_icon_index[the_index];
271        if (nIconPos >= 0)
272      {
273         for (drv = drivers[nGame]; drv; drv = driver_get_clone(drv))
274         {
275            _snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%s/%s", drv->name, iconname);
276            hIcon = LoadIconFromFile(buffer);
277            if (hIcon)
278               break;
279         }
280
281         if (hIcon)
282         {
283            nIconPos = ImageList_AddIcon(GetSmallImageList(), hIcon);
284            ImageList_AddIcon(GetLargeImageList(), hIcon);
285            if (nIconPos != -1)
286               mess_icon_index[the_index] = nIconPos;
287         }
288        }
289    }
290    return nIconPos;
291}
292
293
294#ifdef UNUSED_FUNCTION
295static void MessHashErrorProc(const char *message)
296{
297   SetStatusBarTextF(0, "Hash file: %s", message);
298}
299#endif
300
301
302static BOOL AddSoftwarePickerDirs(HWND hwndPicker, LPCSTR pszDirectories, LPCSTR pszSubDir)
303{
304   LPCSTR s;
305   LPSTR pszNewString;
306   char cSeparator = ';';
307   int nLength;
308
309   do
310   {
311      s = pszDirectories;
312      while(*s && (*s != cSeparator))
313         s++;
314
315      nLength = s - pszDirectories;
316      if (nLength > 0)
317      {
318         pszNewString = (LPSTR) alloca((nLength + 1 + (pszSubDir ? strlen(pszSubDir) + 1 : 0)));
319         memcpy(pszNewString, pszDirectories, nLength);
320         pszNewString[nLength] = '\0';
321
322         if (pszSubDir)
323         {
324            pszNewString[nLength++] = '\\';
325            strcpy(&pszNewString[nLength], pszSubDir);
326         }
327
328         if (!SoftwarePicker_AddDirectory(hwndPicker, pszNewString))
329            return FALSE;
330      }
331      pszDirectories = s + 1;
332   }
333   while(*s);
334   return TRUE;
335}
336
337
338
339void MyFillSoftwareList(int nGame, BOOL bForce)
340{
341   const game_driver *drv;
342   HWND hwndSoftwarePicker;
343   HWND hwndSoftwareDevView;
344   
345   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
346   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
347
348   // Set up the device view
349   DevView_SetDriver(hwndSoftwareDevView, nGame);
350
351   if (!bForce && (s_nGame == nGame))
352      return;
353   s_nGame = nGame;
354
355   // Set up the software picker
356   SoftwarePicker_Clear(hwndSoftwarePicker);
357   drv = drivers[nGame];
358   SoftwarePicker_SetDriver(hwndSoftwarePicker, drv);
359   while(drv)
360   {
361      AddSoftwarePickerDirs(hwndSoftwarePicker, GetSoftwareDirs(), drv->name);
362      drv = mess_next_compatible_driver(drv);
363   }
364   AddSoftwarePickerDirs(hwndSoftwarePicker, GetExtraSoftwarePaths(nGame), NULL);
365}
366
367
368
369void MessUpdateSoftwareList(void)
370{
371   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
372   MyFillSoftwareList(Picker_GetSelectedItem(hwndList), TRUE);
373}
374
375
376
377BOOL MessApproveImageList(HWND hParent, int nGame)
378{
379   int i, nPos, devindex;
380   const struct IODevice *devices;
381   const game_driver *pDriver;
382   char szMessage[256];
383   LPCSTR pszSoftware;
384   BOOL bResult = FALSE;
385
386   begin_resource_tracking();
387
388   pDriver = drivers[nGame];
389   devices = devices_allocate(pDriver);
390
391   nPos = 0;
392   for (devindex = 0; devices[devindex].type < IO_COUNT; devindex++)
393   {
394      // confirm any mandatory devices are loaded
395      if (devices[devindex].must_be_loaded)
396      {
397         for (i = 0; i < devices[devindex].count; i++)
398         {
399            pszSoftware = GetSelectedSoftware(nGame, &devices[devindex].devclass, i);
400            if (!pszSoftware || !*pszSoftware)
401            {
402               snprintf(szMessage, sizeof(szMessage) / sizeof(szMessage[0]),
403                  "System '%s' requires that device %s must have an image to load\n",
404                  pDriver->description,
405                  device_typename(devices[devindex].type));
406               goto done;
407            }
408         }
409      }
410
411      nPos += devices[devindex].count;
412   }
413   bResult = TRUE;
414
415done:
416   if (!bResult)
417   {
418      win_message_box_utf8(hParent, szMessage, MAMEUINAME, MB_OK);
419   }
420
421   devices_free(devices);
422   return bResult;
423}
424
425
426
427// this is a wrapper call to wrap the idiosycracies of SetSelectedSoftware()
428static void InternalSetSelectedSoftware(int nGame, const device_class *devclass, int device_inst, const char *pszSoftware)
429{
430   if (!pszSoftware)
431      pszSoftware = "";
432
433   // only call SetSelectedSoftware() if this value is different
434   if (strcmp(GetSelectedSoftware(nGame, devclass, device_inst), pszSoftware))
435   {
436      SetSelectedSoftware(nGame, devclass, device_inst, pszSoftware);
437   }
438}
439
440
441
442// Places the specified image in the specified slot; nID = -1 means don't matter
443static void MessSpecifyImage(int nGame, const device_class *devclass, int nID, LPCSTR pszFilename)
444{
445   const struct IODevice *devices;
446   const struct IODevice *dev;
447   const char *s;
448   int i;
449
450   devices = devices_allocate(devclass->gamedrv);
451
452   for (dev = devices; dev->type < IO_COUNT; dev++)
453   {
454      if (dev->devclass.get_info == devclass->get_info)
455         break;
456   }
457
458   if (LOG_SOFTWARE)
459   {
460      dprintf("MessSpecifyImage(): nID=%d pszFilename='%s'\n", nID, pszFilename);
461   }
462
463   if (nID < 0)
464   {
465      // special case; first try to find existing image
466      for (i = 0; i < dev->count; i++)
467      {
468         s = GetSelectedSoftware(nGame, &dev->devclass, i);
469         if (s && !mame_stricmp(s, pszFilename))
470         {
471            nID = i;
472            break;
473         }
474      }
475   }
476
477   if (nID < 0)
478   {
479      // still not found?  locate an empty slot
480      for (i = 0; i < dev->count; i++)
481      {
482         s = GetSelectedSoftware(nGame, &dev->devclass, i);
483         if (!s || !*s || !mame_stricmp(s, pszFilename))
484         {
485            nID = i;
486            break;
487         }
488      }
489   }
490
491   if (nID >= 0)
492      InternalSetSelectedSoftware(nGame, &dev->devclass, nID, pszFilename);
493   else if (LOG_SOFTWARE)
494      dprintf("MessSpecifyImage(): Failed to place image '%s'\n", pszFilename);
495
496   devices_free(devices);
497}
498
499
500
501static void MessRemoveImage(int nGame, device_class devclass, LPCSTR pszFilename)
502{
503   int i, nPos;
504   const struct IODevice *devices;
505   const struct IODevice *dev;
506
507   if (devclass.gamedrv)
508   {
509      devices = devices_allocate(devclass.gamedrv);
510
511      nPos = 0;
512      for (dev = devices; dev->type < IO_COUNT; dev++)
513      {
514         if (dev->devclass.get_info == devclass.get_info)
515            break;
516         nPos += dev->count;
517      }
518
519      if (dev->type < IO_COUNT)
520      {
521         for (i = 0; i < dev->count; i++)
522         {
523            if (!mame_stricmp(pszFilename, GetSelectedSoftware(nGame, &dev->devclass, i)))
524            {
525               MessSpecifyImage(nGame, &devclass, i, NULL);
526               break;
527            }
528         }
529      }
530
531      devices_free(devices);
532   }
533}
534
535
536
537void MessReadMountedSoftware(int nGame)
538{
539   // First read stuff into device view
540   DevView_Refresh(GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW));
541
542   // Now read stuff into picker
543   MessRefreshPicker(nGame);
544}
545
546
547
548static void MessRefreshPicker(int nGame)
549{
550   HWND hwndSoftware;
551   int i, id;
552   LVFINDINFO lvfi;
553   const game_driver *pDriver;
554   const struct IODevice *pDeviceList;
555   const struct IODevice *pDevice;
556   LPCSTR pszSoftware;
557
558   hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST);
559   pDriver = drivers[nGame];
560   pDeviceList = devices_allocate(pDriver);
561   if (!pDeviceList)
562      goto done;
563
564   s_bIgnoreSoftwarePickerNotifies = TRUE;
565
566   // Now clear everything out; this may call back into us but it should not
567   // be problematic
568   ListView_SetItemState(hwndSoftware, -1, 0, LVIS_SELECTED);
569
570   for (pDevice = pDeviceList; pDevice->type < IO_COUNT; pDevice++)
571   {
572      for (id = 0; id < pDevice->count; id++)
573      {
574         pszSoftware = GetSelectedSoftware(nGame, &pDevice->devclass, id);
575         if (pszSoftware && *pszSoftware)
576         {
577            i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
578            if (i < 0)
579            {
580               SoftwarePicker_AddFile(hwndSoftware, pszSoftware);
581               i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
582            }
583            if (i >= 0)
584            {
585               memset(&lvfi, 0, sizeof(lvfi));
586               lvfi.flags = LVFI_PARAM;
587               lvfi.lParam = i;
588               i = ListView_FindItem(hwndSoftware, -1, &lvfi);
589               ListView_SetItemState(hwndSoftware, i, LVIS_SELECTED, LVIS_SELECTED);
590            }
591         }
592      }
593   }
594
595
596done:
597   devices_free(pDeviceList);
598   s_bIgnoreSoftwarePickerNotifies = FALSE;
599}
600
601
602
603void InitMessPicker(void)
604{
605   struct PickerOptions opts;
606   HWND hwndSoftware;
607
608   s_nGame = -1;
609   hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST);
610
611   memset(&opts, 0, sizeof(opts));
612   opts.pCallbacks = &s_softwareListCallbacks;
613   opts.nColumnCount = MESS_COLUMN_MAX;
614   opts.ppszColumnNames = mess_column_names;
615   SetupSoftwarePicker(hwndSoftware, &opts);
616
617   SetWindowLong(hwndSoftware, GWL_STYLE, GetWindowLong(hwndSoftware, GWL_STYLE)
618      | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED);
619
620   SetupSoftwareTabView();
621
622   {
623      static const struct DevViewCallbacks s_devViewCallbacks =
624      {
625         DevView_GetOpenFileName,
626         DevView_GetCreateFileName,
627         DevView_SetSelectedSoftware,
628         DevView_GetSelectedSoftware
629      };
630      DevView_SetCallbacks(GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW), &s_devViewCallbacks);
631   }
632}
633
634
635
636// ------------------------------------------------------------------------
637// Open others dialog
638// ------------------------------------------------------------------------
639
640typedef struct
641{
642   const struct IODevice *dev;
643    const char *ext;
644} mess_image_type;
645
646static BOOL CommonFileImageDialog(LPTSTR the_last_directory, common_file_dialog_proc cfd, LPTSTR filename, mess_image_type *imagetypes)
647{
648    BOOL success;
649    OPENFILENAME of;
650    char szFilter[2048];
651    LPSTR s;
652   const char *typname;
653    int i;
654    TCHAR* t_filter;
655    TCHAR* t_buffer;
656
657   s = szFilter;
658    *filename = 0;
659
660    // Common image types
661    strcpy(s, "Common image types");
662    s += strlen(s);
663    *(s++) = '|';
664    for (i = 0; imagetypes[i].ext; i++)
665   {
666        *(s++) = '*';
667        *(s++) = '.';
668        strcpy(s, imagetypes[i].ext);
669        s += strlen(s);
670        *(s++) = ';';
671    }
672    *(s++) = '|';
673
674    // All files
675    strcpy(s, "All files (*.*)");
676    s += strlen(s);
677    *(s++) = '|';
678    strcpy(s, "*.*");
679    s += strlen(s);
680    *(s++) = '|';
681
682    // The others
683    for (i = 0; imagetypes[i].ext; i++)
684   {
685      if (!imagetypes[i].dev)
686         typname = "Compressed images";
687      else
688         typname = lookupdevice(imagetypes[i].dev->type)->dlgname;
689
690        strcpy(s, typname);
691        s += strlen(s);
692        strcpy(s, " (*.");
693        s += strlen(s);
694        strcpy(s, imagetypes[i].ext);
695        s += strlen(s);
696        *(s++) = ')';
697        *(s++) = '|';
698        *(s++) = '*';
699        *(s++) = '.';
700        strcpy(s, imagetypes[i].ext);
701        s += strlen(s);
702        *(s++) = '|';
703    }
704    *(s++) = '|';
705   
706    t_buffer = tstring_from_utf8(szFilter);
707    if( !t_buffer )
708       return FALSE;
709
710   // convert a pipe-char delimited string into a NUL delimited string
711   t_filter = (LPTSTR) alloca((_tcslen(t_buffer) + 2) * sizeof(*t_filter));
712   for (i = 0; t_buffer[i] != '\0'; i++)
713      t_filter[i] = (t_buffer[i] != '|') ? t_buffer[i] : '\0';
714   t_filter[i++] = '\0';
715   t_filter[i++] = '\0';
716   free(t_buffer);
717
718    of.lStructSize = sizeof(of);
719    of.hwndOwner = GetMainWindow();
720    of.hInstance = NULL;
721    of.lpstrFilter = t_filter;
722    of.lpstrCustomFilter = NULL;
723    of.nMaxCustFilter = 0;
724    of.nFilterIndex = 1;
725    of.lpstrFile = filename;
726    of.nMaxFile = MAX_PATH;
727    of.lpstrFileTitle = NULL;
728    of.nMaxFileTitle = 0;
729    of.lpstrInitialDir = last_directory;
730    of.lpstrTitle = NULL;
731    of.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
732    of.nFileOffset = 0;
733    of.nFileExtension = 0;
734    of.lpstrDefExt = TEXT("rom");
735    of.lCustData = 0;
736    of.lpfnHook = NULL;
737    of.lpTemplateName = NULL;
738
739    success = cfd(&of);
740    if (success)
741    {
742        //GetDirectory(filename,last_directory,sizeof(last_directory));
743    }
744   
745    return success;
746}
747
748
749
750/* Specify IO_COUNT for type if you want all types */
751static void SetupImageTypes(const struct IODevice *devices, mess_image_type *types, int count, BOOL bZip, int type)
752{
753    int num_extensions = 0;
754   int devindex;
755
756   memset(types, 0, sizeof(*types) * count);
757    count--;
758
759    if (bZip)
760   {
761      types[num_extensions].ext = "zip";
762      types[num_extensions].dev = NULL;
763      num_extensions++;
764    }
765
766   if (devices != NULL)
767   {
768      for (devindex = 0; devices[devindex].type < IO_COUNT; devindex++)
769      {
770         if (devices[devindex].type != IO_PRINTER)
771         {
772            const char *ext = devices[devindex].file_extensions;
773            if (ext)
774            {
775               while(*ext)
776               {
777                  if ((type == IO_COUNT) || (type == devices[devindex].type))
778                  {
779                     if (num_extensions < count)
780                     {
781                        types[num_extensions].dev = &devices[devindex];
782                        types[num_extensions].ext = ext;
783                        num_extensions++;
784                     }
785                  }
786                  ext += strlen(ext) + 1;
787               }
788            }
789         }
790      }
791   }
792}
793
794
795
796static void MessSetupDevice(common_file_dialog_proc cfd, int iDevice)
797{
798   TCHAR filename[MAX_PATH];
799   mess_image_type imagetypes[64];
800   int nGame;
801   HWND hwndList;
802   char* utf8_filename;
803   const struct IODevice *devices;
804
805   begin_resource_tracking();
806
807   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
808   nGame = Picker_GetSelectedItem(hwndList);
809   devices = devices_allocate(drivers[nGame]);
810   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, iDevice);
811
812   if (CommonFileImageDialog(last_directory, cfd, filename, imagetypes))
813   {
814      utf8_filename = utf8_from_tstring(filename);
815      if( !utf8_filename )
816         return;
817      // TODO - this should go against InternalSetSelectedSoftware()
818      SoftwarePicker_AddFile(GetDlgItem(GetMainWindow(), IDC_SWLIST), utf8_filename);
819      free(utf8_filename);
820   }
821
822   if (devices != NULL)
823      devices_free(devices);
824}
825
826
827
828static void MessOpenOtherSoftware(int iDevice)
829{
830   MessSetupDevice(GetOpenFileName, iDevice);
831}
832
833
834
835static void MessCreateDevice(int iDevice)
836{
837   MessSetupDevice(GetSaveFileName, iDevice);
838}
839
840
841
842static BOOL DevView_GetOpenFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength)
843{
844   BOOL bResult;
845   mess_image_type imagetypes[64];
846   HWND hwndList;
847   int gamenum;
848   const struct IODevice *devices;
849
850   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
851   gamenum = Picker_GetSelectedItem(hwndList);
852   devices = devices_allocate(drivers[gamenum]);
853   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, dev->type);
854   bResult = CommonFileImageDialog(last_directory, GetOpenFileName, pszFilename, imagetypes);
855
856   if (devices != NULL)
857      devices_free(devices);
858   return bResult;
859}
860
861
862
863static BOOL DevView_GetCreateFileName(HWND hwndDevView, const struct IODevice *dev, LPTSTR pszFilename, UINT nFilenameLength)
864{
865   BOOL bResult;
866   mess_image_type imagetypes[64];
867   HWND hwndList;
868   int gamenum;
869   const struct IODevice *devices;
870
871   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
872   gamenum = Picker_GetSelectedItem(hwndList);
873   devices = devices_allocate(drivers[gamenum]);
874   SetupImageTypes(devices, imagetypes, sizeof(imagetypes) / sizeof(imagetypes[0]), TRUE, dev->type);
875   bResult = CommonFileImageDialog(last_directory, GetSaveFileName, pszFilename, imagetypes);
876
877   if (devices != NULL)
878      devices_free(devices);
879   return bResult;
880}
881
882
883
884static void DevView_SetSelectedSoftware(HWND hwndDevView, int nGame,
885   const struct IODevice *dev, int nID, LPCTSTR pszFilename)
886{
887   char* utf8_filename = utf8_from_tstring(pszFilename);
888   if( !utf8_filename )
889      return;
890   MessSpecifyImage(nGame, &dev->devclass, nID, utf8_filename);
891   MessRefreshPicker(nGame);
892   free(utf8_filename);
893}
894
895
896
897static LPCTSTR DevView_GetSelectedSoftware(HWND hwndDevView, int nDriverIndex,
898   const struct IODevice *dev, int nID, LPTSTR pszBuffer, UINT nBufferLength)
899{
900   LPCTSTR t_buffer = NULL;
901   TCHAR* t_s;
902   LPCSTR s = GetSelectedSoftware(nDriverIndex, &dev->devclass, nID);
903   
904   t_s = tstring_from_utf8(s);
905   if( !t_s )
906      return t_buffer;
907   
908   _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s);
909   free(t_s);   
910   t_buffer = pszBuffer;
911   
912   return t_buffer;
913}
914
915
916
917// ------------------------------------------------------------------------
918// Software List Class
919// ------------------------------------------------------------------------
920
921static int SoftwarePicker_GetItemImage(HWND hwndPicker, int nItem)
922{
923    int nType;
924    int nIcon;
925   int nGame;
926   const char *icon_name;
927   HWND hwndGamePicker;
928   HWND hwndSoftwarePicker;
929
930   hwndGamePicker = GetDlgItem(GetMainWindow(), IDC_LIST);
931   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
932   nGame = Picker_GetSelectedItem(hwndGamePicker);
933    nType = SoftwarePicker_GetImageType(hwndSoftwarePicker, nItem);
934    nIcon = GetMessIcon(nGame, nType);
935    if (!nIcon)
936   {
937      if (nType < 0)
938         nType = IO_BAD;
939      switch(nType)
940      {
941         case IO_UNKNOWN:
942            // Unknowns
943            nIcon = FindIconIndex(IDI_WIN_UNKNOWN);
944            break;
945
946         case IO_BAD:
947         case IO_ZIP:
948            // Bad files
949            nIcon = FindIconIndex(IDI_WIN_REDX);
950            break;
951
952         default:
953            icon_name = lookupdevice(nType)->icon_name;
954            if (!icon_name)
955               icon_name = device_typename(nType);
956            nIcon = FindIconIndexByName(icon_name);
957            if (nIcon < 0)
958               nIcon = FindIconIndexByName("unknown");
959            break;
960      }
961    }
962    return nIcon;
963}
964
965
966
967static void SoftwarePicker_LeavingItem(HWND hwndSoftwarePicker, int nItem)
968{
969   int nGame;
970   device_class devclass;
971   LPCSTR pszFullName;
972   HWND hwndList;
973
974   if (!s_bIgnoreSoftwarePickerNotifies)
975   {
976      hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
977      nGame = Picker_GetSelectedItem(hwndList);
978      devclass = SoftwarePicker_LookupDevice(hwndSoftwarePicker, nItem);
979      pszFullName = SoftwarePicker_LookupFilename(hwndSoftwarePicker, nItem);
980
981      MessRemoveImage(nGame, devclass, pszFullName);
982   }
983}
984
985
986
987static void SoftwarePicker_EnteringItem(HWND hwndSoftwarePicker, int nItem)
988{
989   LPCSTR pszFullName;
990   LPCSTR pszName;
991   LPSTR s;
992   int nGame;
993   device_class devclass;
994   HWND hwndList;
995
996   hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
997
998   if (!s_bIgnoreSoftwarePickerNotifies)
999   {
1000      nGame = Picker_GetSelectedItem(hwndList);
1001
1002      // Get the fullname and partialname for this file
1003      pszFullName = SoftwarePicker_LookupFilename(hwndSoftwarePicker, nItem);
1004      s = strchr(pszFullName, '\\');
1005      pszName = s ? s + 1 : pszFullName;
1006
1007      // Do the dirty work
1008      devclass = SoftwarePicker_LookupDevice(hwndSoftwarePicker, nItem);
1009      if (!devclass.gamedrv)
1010         return;
1011      MessSpecifyImage(nGame, &devclass, -1, pszFullName);
1012
1013      // Set up s_szSelecteItem, for the benefit of UpdateScreenShot()
1014      strncpyz(g_szSelectedItem, pszName, sizeof(g_szSelectedItem) / sizeof(g_szSelectedItem[0]));
1015      s = strrchr(g_szSelectedItem, '.');
1016      if (s)
1017         *s = '\0';
1018
1019      UpdateScreenShot();
1020   }
1021}
1022
1023
1024
1025// ------------------------------------------------------------------------
1026// Header context menu stuff
1027// ------------------------------------------------------------------------
1028
1029static HWND MyColumnDialogProc_hwndPicker;
1030static int *MyColumnDialogProc_order;
1031static int *MyColumnDialogProc_shown;
1032
1033static void MyGetRealColumnOrder(int *order)
1034{
1035   int i, nColumnCount;
1036   nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1037   for (i = 0; i < nColumnCount; i++)
1038      order[i] = Picker_GetRealColumnFromViewColumn(MyColumnDialogProc_hwndPicker, i);
1039}
1040
1041
1042
1043static void MyGetColumnInfo(int *order, int *shown)
1044{
1045   const struct PickerCallbacks *pCallbacks;
1046   pCallbacks = Picker_GetCallbacks(MyColumnDialogProc_hwndPicker);
1047   pCallbacks->pfnGetColumnOrder(order);
1048   pCallbacks->pfnGetColumnShown(shown);
1049}
1050
1051
1052
1053static void MySetColumnInfo(int *order, int *shown)
1054{
1055   const struct PickerCallbacks *pCallbacks;
1056   pCallbacks = Picker_GetCallbacks(MyColumnDialogProc_hwndPicker);
1057   pCallbacks->pfnSetColumnOrder(order);
1058   pCallbacks->pfnSetColumnShown(shown);
1059}
1060
1061
1062
1063static INT_PTR CALLBACK MyColumnDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
1064{
1065   INT_PTR result = 0;
1066   int nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1067   LPCTSTR *ppszColumnNames = Picker_GetColumnNames(MyColumnDialogProc_hwndPicker);
1068   
1069   result = InternalColumnDialogProc(hDlg, Msg, wParam, lParam, nColumnCount,
1070      MyColumnDialogProc_shown, MyColumnDialogProc_order, ppszColumnNames,
1071      MyGetRealColumnOrder, MyGetColumnInfo, MySetColumnInfo);
1072     
1073   return result;
1074}
1075
1076
1077
1078static BOOL RunColumnDialog(HWND hwndPicker)
1079{
1080   BOOL bResult;
1081   int nColumnCount;
1082
1083   MyColumnDialogProc_hwndPicker = hwndPicker;
1084   nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
1085
1086   MyColumnDialogProc_order = alloca(nColumnCount * sizeof(int));
1087   MyColumnDialogProc_shown = alloca(nColumnCount * sizeof(int));
1088   bResult = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_COLUMNS), GetMainWindow(), MyColumnDialogProc);
1089   return bResult;
1090}
1091
1092
1093
1094static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn)
1095{
1096   HMENU hMenu;
1097   HMENU hMenuLoad;
1098   HWND hwndPicker;
1099   int nMenuItem;
1100
1101   hMenuLoad = LoadMenu(NULL, MAKEINTRESOURCE(IDR_CONTEXT_HEADER));
1102   hMenu = GetSubMenu(hMenuLoad, 0);
1103
1104   nMenuItem = (int) TrackPopupMenu(hMenu,
1105      TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
1106      pt.x,
1107      pt.y,
1108      0,
1109      GetMainWindow(),
1110      NULL);
1111
1112   DestroyMenu(hMenuLoad);
1113
1114   hwndPicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1115
1116   switch(nMenuItem) {
1117   case ID_SORT_ASCENDING:
1118      SetMessSortReverse(FALSE);
1119      SetMessSortColumn(Picker_GetRealColumnFromViewColumn(hwndPicker, nColumn));
1120      Picker_Sort(hwndPicker);
1121      break;
1122
1123   case ID_SORT_DESCENDING:
1124      SetMessSortReverse(TRUE);
1125      SetMessSortColumn(Picker_GetRealColumnFromViewColumn(hwndPicker, nColumn));
1126      Picker_Sort(hwndPicker);
1127      break;
1128
1129   case ID_CUSTOMIZE_FIELDS:
1130      if (RunColumnDialog(hwndPicker))
1131         Picker_ResetColumnDisplay(hwndPicker);
1132      break;
1133   }
1134}
1135
1136
1137
1138// ------------------------------------------------------------------------
1139// MessCommand
1140// ------------------------------------------------------------------------
1141
1142BOOL MessCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify)
1143{
1144   switch (id) {
1145   case ID_MESS_OPEN_SOFTWARE:
1146      MessOpenOtherSoftware(IO_COUNT);
1147      break;
1148
1149   case ID_MESS_CREATE_SOFTWARE:
1150      MessCreateDevice(IO_COUNT);
1151      break;
1152
1153#ifdef MAME_DEBUG
1154   case ID_MESS_RUN_TESTS:
1155      MessTestsBegin();
1156      break;
1157#endif /* MAME_DEBUG */
1158   }
1159   return FALSE;
1160}
1161
1162
1163
1164// ------------------------------------------------------------------------
1165// Software Tab View
1166// ------------------------------------------------------------------------
1167
1168static LPCSTR s_tabs[] =
1169{
1170   "picker\0Picker",
1171   "devview\0Device View"
1172};
1173
1174
1175
1176static LPCSTR SoftwareTabView_GetTabShortName(int tab)
1177{
1178   return s_tabs[tab];
1179}
1180
1181
1182
1183static LPCSTR SoftwareTabView_GetTabLongName(int tab)
1184{
1185   return s_tabs[tab] + strlen(s_tabs[tab]) + 1;
1186}
1187
1188
1189
1190static void SoftwareTabView_OnSelectionChanged(void)
1191{
1192   int nTab;
1193   HWND hwndSoftwarePicker;
1194   HWND hwndSoftwareDevView;
1195
1196   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1197   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
1198
1199   nTab = TabView_GetCurrentTab(GetDlgItem(GetMainWindow(), IDC_SWTAB));
1200
1201   switch(nTab)
1202   {
1203      case 0:
1204         ShowWindow(hwndSoftwarePicker, SW_SHOW);
1205         ShowWindow(hwndSoftwareDevView, SW_HIDE);
1206         break;
1207
1208      case 1:
1209         ShowWindow(hwndSoftwarePicker, SW_HIDE);
1210         ShowWindow(hwndSoftwareDevView, SW_SHOW);
1211         break;
1212   }
1213}
1214
1215
1216
1217static void SoftwareTabView_OnMoveSize(void)
1218{
1219   HWND hwndSoftwareTabView;
1220   HWND hwndSoftwarePicker;
1221   HWND hwndSoftwareDevView;
1222   RECT rMain, rSoftwareTabView, rClient, rTab;
1223
1224   hwndSoftwareTabView = GetDlgItem(GetMainWindow(), IDC_SWTAB);
1225   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
1226   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
1227
1228   GetWindowRect(hwndSoftwareTabView, &rSoftwareTabView);
1229   GetClientRect(GetMainWindow(), &rMain);
1230   ClientToScreen(GetMainWindow(), &((POINT *) &rMain)[0]);
1231   ClientToScreen(GetMainWindow(), &((POINT *) &rMain)[1]);
1232
1233   // Calculate rClient from rSoftwareTabView in terms of rMain coordinates
1234   rClient.left = rSoftwareTabView.left - rMain.left;
1235   rClient.top = rSoftwareTabView.top - rMain.top;
1236   rClient.right = rSoftwareTabView.right - rMain.left;
1237   rClient.bottom = rSoftwareTabView.bottom - rMain.top;
1238
1239   // If the tabs are visible, then make sure that the tab view's tabs are
1240   // not being covered up
1241   if (GetWindowLong(hwndSoftwareTabView, GWL_STYLE) & WS_VISIBLE)
1242   {
1243      TabCtrl_GetItemRect(hwndSoftwareTabView, 0, &rTab);
1244      rClient.top += rTab.bottom - rTab.top + 4;
1245   }
1246
1247   /* Now actually move the controls */
1248   MoveWindow(hwndSoftwarePicker, rClient.left, rClient.top,
1249      rClient.right - rClient.left, rClient.bottom - rClient.top,
1250      TRUE);
1251   MoveWindow(hwndSoftwareDevView, rClient.left, rClient.top,
1252      rClient.right - rClient.left, rClient.bottom - rClient.top,
1253      TRUE);
1254}
1255
1256
1257
1258static void SetupSoftwareTabView(void)
1259{
1260   struct TabViewOptions opts;
1261
1262   memset(&opts, 0, sizeof(opts));
1263   opts.pCallbacks = &s_softwareTabViewCallbacks;
1264   opts.nTabCount = sizeof(s_tabs) / sizeof(s_tabs[0]);
1265
1266   SetupTabView(GetDlgItem(GetMainWindow(), IDC_SWTAB), &opts);
1267}
1268
1269
1270
1271void MessCopyDeviceOption(core_options *opts, const game_driver *gamedrv, const device_class *devclass, int device_index, int global_index)
1272{
1273   const char *dev_name;
1274   const char *opt_value;
1275
1276   dev_name = device_instancename(devclass, device_index);
1277   opt_value = options_get_string(opts, dev_name);
1278   options_set_string(mame_options(), dev_name, opt_value, OPTION_PRIORITY_CMDLINE);
1279}
1280
1281
1282
1283// ------------------------------------------------------------------------
1284// MessUI Diagnostics
1285// ------------------------------------------------------------------------
1286
1287#ifdef MAME_DEBUG
1288
1289static int s_nOriginalPick;
1290static UINT_PTR s_nTestingTimer;
1291static BOOL s_bInTimerProc;
1292
1293static void MessTestsColumns(void)
1294{
1295   int i, j;
1296   int oldshown[MESS_COLUMN_MAX];
1297   int shown[MESS_COLUMN_MAX];
1298
1299   GetMessColumnShown(oldshown);
1300
1301   shown[0] = 1;
1302   for (i = 0; i < (1<<(MESS_COLUMN_MAX-1)); i++)
1303   {
1304      for (j = 1; j < MESS_COLUMN_MAX; j++)
1305         shown[j] = (i & (1<<(j-1))) ? 1 : 0;
1306
1307      SetMessColumnShown(shown);
1308      Picker_ResetColumnDisplay(GetDlgItem(GetMainWindow(), IDC_SWLIST));
1309   }
1310
1311   SetMessColumnShown(oldshown);
1312   Picker_ResetColumnDisplay(GetDlgItem(GetMainWindow(), IDC_SWLIST));
1313}
1314
1315
1316
1317
1318static void CALLBACK MessTestsTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
1319{
1320   int nNewGame;
1321   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
1322
1323   // if either of the pickers have further idle work to do, or we are
1324   // already in this timerproc, do not do anything
1325   if (s_bInTimerProc || Picker_IsIdling(hwndList)
1326      || Picker_IsIdling(GetDlgItem(GetMainWindow(), IDC_SWLIST)))
1327      return;
1328   s_bInTimerProc = TRUE;
1329
1330   nNewGame = GetSelectedPick() + 1;
1331
1332   if (nNewGame >= driver_list_get_count(drivers))
1333   {
1334      /* We are done */
1335      Picker_SetSelectedPick(hwndList, s_nOriginalPick);
1336
1337      KillTimer(NULL, s_nTestingTimer);
1338      s_nTestingTimer = 0;
1339
1340      win_message_box_utf8(GetMainWindow(), "Tests successfully completed!", MAMEUINAME, MB_OK);
1341   }
1342   else
1343   {
1344//      MessTestsFlex(GetDlgItem(GetMainWindow(), IDC_SWLIST), drivers[Picker_GetSelectedItem(hwndList)]);
1345      Picker_SetSelectedPick(hwndList, nNewGame);
1346   }
1347   s_bInTimerProc = FALSE;
1348}
1349
1350
1351
1352static void MessTestsBegin(void)
1353{
1354   int nOriginalPick;
1355   HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
1356
1357   nOriginalPick = GetSelectedPick();
1358
1359   // If we are not currently running tests, set up the timer and keep track
1360   // of the original selected pick item
1361   if (!s_nTestingTimer)
1362   {
1363      s_nTestingTimer = SetTimer(NULL, 0, 50, MessTestsTimerProc);
1364      if (!s_nTestingTimer)
1365         return;
1366      s_nOriginalPick = nOriginalPick;
1367   }
1368
1369   MessTestsColumns();
1370
1371   if (nOriginalPick == 0)
1372      Picker_SetSelectedPick(hwndList, 1);
1373   Picker_SetSelectedPick(hwndList, 0);
1374}
1375
1376
1377
1378#endif // MAME_DEBUG
src/mess/osd/winui/devview.c
r1367r1368
1919#include "uitext.h"
2020#include "strconv.h"
2121#include "winutf8.h"
22#include "m32util.h"
22#include "mui_util.h"
2323
2424#define DEVVIEW_PADDING   10
2525
src/mess/osd/winui/messui.h
r0r1368
1#ifndef __MESSUI_H__
2#define __MESSUI_H__
3
4#include "driver.h"
5#include "resourcems.h"
6#include "devview.h"
7#include "uitext.h"
8#include "options.h"
9
10extern char g_szSelectedItem[MAX_PATH];
11
12void InitMessPicker(void);
13void MessUpdateSoftwareList(void);
14void MyFillSoftwareList(int nGame, BOOL bForce);
15BOOL MessCommand(HWND hwnd,int id, HWND hwndCtl, UINT codeNotify);
16void MessReadMountedSoftware(int nGame);
17BOOL CreateMessIcons(void);
18BOOL MessApproveImageList(HWND hParent, int nDriver);
19
20void MessCopyDeviceOption(core_options *opts, const game_driver *gamedrv, const device_class *devclass, int device_index, int global_index);
21
22#endif // __MESSUI_H__
src/mess/osd/winui/msuiutil.c
r0r1368
1#include "driver.h"
2#include "device.h"
3#include "msuiutil.h"
4
5BOOL DriverIsComputer(int driver_index)
6{
7   return (drivers[driver_index]->flags & GAME_COMPUTER) != 0;
8}
9
10BOOL DriverIsModified(int driver_index)
11{
12   return (drivers[driver_index]->flags & GAME_COMPUTER_MODIFIED) != 0;
13}
14
15BOOL DriverUsesMouse(int driver_index)
16{
17   const input_port_entry *input_ports;
18   BOOL retval = FALSE;
19
20   if (drivers[driver_index]->ipt)
21   {
22      begin_resource_tracking();
23      input_ports = input_port_allocate(drivers[driver_index]->ipt, NULL);
24
25      while (input_ports->type != IPT_END)
26      {
27         if (input_ports->type == IPT_MOUSE_X || input_ports->type == IPT_MOUSE_Y)
28         {
29            retval = TRUE;
30            break;
31         }
32         input_ports++;
33      }
34
35      end_resource_tracking();
36   }
37
38   return retval;
39}
40
41BOOL DriverHasDevice(const game_driver *gamedrv, iodevice_t type)
42{
43   BOOL b;
44   const struct IODevice *devices;
45
46   devices = devices_allocate(gamedrv);
47   b = device_find(devices, IO_PRINTER) ? TRUE : FALSE;
48   devices_free(devices);
49   return b;
50}
51
52
src/mess/osd/winui/layoutms.c
r1367r1368
1717
1818#include "bitmask.h"
1919#include "TreeView.h"
20#include "M32Util.h"
20#include "mui_util.h"
2121#include "resource.h"
2222#include "directories.h"
23#include "m32opts.h"
23#include "mui_opts.h"
2424#include "splitters.h"
2525#include "help.h"
26#include "audit32.h"
26#include "mui_audit.h"
2727#include "screenshot.h"
28#include "win32ui.h"
28#include "winui.h"
2929#include "properties.h"
3030
31#include "ms32util.h"
31#include "msuiutil.h"
3232#include "resourcems.h"
3333#include "propertiesms.h"
3434
src/mess/osd/winui/msuiutil.h
r0r1368
1#ifndef MSUIUTIL_H
2#define MSUIUTIL_H
3
4#include <windows.h>
5
6BOOL DriverIsComputer(int driver_index);
7BOOL DriverIsModified(int driver_index);
8BOOL DriverUsesMouse(int driver_index);
9BOOL DriverHasDevice(const game_driver *gamedrv, iodevice_t type);
10
11#endif /* MSUIUTIL_H */
12
src/mess/osd/winui/messui.rc
r0r1368
1#include "resource.h"
2#include "resourcems.h"
3#include "windows.h"
4#include "commctrl.h"
5
6/////////////////////////////////////////////////////////////////////////////
7//
8// Dialog
9//
10
11IDD_PROP_SOFTWARE DIALOGEX 0, 0, 220, 220
12STYLE WS_CHILD | WS_CAPTION
13CAPTION "Software"
14FONT 8, "MS Sans Serif"
15BEGIN
16    ICON            IDI_WIN_FLOP,IDC_STATIC,20,10,20,20
17    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
18                    SS_NOPREFIX
19    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
20    LTEXT           "Additional directories:",IDC_STATIC,7,40,157,8
21    CONTROL         "List1",IDC_DIR_LIST,"SysListView32",LVS_REPORT |
22                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS |
23                    LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER |
24                    WS_TABSTOP,7,50,206,120
25    PUSHBUTTON      "Browse...",IDC_DIR_BROWSE,7,180,50,14
26    PUSHBUTTON      "Insert",IDC_DIR_INSERT,85,180,50,14
27    PUSHBUTTON      "Delete",IDC_DIR_DELETE,163,180,50,14
28END
29
30
31IDD_PROP_CONFIGURATION DIALOGEX 0, 0, 220, 220
32STYLE WS_CHILD | WS_CAPTION
33CAPTION "Configuration"
34FONT 8, "MS Sans Serif"
35BEGIN
36    ICON            IDI_MAMEUI_ICON,IDC_STATIC,20,10,20,20
37    LTEXT           "Title\nDirectory\nExtra",IDC_PROP_TITLE,52,9,161,25,
38                    SS_NOPREFIX
39    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,20,38,178,1
40    LTEXT           "RAM size",IDC_RAM_CAPTION,20,50,50,10
41    COMBOBOX        IDC_RAM_COMBOBOX,70,50,100,76,CBS_DROPDOWNLIST | WS_VSCROLL |
42                    WS_TABSTOP
43END
44
45/////////////////////////////////////////////////////////////////////////////
46
47#include "mameui.rc"
src/mess/osd/winui/softwarepicker.c
r1367r1368
2323#include "picker.h"
2424#include "screenshot.h"
2525#include "bitmask.h"
26#include "mame32.h"
26#include "winui.h"
2727#include "resourcems.h"
28#include "m32opts.h"
28#include "mui_opts.h"
2929#include "softwarepicker.h"
30#include "m32util.h"
30#include "mui_util.h"
3131
3232
3333
r1367r1368
212212      {
213213         while(pDriver && !pPickerInfo->pHashFile)
214214         {
215            pPickerInfo->pHashFile = hashfile_open_options(Mame32Global(), pDriver->name, TRUE, pPickerInfo->pfnErrorProc);
215            pPickerInfo->pHashFile = hashfile_open_options(MameUIGlobal(), pDriver->name, TRUE, pPickerInfo->pfnErrorProc);
216216            pDriver = mess_next_compatible_driver(pDriver);
217217         }
218218      }
src/mess/osd/winui/optionsms.c
r1367r1368
99#include <winuser.h>
1010#include <tchar.h>
1111
12#include "m32util.h"
13#include "m32opts.h"
12#include "mui_util.h"
13#include "mui_opts.h"
1414#include "optionsms.h"
1515#include "emuopts.h"
1616#include "driver.h"
r1367r1368
6363{
6464   char column_order_string[10000];
6565   ColumnEncodeStringWithCount(order, column_order_string, MESS_COLUMN_MAX);
66   options_set_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_ORDER, column_order_string, OPTION_PRIORITY_CMDLINE);
66   options_set_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_ORDER, column_order_string, OPTION_PRIORITY_CMDLINE);
6767}
6868
6969void GetMessColumnOrder(int order[])
7070{
7171   const char *column_order_string;
72   column_order_string = options_get_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_ORDER);
72   column_order_string = options_get_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_ORDER);
7373   ColumnDecodeStringWithCount(column_order_string, order, MESS_COLUMN_MAX);
7474}
7575
r1367r1368
7777{
7878   char column_shown_string[10000];
7979   ColumnEncodeStringWithCount(shown, column_shown_string, MESS_COLUMN_MAX);
80   options_set_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_SHOWN, column_shown_string, OPTION_PRIORITY_CMDLINE);
80   options_set_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_SHOWN, column_shown_string, OPTION_PRIORITY_CMDLINE);
8181}
8282
8383void GetMessColumnShown(int shown[])
8484{
8585   const char *column_shown_string;
86   column_shown_string = options_get_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_SHOWN);
86   column_shown_string = options_get_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_SHOWN);
8787   ColumnDecodeStringWithCount(column_shown_string, shown, MESS_COLUMN_MAX);
8888}
8989
r1367r1368
9191{
9292   char column_width_string[10000];
9393   ColumnEncodeStringWithCount(width, column_width_string, MESS_COLUMN_MAX);
94   options_set_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_WIDTHS, column_width_string, OPTION_PRIORITY_CMDLINE);
94   options_set_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_WIDTHS, column_width_string, OPTION_PRIORITY_CMDLINE);
9595}
9696
9797void GetMessColumnWidths(int width[])
9898{
9999   const char *column_width_string;
100   column_width_string = options_get_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_COLUMN_WIDTHS);
100   column_width_string = options_get_string(MameUISettings(), WINGUIOPTION_SOFTWARE_COLUMN_WIDTHS);
101101   ColumnDecodeStringWithCount(column_width_string, width, MESS_COLUMN_MAX);
102102}
103103
104104void SetMessSortColumn(int column)
105105{
106   options_set_int(Mame32Settings(), WINGUIOPTION_SOFTWARE_SORT_COLUMN, column, OPTION_PRIORITY_CMDLINE);
106   options_set_int(MameUISettings(), WINGUIOPTION_SOFTWARE_SORT_COLUMN, column, OPTION_PRIORITY_CMDLINE);
107107}
108108
109109int GetMessSortColumn(void)
110110{
111   return options_get_int(Mame32Settings(), WINGUIOPTION_SOFTWARE_SORT_COLUMN);
111   return options_get_int(MameUISettings(), WINGUIOPTION_SOFTWARE_SORT_COLUMN);
112112}
113113
114114void SetMessSortReverse(BOOL reverse)
115115{
116   options_set_bool(Mame32Settings(), WINGUIOPTION_SOFTWARE_SORT_REVERSED, reverse, OPTION_PRIORITY_CMDLINE);
116   options_set_bool(MameUISettings(), WINGUIOPTION_SOFTWARE_SORT_REVERSED, reverse, OPTION_PRIORITY_CMDLINE);
117117}
118118
119119BOOL GetMessSortReverse(void)
120120{
121   return options_get_bool(Mame32Settings(), WINGUIOPTION_SOFTWARE_SORT_REVERSED);
121   return options_get_bool(MameUISettings(), WINGUIOPTION_SOFTWARE_SORT_REVERSED);
122122}
123123
124124const char* GetSoftwareDirs(void)
125125{
126   return options_get_string(Mame32Settings(), WINGUIOPTION_SOFTWAREPATH);
126   return options_get_string(MameUISettings(), WINGUIOPTION_SOFTWAREPATH);
127127}
128128
129129void SetSoftwareDirs(const char* paths)
130130{
131   options_set_string(Mame32Settings(), WINGUIOPTION_SOFTWAREPATH, paths, OPTION_PRIORITY_CMDLINE);
131   options_set_string(MameUISettings(), WINGUIOPTION_SOFTWAREPATH, paths, OPTION_PRIORITY_CMDLINE);
132132}
133133
134134const char *GetHashDirs(void)
135135{
136   return options_get_string(Mame32Global(), OPTION_HASHPATH);
136   return options_get_string(MameUIGlobal(), OPTION_HASHPATH);
137137}
138138
139139void SetHashDirs(const char *paths)
140140{
141   options_set_string(Mame32Global(), OPTION_HASHPATH, paths, OPTION_PRIORITY_CMDLINE);
141   options_set_string(MameUIGlobal(), OPTION_HASHPATH, paths, OPTION_PRIORITY_CMDLINE);
142142}
143143
144144void SetSelectedSoftware(int driver_index, const device_class *devclass, int device_inst, const char *software)
r1367r1368
178178   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
179179
180180   snprintf(opt_name, ARRAY_LENGTH(opt_name), "%s_extra_software", drivers[driver_index]->name);
181   options_set_string(Mame32Settings(), opt_name, extra_paths, OPTION_PRIORITY_CMDLINE);
181   options_set_string(MameUISettings(), opt_name, extra_paths, OPTION_PRIORITY_CMDLINE);
182182}
183183
184184const char *GetExtraSoftwarePaths(int driver_index)
r1367r1368
189189   assert(0 <= driver_index && driver_index < driver_list_get_count(drivers));
190190
191191   snprintf(opt_name, ARRAY_LENGTH(opt_name), "%s_extra_software", drivers[driver_index]->name);
192   paths = options_get_string(Mame32Settings(), opt_name);
192   paths = options_get_string(MameUISettings(), opt_name);
193193   return paths ? paths : "";
194194}
195195
196196void SetCurrentSoftwareTab(const char *shortname)
197197{
198   options_set_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_TAB, shortname, OPTION_PRIORITY_CMDLINE);
198   options_set_string(MameUISettings(), WINGUIOPTION_SOFTWARE_TAB, shortname, OPTION_PRIORITY_CMDLINE);
199199}
200200
201201const char *GetCurrentSoftwareTab(void)
202202{
203   return options_get_string(Mame32Settings(), WINGUIOPTION_SOFTWARE_TAB);
203   return options_get_string(MameUISettings(), WINGUIOPTION_SOFTWARE_TAB);
204204}
src/mess/osd/winui/propertiesms.c
r1367r1368
1919#include "screenshot.h"
2020#include "datamap.h"
2121#include "bitmask.h"
22#include "mame32.h"
22#include "winui.h"
2323#include "directories.h"
24#include "m32util.h"
25#include "m32opts.h"
24#include "mui_util.h"
25#include "mui_opts.h"
2626#include "resourcems.h"
2727#include "mess.h"
2828#include "utils.h"
2929#include "propertiesms.h"
3030#include "optionsms.h"
31#include "ms32util.h"
31#include "msuiutil.h"
3232#include "messopts.h"
3333#include "strconv.h"
3434#include "winutf8.h"
r1367r1368
191191        }
192192        else
193193        {
194            if (win_message_box_utf8(NULL, "Directory does not exist, continue anyway?", MAME32NAME, MB_OKCANCEL) == IDOK)
194            if (win_message_box_utf8(NULL, "Directory does not exist, continue anyway?", MAMEUINAME, MB_OKCANCEL) == IDOK)
195195                bResult = TRUE;
196196        }
197197    }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team