src/mess/osd/winui/messui.c
| r8213 | r8214 | |
| 78 | 78 | |
| 79 | 79 | char g_szSelectedItem[MAX_PATH]; |
| 80 | 80 | |
| 81 | char g_szSelectedSoftware[MAX_PATH]; |
| 81 | 82 | |
| 83 | char g_szSelectedDevice[MAX_PATH]; |
| 82 | 84 | |
| 83 | 85 | //============================================================ |
| 84 | 86 | // LOCAL VARIABLES |
| r8213 | r8214 | |
| 462 | 464 | { |
| 463 | 465 | for (software_info *swinfo = software_list_first(list); swinfo != NULL; swinfo = software_list_next(list)) |
| 464 | 466 | { |
| 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 | } |
| 466 | 488 | } |
| 467 | 489 | |
| 468 | 490 | software_list_close(list); |
| r8213 | r8214 | |
| 495 | 517 | LPCSTR pszSoftware; |
| 496 | 518 | BOOL bResult = FALSE; |
| 497 | 519 | |
| 520 | if (g_szSelectedSoftware[0] && g_szSelectedDevice[0]) { |
| 521 | return TRUE; |
| 522 | } |
| 498 | 523 | // begin_resource_tracking(); |
| 499 | 524 | |
| 500 | 525 | // allocate the machine config |
| r8213 | r8214 | |
| 1285 | 1310 | |
| 1286 | 1311 | static void SoftwareList_LeavingItem(HWND hwndSoftwareList, int nItem) |
| 1287 | 1312 | { |
| 1288 | | int drvindex; |
| 1289 | | const char *pszFullName; |
| 1290 | | HWND hwndList; |
| 1291 | | |
| 1292 | 1313 | if (!s_bIgnoreSoftwarePickerNotifies) |
| 1293 | 1314 | { |
| 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; |
| 1299 | 1317 | } |
| 1300 | 1318 | } |
| 1301 | 1319 | |
| r8213 | r8214 | |
| 1304 | 1322 | static void SoftwareList_EnteringItem(HWND hwndSoftwareList, int nItem) |
| 1305 | 1323 | { |
| 1306 | 1324 | LPCSTR pszFullName; |
| 1307 | | LPCSTR pszName; |
| 1308 | | const char* tmp; |
| 1309 | | LPSTR s; |
| 1310 | 1325 | int drvindex; |
| 1311 | 1326 | HWND hwndList; |
| 1312 | 1327 | |
| r8213 | r8214 | |
| 1318 | 1333 | |
| 1319 | 1334 | // Get the fullname and partialname for this file |
| 1320 | 1335 | pszFullName = SoftwareList_LookupFilename(hwndSoftwareList, nItem); |
| 1321 | | tmp = strchr(pszFullName, '\\'); |
| 1322 | | pszName = tmp ? tmp + 1 : pszFullName; |
| 1323 | 1336 | |
| 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 | |
| 1327 | 1341 | // 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)); |
| 1332 | 1343 | |
| 1333 | 1344 | UpdateScreenShot(); |
| 1334 | 1345 | } |
src/mess/osd/winui/softwarelist.c
| r8213 | r8214 | |
| 38 | 38 | typedef struct _file_info file_info; |
| 39 | 39 | struct _file_info |
| 40 | 40 | { |
| 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]; |
| 45 | 45 | char year[10]; |
| 46 | |
| 47 | char device[MAX_PATH]; |
| 46 | 48 | }; |
| 47 | 49 | |
| 48 | 50 | typedef struct _software_list_info software_list_info; |
| r8213 | r8214 | |
| 84 | 86 | return pPickerInfo->file_index[nIndex]->file_name; |
| 85 | 87 | } |
| 86 | 88 | |
| 89 | LPCSTR 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 | } |
| 87 | 97 | |
| 88 | 98 | |
| 89 | 99 | int SoftwareList_LookupIndex(HWND hwndPicker, LPCSTR pszFilename) |
| r8213 | r8214 | |
| 118 | 128 | } |
| 119 | 129 | |
| 120 | 130 | |
| 121 | | BOOL SoftwareList_AddFile(HWND hwndPicker,LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear) |
| 131 | BOOL SoftwareList_AddFile(HWND hwndPicker,LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear, LPCSTR pszDevice) |
| 122 | 132 | { |
| 123 | 133 | Picker_ResetIdle(hwndPicker); |
| 124 | 134 | |
| r8213 | r8214 | |
| 146 | 156 | strcpy(pInfo->description, pszDescription); |
| 147 | 157 | strcpy(pInfo->publisher, pszPublisher); |
| 148 | 158 | strcpy(pInfo->year, pszYear); |
| 159 | strcpy(pInfo->device, pszDevice); |
| 149 | 160 | |
| 150 | 161 | ppNewIndex = (file_info**)malloc((pPickerInfo->file_index_length + 1) * sizeof(*pPickerInfo->file_index)); |
| 151 | 162 | memcpy(ppNewIndex,pPickerInfo->file_index,pPickerInfo->file_index_length * sizeof(*pPickerInfo->file_index)); |
src/mess/osd/winui/softwarelist.h
| r8213 | r8214 | |
| 7 | 7 | #include "swconfig.h" |
| 8 | 8 | |
| 9 | 9 | LPCSTR SoftwareList_LookupFilename(HWND hwndPicker, int nIndex); |
| 10 | | const device_config *SoftwareList_LookupDevice(HWND hwndPicker, int nIndex); |
| 10 | LPCSTR SoftwareList_LookupDevice(HWND hwndPicker, int nIndex); |
| 11 | 11 | int SoftwareList_LookupIndex(HWND hwndPicker, LPCSTR pszFilename); |
| 12 | 12 | iodevice_t SoftwareList_GetImageType(HWND hwndPicker, int nIndex); |
| 13 | | BOOL SoftwareList_AddFile(HWND hwndPicker, LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear); |
| 13 | BOOL SoftwareList_AddFile(HWND hwndPicker, LPCSTR pszName, LPCSTR pszListname, LPCSTR pszDescription, LPCSTR pszPublisher, LPCSTR pszYear, LPCSTR pszDevice); |
| 14 | 14 | void SoftwareList_Clear(HWND hwndPicker); |
| 15 | 15 | void SoftwareList_SetDriver(HWND hwndPicker, const software_config *config); |
| 16 | 16 | |