mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Windows: When using "Create shortcut", use the game's icon instead of PPSSPP's.
Since on Windows, shortcuts can't embed icons, we first save the game's icon .png as an .ico in the SAVESTATE folder (there might be a better place, but it also doesn't seem worth it to create a new folder for this). Part of #10885 (Android functionality still missing, for example).
This commit is contained in:
+21
-1
@@ -635,7 +635,27 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::CREATE_GAME_SHORTCUT:
|
||||
return W32Util::CreateDesktopShortcut(param1, param2);
|
||||
{
|
||||
// Get the game info to get our hands on the icon png
|
||||
Path gamePath(param1);
|
||||
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath, GameInfoFlags::ICON);
|
||||
Path icoPath;
|
||||
if (info->icon.dataLoaded) {
|
||||
// Write the icon png out as a .ICO file so the shortcut can point to it
|
||||
|
||||
// Savestate seems like a good enough place to put ico files.
|
||||
Path iconFolder = GetSysDirectory(PSPDirectories::DIRECTORY_SAVESTATE);
|
||||
|
||||
icoPath = iconFolder / (info->id + ".ico");
|
||||
if (!File::Exists(icoPath)) {
|
||||
if (!W32Util::CreateICOFromPNGData((const uint8_t *)info->icon.data.data(), info->icon.data.size(), icoPath)) {
|
||||
ERROR_LOG(SYSTEM, "ICO creation failed");
|
||||
icoPath.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
return W32Util::CreateDesktopShortcut(param1, param2, icoPath);
|
||||
}
|
||||
case SystemRequestType::RUN_CALLBACK_IN_WNDPROC:
|
||||
{
|
||||
auto func = reinterpret_cast<void (*)(void *window, void *userdata)>(param3);
|
||||
|
||||
Reference in New Issue
Block a user