mirror of
https://github.com/Zaarrg/stremio-community-v5.git
synced 2026-01-11 20:10:31 +00:00
Blackscreen + Volume Control fix and more fixes
- Fixed Blackscreen and volume control being disabled bug. - Fixed Alt+Tab not focusing webview correctly - Added InitalVolume and VO (VideoOutput) to stremio-settings.ini. - Added updater clean up which deletes all old installers.
This commit is contained in:
parent
c0d7d1e9d2
commit
054ff34ddb
7 changed files with 42 additions and 0 deletions
|
|
@ -20,6 +20,9 @@ bool g_autoupdaterForceFull = false;
|
|||
// mpv
|
||||
mpv_handle* g_mpv = nullptr;
|
||||
std::set<std::string> g_observedProps;
|
||||
bool g_initialSet = false;
|
||||
std::string g_initialVO = "gpu-next";
|
||||
int g_currentVolume = 50;
|
||||
|
||||
// Node
|
||||
std::atomic_bool g_nodeRunning = false;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ extern bool g_autoupdaterForceFull;
|
|||
// mpv
|
||||
extern mpv_handle* g_mpv;
|
||||
extern std::set<std::string> g_observedProps;
|
||||
extern bool g_initialSet;
|
||||
extern std::string g_initialVO;
|
||||
extern int g_currentVolume;
|
||||
|
||||
// custom messages
|
||||
#define WM_MPV_WAKEUP (WM_APP + 2)
|
||||
|
|
|
|||
|
|
@ -131,6 +131,9 @@ void HandleMpvEvents()
|
|||
j["data"]=nullptr;
|
||||
break;
|
||||
}
|
||||
if (j["name"] == "volume" && g_initialSet) {
|
||||
g_currentVolume = j["data"];
|
||||
}
|
||||
SendToJS("mpv-prop-change", j);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ void HandleEvent(const std::string &ev, std::vector<std::string> &args)
|
|||
if(ev=="mpv-command"){
|
||||
if(!args.empty() && args[0] == "loadfile" && args.size() > 1) {
|
||||
args[1] = decodeURIComponent(args[1]);
|
||||
std::vector<std::string> voArgs = {"vo",g_initialVO};
|
||||
HandleMpvSetProp(voArgs);
|
||||
std::vector<std::string> volumeArgs = {"volume", std::to_string(g_currentVolume)};
|
||||
HandleMpvSetProp(volumeArgs);
|
||||
g_initialSet = true;
|
||||
}
|
||||
HandleMpvCommand(args);
|
||||
} else if(ev=="mpv-set-prop"){
|
||||
|
|
@ -488,6 +493,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if(LOWORD(wParam)==WA_INACTIVE){
|
||||
pauseMPV(g_pauseOnLostFocus);
|
||||
}
|
||||
if (LOWORD(wParam) != WA_INACTIVE)
|
||||
{
|
||||
SetFocus(hWnd);
|
||||
if (g_webview && g_webviewController) {
|
||||
g_webviewController->MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_SIZE:
|
||||
|
|
|
|||
|
|
@ -181,6 +181,17 @@ void RunAutoUpdaterOnce()
|
|||
std::string filename = url.substr(url.find_last_of('/') + 1);
|
||||
std::filesystem::path installerPath = tempDir / std::wstring(filename.begin(), filename.end());
|
||||
|
||||
// Cleanup: Delete all files in tempDir except the current installer
|
||||
for (const auto& entry : std::filesystem::directory_iterator(tempDir)) {
|
||||
if (entry.path() != installerPath) {
|
||||
try {
|
||||
std::filesystem::remove_all(entry.path());
|
||||
} catch (const std::exception& e) {
|
||||
AppendToCrashLog("[UPDATER]: Cleanup failed for " + entry.path().string() + ": " + e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(std::filesystem::exists(installerPath)) {
|
||||
if(FileChecksum(installerPath) != expectedChecksum) {
|
||||
std::filesystem::remove(installerPath);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ void LoadSettings()
|
|||
g_allowZoom = GetPrivateProfileIntW(L"General", L"AllowZoom", 0, iniPath.c_str());
|
||||
g_pauseOnMinimize = (GetPrivateProfileIntW(L"General", L"PauseOnMinimize", 1, iniPath.c_str()) == 1);
|
||||
g_pauseOnLostFocus = (GetPrivateProfileIntW(L"General", L"PauseOnLostFocus", 0, iniPath.c_str()) == 1);
|
||||
//Mpv
|
||||
wchar_t voBuffer[32];
|
||||
GetPrivateProfileStringW(L"MPV", L"VideoOutput", L"gpu-next", voBuffer, 32, iniPath.c_str());
|
||||
char narrowVO[32];
|
||||
WideCharToMultiByte(CP_UTF8, 0, voBuffer, -1, narrowVO, 32, NULL, NULL);
|
||||
g_initialVO = narrowVO;
|
||||
g_currentVolume = GetPrivateProfileIntW(L"MPV", L"InitialVolume", 50, iniPath.c_str());
|
||||
}
|
||||
|
||||
void SaveSettings()
|
||||
|
|
|
|||
|
|
@ -5,3 +5,6 @@ ThumbFastHeight=0
|
|||
PauseOnMinimize=1
|
||||
PauseOnLostFocus=0
|
||||
AllowZoom=0
|
||||
[MPV]
|
||||
VideoOutput=gpu-next
|
||||
InitialVolume=50
|
||||
|
|
|
|||
Loading…
Reference in a new issue