mirror of
https://github.com/R2Northstar/NorthstarLauncher
synced 2026-08-23 20:26:04 -04:00
Allow external authentication methods to work on linux (#913)
* add the origin sdk hooks * fmt * more fmt
This commit is contained in:
parent
ca2f5670fd
commit
14b9a6281a
3 changed files with 47 additions and 0 deletions
|
|
@ -188,6 +188,8 @@ add_library(
|
|||
"vscript/vscript.h"
|
||||
"windows/libsys.cpp"
|
||||
"windows/libsys.h"
|
||||
"origin/origin.cpp"
|
||||
"origin/origin.h"
|
||||
"dllmain.cpp"
|
||||
"ns_version.h"
|
||||
"Northstar.def"
|
||||
|
|
|
|||
44
primedev/origin/origin.cpp
Normal file
44
primedev/origin/origin.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "origin.h"
|
||||
#include <cstdint>
|
||||
|
||||
static bool(__fastcall* o_pCheckIfOriginIsInstalled)() = nullptr;
|
||||
static bool __fastcall h_CheckIfOriginIsInstalled()
|
||||
{
|
||||
if (!strstr(GetCommandLineA(), "-noOriginStartup"))
|
||||
return o_pCheckIfOriginIsInstalled();
|
||||
|
||||
if (o_pCheckIfOriginIsInstalled())
|
||||
{
|
||||
NS::log::NORTHSTAR->warn(
|
||||
"Origin is NOT installed according to OriginSDK's check (HKLM\\SOFTWARE\\Wow6432Node\\Origin\\ClientPath is missing/empty).");
|
||||
NS::log::NORTHSTAR->warn("We are bypassing this check in case LSX server is remotely ran (such as in Linux in another WINE "
|
||||
"prefix), but note that things will fail if Origin is actually not running.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint64_t(__fastcall* o_pTryToStartOrigin)(void* a1) = nullptr;
|
||||
static uint64_t __fastcall h_TryToStartOrigin(void* a1)
|
||||
{
|
||||
if (!strstr(GetCommandLineA(), "-noOriginStartup"))
|
||||
return o_pTryToStartOrigin(a1);
|
||||
|
||||
if (o_pTryToStartOrigin(a1) != 0)
|
||||
{
|
||||
NS::log::NORTHSTAR->warn("Origin process has failed to start. We are ignoring this and let it fail on LSX connection attempt, "
|
||||
"because LSX might still be up regardless, even if this failed.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ON_DLL_LOAD("OriginSDK.dll", OriginSDKFuncs, (CModule module))
|
||||
{
|
||||
// these hooks are required for linux to work without EA app or Origin in the same wine prefix
|
||||
|
||||
o_pCheckIfOriginIsInstalled = module.Offset(0xa1850).RCast<decltype(o_pCheckIfOriginIsInstalled)>();
|
||||
HookAttach(&(PVOID&)o_pCheckIfOriginIsInstalled, (PVOID)h_CheckIfOriginIsInstalled);
|
||||
|
||||
o_pTryToStartOrigin = module.Offset(0xa19b0).RCast<decltype(o_pTryToStartOrigin)>();
|
||||
HookAttach(&(PVOID&)o_pTryToStartOrigin, (PVOID)h_TryToStartOrigin);
|
||||
}
|
||||
1
primedev/origin/origin.h
Normal file
1
primedev/origin/origin.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#pragma once
|
||||
Loading…
Add table
Add a link
Reference in a new issue