Skip to content

Commit 26accc1

Browse files
committed
hotfix for broken login page
1 parent 30e5858 commit 26accc1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/main/origin_client_dll_patches.cpp

+39
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,41 @@ void __fastcall checkForUpdate_hook(void* thisptr /*ecx*/)
9797
// downloaded upon next Origin launch by thin setup.
9898
}
9999

100+
// Origin::Client::LoginViewController::init
101+
void(__thiscall* loginViewController_init_org)(void*, DWORD*, /* Origin::Client::AuthenticationJsHelper* */ void*, int);
102+
void __fastcall loginViewController_init_hook(void* thisptr /*ecx*/, void* /*edx*/, DWORD* a2, void* a3, int a4)
103+
{
104+
*(bool*)((uintptr_t)thisptr + 166) = true; // make it think we've loaded all cookies already
105+
//*(bool*)((uintptr_t)thisptr + 167) = true; // make it think Trusted Clock is already initialized
106+
loginViewController_init_org(thisptr, a2, a3, a4);
107+
108+
// this does NOT seem to work here!
109+
// Origin::Client::LoginViewController::killSplashScreenAndShowLoginWindow
110+
//static auto killSplashScreenAndShowLoginWindow = GetExport<void(__thiscall*)(void*)>(OriginClient, "?killSplashScreenAndShowLoginWindow@LoginViewController@Client@Origin@@AAEXXZ");
111+
//killSplashScreenAndShowLoginWindow(thisptr);
112+
}
113+
114+
// Origin::Client::LoginViewController::loadLoginPage
115+
void(__thiscall* loginViewController_loadLoginPage_org)(void*, int);
116+
void __fastcall loginViewController_loadLoginPage_hook(void* thisptr /*ecx*/, void* /*edx*/, int a2)
117+
{
118+
loginViewController_loadLoginPage_org(thisptr, a2);
119+
120+
static auto killSplashScreenAndShowLoginWindow = GetExport<void(__thiscall*)(void*)>(OriginClient, "?killSplashScreenAndShowLoginWindow@LoginViewController@Client@Origin@@AAEXXZ");
121+
122+
static bool didWarnAboutMissingAlready = false;
123+
if (!didWarnAboutMissingAlready && (!killSplashScreenAndShowLoginWindow)) [[unlikely]]
124+
{
125+
didWarnAboutMissingAlready = true;
126+
MessageBoxA(nullptr, "Error in Origin::Client::LoginViewController::loadLoginPage: killSplashScreenAndShowLoginWindow was not found, your Origin client will probably be stuck on splash screen\n"
127+
"\nRight-click Origin icon in your tray and click Open Origin as a workaround.",
128+
ERROR_MSGBOX_CAPTION, MB_ICONERROR);
129+
}
130+
131+
// well it seems someone forgot to call this func in a reasonable place like here
132+
if (killSplashScreenAndShowLoginWindow)
133+
killSplashScreenAndShowLoginWindow(thisptr);
134+
}
100135
void DoOriginClientDllPatches()
101136
{
102137
{
@@ -136,4 +171,8 @@ void DoOriginClientDllPatches()
136171

137172
// This checks for update to nag the user in the UI and auto-download the update zip, we don't ever need that
138173
CreateHookNamed("OriginClient", "?checkForUpdate@SelfUpdateService@Services@Origin@@QAEXXZ", checkForUpdate_hook, reinterpret_cast<LPVOID*>(&checkForUpdate_org));
174+
175+
// Patches around broken login screen due to missing cookie (hopefully it's a temporary thing?)
176+
CreateHookNamed("OriginClient", "?init@LoginViewController@Client@Origin@@QAEXABW4StartupState@@W4IconType@OriginBanner@UIToolkit@3@ABVQString@@@Z", loginViewController_init_hook, reinterpret_cast<LPVOID*>(&loginViewController_init_org));
177+
CreateHookNamed("OriginClient", "?loadLoginPage@LoginViewController@Client@Origin@@IAEX_N@Z", loginViewController_loadLoginPage_hook, reinterpret_cast<LPVOID*>(&loginViewController_loadLoginPage_org));
139178
}

0 commit comments

Comments
 (0)