Skip to content

Commit 8ebb119

Browse files
committed
lets see here
1 parent 6230cff commit 8ebb119

14 files changed

Lines changed: 1249 additions & 41 deletions

.github/workflows/pr-build.yml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,77 @@ jobs:
1515
- name: Set up MSBuild
1616
uses: microsoft/setup-msbuild@v2
1717

18-
- name: Build Win32 DLL
18+
- name: Build release Win32 DLL
1919
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=Win32 -m
2020

21-
- name: Build x64 DLL
21+
- name: Build release x64 DLL
2222
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=x64 -m
2323

24+
- name: Build debug Win32 DLL
25+
run: msbuild uc_online2.vcxproj -p:Configuration=Debug -p:Platform=Win32 -m
26+
27+
- name: Build debug x64 DLL
28+
run: msbuild uc_online2.vcxproj -p:Configuration=Debug -p:Platform=x64 -m
29+
2430
- name: Verify build outputs
2531
shell: pwsh
2632
run: |
2733
$files = @(
28-
"build/x86/steam_api.dll",
29-
"build/x64/steam_api64.dll"
34+
"relbuild/x86/steam_api.dll",
35+
"relbuild/x64/steam_api64.dll"
36+
"debbuild/x86/steam_api.dll",
37+
"debbuild/x64/steam_api64.dll"
3038
)
3139
3240
foreach ($file in $files) {
3341
if (-not (Test-Path $file)) {
3442
throw "Missing expected build output: $file"
3543
}
36-
}
44+
}
45+
46+
- name: Package release zip
47+
shell: pwsh
48+
run: |
49+
$packageRoot = "dist/uc-online2-${{ github.ref_name }}.release"
50+
$archivePath = "$packageRoot.zip"
51+
52+
New-Item -ItemType Directory -Path "$packageRoot/x86" -Force | Out-Null
53+
New-Item -ItemType Directory -Path "$packageRoot/x64" -Force | Out-Null
54+
55+
Copy-Item "relbuild/x86/steam_api.dll" "$packageRoot/x86/steam_api.dll"
56+
Copy-Item "relbuild/x64/steam_api64.dll" "$packageRoot/x64/steam_api64.dll"
57+
58+
if (Test-Path $archivePath) {
59+
Remove-Item $archivePath -Force
60+
}
61+
62+
Compress-Archive -Path $packageRoot -DestinationPath $archivePath
63+
64+
- name: Package debug zip
65+
shell: pwsh
66+
run: |
67+
$packageRootdeb = "dist/uc-online2-${{ github.ref_name }}.debug"
68+
$archivePathdeb = "$packageRoot.zip"
69+
70+
New-Item -ItemType Directory -Path "$packageRootdeb/x86" -Force | Out-Null
71+
New-Item -ItemType Directory -Path "$packageRootdeb/x64" -Force | Out-Null
72+
73+
Copy-Item "debbuild/x86/steam_api.dll" "$packageRootdeb/x86/steam_api.dll"
74+
Copy-Item "debbuild/x64/steam_api64.dll" "$packageRootdeb/x64/steam_api64.dll"
75+
76+
if (Test-Path $archivePathdeb) {
77+
Remove-Item $archivePathdeb -Force
78+
}
79+
80+
Compress-Archive -Path $packageRootdeb -DestinationPath $archivePathdeb
81+
82+
- name: Upload workflow artifact
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: |
86+
uc-online2-${{ github.ref_name }}.release
87+
uc-online2-${{ github.ref_name }}.debug
88+
path: |
89+
dist/uc-online2-${{ github.ref_name }}.release.zip
90+
dist/uc-online2-${{ github.ref_name }}.debug.zip
91+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ jobs:
2525
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=Win32 -m
2626

2727
- name: Build x64 version (steam_api64.dll)
28-
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=x64 -m
28+
run: msbuild uc_online2.vcxproj -p:Configuration=Release -p:Platform=x64 -m
29+
30+
- name: Build x86 version debug (steam_api.dll)
31+
run: msbuild uc_online2.vcxproj -p:Configuration=Debug -p:Platform=Win32 -m
32+
33+
- name: Build x64 version debug (steam_api64.dll)
34+
run: msbuild uc_online2.vcxproj -p:Configuration=Debug -p:Platform=x64 -m
2935

3036
- name: Verify build outputs
3137
shell: pwsh
3238
run: |
3339
$files = @(
34-
"build/x86/steam_api.dll",
35-
"build/x64/steam_api64.dll"
40+
"relbuild/x86/steam_api.dll",
41+
"relbuild/x64/steam_api64.dll"
42+
"debbuild/x86/steam_api.dll"
43+
"debbuild/x64/steam_api64.dll"
3644
)
3745
3846
foreach ($file in $files) {
@@ -44,26 +52,48 @@ jobs:
4452
- name: Package release zip
4553
shell: pwsh
4654
run: |
47-
$packageRoot = "dist/uc-online2-${{ github.ref_name }}"
55+
$packageRoot = "dist/uc-online2-${{ github.ref_name }}.release"
4856
$archivePath = "$packageRoot.zip"
4957
5058
New-Item -ItemType Directory -Path "$packageRoot/x86" -Force | Out-Null
5159
New-Item -ItemType Directory -Path "$packageRoot/x64" -Force | Out-Null
5260
53-
Copy-Item "build/x86/steam_api.dll" "$packageRoot/x86/steam_api.dll"
54-
Copy-Item "build/x64/steam_api64.dll" "$packageRoot/x64/steam_api64.dll"
61+
Copy-Item "relbuild/x86/steam_api.dll" "$packageRoot/x86/steam_api.dll"
62+
Copy-Item "relbuild/x64/steam_api64.dll" "$packageRoot/x64/steam_api64.dll"
5563
5664
if (Test-Path $archivePath) {
5765
Remove-Item $archivePath -Force
5866
}
5967
6068
Compress-Archive -Path $packageRoot -DestinationPath $archivePath
6169
70+
- name: Package debug zip
71+
shell: pwsh
72+
run: |
73+
$packageRootdeb = "dist/uc-online2-${{ github.ref_name }}.debug"
74+
$archivePathdeb = "$packageRoot.zip"
75+
76+
New-Item -ItemType Directory -Path "$packageRootdeb/x86" -Force | Out-Null
77+
New-Item -ItemType Directory -Path "$packageRootdeb/x64" -Force | Out-Null
78+
79+
Copy-Item "debbuild/x86/steam_api.dll" "$packageRootdeb/x86/steam_api.dll"
80+
Copy-Item "debbuild/x64/steam_api64.dll" "$packageRootdeb/x64/steam_api64.dll"
81+
82+
if (Test-Path $archivePathdeb) {
83+
Remove-Item $archivePathdeb -Force
84+
}
85+
86+
Compress-Archive -Path $packageRootdeb -DestinationPath $archivePathdeb
87+
6288
- name: Upload workflow artifact
6389
uses: actions/upload-artifact@v4
6490
with:
65-
name: uc-online2-${{ github.ref_name }}
66-
path: dist/uc-online2-${{ github.ref_name }}.zip
91+
name: |
92+
uc-online2-${{ github.ref_name }}.release
93+
uc-online2-${{ github.ref_name }}.debug
94+
path: |
95+
dist/uc-online2-${{ github.ref_name }}.release.zip
96+
dist/uc-online2-${{ github.ref_name }}.debug.zip
6797
if-no-files-found: error
6898

6999
- name: Publish release assets
@@ -72,6 +102,8 @@ jobs:
72102
with:
73103
tag_name: ${{ github.ref_name }}
74104
name: ${{ github.ref_name }}
75-
files: dist/uc-online2-${{ github.ref_name }}.zip
105+
files: |
106+
dist/uc-online2-${{ github.ref_name }}.release.zip
107+
dist/uc-online2-${{ github.ref_name }}.debug.zip
76108
generate_release_notes: true
77109
fail_on_unmatched_files: true

build debug.bat

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@echo off
2+
setlocal
3+
4+
set "PROJECT=%~dp0uc_online2.vcxproj"
5+
6+
REM Find MSBuild
7+
set "MSBUILD="
8+
for /f "delims=" %%i in ('dir /b /s "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" 2^>nul') do (
9+
if not defined MSBUILD set "MSBUILD=%%i"
10+
)
11+
12+
if not defined MSBUILD (
13+
echo [ERROR] MSBuild not found.
14+
echo.
15+
echo You need Visual Studio Build Tools 2022 or later.
16+
echo Install it here: https://visualstudio.microsoft.com/visual-cpp-build-tools/
17+
echo.
18+
echo Select "Desktop development with C++" during installation.
19+
echo.
20+
pause
21+
exit /b 1
22+
)
23+
24+
echo Found MSBuild: %MSBUILD%
25+
echo.
26+
27+
echo ========================================
28+
echo Building x86 (debug) (steam_api.dll)
29+
echo ========================================
30+
"%MSBUILD%" "%PROJECT%" -p:Configuration=Debug -p:Platform=Win32 -m
31+
if %errorlevel% neq 0 (
32+
echo.
33+
echo [ERROR] x86 build failed.
34+
pause
35+
exit /b 1
36+
)
37+
echo x86 debug build succeeded: debbuild\x86\steam_api.dll
38+
echo.
39+
40+
echo ========================================
41+
echo Building x64 (debug) (steam_api64.dll)
42+
echo ========================================
43+
"%MSBUILD%" "%PROJECT%" -p:Configuration=Debug -p:Platform=x64 -m
44+
if %errorlevel% neq 0 (
45+
echo.
46+
echo [ERROR] x64 build failed.
47+
pause
48+
exit /b 1
49+
)
50+
echo x64 debug build succeeded: debbuild\x64\steam_api64.dll
51+
echo.
52+
53+
echo ========================================
54+
echo Both debug builds completed successfully
55+
echo ========================================
56+
echo x86: debbuild\x86\steam_api.dll
57+
echo x64: debbuild\x64\steam_api64.dll
58+
echo ========================================
59+
60+
pause

build.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if %errorlevel% neq 0 (
3434
pause
3535
exit /b 1
3636
)
37-
echo x86 build succeeded: build\x86\steam_api.dll
37+
echo x86 build succeeded: relbuild\x86\steam_api.dll
3838
echo.
3939

4040
echo ========================================
@@ -47,14 +47,14 @@ if %errorlevel% neq 0 (
4747
pause
4848
exit /b 1
4949
)
50-
echo x64 build succeeded: build\x64\steam_api64.dll
50+
echo x64 build succeeded: relbuild\x64\steam_api64.dll
5151
echo.
5252

5353
echo ========================================
5454
echo Both builds completed successfully
5555
echo ========================================
56-
echo x86: build\x86\steam_api.dll
57-
echo x64: build\x64\steam_api64.dll
56+
echo x86: relbuild\x86\steam_api.dll
57+
echo x64: relbuild\x64\steam_api64.dll
5858
echo ========================================
5959

6060
pause

dllmain.cpp

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <Windows.h>
22
#include <Shlwapi.h>
3+
#include <DbgHelp.h>
34
#include <new.h>
45
#include <stdarg.h>
56
#include <stdio.h>
@@ -11,11 +12,14 @@
1112
#include "include/sdk/steamclientpublic.h"
1213
#include "include/sdk/steam_gameserver.h"
1314

15+
S_API ISteamClient* g_pSteamClientGameServer = nullptr;
16+
1417
#include "include/registfuncs.h"
1518
#include "include/callback_dispatcher.h"
1619
#include "include/globals.h"
17-
#include "include/dll_loader.h"
20+
#include "include/uc_loader.h"
1821
#include "include/dump_handler.h"
22+
#include "include/MinHook.h"
1923

2024
#include "include/api/api_callbacks.h"
2125
#include "include/api/api_client.h"
@@ -48,7 +52,6 @@ HSteamPipe g_ServerPipe = 0;
4852
HSteamUser g_ServerUser = 0;
4953
ISteamClient* g_ServerClient = nullptr;
5054
ISteamClient* g_pServerClient = nullptr;
51-
ISteamClient* g_pSteamClientGameServer = nullptr;
5255
ISteamClient* g_pSteamClientGameServer_Latest = nullptr;
5356
ISteamGameServer* g_pGameServer = nullptr;
5457
ISteamUtils* g_pServerUtils = nullptr;
@@ -151,26 +154,23 @@ static void UCOLogImpl(const char* fmt, va_list args)
151154

152155
void UCOLOG(const char* fmt, ...)
153156
{
154-
#ifdef _DEBUG
155157
if (!fmt) return;
156158
va_list args;
157159
va_start(args, fmt);
158160
UCOLogImpl(fmt, args);
159161
va_end(args);
160-
#endif
161162
}
162163

163164
void UCOColor(WORD color, const char* text)
164165
{
165166
(void)color;
166-
#ifdef _DEBUG
167167
if (text && text[0])
168168
UCOLOG("%s", text);
169-
#endif
170169
}
171170

172171
// ============================================================
173-
// InitSteamClient
172+
// InitSteamClient // I seriously broke this later on in the
173+
// // releases, I am SO SORRY ya'll!!
174174
// ============================================================
175175

176176
void* InitSteamClient(HMODULE* phMod, bool bLocal, const char* iface)
@@ -251,6 +251,55 @@ void* InitSteamClient(HMODULE* phMod, bool bLocal, const char* iface)
251251
return nullptr;
252252
}
253253

254+
// ============================================================
255+
// BIsSubscribedApp Hook - always return true
256+
// Fixes games with hardcoded AppID subscription checks
257+
// ~ credits to xinerqu ~
258+
// ============================================================
259+
260+
typedef bool (S_CALLTYPE *Fn_BIsSubscribedApp)(void*, AppId_t);
261+
static Fn_BIsSubscribedApp g_pfnOriginalBIsSubscribedApp = nullptr;
262+
263+
static bool S_CALLTYPE Hooked_BIsSubscribedApp(void* pSteamApps, AppId_t appId)
264+
{
265+
UCOLOG("[UCOnline2] BIsSubscribedApp(%u) -> hooked, returning true", appId);
266+
return true;
267+
}
268+
269+
void InstallBIsSubscribedAppHook()
270+
{
271+
if (!g_bClientReady || !g_ClientCtx.SteamApps())
272+
{
273+
UCOLOG("[UCOnline2] Cannot install BIsSubscribedApp hook: client not ready or SteamApps is null");
274+
return;
275+
}
276+
277+
void** vtable = *reinterpret_cast<void***>(g_ClientCtx.SteamApps());
278+
279+
// ISteamApps vtable layout (from isteamapps.h):
280+
// 0: BIsSubscribed, 1: BIsLowViolence, 2: BIsCybercafe, 3: BIsVACBanned,
281+
// 4: GetCurrentGameLanguage, 5: GetAvailableGameLanguages, 6: BIsSubscribedApp
282+
void* pOriginalFunc = vtable[6];
283+
284+
MH_STATUS mhStatus = MH_Initialize();
285+
UCOLOG("[UCOnline2] MH_Initialize status: %d", mhStatus);
286+
287+
mhStatus = MH_CreateHook(pOriginalFunc, &Hooked_BIsSubscribedApp, reinterpret_cast<void**>(&g_pfnOriginalBIsSubscribedApp));
288+
if (mhStatus == MH_OK)
289+
{
290+
mhStatus = MH_EnableHook(pOriginalFunc);
291+
if (mhStatus == MH_OK)
292+
UCOLOG("[UCOnline2] BIsSubscribedApp hook installed successfully");
293+
else
294+
UCOLOG("[UCOnline2] MH_EnableHook failed for BIsSubscribedApp: %d", mhStatus);
295+
}
296+
else
297+
{
298+
UCOLOG("[UCOnline2] MH_CreateHook failed for BIsSubscribedApp: %d", mhStatus);
299+
}
300+
}
301+
302+
254303
// ============================================================
255304
// LoadGameOverlay
256305
// ============================================================

include/api/api_client.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
static bool s_bDispatcherInited = false;
22
CCallbackDispatcher* GetDispatcher();
33

4+
bool GetSteamPathFromRegistry(char* outPath, size_t pathSize);
5+
46
uint32 CountRegisteredCallbacks(int iCallbackId)
57
{
68
uint32 count = 0;
@@ -272,6 +274,10 @@ S_API ESteamAPIInitResult S_CALLTYPE SteamInternal_SteamAPI_Init(const char* psz
272274

273275
if (g_bClientReady)
274276
{
277+
// try and make sure this works, thank you xinerqu
278+
InstallBIsSubscribedAppHook();
279+
280+
return k_ESteamAPIInitResult_OK;
275281
}
276282

277283
if (!g_bClientReady)

0 commit comments

Comments
 (0)