Improve: Add adaptive screen algorithm option and set to default

Fix: send Windows client path/username as UTF-8 (consistent with CLIENT_CAP_UTF8), keep client ID stable across upgrade
This commit is contained in:
yuanyuanxiang
2026-05-09 22:25:20 +02:00
parent a354f1ed86
commit 70354e244c
7 changed files with 61 additions and 20 deletions

View File

@@ -3902,7 +3902,23 @@ void CMy2015RemoteDlg::OnOnlineUpdate()
return;
DWORD dwFileSize = 0;
BOOL is64bit = "64" == ContextObject->GetAdditionalData(RES_PROGRAM_BITS);
std::filesystem::path path = ContextObject->GetAdditionalData(RES_FILE_PATH).GetString();
// 客户端 RES_FILE_PATH 编码取决于其能力位(新 Win/Linux/macOS 是 UTF-8
// std::filesystem::path 的 std::string 构造器把字节当本机 ANSI 解读——
// 直接用 UTF-8 字节会被 CP936 误解为乱码,进而 stem() / parent_path() 提取错误。
// 走 cap 位 → wide → wstring 构造路径,规避编码假设。
CString pathRaw = ContextObject->GetAdditionalData(RES_FILE_PATH);
std::filesystem::path path;
{
UINT cp = GetClientEncoding(ContextObject);
int wlen = MultiByteToWideChar(cp, 0, pathRaw, -1, NULL, 0);
if (wlen > 1) {
std::wstring wpath(wlen - 1, L'\0');
MultiByteToWideChar(cp, 0, pathRaw, -1, &wpath[0], wlen);
path = std::filesystem::path(wpath);
} else {
path = std::filesystem::path(pathRaw.GetString());
}
}
std::string stem = path.stem().string();
std::string dirName = path.parent_path().filename().string();
const char* resName = dlg.m_nSelected
@@ -4046,7 +4062,7 @@ VOID CMy2015RemoteDlg::OnOnlineDesktopManager()
return;
int n = THIS_CFG.GetInt("settings", "DXGI");
BOOL all = THIS_CFG.GetInt("settings", "MultiScreen", TRUE);
CString algo = THIS_CFG.GetStr("settings", "ScreenCompress", "").c_str();
CString algo = THIS_CFG.GetStr("settings", "ScreenCompress", ALGORITHM_NULL).c_str();
BYTE bToken[32] = { COMMAND_SCREEN_SPY, n, algo.IsEmpty() ? ALGORITHM_RGB565 : atoi(algo.GetString()), all};
SendSelectedCommand(bToken, sizeof(bToken), screenParamModifier, bToken);
}