// Get a translation. wstring Localization::get(wstring &key, const wchar_t* def) { if (key.empty()) return wstring(); auto i = mMenu.find(key); if (i == mMenu.end()) { dwprintf(L"Not Found: %s\n", key.c_str()); return wstring(def); } return i->second; }
bool Localization::has(wchar_t* key) { wstring wKey(key); #ifdef _DEBUG if (wKey.empty()) return false; bool r = mMenu.find(wKey) == mMenu.end(); if (r) { dwprintf(L"Not Found: %s\n", key); } return !r; #else return !wKey.empty() && mMenu.find(wKey) != mMenu.end(); #endif }
/* 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; }