Previous 15994 Revisions Next

r8256 Wednesday 9th June, 2010 at 23:00:06 UTC by Angelo Salese
Fix compile
[src/osd/winui]properties.c

src/osd/winui/properties.c
r8255r8256
1010  that you have read the license and understand and accept it fully.
1111
1212 ***************************************************************************/
13
13
1414/***************************************************************************
1515
1616  Properties.c
1717
1818    Properties Popup and Misc UI support routines.
19   
19
2020    Created 8/29/98 by Mike Haaland (mhaaland@hypertech.com)
2121
2222***************************************************************************/
r8255r8256
2525
2626MSH - 20070809
2727--
28Notes on properties and ini files, reset and reset to default.
28Notes on properties and ini files, reset and reset to default.
2929----------------------------------------------------------------------------
3030Each ini contains a complete option set.
3131
r8255r8256
255255{
256256   const TCHAR*   m_pText;
257257   const char*      m_pData;
258} g_ComboBoxVideo[] =
258} g_ComboBoxVideo[] =
259259{
260260   { TEXT("None"),                 "none"    },
261261   { TEXT("GDI"),                  "gdi"    },
r8255r8256
268268{
269269   const TCHAR*   m_pText;
270270   const int      m_pData;
271} g_ComboBoxD3DVersion[] =
271} g_ComboBoxD3DVersion[] =
272272{
273273   { TEXT("Version 9"),           9   },
274274   { TEXT("Version 8"),           8   },
r8255r8256
280280{
281281   const TCHAR*   m_pText;
282282   const int      m_pData;
283} g_ComboBoxSelectScreen[] =
283} g_ComboBoxSelectScreen[] =
284284{
285285   { TEXT("Screen 0"),             0    },
286286   { TEXT("Screen 1"),             1    },
r8255r8256
293293{
294294   const TCHAR*   m_pText;
295295   const char*      m_pData;
296} g_ComboBoxView[] =
296} g_ComboBoxView[] =
297297{
298298   { TEXT("Auto"),              "auto"        },
299   { TEXT("Standard"),         "standard"    },
300   { TEXT("Pixel Aspect"),     "pixel"       },
299   { TEXT("Standard"),         "standard"    },
300   { TEXT("Pixel Aspect"),     "pixel"       },
301301   { TEXT("Cocktail"),         "cocktail"    },
302302};
303303#define NUMVIEW (sizeof(g_ComboBoxView) / sizeof(g_ComboBoxView[0]))
r8255r8256
308308{
309309   const TCHAR*   m_pText;
310310   const char*    m_pData;
311} g_ComboBoxDevice[] =
311} g_ComboBoxDevice[] =
312312{
313313   { TEXT("None"),                  "none"      },
314314   { TEXT("Keyboard"),              "keyboard"  },
r8255r8256
323323{
324324   const TCHAR*   m_pText;
325325   const char*      m_pData;
326} g_ComboBoxSnapView[] =
326} g_ComboBoxSnapView[] =
327327{
328328   { TEXT("Internal"),           "internal"    },
329329   { TEXT("Auto"),              "auto"        },
330   { TEXT("Standard"),         "standard"    },
331   { TEXT("Pixel Aspect"),     "pixel"       },
330   { TEXT("Standard"),         "standard"    },
331   { TEXT("Pixel Aspect"),     "pixel"       },
332332   { TEXT("Cocktail"),         "cocktail"    },
333333};
334334#define NUMSNAPVIEW (sizeof(g_ComboBoxSnapView) / sizeof(g_ComboBoxSnapView[0]))
r8255r8256
385385   memset(pspages, 0, sizeof(PROPSHEETPAGE) * possiblePropSheets);
386386
387387   maxPropSheets = 0;
388   
388
389389   i = ( isGame ) ? 0 : 2;
390390
391391   for (; g_propSheets[i].pfnDlgProc; i++)
r8255r8256
417417         }
418418      }
419419   }
420   
420
421421   if (pnMaxPropSheets)
422422      *pnMaxPropSheets = maxPropSheets;
423423
r8255r8256
486486   PROPSHEETPAGE   *pspage;
487487   TCHAR*          t_description = NULL;
488488   OPTIONS_TYPE    default_type = opt_type;
489   
489
490490   if (highlight_brush == NULL)
491491      highlight_brush = CreateSolidBrush(HIGHLIGHT_COLOR);
492492
r8255r8256
532532
533533   ZeroMemory(&pshead, sizeof(PROPSHEETHEADER));
534534
535   // Set the game to audio to this game
535   // Set the game to audio to this game
536536   InitGameAudit(game_num);
537537
538538   // Create the propery sheets
r8255r8256
562562   case OPTIONS_GLOBAL:
563563      t_description = tstring_from_utf8("Default Settings");
564564      break;
565   case OPTIONS_PARENT:
566   case OPTIONS_MAX:
567      break;
565568   }
566569   // If we have no descrption, return.
567570   if( !t_description ) {
r8255r8256
643646   const device_config *sound;
644647
645648   buf[0] = 0;
646   
649
647650   /* iterate over sound chips */
648651   sound = config->devicelist.first(DEVICE_CLASS_SOUND_CHIP);
649652   while(sound != NULL)
r8255r8256
708711
709712   if (isDriverVector(config))
710713   {
711      strcpy(buf, "Vector Game");
714      strcpy(buf, "Vector Game");
712715   }
713716   else
714717   {
715718      const device_config *screen = video_screen_first(config);
716719      if (screen == NULL) {
717         strcpy(buf, "Screenless Game");
720         strcpy(buf, "Screenless Game");
718721      }
719722      else {
720723         for (; screen != NULL; screen = video_screen_next(screen)) {
r8255r8256
773776         if (DriverIsBroken(driver_index))
774777          {
775778            strcpy(buffer, "Not working");
776           
779
777780            if (drivers[driver_index]->flags & GAME_UNEMULATED_PROTECTION)
778781            {
779782               if (*buffer != '\0')
r8255r8256
821824               if (*buffer != '\0')
822825                  strcat(buffer, "\r\n");
823826               strcat(buffer, "Game requires artwork");
824            }           
827            }
825828          }
826829         else
827830         {
828831            strcpy(buffer, "Working");
829           
832
830833            if (drivers[driver_index]->flags & GAME_UNEMULATED_PROTECTION)
831834            {
832835               if (*buffer != '\0')
r8255r8256
874877               if (*buffer != '\0')
875878                  strcat(buffer, "\r\n");
876879               strcat(buffer, "Game requires artwork");
877            }           
880            }
878881         }
879882      }
880883      else
r8255r8256
897900      else
898901      {
899902         strcpy(buffer, "Working");
900      }   
903      }
901904      if (drivers[driver_index]->flags & GAME_UNEMULATED_PROTECTION)
902905      {
903906         if (*buffer != '\0')
r8255r8256
945948         if (*buffer != '\0')
946949            strcat(buffer, "\r\n");
947950         strcat(buffer, "Game requires artwork");
948      }     
951      }
949952   }
950953   return buffer;
951954}
r8255r8256
955958{
956959   static char buffer[1024];
957960
958   snprintf(buffer,sizeof(buffer),"%s %s",drivers[nIndex]->year,drivers[nIndex]->manufacturer);
961   snprintf(buffer,sizeof(buffer),"%s %s",drivers[nIndex]->year,drivers[nIndex]->manufacturer);
959962   return buffer;
960963}
961964
r8255r8256
970973      OPTIONS_VERTICAL == opt_type || OPTIONS_HORIZONTAL == opt_type)
971974      strcpy(buf, "Global folder options\nDefault options used by all games in the folder");
972975   else
973      sprintf(buf, "%s\n\"%s\"", ModifyThe(drivers[nIndex]->description), drivers[nIndex]->name);
976      sprintf(buf, "%s\n\"%s\"", ModifyThe(drivers[nIndex]->description), drivers[nIndex]->name);
974977   return buf;
975978}
976979
r8255r8256
987990      nParentIndex = GetParentIndex(drivers[nIndex]);
988991      sprintf(buf, "%s - \"%s\"",
989992         ConvertAmpersandString(ModifyThe(drivers[nParentIndex]->description)),
990         drivers[nParentIndex]->name);
993         drivers[nParentIndex]->name);
991994   }
992995
993996   return buf;
r8255r8256
10241027      win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_COLORS),        GameInfoColors(g_nGame));
10251028      win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_CLONEOF),       GameInfoCloneOf(g_nGame));
10261029      win_set_window_text_utf8(GetDlgItem(hDlg, IDC_PROP_SOURCE),        GameInfoSource(g_nGame));
1027     
1030
10281031      if (DriverIsClone(g_nGame))
10291032      {
10301033         ShowWindow(GetDlgItem(hDlg, IDC_PROP_CLONEOF_TEXT), SW_SHOW);
r8255r8256
10661069         EnableWindow(GetDlgItem(hDlg, IDC_USE_DEFAULT), (g_bUseDefaults) ? FALSE : TRUE);
10671070      EnableWindow(GetDlgItem(hDlg, IDC_PROP_RESET), g_bReset);
10681071      ShowWindow(hDlg, SW_SHOW);
1069   
1072
10701073      return 1;
10711074
10721075   case WM_HSCROLL:
r8255r8256
11671170            options_copy(pCurrentOpts, pDefaultOpts);
11681171            // repopulate the controls with the new data
11691172            UpdateProperties(hDlg, properties_datamap, pCurrentOpts);
1170           
1173
11711174            g_bUseDefaults = options_equal(pCurrentOpts, pDefaultOpts);
11721175            // This evaluates properly
11731176            g_bReset = options_equal(pCurrentOpts, pOrigOpts) ? FALSE : TRUE;
r8255r8256
12691272   case WM_NOTIFY:
12701273      {
12711274         // Set to true if we are exiting the properites dialog
1272         BOOL bClosing = ((LPPSHNOTIFY) lParam)->lParam;
1275         BOOL bClosing = ((LPPSHNOTIFY) lParam)->lParam;
12731276
12741277         switch (((NMHDR *) lParam)->code)
12751278         {
1276            //We'll need to use a CheckState Table
1279            //We'll need to use a CheckState Table
12771280            //Because this one gets called for all kinds of other things too, and not only if a check is set
12781281         case PSN_SETACTIVE:
12791282            /* Initialize the controls. */
r8255r8256
13001303
13011304            // Copy current options to orignal options.
13021305            options_copy(pOrigOpts, pCurrentOpts);
1303           
1306
13041307            // Repopulate the controls?  WTF?  We just read them, they should be fine.
13051308            UpdateProperties(hDlg, properties_datamap, pCurrentOpts);
13061309
r8255r8256
13391342
13401343            ResetDataMap(hDlg);
13411344            SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
1342            return 1; 
1345            return 1;
13431346
13441347         case PSN_RESET:
13451348            // Reset to the original values. Disregard changes
r8255r8256
13551358      break;
13561359
13571360#if 0
1358   /* FIXME
1361   /* FIXME
13591362    * We need to figure out in which ini of our hierarchy the current value is set, then apply the corresponding colouring.
13601363    * Is there an easy way to figure this out?
13611364    * The actual colour coding should still work
r8255r8256
14691472      HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
14701473      break;
14711474
1472   case WM_CONTEXTMENU:
1475   case WM_CONTEXTMENU:
14731476      HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
1474      break;
1477      break;
14751478
14761479   }
14771480   EnableWindow(GetDlgItem(hDlg, IDC_PROP_RESET), g_bReset);
r8255r8256
17441747   int in_window = 0;
17451748
17461749   nIndex = g_nGame;
1747   
1750
17481751   d3d = !mame_stricmp(options_get_string(pCurrentOpts, WINOPTION_VIDEO), "d3d");
17491752   ddraw = !mame_stricmp(options_get_string(pCurrentOpts, WINOPTION_VIDEO), "ddraw");
17501753   gdi = !d3d && !ddraw;
r8255r8256
17821785
17831786   EnableWindow(GetDlgItem(hWnd,IDC_D3D_FILTER),d3d);
17841787   EnableWindow(GetDlgItem(hWnd,IDC_D3D_VERSION),d3d);
1785   
1788
17861789   //Switchres and D3D or ddraw enable the per screen parameters
17871790
17881791   EnableWindow(GetDlgItem(hWnd, IDC_NUMSCREENS),                 (ddraw || d3d));
r8255r8256
18411844      else
18421845      {
18431846         BOOL use_lightgun;
1844         // Older than XP
1847         // Older than XP
18451848         Button_Enable(GetDlgItem(hWnd,IDC_LIGHTGUN),TRUE);
18461849         use_lightgun = Button_GetCheck(GetDlgItem(hWnd,IDC_LIGHTGUN));
18471850         Button_Enable(GetDlgItem(hWnd,IDC_DUAL_LIGHTGUN),use_lightgun);
r8255r8256
18721875      EnableWindow(GetDlgItem(hWnd,IDC_AUDIO_LATENCY_TEXT),sound);
18731876      SetSamplesEnabled(hWnd, nIndex, sound);
18741877   }
1875   
1878
18761879   if (Button_GetCheck(GetDlgItem(hWnd, IDC_AUTOFRAMESKIP)))
18771880      EnableWindow(GetDlgItem(hWnd, IDC_FRAMESKIP), FALSE);
18781881   else
r8255r8256
20592062
20602063static BOOL DefaultInputReadControl(datamap *map, HWND dialog, HWND control, core_options *opts, const char *option_name)
20612064{
2062   TCHAR *input_option_value;   
2065   TCHAR *input_option_value;
20632066   int input_option_index;
20642067   char *op_val;
20652068
20662069   input_option_index = ComboBox_GetCurSel(control);
2067   input_option_value = (TCHAR*) ComboBox_GetItemData(control, input_option_index);   
2070   input_option_value = (TCHAR*) ComboBox_GetItemData(control, input_option_index);
20682071   op_val = utf8_from_tstring(input_option_value);
20692072   options_set_string(opts, OPTION_CTRLR, op_val, OPTION_PRIORITY_CMDLINE);
20702073   osd_free(op_val);
r8255r8256
21042107   (void)ComboBox_InsertString(control, index, TEXT("Standard"));
21052108   (void)ComboBox_SetItemData(control, index, "");
21062109   index++;
2107   
2110
21082111   t_ctrldir = tstring_from_utf8(GetCtrlrDir());
21092112   if( !t_ctrldir )
21102113   {
r8255r8256
21142117   }
21152118
21162119   _stprintf (path, TEXT("%s\\*.*"), t_ctrldir);
2117   
2120
21182121   osd_free(t_ctrldir);
21192122
21202123   hFind = FindFirstFile(path, &FindFileData);
21212124
21222125   if (hFind != INVALID_HANDLE_VALUE)
21232126   {
2124      do
2127      do
21252128      {
21262129         // copy the filename
21272130         _tcscpy (root,FindFileData.cFileName);
r8255r8256
21482151         }
21492152      }
21502153      while (FindNextFile (hFind, &FindFileData) != 0);
2151     
2154
21522155      FindClose (hFind);
21532156   }
21542157
21552158   (void)ComboBox_SetCurSel(control, selected);
2156   
2159
21572160   if( t_buf )
21582161      osd_free(t_buf);
21592162
r8255r8256
22612264
22622265            }
22632266         }
2264         if (devmode.dmDisplayFrequency >= 10 )
2267         if (devmode.dmDisplayFrequency >= 10 )
22652268         {
22662269            // I have some devmode "vga" which specifes 1 Hz, which is probably bogus, so we filter it out
22672270
r8255r8256
23022305
23032306   snprintf(screen_option, ARRAY_LENGTH(screen_option), "screen%d", GetSelectedScreen(hWnd));
23042307
2305   if (options_get_string(pCurrentOpts, screen_option) == NULL
2308   if (options_get_string(pCurrentOpts, screen_option) == NULL
23062309      || (mame_stricmp(options_get_string(pCurrentOpts, screen_option), "") == 0 )
23072310      || (mame_stricmp(options_get_string(pCurrentOpts, screen_option), "auto") == 0 ) )
23082311   {
r8255r8256
23692372   datamap_add(properties_datamap, IDC_VOLUME,               DM_INT,      OPTION_VOLUME);
23702373   datamap_add(properties_datamap, IDC_VOLUMEDISP,            DM_INT,      OPTION_VOLUME);
23712374
2372   // core input options
2375   // core input options
23732376   datamap_add(properties_datamap, IDC_COINLOCKOUT,         DM_BOOL,   OPTION_COIN_LOCKOUT);
23742377   datamap_add(properties_datamap, IDC_DEFAULT_INPUT,         DM_STRING,   OPTION_CTRLR);
23752378   datamap_add(properties_datamap, IDC_USE_MOUSE,            DM_BOOL,   OPTION_MOUSE);
r8255r8256
24722475   datamap_set_callback(properties_datamap, IDC_REFRESH,      DCT_POPULATE_CONTROL,   ResolutionPopulateControl);
24732476   datamap_set_callback(properties_datamap, IDC_SIZES,         DCT_READ_CONTROL,      ResolutionReadControl);
24742477   datamap_set_callback(properties_datamap, IDC_SIZES,         DCT_POPULATE_CONTROL,   ResolutionPopulateControl);
2475   datamap_set_callback(properties_datamap, IDC_DEFAULT_INPUT,   DCT_READ_CONTROL,      DefaultInputReadControl);   
2478   datamap_set_callback(properties_datamap, IDC_DEFAULT_INPUT,   DCT_READ_CONTROL,      DefaultInputReadControl);
24762479   datamap_set_callback(properties_datamap, IDC_DEFAULT_INPUT,   DCT_POPULATE_CONTROL,   DefaultInputPopulateControl);
24772480   datamap_set_callback(properties_datamap, IDC_SNAPVIEW,      DCT_POPULATE_CONTROL,   SnapViewPopulateControl);
24782481
r8255r8256
25572560         if ((strcmp(options_get_string(pCurrentOpts, resolution_option), "auto") == 0) &&
25582561            (strcmp(options_get_string(opts, resolution_option), "auto") == 0))
25592562            return TRUE;
2560         
2563
25612564         sscanf(options_get_string(pCurrentOpts, resolution_option),"%d x %d",&x1,&y1);
25622565         sscanf(options_get_string(opts, resolution_option),"%d x %d",&x2,&y2);
25632566
2564         return x1 == x2 && y1 == y2;     
2567         return x1 == x2 && y1 == y2;
25652568      }
25662569      case IDC_ROTATE :
25672570      {
r8255r8256
25932596   if ( nIndex > -1 ) {
25942597      config = machine_config_alloc(drivers[nIndex]->machine_config);
25952598   }
2596   
2599
25972600   if (hCtrl)
25982601   {
25992602      const device_config *sound;
r8255r8256
30963099
30973100        // Create a compatible DC
30983101        hDCMem = CreateCompatibleDC(hDC);
3099        hBmp = CreateCompatibleBitmap(hDC,
3102        hBmp = CreateCompatibleBitmap(hDC,
31003103               rc.right - rc.left, rc.bottom - rc.top);
31013104        hBmpOld = (HBITMAP)(SelectObject(hDCMem, hBmp));
31023105
31033106        // Tell the tab control to paint in our DC
3104        SendMessage(hwndTab, WM_PRINTCLIENT, (WPARAM)(hDCMem),
3107        SendMessage(hwndTab, WM_PRINTCLIENT, (WPARAM)(hDCMem),
31053108           (LPARAM)(PRF_ERASEBKGND | PRF_CLIENT | PRF_NONCLIENT));
31063109
31073110        // Create a pattern brush from the bitmap selected in our DC

Previous 15994 Revisions Next


© 1998-2018 The MESS Team