src/mess/osd/winui/messui.c
| r2488 | r2489 | |
| 35 | 35 | #include "strconv.h" |
| 36 | 36 | #include "messui.h" |
| 37 | 37 | #include "winutf8.h" |
| 38 | #include "swconfig.h" |
| 38 | 39 | |
| 39 | 40 | |
| 40 | 41 | //============================================================ |
| r2488 | r2489 | |
| 79 | 80 | // LOCAL VARIABLES |
| 80 | 81 | //============================================================ |
| 81 | 82 | |
| 82 | | static int s_nGame; |
| 83 | static software_config *config; |
| 83 | 84 | static BOOL s_bIgnoreSoftwarePickerNotifies; |
| 84 | 85 | |
| 85 | 86 | static int *mess_icon_index; |
| r2488 | r2489 | |
| 133 | 134 | |
| 134 | 135 | static void MessOpenOtherSoftware(const device_config *dev); |
| 135 | 136 | static void MessCreateDevice(const device_config *dev); |
| 136 | | static void MessRefreshPicker(int drvindex); |
| 137 | static void MessRefreshPicker(void); |
| 137 | 138 | |
| 138 | 139 | static int SoftwarePicker_GetItemImage(HWND hwndPicker, int nItem); |
| 139 | 140 | static void SoftwarePicker_LeavingItem(HWND hwndSoftwarePicker, int nItem); |
| r2488 | r2489 | |
| 346 | 347 | |
| 347 | 348 | void MyFillSoftwareList(int drvindex, BOOL bForce) |
| 348 | 349 | { |
| 350 | BOOL is_same; |
| 349 | 351 | const game_driver *drv; |
| 350 | 352 | HWND hwndSoftwarePicker; |
| 351 | 353 | HWND hwndSoftwareDevView; |
| 352 | 354 | |
| 355 | // do we have to do anything? |
| 356 | if (!bForce) |
| 357 | { |
| 358 | if (config != NULL) |
| 359 | is_same = (drvindex == config->driver_index); |
| 360 | else |
| 361 | is_same = (drvindex < 0); |
| 362 | if (is_same) |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | // free the machine config, if necessary |
| 367 | if (config != NULL) |
| 368 | { |
| 369 | software_config_free(config); |
| 370 | config = NULL; |
| 371 | } |
| 372 | |
| 373 | // allocate the machine config, if necessary |
| 374 | if (drvindex >= 0) |
| 375 | { |
| 376 | config = software_config_alloc(drvindex, MameUIGlobal(), NULL); |
| 377 | } |
| 378 | |
| 379 | // locate key widgets |
| 353 | 380 | hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST); |
| 354 | 381 | hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW); |
| 355 | 382 | |
| 356 | | // Set up the device view |
| 357 | | DevView_SetDriver(hwndSoftwareDevView, drvindex); |
| 383 | // set up the device view |
| 384 | DevView_SetDriver(hwndSoftwareDevView, config); |
| 358 | 385 | |
| 359 | | if (!bForce && (s_nGame == drvindex)) |
| 360 | | return; |
| 361 | | s_nGame = drvindex; |
| 386 | // set up the software picker |
| 387 | SoftwarePicker_Clear(hwndSoftwarePicker); |
| 388 | SoftwarePicker_SetDriver(hwndSoftwarePicker, config); |
| 362 | 389 | |
| 363 | | // Set up the software picker |
| 364 | | SoftwarePicker_Clear(hwndSoftwarePicker); |
| 390 | // add the relevant paths |
| 365 | 391 | drv = drivers[drvindex]; |
| 366 | | SoftwarePicker_SetDriver(hwndSoftwarePicker, drv); |
| 367 | | while(drv) |
| 392 | while(drv != NULL) |
| 368 | 393 | { |
| 369 | 394 | AddSoftwarePickerDirs(hwndSoftwarePicker, GetSoftwareDirs(), drv->name); |
| 370 | 395 | drv = mess_next_compatible_driver(drv); |
| r2488 | r2489 | |
| 528 | 553 | DevView_Refresh(GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW)); |
| 529 | 554 | |
| 530 | 555 | // Now read stuff into picker |
| 531 | | MessRefreshPicker(drvindex); |
| 556 | MessRefreshPicker(); |
| 532 | 557 | } |
| 533 | 558 | |
| 534 | 559 | |
| 535 | 560 | |
| 536 | | static void MessRefreshPicker(int drvindex) |
| 561 | static void MessRefreshPicker(void) |
| 537 | 562 | { |
| 538 | 563 | HWND hwndSoftware; |
| 539 | 564 | int i; |
| 540 | 565 | LVFINDINFO lvfi; |
| 541 | | machine_config *config; |
| 542 | 566 | const device_config *dev; |
| 543 | 567 | LPCSTR pszSoftware; |
| 544 | 568 | |
| 545 | 569 | hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST); |
| 546 | 570 | |
| 547 | | // allocate the machine config |
| 548 | | config = machine_config_alloc_with_mess_devices(drivers[drvindex]); |
| 549 | | |
| 550 | 571 | s_bIgnoreSoftwarePickerNotifies = TRUE; |
| 551 | 572 | |
| 552 | 573 | // Now clear everything out; this may call back into us but it should not |
| 553 | 574 | // be problematic |
| 554 | 575 | ListView_SetItemState(hwndSoftware, -1, 0, LVIS_SELECTED); |
| 555 | 576 | |
| 556 | | for (dev = image_device_first(config); dev != NULL; dev = image_device_next(dev)) |
| 577 | for (dev = image_device_first(config->mconfig); dev != NULL; dev = image_device_next(dev)) |
| 557 | 578 | { |
| 558 | | pszSoftware = GetSelectedSoftware(drvindex, config, dev); |
| 579 | pszSoftware = GetSelectedSoftware(config->driver_index, config->mconfig, dev); |
| 559 | 580 | if (pszSoftware && *pszSoftware) |
| 560 | 581 | { |
| 561 | 582 | i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware); |
| r2488 | r2489 | |
| 575 | 596 | } |
| 576 | 597 | } |
| 577 | 598 | |
| 578 | | machine_config_free(config); |
| 579 | 599 | s_bIgnoreSoftwarePickerNotifies = FALSE; |
| 580 | 600 | } |
| 581 | 601 | |
| r2488 | r2489 | |
| 586 | 606 | struct PickerOptions opts; |
| 587 | 607 | HWND hwndSoftware; |
| 588 | 608 | |
| 589 | | s_nGame = -1; |
| 609 | config = NULL; |
| 590 | 610 | hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST); |
| 591 | 611 | |
| 592 | 612 | memset(&opts, 0, sizeof(opts)); |
| r2488 | r2489 | |
| 865 | 885 | if( !utf8_filename ) |
| 866 | 886 | return; |
| 867 | 887 | MessSpecifyImage(drvindex, dev, utf8_filename); |
| 868 | | MessRefreshPicker(drvindex); |
| 888 | MessRefreshPicker(); |
| 869 | 889 | free(utf8_filename); |
| 870 | 890 | } |
| 871 | 891 | |
src/mess/osd/winui/devview.c
| r2488 | r2489 | |
| 26 | 26 | struct DevViewInfo |
| 27 | 27 | { |
| 28 | 28 | HFONT hFont; |
| 29 | | int nGame; |
| 30 | 29 | int nWidth; |
| 31 | 30 | BOOL bSurpressFilenameChanged; |
| 32 | | machine_config *config; |
| 31 | const software_config *config; |
| 33 | 32 | const struct DevViewCallbacks *pCallbacks; |
| 34 | 33 | struct DevViewEntry *pEntries; |
| 35 | 34 | }; |
| r2488 | r2489 | |
| 75 | 74 | pDevViewInfo->pEntries = NULL; |
| 76 | 75 | } |
| 77 | 76 | |
| 78 | | if (pDevViewInfo->config != NULL) |
| 79 | | { |
| 80 | | machine_config_free(pDevViewInfo->config); |
| 81 | | pDevViewInfo->config = NULL; |
| 82 | | } |
| 77 | pDevViewInfo->config = NULL; |
| 83 | 78 | } |
| 84 | 79 | |
| 85 | 80 | |
| r2488 | r2489 | |
| 123 | 118 | { |
| 124 | 119 | pszSelection = pDevViewInfo->pCallbacks->pfnGetSelectedSoftware( |
| 125 | 120 | hwndDevView, |
| 126 | | pDevViewInfo->nGame, |
| 127 | | pDevViewInfo->config, |
| 121 | pDevViewInfo->config->driver_index, |
| 122 | pDevViewInfo->config->mconfig, |
| 128 | 123 | pDevViewInfo->pEntries[i].dev, |
| 129 | 124 | szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])); |
| 130 | 125 | |
| r2488 | r2489 | |
| 148 | 143 | if (!pDevViewInfo->bSurpressFilenameChanged && pDevViewInfo->pCallbacks->pfnSetSelectedSoftware) |
| 149 | 144 | { |
| 150 | 145 | pDevViewInfo->pCallbacks->pfnSetSelectedSoftware(hwndDevView, |
| 151 | | pDevViewInfo->nGame, |
| 152 | | pDevViewInfo->config, |
| 146 | pDevViewInfo->config->driver_index, |
| 147 | pDevViewInfo->config->mconfig, |
| 153 | 148 | pDevViewInfo->pEntries[nChangedEntry].dev, |
| 154 | 149 | pszFilename); |
| 155 | 150 | } |
| r2488 | r2489 | |
| 183 | 178 | |
| 184 | 179 | |
| 185 | 180 | |
| 186 | | BOOL DevView_SetDriver(HWND hwndDevView, int nGame) |
| 181 | BOOL DevView_SetDriver(HWND hwndDevView, const software_config *config) |
| 187 | 182 | { |
| 188 | 183 | struct DevViewInfo *pDevViewInfo; |
| 189 | 184 | const device_config *dev; |
| r2488 | r2489 | |
| 199 | 194 | |
| 200 | 195 | pDevViewInfo = GetDevViewInfo(hwndDevView); |
| 201 | 196 | |
| 202 | | // already selected this driver? |
| 203 | | if (nGame == pDevViewInfo->nGame) |
| 204 | | return TRUE; |
| 205 | | |
| 197 | // clear out |
| 206 | 198 | DevView_Clear(hwndDevView); |
| 207 | 199 | |
| 208 | | // allocate the machine config |
| 209 | | pDevViewInfo->config = machine_config_alloc_with_mess_devices(drivers[nGame]); |
| 200 | // copy the config |
| 201 | pDevViewInfo->config = config; |
| 210 | 202 | |
| 211 | 203 | // count total amount of devices |
| 212 | | nDevCount = image_device_count(pDevViewInfo->config); |
| 204 | nDevCount = image_device_count(pDevViewInfo->config->mconfig); |
| 213 | 205 | |
| 214 | 206 | if (nDevCount > 0) |
| 215 | 207 | { |
| r2488 | r2489 | |
| 217 | 209 | ppszDevices = (LPTSTR *) alloca(nDevCount * sizeof(*ppszDevices)); |
| 218 | 210 | i = 0; |
| 219 | 211 | |
| 220 | | for (dev = image_device_first(pDevViewInfo->config); dev != NULL; dev = image_device_next(dev)) |
| 212 | for (dev = image_device_first(pDevViewInfo->config->mconfig); dev != NULL; dev = image_device_next(dev)) |
| 221 | 213 | { |
| 222 | | image_device_info info = image_device_getinfo(pDevViewInfo->config, dev); |
| 214 | image_device_info info = image_device_getinfo(pDevViewInfo->config->mconfig, dev); |
| 223 | 215 | |
| 224 | 216 | s = tstring_from_utf8(info.name); |
| 225 | 217 | ppszDevices[i] = alloca((_tcslen(s) + 1) * sizeof(TCHAR)); |
| r2488 | r2489 | |
| 253 | 245 | DevView_GetColumns(hwndDevView, &nStaticPos, &nStaticWidth, |
| 254 | 246 | &nEditPos, &nEditWidth, &nButtonPos, &nButtonWidth); |
| 255 | 247 | |
| 256 | | for (dev = image_device_first(pDevViewInfo->config); dev != NULL; dev = image_device_next(dev)) |
| 248 | for (dev = image_device_first(pDevViewInfo->config->mconfig); dev != NULL; dev = image_device_next(dev)) |
| 257 | 249 | { |
| 258 | | image_device_info info = image_device_getinfo(pDevViewInfo->config, dev); |
| 250 | image_device_info info = image_device_getinfo(pDevViewInfo->config->mconfig, dev); |
| 259 | 251 | |
| 260 | 252 | pEnt->dev = dev; |
| 261 | 253 | |
| r2488 | r2489 | |
| 293 | 285 | } |
| 294 | 286 | } |
| 295 | 287 | |
| 296 | | pDevViewInfo->nGame = nGame; |
| 297 | 288 | DevView_Refresh(hwndDevView); |
| 298 | 289 | return TRUE; |
| 299 | 290 | } |
| r2488 | r2489 | |
| 331 | 322 | switch(rc) |
| 332 | 323 | { |
| 333 | 324 | case 1: |
| 334 | | b = pDevViewInfo->pCallbacks->pfnGetOpenFileName(hwndDevView, pDevViewInfo->config, pEnt->dev, |
| 325 | b = pDevViewInfo->pCallbacks->pfnGetOpenFileName(hwndDevView, pDevViewInfo->config->mconfig, pEnt->dev, |
| 335 | 326 | szPath, sizeof(szPath) / sizeof(szPath[0])); |
| 336 | 327 | break; |
| 337 | 328 | case 2: |
| 338 | | b = pDevViewInfo->pCallbacks->pfnGetCreateFileName(hwndDevView, pDevViewInfo->config, pEnt->dev, |
| 329 | b = pDevViewInfo->pCallbacks->pfnGetCreateFileName(hwndDevView, pDevViewInfo->config->mconfig, pEnt->dev, |
| 339 | 330 | szPath, sizeof(szPath) / sizeof(szPath[0])); |
| 340 | 331 | break; |
| 341 | 332 | case 3: |
| r2488 | r2489 | |
| 357 | 348 | { |
| 358 | 349 | struct DevViewInfo *pDevViewInfo; |
| 359 | 350 | |
| 351 | // allocate the device view info |
| 360 | 352 | pDevViewInfo = malloc(sizeof(struct DevViewInfo)); |
| 361 | 353 | if (!pDevViewInfo) |
| 362 | 354 | return FALSE; |
| 363 | 355 | memset(pDevViewInfo, 0, sizeof(*pDevViewInfo)); |
| 364 | | pDevViewInfo->nGame = -1; |
| 356 | |
| 365 | 357 | SetWindowLongPtr(hwndDevView, GWLP_USERDATA, (LONG_PTR) pDevViewInfo); |
| 366 | 358 | |
| 359 | // create and specify the font |
| 367 | 360 | pDevViewInfo->hFont = CreateFont(10, 0, 0, 0, FW_NORMAL, 0, 0, 0, 0, 0, |
| 368 | 361 | 0, 0, 0, TEXT("MS Sans Serif")); |
| 369 | 362 | SendMessage(hwndDevView, WM_SETFONT, (WPARAM) pDevViewInfo->hFont, FALSE); |
src/mess/osd/winui/swconfig.c
| r0 | r2489 | |
| 1 | //============================================================ |
| 2 | // |
| 3 | // swconfig.c |
| 4 | // |
| 5 | //============================================================ |
| 6 | |
| 7 | #include "swconfig.h" |
| 8 | |
| 9 | |
| 10 | //============================================================ |
| 11 | // IMPLEMENTATION |
| 12 | //============================================================ |
| 13 | |
| 14 | software_config *software_config_alloc(int driver_index, core_options *opts, hashfile_error_func error_proc) |
| 15 | { |
| 16 | const game_driver *driver; |
| 17 | software_config *config; |
| 18 | |
| 19 | // allocate the software_config |
| 20 | config = malloc_or_die(sizeof(*config)); |
| 21 | memset(config, 0, sizeof(*config)); |
| 22 | |
| 23 | // allocate the machine config |
| 24 | config->mconfig = machine_config_alloc_with_mess_devices(drivers[driver_index]); |
| 25 | |
| 26 | // allocate the hash file |
| 27 | driver = drivers[driver_index]; |
| 28 | while((driver != NULL) && (config->hashfile != NULL)) |
| 29 | { |
| 30 | config->hashfile = hashfile_open_options(opts, driver->name, TRUE, error_proc); |
| 31 | driver = mess_next_compatible_driver(driver); |
| 32 | } |
| 33 | |
| 34 | // other stuff |
| 35 | config->driver_index = driver_index; |
| 36 | config->gamedrv = drivers[driver_index]; |
| 37 | |
| 38 | return config; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | |
| 43 | void software_config_free(software_config *config) |
| 44 | { |
| 45 | if (config->mconfig != NULL) |
| 46 | { |
| 47 | machine_config_free(config->mconfig); |
| 48 | config->mconfig = NULL; |
| 49 | } |
| 50 | if (config->hashfile != NULL) |
| 51 | { |
| 52 | hashfile_close(config->hashfile); |
| 53 | config->hashfile = NULL; |
| 54 | } |
| 55 | free(config); |
| 56 | } |
src/mess/osd/winui/softwarepicker.c
| r2488 | r2489 | |
| 69 | 69 | int current_position; |
| 70 | 70 | directory_search_info *first_search_info; |
| 71 | 71 | directory_search_info *last_search_info; |
| 72 | | const game_driver *driver; |
| 73 | | machine_config *config; |
| 74 | | hash_file *hashfile; |
| 75 | | void (*error_callback)(const char *message); |
| 72 | const software_config *config; |
| 76 | 73 | }; |
| 77 | 74 | |
| 78 | 75 | |
| r2488 | r2489 | |
| 185 | 182 | |
| 186 | 183 | if (device != NULL) |
| 187 | 184 | { |
| 188 | | type = image_device_getinfo(GetSoftwarePickerInfo(hwndPicker)->config, device).type; |
| 185 | type = image_device_getinfo(GetSoftwarePickerInfo(hwndPicker)->config->mconfig, device).type; |
| 189 | 186 | } |
| 190 | 187 | else |
| 191 | 188 | { |
| r2488 | r2489 | |
| 196 | 193 | |
| 197 | 194 | |
| 198 | 195 | |
| 199 | | void SoftwarePicker_SetDriver(HWND hwndPicker, const game_driver *driver) |
| 196 | void SoftwarePicker_SetDriver(HWND hwndPicker, const software_config *config) |
| 200 | 197 | { |
| 201 | | software_picker_info *pPickerInfo; |
| 202 | 198 | int i; |
| 199 | software_picker_info *pPickerInfo; |
| 203 | 200 | |
| 204 | 201 | pPickerInfo = GetSoftwarePickerInfo(hwndPicker); |
| 202 | pPickerInfo->config = config; |
| 205 | 203 | |
| 206 | | // did the driver change? |
| 207 | | if (pPickerInfo->driver != driver) |
| 204 | // invalidate the hash "realization" |
| 205 | for (i = 0; i < pPickerInfo->file_index_length; i++) |
| 208 | 206 | { |
| 209 | | // is there a hash file loaded? |
| 210 | | if (pPickerInfo->hashfile != NULL) |
| 211 | | { |
| 212 | | // close down the file |
| 213 | | hashfile_close(pPickerInfo->hashfile); |
| 214 | | pPickerInfo->hashfile = NULL; |
| 215 | | |
| 216 | | // invalidate the hash "realization" |
| 217 | | for (i = 0; i < pPickerInfo->file_index_length; i++) |
| 218 | | { |
| 219 | | pPickerInfo->file_index[i]->hashinfo = NULL; |
| 220 | | pPickerInfo->file_index[i]->hash_realized = FALSE; |
| 221 | | } |
| 222 | | pPickerInfo->hashes_realized = 0; |
| 223 | | } |
| 224 | | |
| 225 | | // is there a machine_config loaded? |
| 226 | | if (pPickerInfo->config != NULL) |
| 227 | | { |
| 228 | | // free the machine_config |
| 229 | | machine_config_free(pPickerInfo->config); |
| 230 | | pPickerInfo->config = NULL; |
| 231 | | } |
| 232 | | |
| 233 | | // change the driver value |
| 234 | | pPickerInfo->driver = driver; |
| 235 | | |
| 236 | | // if we have a driver, we have to load some stuff |
| 237 | | if (driver != NULL) |
| 238 | | { |
| 239 | | // get the configuration |
| 240 | | pPickerInfo->config = machine_config_alloc_with_mess_devices(driver); |
| 241 | | |
| 242 | | // find a hash file |
| 243 | | while((driver != NULL) && !pPickerInfo->hashfile) |
| 244 | | { |
| 245 | | pPickerInfo->hashfile = hashfile_open_options(MameUIGlobal(), driver->name, TRUE, pPickerInfo->error_callback); |
| 246 | | driver = mess_next_compatible_driver(driver); |
| 247 | | } |
| 248 | | } |
| 207 | pPickerInfo->file_index[i]->hashinfo = NULL; |
| 208 | pPickerInfo->file_index[i]->hash_realized = FALSE; |
| 249 | 209 | } |
| 210 | pPickerInfo->hashes_realized = 0; |
| 250 | 211 | } |
| 251 | 212 | |
| 252 | 213 | |
| 253 | 214 | |
| 254 | | void SoftwarePicker_SetErrorProc(HWND hwndPicker, void (*error_callback)(const char *message)) |
| 255 | | { |
| 256 | | software_picker_info *pPickerInfo; |
| 257 | | pPickerInfo = GetSoftwarePickerInfo(hwndPicker); |
| 258 | | pPickerInfo->error_callback = error_callback; |
| 259 | | } |
| 260 | | |
| 261 | | |
| 262 | | |
| 263 | 215 | static void ComputeFileHash(software_picker_info *pPickerInfo, |
| 264 | 216 | file_info *pFileInfo, const unsigned char *pBuffer, unsigned int nLength) |
| 265 | 217 | { |
| r2488 | r2489 | |
| 267 | 219 | unsigned int functions; |
| 268 | 220 | |
| 269 | 221 | // get the device info |
| 270 | | info = image_device_getinfo(pPickerInfo->config, pFileInfo->device); |
| 222 | info = image_device_getinfo(pPickerInfo->config->mconfig, pFileInfo->device); |
| 271 | 223 | |
| 272 | 224 | // determine which functions to use |
| 273 | | functions = hashfile_functions_used(pPickerInfo->hashfile, info.type); |
| 225 | functions = hashfile_functions_used(pPickerInfo->config->hashfile, info.type); |
| 274 | 226 | |
| 275 | 227 | // compute the hash |
| 276 | 228 | image_device_compute_hash(pFileInfo->hash_string, pFileInfo->device, pBuffer, nLength, functions); |
| r2488 | r2489 | |
| 385 | 337 | |
| 386 | 338 | // Determine which hash functions we need to use for this file, and which hashes |
| 387 | 339 | // have already been calculated |
| 388 | | if ((pPickerInfo->hashfile != NULL) && (pFileInfo->device != NULL)) |
| 340 | if ((pPickerInfo->config->hashfile != NULL) && (pFileInfo->device != NULL)) |
| 389 | 341 | { |
| 390 | | image_device_info info = image_device_getinfo(pPickerInfo->config, pFileInfo->device); |
| 342 | image_device_info info = image_device_getinfo(pPickerInfo->config->mconfig, pFileInfo->device); |
| 391 | 343 | type = info.type; |
| 392 | 344 | if (type < IO_COUNT) |
| 393 | | nHashFunctionsUsed = hashfile_functions_used(pPickerInfo->hashfile, type); |
| 345 | nHashFunctionsUsed = hashfile_functions_used(pPickerInfo->config->hashfile, type); |
| 394 | 346 | nCalculatedHashes = hash_data_used_functions(pFileInfo->hash_string); |
| 395 | 347 | } |
| 396 | 348 | |
| r2488 | r2489 | |
| 401 | 353 | pPickerInfo->file_index[nIndex]->hash_realized = TRUE; |
| 402 | 354 | pPickerInfo->hashes_realized++; |
| 403 | 355 | |
| 404 | | if (pPickerInfo->hashfile) |
| 356 | if (pPickerInfo->config->hashfile) |
| 405 | 357 | { |
| 406 | | pPickerInfo->file_index[nIndex]->hashinfo = hashfile_lookup(pPickerInfo->hashfile, |
| 358 | pPickerInfo->file_index[nIndex]->hashinfo = hashfile_lookup(pPickerInfo->config->hashfile, |
| 407 | 359 | pPickerInfo->file_index[nIndex]->hash_string); |
| 408 | 360 | } |
| 409 | 361 | } |
| r2488 | r2489 | |
| 430 | 382 | // look up the device |
| 431 | 383 | if (strrchr(pszFilename, '.')) |
| 432 | 384 | pszExtension = strrchr(pszFilename, '.'); |
| 433 | | if ((pszExtension != NULL) && (pPickerInfo->driver != NULL)) |
| 385 | if ((pszExtension != NULL) && (pPickerInfo->config != NULL)) |
| 434 | 386 | { |
| 435 | | for (device = image_device_first(pPickerInfo->config); device != NULL; device = image_device_next(device)) |
| 387 | for (device = image_device_first(pPickerInfo->config->mconfig); device != NULL; device = image_device_next(device)) |
| 436 | 388 | { |
| 437 | 389 | if (image_device_uses_file_extension(device, pszExtension)) |
| 438 | 390 | break; |
| r2488 | r2489 | |
| 455 | 407 | |
| 456 | 408 | // set up device and CRC, if specified |
| 457 | 409 | pInfo->device = device; |
| 458 | | if ((device != NULL) && (image_device_getinfo(pPickerInfo->config, device).has_partial_hash != 0)) |
| 410 | if ((device != NULL) && (image_device_getinfo(pPickerInfo->config->mconfig, device).has_partial_hash != 0)) |
| 459 | 411 | nCrc = 0; |
| 460 | 412 | if (nCrc != 0) |
| 461 | 413 | snprintf(pInfo->hash_string, sizeof(pInfo->hash_string) / sizeof(pInfo->hash_string[0]), "c:%08x#", nCrc); |
| r2488 | r2489 | |
| 720 | 672 | SoftwarePicker_FreeSearchInfo(pSearchInfo); |
| 721 | 673 | } |
| 722 | 674 | } |
| 723 | | else if (pPickerInfo->hashfile && (pPickerInfo->hashes_realized |
| 675 | else if (pPickerInfo->config->hashfile && (pPickerInfo->hashes_realized |
| 724 | 676 | < pPickerInfo->file_index_length)) |
| 725 | 677 | { |
| 726 | 678 | // time to realize some hashes |
| r2488 | r2489 | |
| 737 | 689 | if (!pFileInfo->hash_realized) |
| 738 | 690 | { |
| 739 | 691 | type = mess_device_from_core_device(pFileInfo->device)->type; |
| 740 | | if (hashfile_functions_used(pPickerInfo->hashfile, type)) |
| 692 | if (hashfile_functions_used(pPickerInfo->config->hashfile, type)) |
| 741 | 693 | { |
| 742 | 694 | // only calculate the hash if it is appropriate for this device |
| 743 | 695 | if (!SoftwarePicker_CalculateHash(hwndPicker, pPickerInfo->current_position)) |