Previous 15994 Revisions Next

r8214 Friday 4th June, 2010 at 09:46:11 UTC by Miodrag Milanović
[MESSUI] Added ability to start software list items.
[src/mess/osd/winui]messui.c messui.h softwarelist.c softwarelist.h
[src/osd/winui]winui.c

src/osd/winui/winui.c
r8213r8214
959959         options_set_string(mame_opts, OPTION_AVIWRITE, playopts->aviwrite, OPTION_PRIORITY_CMDLINE);
960960   }
961961
962   #ifdef MESS
963   if (g_szSelectedSoftware[0] && g_szSelectedDevice[0]) {
964         options_set_string(mame_opts, g_szSelectedDevice, g_szSelectedSoftware, OPTION_PRIORITY_CMDLINE);
965         // Add params and clear so next start of driver is without parameters         
966         g_szSelectedSoftware[0] = 0;
967         g_szSelectedDevice[0] = 0;
968   }
969   #endif   
962970   // Mame will parse all the needed .ini files.
963971
964972   // prepare MAME32 to run the game
src/mess/osd/winui/messui.c
r8213r8214
7878
7979char g_szSelectedItem[MAX_PATH];
8080
81char g_szSelectedSoftware[MAX_PATH];
8182
83char g_szSelectedDevice[MAX_PATH];
8284
8385//============================================================
8486//  LOCAL VARIABLES
r8213r8214
462464               {
463465                  for (software_info *swinfo = software_list_first(list); swinfo != NULL; swinfo = software_list_next(list))
464466                  {                     
465                     SoftwareList_AddFile(hwndSoftwareList, swinfo->shortname, swlist->list_name[i], swinfo->longname, swinfo->publisher, swinfo->year);
467                     const device_config *selimage = NULL;
468                     software_part *part = software_find_part(swinfo, NULL, NULL);         
469
470                     /* search for a device with the right interface */
471                     for (const device_config *image = config->devicelist.first(); image != NULL; image = image->next)
472                     {
473                        const char *interface = image->get_config_string(DEVINFO_STR_INTERFACE);
474
475                        if (interface != NULL)
476                        {
477                           if (!strcmp(interface, part->interface_))
478                           {
479                              selimage = image;
480                              break;
481                           }
482                        }
483                     }
484                     if (selimage) {
485                        image_device_info info = image_device_getinfo(config, selimage);
486                        SoftwareList_AddFile(hwndSoftwareList, swinfo->shortname, swlist->list_name[i], swinfo->longname, swinfo->publisher, swinfo->year, info.brief_instance_name);
487                     }
466488                  }
467489
468490                  software_list_close(list);
r8213r8214
495517   LPCSTR pszSoftware;
496518   BOOL bResult = FALSE;
497519
520   if (g_szSelectedSoftware[0] && g_szSelectedDevice[0]) {
521      return TRUE;
522   }
498523//  begin_resource_tracking();
499524
500525   // allocate the machine config
r8213r8214
12851310
12861311static void SoftwareList_LeavingItem(HWND hwndSoftwareList, int nItem)
12871312{
1288   int drvindex;
1289   const char *pszFullName;
1290   HWND hwndList;
1291
12921313   if (!s_bIgnoreSoftwarePickerNotifies)
12931314   {
1294      hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);
1295      drvindex = Picker_GetSelectedItem(hwndList);
1296      pszFullName = SoftwareList_LookupFilename(hwndSoftwareList, nItem);
1297
1298      MessRemoveImage(drvindex, pszFullName);
1315      g_szSelectedSoftware[0] = 0;
1316      g_szSelectedDevice[0] = 0;
12991317   }
13001318}
13011319
r8213r8214
13041322static void SoftwareList_EnteringItem(HWND hwndSoftwareList, int nItem)
13051323{
13061324   LPCSTR pszFullName;
1307   LPCSTR pszName;
1308   const char* tmp;
1309   LPSTR s;
13101325   int drvindex;
13111326   HWND hwndList;
13121327
r8213r8214
13181333
13191334      // Get the fullname and partialname for this file
13201335      pszFullName = SoftwareList_LookupFilename(hwndSoftwareList, nItem);
1321      tmp = strchr(pszFullName, '\\');
1322      pszName = tmp ? tmp + 1 : pszFullName;
13231336
1324      // Do the dirty work
1325      MessSpecifyImage(drvindex, NULL, pszFullName);
1326
1337      strncpyz(g_szSelectedSoftware, pszFullName, ARRAY_LENGTH(g_szSelectedSoftware));
1338     
1339      strncpyz(g_szSelectedDevice, SoftwareList_LookupDevice(hwndSoftwareList, nItem), ARRAY_LENGTH(g_szSelectedDevice));
1340     
13271341      // Set up s_szSelecteItem, for the benefit of UpdateScreenShot()
1328      strncpyz(g_szSelectedItem, pszName, ARRAY_LENGTH(g_szSelectedItem));
1329      s = strrchr(g_szSelectedItem, '.');
1330      if (s)
1331         *s = '\0';
1342      strncpyz(g_szSelectedItem, pszFullName, ARRAY_LENGTH(g_szSelectedItem));
13321343
13331344      UpdateScreenShot();
13341345   }
src/mess/osd/winui/messui.h
r8213r8214
77#include "options.h"
88
99extern char g_szSelectedItem[MAX_PATH];
10extern char g_szSelectedSoftware[MAX_PATH];
11extern char g_szSelectedDevice[MAX_PATH];
1012
1113void InitMessPicker(void);
1214void MessUpdateSoftwareList(void);
src/mess/osd/winui/softwarelist.c
r8213r8214
3838typedef struct _file_info file_info;
3939struct _file_info
4040{
41   char list_name[256];
42   char description[256];
43   char file_name[256];
44   char publisher[256];
41   char list_name[MAX_PATH];
42   char description[MAX_PATH];
43   char file_name[MAX_PATH];
44   char publisher[MAX_PATH];
4545   char year[10];
46   
47   char device[MAX_PATH];
4648};
4749
4850typedef struct _software_list_info software_list_info;
r8213r8214
8486   return pPickerInfo->file_index[nIndex]->file_name;
8587}
8688
89LPCSTR SoftwareList_LookupDevice(HWND hwndPicker, int nIndex)
90{
91   software_list_info *pPickerInfo;
92   pPickerInfo = GetSoftwareListInfo(hwndPicker);
93   if ((nIndex < 0) || (nIndex >= pPickerInfo->file_index_length))
94      return NULL;
95   return pPickerInfo->file_index[nIndex]->device;
96}
8797
8898
8999int SoftwareList_LookupIndex(HWND hwndPicker, LPCSTR pszFilename)
r8213r8214
118128}
119129
120130
121BOOL SoftwareList_AddFile(HWND hwndPicker,LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear)
131BOOL SoftwareList_AddFile(HWND hwndPicker,LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear, LPCSTR pszDevice)
122132{
123133   Picker_ResetIdle(hwndPicker);
124134   
r8213r8214
146156   strcpy(pInfo->description, pszDescription);
147157   strcpy(pInfo->publisher, pszPublisher);
148158   strcpy(pInfo->year, pszYear);
159   strcpy(pInfo->device, pszDevice);
149160   
150161   ppNewIndex = (file_info**)malloc((pPickerInfo->file_index_length + 1) * sizeof(*pPickerInfo->file_index));
151162   memcpy(ppNewIndex,pPickerInfo->file_index,pPickerInfo->file_index_length * sizeof(*pPickerInfo->file_index));
src/mess/osd/winui/softwarelist.h
r8213r8214
77#include "swconfig.h"
88
99LPCSTR SoftwareList_LookupFilename(HWND hwndPicker, int nIndex);
10const device_config *SoftwareList_LookupDevice(HWND hwndPicker, int nIndex);
10LPCSTR SoftwareList_LookupDevice(HWND hwndPicker, int nIndex);
1111int SoftwareList_LookupIndex(HWND hwndPicker, LPCSTR pszFilename);
1212iodevice_t SoftwareList_GetImageType(HWND hwndPicker, int nIndex);
13BOOL SoftwareList_AddFile(HWND hwndPicker, LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear);
13BOOL SoftwareList_AddFile(HWND hwndPicker, LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear, LPCSTR pszDevice);
1414void SoftwareList_Clear(HWND hwndPicker);
1515void SoftwareList_SetDriver(HWND hwndPicker, const software_config *config);
1616

Previous 15994 Revisions Next


© 1998-2018 The MESS Team