Skip to content

Commit

Permalink
bump proton-osu-9-10 (non-hide-wine crash fix + more)
Browse files Browse the repository at this point in the history
- hide wine isn't forced anymore by the magic-tricks patch, it only makes it work under the usual env var
- umu-run doesn't unset UMU_RUNTIME_UPDATE anymore as it seems to work with it as well
  • Loading branch information
NelloKudo committed Nov 9, 2024
1 parent 96c98c9 commit b94ca22
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From fb59e813a6f438e1887faadf8d1a250c140a7fe0 Mon Sep 17 00:00:00 2001
From: NelloKudo <[email protected]>
Date: Thu, 7 Nov 2024 05:30:31 +0100
Subject: [PATCH] Revert "ntdll: Report the space completely outside of
reserved areas as allocated on i386."

This reverts commit a136efeac8161406c4f15070d910e9038e74f79d, fixing osu! crashing
with Hide Wine version disabled.
---
dlls/ntdll/unix/virtual.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 42b40d59d58..62391642d82 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -5558,7 +5558,6 @@ static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFOR
* so that the app doesn't believe it's fully available */
{
struct reserved_area *area;
- BOOL in_reserved = FALSE;

LIST_FOR_EACH_ENTRY( area, &reserved_areas, struct reserved_area, entry )
{
@@ -5573,7 +5572,6 @@ static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFOR
if (area_start <= base || area_start <= (char *)address_space_start)
{
if (area_end < alloc_end) info->RegionSize = area_end - base;
- in_reserved = TRUE;
break;
}
/* report the remaining part of the 64K after the view as free */
@@ -5584,22 +5582,18 @@ static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFOR
if (base < next)
{
info->RegionSize = min( next, alloc_end ) - base;
- in_reserved = TRUE;
break;
}
else alloc_base = base;
}
/* pretend it's allocated */
if (area_start < alloc_end) info->RegionSize = area_start - base;
- break;
- }
- if (!in_reserved)
- {
info->State = MEM_RESERVE;
info->Protect = PAGE_NOACCESS;
info->AllocationBase = alloc_base;
info->AllocationProtect = PAGE_NOACCESS;
info->Type = MEM_PRIVATE;
+ break;
}
}
#endif
--
2.47.0

Original file line number Diff line number Diff line change
Expand Up @@ -47,51 +47,3 @@ index e1017f1..c2a012c 100644
if (iid) *iid = GUID_NULL;
if (hiid) *hiid = INVALID_HANDLE_VALUE;
return E_NOTIMPL;
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index ed15e57..513bb93 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -262,6 +262,21 @@ BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType )
return GetBinaryTypeW(NtCurrentTeb()->StaticUnicodeString.Buffer, lpBinaryType);
}

+/* copied from dlls/mshtml/mutation.c is_iexplore() */
+static BOOL is_osu(void)
+{
+ static volatile char cache = -1;
+ BOOL ret = cache;
+ if(ret == -1) {
+ const WCHAR *p, *name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
+ if((p = wcsrchr(name, '/'))) name = p + 1;
+ if((p = wcsrchr(name, '\\'))) name = p + 1;
+ ret = !wcsicmp(name, L"osu!.exe");
+ cache = ret;
+ }
+ return ret;
+}
+
/***********************************************************************
* GetProcAddress (KERNEL32.@)
*
@@ -279,6 +294,18 @@ FARPROC get_proc_address( HMODULE hModule, LPCSTR function )
{
FARPROC fp;

+ if ((ULONG_PTR)function >> 16)
+ {
+ /* HACK for osu! after October 29th update (PROTON EDITION)
+ *
+ * Justification: It makes the game work when wine_get_version() is masked/nulled/unexported.
+ * The game uses a code path that's broken under newer Proton versions if it detects that it's
+ * running under wine, so we need to pretend that we're on Windows.
+ */
+ if (is_osu() && !strncmp( function, "wine_get_version", 16 ))
+ return NULL;
+ }
+
if (!hModule) hModule = NtCurrentTeb()->Peb->ImageBaseAddress;

if ((ULONG_PTR)function >> 16)
--
2.47.0

54 changes: 54 additions & 0 deletions patches/wine/0005-osu/hide-wine-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 11111111111..11111111111 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -262,6 +262,34 @@ BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType )
return GetBinaryTypeW(NtCurrentTeb()->StaticUnicodeString.Buffer, lpBinaryType);
}

+static BOOL block_wine_get_version = FALSE;
+
+BOOL CALLBACK init_block_wine_get_version( INIT_ONCE* init_once, PVOID param, PVOID *ctx )
+{
+ WCHAR *buffer;
+ DWORD size;
+
+ if ((size = GetEnvironmentVariableW( L"WINE_BLOCK_GET_VERSION", NULL, 0 )))
+ {
+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(*buffer) * size )))
+ {
+ ERR("No memory.\n");
+ return FALSE;
+ }
+
+ if (GetEnvironmentVariableW( L"WINE_BLOCK_GET_VERSION", buffer, size ) != size - 1)
+ {
+ ERR("Error getting WINE_BLOCK_GET_VERSION env variable.\n");
+ return FALSE;
+ }
+
+ block_wine_get_version = *buffer && !!wcsncmp( buffer, L"0", 1 );
+
+ HeapFree( GetProcessHeap(), 0, buffer );
+ }
+ return TRUE;
+}
+
/***********************************************************************
* GetProcAddress (KERNEL32.@)
*
@@ -279,6 +307,14 @@ FARPROC get_proc_address( HMODULE hModule, LPCSTR function )
{
FARPROC fp;

+ if ((ULONG_PTR)function >> 16)
+ {
+ static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
+ InitOnceExecuteOnce( &init_once, init_block_wine_get_version, NULL, NULL );
+ if (block_wine_get_version && !strncmp( function, "wine_get_version", 16 ))
+ return NULL;
+ }
+
if (!hModule) hModule = NtCurrentTeb()->Peb->ImageBaseAddress;

if ((ULONG_PTR)function >> 16)
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

pkgver=9-9
pkgver=9-10
buildname="proton-osu"
pkgname="${buildname}-${pkgver}"

Expand Down
3 changes: 1 addition & 2 deletions umu-static-bundler/wrapper/src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,7 @@ wrp_status_t setup_python_environment(const char *app_dir,

/* Set environment variables */
if (setenv("PATH", new_path, 1) != 0 ||
setenv("PYTHONEXECUTABLE", python_path, 1) != 0 ||
unsetenv("UMU_RUNTIME_UPDATE") != 0) { /* temporary osu-winello-specific workaround */
setenv("PYTHONEXECUTABLE", python_path, 1) ) {
return handle_error(WRP_EERRNO, NULL, NULL,
"Failed to set environment variables");
}
Expand Down

0 comments on commit b94ca22

Please sign in to comment.