Skip to content

Commit 014c19c

Browse files
committed
Release v3.5: add Wine-aware auto-install script selection
1 parent bd54720 commit 014c19c

4 files changed

Lines changed: 33 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v3.5
4+
5+
- Updater install: `sofbuddy_update_install` now detects Wine (`wine_get_version`) and prefers `sof_buddy/update_from_zip.sh` under Wine/Proton.
6+
- Shutdown launch path: Wine install commands are queued in `winstart` as `/unix "<script>" "<zip>"`, with fallback to `.cmd` when `.sh` is unavailable.
7+
- Native Windows behavior remains unchanged (`update_from_zip.cmd`) while still using direct `winstart` buffer queueing.
8+
39
## v3.4
410

511
- Updater install: `sofbuddy_update_install` now writes the `winstart` command buffer directly (no `start` command seeding), improving reliability for auto-install on shutdown.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4
1+
3.5

hdr/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
Increment version using: ./increment_version.sh
88
*/
99

10-
#define SOFBUDDY_VERSION "3.4"
10+
#define SOFBUDDY_VERSION "3.5"

src/core/update_command.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ constexpr const char* kUpdateReleasesUrl = kUpdateReleasesUrlGitHub;
3535
#endif
3636
constexpr const char* kUpdateOutputDir = "sof_buddy/update";
3737
constexpr const char* kUpdateInstallScript = "sof_buddy/update_from_zip.cmd";
38+
constexpr const char* kUpdateInstallScriptWine = "sof_buddy/update_from_zip.sh";
3839
constexpr DWORD kUpdateTimeoutMs = 8000;
3940
constexpr uintptr_t kWinstartRva = 0x0040353C;
4041

@@ -80,6 +81,11 @@ bool is_regular_file(const char* path) {
8081
return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) == 0;
8182
}
8283

84+
bool is_running_under_wine() {
85+
HMODULE ntdll = GetModuleHandleA("ntdll.dll");
86+
return ntdll && GetProcAddress(ntdll, "wine_get_version");
87+
}
88+
8389
bool queue_winstart_command(const char* command) {
8490
if (!command || !command[0]) return false;
8591
char** slot = reinterpret_cast<char**>(rvaToAbsExe(reinterpret_cast<void*>(kWinstartRva)));
@@ -1028,9 +1034,13 @@ void Cmd_SoFBuddy_Update_f(void) {
10281034

10291035
void Cmd_SoFBuddy_UpdateInstall_f(void) {
10301036
if (!orig_Cmd_ExecuteString) return;
1031-
if (!is_regular_file(kUpdateInstallScript)) {
1037+
const bool wine = is_running_under_wine();
1038+
const char* script = wine ? kUpdateInstallScriptWine : kUpdateInstallScript;
1039+
if (!is_regular_file(script) && wine && is_regular_file(kUpdateInstallScript))
1040+
script = kUpdateInstallScript;
1041+
if (!is_regular_file(script)) {
10321042
set_update_status("install script missing");
1033-
PrintOut(PRINT_BAD, "sofbuddy_update_install: missing %s\n", kUpdateInstallScript);
1043+
PrintOut(PRINT_BAD, "sofbuddy_update_install: missing %s\n", script);
10341044
return;
10351045
}
10361046
const std::string zip_path = get_update_cvar_or_default(kCvarUpdateDownloadPath, "");
@@ -1039,10 +1049,19 @@ void Cmd_SoFBuddy_UpdateInstall_f(void) {
10391049
PrintOut(PRINT_BAD, "sofbuddy_update_install: exact downloaded zip missing; run sofbuddy_update download\n");
10401050
return;
10411051
}
1042-
std::string command = kUpdateInstallScript;
1043-
command += " \"";
1044-
command += zip_path;
1045-
command += "\"";
1052+
std::string command;
1053+
if (wine && std::strcmp(script, kUpdateInstallScriptWine) == 0) {
1054+
command = "/unix \"";
1055+
command += script;
1056+
command += "\" \"";
1057+
command += zip_path;
1058+
command += "\"";
1059+
} else {
1060+
command = script;
1061+
command += " \"";
1062+
command += zip_path;
1063+
command += "\"";
1064+
}
10461065

10471066
if (!queue_winstart_command(command.c_str())) {
10481067
set_update_status("failed to queue install command");

0 commit comments

Comments
 (0)