Previous 15994 Revisions Next

r2244 Friday 4th April, 2008 at 02:11:02 UTC by Nathan Woods
[Windows GUI] Device transitions
[src/mess/osd/winui]messui.c optionsms.c optionsms.h

src/mess/osd/winui/optionsms.h
r2243r2244
4141void SetHashDirs(const char *dir);
4242const char *GetHashDirs(void);
4343
44void SetSelectedSoftware(int driver_index, const mess_device_class *devclass, int device_inst, const char *software);
45const char *GetSelectedSoftware(int driver_index, const mess_device_class *devclass, int device_inst);
44void SetSelectedSoftware(int driver_index, const device_config *device, const char *software);
45const char *GetSelectedSoftware(int driver_index, const device_config *device);
4646
4747void SetExtraSoftwarePaths(int driver_index, const char *extra_paths);
4848const char *GetExtraSoftwarePaths(int driver_index);
src/mess/osd/winui/messui.c
r2243r2244
396396      // confirm any mandatory devices are loaded
397397      if (iodev->must_be_loaded)
398398      {
399         pszSoftware = GetSelectedSoftware(drvindex, &iodev->devclass, iodev->index_in_device);
399         pszSoftware = GetSelectedSoftware(drvindex, dev);
400400         if (!pszSoftware || !*pszSoftware)
401401         {
402402            snprintf(szMessage, sizeof(szMessage) / sizeof(szMessage[0]),
r2243r2244
424424
425425
426426// this is a wrapper call to wrap the idiosycracies of SetSelectedSoftware()
427static void InternalSetSelectedSoftware(int drvindex, const mess_device_class *devclass, int device_inst, const char *pszSoftware)
427static void InternalSetSelectedSoftware(int drvindex, const device_config *device, const char *pszSoftware)
428428{
429429   if (!pszSoftware)
430430      pszSoftware = "";
431431
432432   // only call SetSelectedSoftware() if this value is different
433   if (strcmp(GetSelectedSoftware(drvindex, devclass, device_inst), pszSoftware))
433   if (strcmp(GetSelectedSoftware(drvindex, device), pszSoftware))
434434   {
435      SetSelectedSoftware(drvindex, devclass, device_inst, pszSoftware);
435      SetSelectedSoftware(drvindex, device, pszSoftware);
436436   }
437437}
438438
r2243r2244
465465   if (nID < 0)
466466   {
467467      // special case; first try to find existing image
468      s = GetSelectedSoftware(drvindex, &iodev->devclass, iodev->index_in_device);
468      s = GetSelectedSoftware(drvindex, dev);
469469      if (s && !mame_stricmp(s, pszFilename))
470470      {
471471         nID = iodev->index_in_device;
r2243r2244
475475   if (nID < 0)
476476   {
477477      // still not found?  locate an empty slot
478      s = GetSelectedSoftware(drvindex, &iodev->devclass, iodev->index_in_device);
478      s = GetSelectedSoftware(drvindex, dev);
479479      if (!s || !*s || !mame_stricmp(s, pszFilename))
480480      {
481481         nID = iodev->index_in_device;
r2243r2244
483483   }
484484
485485   if (nID >= 0)
486      InternalSetSelectedSoftware(drvindex, &iodev->devclass, nID, pszFilename);
486      InternalSetSelectedSoftware(drvindex, dev, pszFilename);
487487   else if (LOG_SOFTWARE)
488488      dprintf("MessSpecifyImage(): Failed to place image '%s'\n", pszFilename);
489489
r2243r2244
516516
517517      if (iodev != NULL)
518518      {
519         if (!mame_stricmp(pszFilename, GetSelectedSoftware(drvindex, &iodev->devclass, iodev->index_in_device)))
519         if (!mame_stricmp(pszFilename, GetSelectedSoftware(drvindex, dev)))
520520         {
521521            MessSpecifyImage(drvindex, &devclass, iodev->index_in_device, NULL);
522522         }
r2243r2244
564564   {
565565      iodev = mess_device_from_core_device(dev);
566566
567      pszSoftware = GetSelectedSoftware(drvindex, &iodev->devclass, iodev->index_in_device);
567      pszSoftware = GetSelectedSoftware(drvindex, dev);
568568      if (pszSoftware && *pszSoftware)
569569      {
570570         i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
r2243r2244
895895{
896896   LPCTSTR t_buffer = NULL;
897897   TCHAR* t_s;
898   LPCSTR s = GetSelectedSoftware(nDriverIndex, &dev->devclass, nID);
898   LPCSTR s = GetSelectedSoftware(nDriverIndex, dev->devconfig);
899899
900900   t_s = tstring_from_utf8(s);
901901   if( !t_s )
src/mess/osd/winui/optionsms.c
r2243r2244
140140   options_set_string(MameUIGlobal(), OPTION_HASHPATH, paths, OPTION_PRIORITY_CMDLINE);
141141}
142142
143void SetSelectedSoftware(int driver_index, const mess_device_class *devclass, int device_inst, const char *software)
143void SetSelectedSoftware(int driver_index, const device_config *dev, const char *software)
144144{
145   const char *opt_name = device_instancename(devclass, device_inst);
145   const struct IODevice *iodev = mess_device_from_core_device(dev);
146   const char *opt_name = device_instancename(&iodev->devclass, iodev->index_in_device);
146147   core_options *o;
147148
148149   if (LOG_SOFTWARE)
149150   {
150      dprintf("SetSelectedSoftware(): driver_index=%d (\'%s\') devclass=%p device_inst=%d software='%s'\n",
151         driver_index, drivers[driver_index]->name, devclass, device_inst, software);
151      dprintf("SetSelectedSoftware(): dev=%p (\'%s\') software='%s'\n",
152         dev, drivers[driver_index]->name, software);
152153   }
153154
154155   o = load_options(OPTIONS_GAME, driver_index);
155   opt_name = device_instancename(devclass, device_inst);
156156   options_set_string(o, opt_name, software, OPTION_PRIORITY_CMDLINE);
157157   save_options(OPTIONS_GAME, o, driver_index);
158158   options_free(o);
159159}
160160
161const char *GetSelectedSoftware(int driver_index, const mess_device_class *devclass, int device_inst)
161const char *GetSelectedSoftware(int driver_index, const device_config *dev)
162162{
163   const char *opt_name = device_instancename(devclass, device_inst);
163   const struct IODevice *iodev = mess_device_from_core_device(dev);
164   const char *opt_name = device_instancename(&iodev->devclass, iodev->index_in_device);
164165   const char *software;
165166   core_options *o;
166167
167168   o = load_options(OPTIONS_GAME, driver_index);
168   opt_name = device_instancename(devclass, device_inst);
169169   software = options_get_string(o, opt_name);
170170   return software ? software : "";
171171}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team