/* Allow us to pre-load the DIB once for future draws */ #ifdef MESS BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType) #else /* !MESS */ BOOL LoadScreenShot(int nGame, int nType) #endif /* MESS */ { BOOL loaded = FALSE; /* No need to reload the same one again */ #ifndef MESS if (nGame == current_image_game && nType == current_image_type) return TRUE; #endif /* Delete the last ones */ FreeScreenShot(); /* Load the DIB */ #ifdef MESS if (lpSoftwareName) { int nParentIndex = -1; loaded = LoadSoftwareScreenShot(drivers[nGame], lpSoftwareName, nType); if (!loaded && DriverIsClone(nGame) == TRUE) { nParentIndex = GetParentIndex(drivers[nGame]); loaded = LoadSoftwareScreenShot(drivers[nParentIndex], lpSoftwareName, nType); } } if (!loaded) #endif /* MESS */ { loaded = LoadDIB(drivers[nGame]->name, &m_hDIB, &m_hPal, nType); } /* If not loaded, see if there is a clone and try that */ if (!loaded) { int nParentIndex = GetParentIndex(drivers[nGame]); if( nParentIndex >= 0) { loaded = LoadDIB(drivers[nParentIndex]->name, &m_hDIB, &m_hPal, nType); nParentIndex = GetParentIndex(drivers[nParentIndex]); if (!loaded && nParentIndex >= 0) loaded = LoadDIB(drivers[nParentIndex]->name, &m_hDIB, &m_hPal, nType); } } if (loaded) { HDC hdc = GetDC(GetMainWindow()); m_hDDB = DIBToDDB(hdc, m_hDIB, NULL); ReleaseDC(GetMainWindow(),hdc); current_image_game = nGame; current_image_type = nType; } return (loaded) ? TRUE : FALSE; }
/* Allow us to pre-load the DIB once for future draws */ BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType) { BOOL loaded = FALSE; /* Delete the last ones */ FreeScreenShot(); /* Load the DIB */ if (lpSoftwareName) { int nParentIndex = -1; loaded = LoadSoftwareScreenShot(&driver_list::driver(nGame), lpSoftwareName, nType); if (!loaded && DriverIsClone(nGame) == TRUE) { nParentIndex = GetParentIndex(&driver_list::driver(nGame)); loaded = LoadSoftwareScreenShot(&driver_list::driver(nParentIndex), lpSoftwareName, nType); } } if (!loaded) loaded = LoadDIB(driver_list::driver(nGame).name, &m_hDIB, &m_hPal, nType); /* If not loaded, see if there is a clone and try that */ if (!loaded) { int nParentIndex = GetParentIndex(&driver_list::driver(nGame)); if( nParentIndex >= 0) { loaded = LoadDIB(driver_list::driver(nParentIndex).name, &m_hDIB, &m_hPal, nType); nParentIndex = GetParentIndex(&driver_list::driver(nParentIndex)); if (!loaded && nParentIndex >= 0) loaded = LoadDIB(driver_list::driver(nParentIndex).name, &m_hDIB, &m_hPal, nType); } } if (loaded) { HDC hdc = GetDC(GetMainWindow()); m_hDDB = DIBToDDB(hdc, m_hDIB, NULL); ReleaseDC(GetMainWindow(),hdc); } return (loaded) ? TRUE : FALSE; }
/* Allow us to pre-load the DIB once for future draws */ #ifdef MESS BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType) #else /* !MESS */ BOOL LoadScreenShot(int nGame, int nType) #endif /* MESS */ { BOOL loaded = FALSE; /* No need to reload the same one again */ #ifndef MESS if (nGame == current_image_game && nType == current_image_type) return TRUE; #endif /* Delete the last ones */ FreeScreenShot(); /* Load the DIB */ #ifdef MESS if (lpSoftwareName) { int nParentIndex = -1; loaded = LoadSoftwareScreenShot(&driver_list::driver(nGame), lpSoftwareName, nType); if (!loaded && DriverIsClone(nGame) == TRUE) { nParentIndex = GetParentIndex(&driver_list::driver(nGame)); loaded = LoadSoftwareScreenShot(&driver_list::driver(nParentIndex), lpSoftwareName, nType); } } if (!loaded) #endif /* MESS */ { loaded = LoadDIB(driver_list::driver(nGame).name, &m_hDIB, &m_hPal, nType); } /* If not loaded, see if there is a clone and try that */ if (!loaded) { int nParentIndex = GetParentIndex(&driver_list::driver(nGame)); if( nParentIndex >= 0) { loaded = LoadDIB(driver_list::driver(nParentIndex).name, &m_hDIB, &m_hPal, nType); nParentIndex = GetParentIndex(&driver_list::driver(nParentIndex)); if (!loaded && nParentIndex >= 0) loaded = LoadDIB(driver_list::driver(nParentIndex).name, &m_hDIB, &m_hPal, nType); } } #ifndef MESS /* MSH 20071029 - If driver is broken and no images exists, look for nonworking.png */ if (!loaded && DriverIsBroken(nGame)) { loaded = LoadDIB("nonworking", &m_hDIB, &m_hPal, nType); } #endif if (loaded) { HDC hdc = GetDC(GetMainWindow()); m_hDDB = DIBToDDB(hdc, m_hDIB, NULL); ReleaseDC(GetMainWindow(),hdc); current_image_game = nGame; current_image_type = nType; } return (loaded) ? TRUE : FALSE; }
/* Allow us to pre-load the DIB once for future draws */ #ifdef MESS BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType) #else /* !MESS */ #ifdef USE_IPS BOOL LoadScreenShot(int nGame, LPCWSTR lpIPSName, int nType) #else /* USE_IPS */ BOOL LoadScreenShot(int nGame, int nType) #endif /* USE_IPS */ #endif /* MESS */ { BOOL loaded = FALSE; int nIndex = nGame; /* No need to reload the same one again */ #ifndef MESS if (nGame == current_image_game && nType == current_image_type) return TRUE; #endif /* Delete the last ones */ FreeScreenShot(); /* Load the DIB */ #ifdef MESS if (lpSoftwareName) { int nParentIndex = -1; loaded = LoadSoftwareScreenShot(&driver_list::driver(nGame), lpSoftwareName, nType); if (!loaded && DriverIsClone(nGame) == TRUE) { nParentIndex = GetParentIndex(drivers[nGame]); loaded = LoadSoftwareScreenShot(&driver_list::driver(nParentIndex), lpSoftwareName, nType); } } if (!loaded) #endif /* MESS */ { #ifdef USE_IPS if (lpIPSName) { WCHAR *wdrv = driversw[nIndex]->name; WCHAR buf[MAX_PATH]; wsprintf(buf, TEXT("%s/%s"), wdrv, lpIPSName); dwprintf(TEXT("found ipsname: %s"), buf); while (!loaded && nIndex >= 0) { wdrv = driversw[nIndex]->name; wsprintf(buf, TEXT("%s/%s"), wdrv, lpIPSName); loaded = LoadDIB(buf, &m_hDIB, &m_hPal, nType); nIndex = GetParentIndex(&driver_list::driver(nIndex)); } } else #endif /* USE_IPS */ { dwprintf(TEXT("not found ipsname: %s"), driversw[nIndex]->name); while (!loaded && nIndex >= 0) { loaded = LoadDIB(driversw[nIndex]->name, &m_hDIB, &m_hPal, nType); nIndex = GetParentIndex(&driver_list::driver(nIndex)); } } } if (loaded) { HDC hdc = GetDC(GetMainWindow()); m_hDDB = DIBToDDB(hdc, m_hDIB, NULL); ReleaseDC(GetMainWindow(),hdc); current_image_game = nGame; current_image_type = nType; } return (loaded) ? TRUE : FALSE; }
static BOOL DevView_GetOpenFileName(HWND hwndDevView, const machine_config *config, const device_image_interface *dev, LPTSTR pszFilename, UINT nFilenameLength) { BOOL bResult = 0; TCHAR *t_s; int i = 0; mess_image_type imagetypes[256]; HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST); int drvindex = Picker_GetSelectedItem(hwndList); std::string as, dst; const char *s, *opt_name = dev->instance_name(); windows_options o; load_options(o, OPTIONS_GAME, drvindex); s = o.value(opt_name); /* Get the path to the currently mounted image */ util::zippath_parent(as, s); dst = as; /* See if an image was loaded, and that the path still exists */ if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) { /* Get the path from the software tab */ int driver_index = drvindex; windows_options o; load_options(o, OPTIONS_GAME, driver_index); const char* paths = o.value(OPTION_SWPATH); if (paths && (paths[0] > 64)) {} else // search deeper when looking for software { // not specified in driver, try parent if it has one int nParentIndex = -1; if (DriverIsClone(driver_index) == TRUE) { nParentIndex = GetParentIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } if (paths && (paths[0] > 64)) {} else { // still nothing, try for a system in the 'compat' field if (nParentIndex >= 0) driver_index = nParentIndex; // now recycle variable as a compat system number nParentIndex = GetCompatIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } } as = paths; /* We only want the first path; throw out the rest */ i = as.find(';'); if (i > 0) as.substr(0, i); dst = as; /* Make sure a folder was specified in the tab, and that it exists */ if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) { // Get the global loose software path as = GetSWDir(); /* We only want the first path; throw out the rest */ i = as.find(';'); if (i > 0) as.substr(0, i); dst = as; /* Make sure a folder was specified in the tab, and that it exists */ if ((!osd::directory::open(as.c_str())) || (as.find(':') == std::string::npos)) { /* Default to emu directory */ osd_get_full_path(dst,"."); } } } SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev); t_s = ui_wstring_from_utf8(dst.c_str()); bResult = CommonFileImageDialog(t_s, GetOpenFileName, pszFilename, config, imagetypes); CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); free(t_s); return bResult; }
void MyFillSoftwareList(int drvindex, BOOL bForce) { BOOL is_same = 0; HWND hwndSoftwarePicker; HWND hwndSoftwareList; HWND hwndSoftwareDevView; // do we have to do anything? if (!bForce) { if (s_config != NULL) is_same = (drvindex == s_config->driver_index); else is_same = (drvindex < 0); if (is_same) return; } // free the machine config, if necessary MySoftwareListClose(); // allocate the machine config, if necessary if (drvindex >= 0) s_config = software_config_alloc(drvindex); // locate key widgets hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST); hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SOFTLIST); hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW); // set up the device view DevView_SetDriver(hwndSoftwareDevView, s_config); // set up the software picker SoftwarePicker_Clear(hwndSoftwarePicker); SoftwarePicker_SetDriver(hwndSoftwarePicker, s_config); // Get the game's software path int driver_index = drvindex; windows_options o; load_options(o, OPTIONS_GAME, driver_index); const char* paths = o.value(OPTION_SWPATH); if (paths && (paths[0] > 64)) {} else // search deeper when looking for software { // not specified in driver, try parent if it has one int nParentIndex = -1; if (DriverIsClone(driver_index) == TRUE) { nParentIndex = GetParentIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } if (paths && (paths[0] > 64)) {} else { // still nothing, try for a system in the 'compat' field if (nParentIndex >= 0) driver_index = nParentIndex; // now recycle variable as a compat system number nParentIndex = GetCompatIndex(&driver_list::driver(driver_index)); if (nParentIndex >= 0) { load_options(o, OPTIONS_PARENT, nParentIndex); paths = o.value(OPTION_SWPATH); } } } // These are the only paths that matter AddSoftwarePickerDirs(hwndSoftwarePicker, paths, NULL); paths = 0; // set up the software picker SoftwareList_Clear(hwndSoftwareList); SoftwareList_SetDriver(hwndSoftwareList, s_config); /* allocate the machine config */ machine_config config(driver_list::driver(drvindex),MameUIGlobal()); for (software_list_device &swlistdev : software_list_device_iterator(config.root_device())) { for (const software_info &swinfo : swlistdev.get_info()) { const software_part &swpart = swinfo.parts().front(); // search for a device with the right interface for (device_image_interface &image : image_interface_iterator(config.root_device())) { const char *interface = image.image_interface(); if (interface) { if (swpart.matches_interface(interface)) { // Extract the Usage data from the "info" fields. const char* usage = NULL; for (const feature_list_item &flist : swinfo.other_info()) if (flist.name() == "usage") usage = flist.value().c_str(); // Now actually add the item SoftwareList_AddFile(hwndSoftwareList, swinfo.shortname().c_str(), swlistdev.list_name().c_str(), swinfo.longname().c_str(), swinfo.publisher().c_str(), swinfo.year().c_str(), usage, image.brief_instance_name()); break; } } } } } }