Skip to content

Commit

Permalink
Add check to disable patching if Aurora/FSD update is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
Ste1io committed Apr 21, 2021
1 parent 05fa53d commit 7c9fb61
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AuroraCrashPatcher/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ void SelfDestruct(HANDLE hModule) {
}
}
}
}
}
7 changes: 7 additions & 0 deletions AuroraCrashPatcher/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ SK_INLINE DWORD ResolveFunction(PCHAR moduleName, DWORD ordinal) {
return addr;
}

SK_INLINE uint32_t ByteSwap(uint32_t value) {
return (value & 0x000000FF) << 0x18
| (value & 0x0000FF00) << 0x08
| (value & 0x00FF0000) >> 0x08
| (value & 0xFF000000) >> 0x18;
}

BOOL MountSysDrives();
bool FileExists(LPCSTR lpFileName);
void SelfDestruct(HANDLE hModule);
11 changes: 8 additions & 3 deletions AuroraCrashPatcher/DllMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* - Changed base address to avoid conflict with nomni.
* - Replaced hook method to more accurately identify and intercept the
* api calls causing the crash for everyone regardless of geographic locale.
* v0.3-beta: 04/21/2021
* - Added check to disable patching if Aurora/FSD update is detected.
*/

#include "stdafx.h"
Expand All @@ -32,14 +34,17 @@ DWORD WINAPI MainThread(LPVOID lpParameter) {
auto Run = [] (uint32_t title) -> bool
{
static uint32_t last = 0;
if (!g_flag) {
if (g_flag < 2) {
if (title != last) {
if (title == 0xFFFE07D1 && ((uint32_t(*)(PVOID))0x800819D0)((PVOID)0x82000000)) {
g_flag = ByteSwap(*(uint32_t*)(0x82000008 + ByteSwap(*(uint32_t*)0x8200003C))) > 0x607F951E;
DbgPrint("[sk] AuroraCrashPatcher by Stelio Kontos: %s. Control flag @ 0x%X" skNewLn, !g_flag ? "ENABLED" : "DISABLED", &g_flag);
DbgPrint("[sk] Flag options: default=0x0, unload=0x1, destroy=0xDEADC0DE" skNewLn);
origHook.SetupDetour(0x81741150, HookProc);
DbgPrint("[sk] Flag options: enable=0x0, disable=0x1, unload=0x2, destroy=0xDEADC0DE" skNewLn);
if (!g_flag)
origHook.SetupDetour(0x81741150, HookProc);
} else if (last == 0xFFFE07D1) {
origHook.TakeDownDetour();
g_flag = 0;
}
last = title;
}
Expand Down
Binary file modified Dist/AuroraCrashPatcher.xex
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Quick and dirty patch to prevent fatal crashing when downloading title assets (boxart, etc) through FSD or Aurora. As of v0.2-beta, this patch should work for everyone, regardless of geographic location (both in and outside of the US).

## Install/Usage
- Download the latest compiled xex from the `Releases` page (direct download: https://github.com/StelioKontosXBL/AuroraCrashPatcher/releases/download/v0.2-beta/AuroraCrashPatcher.xex)
- Download the latest compiled xex from the `Releases` page (direct download: https://github.com/StelioKontosXBL/AuroraCrashPatcher/releases/download/v0.3-beta/AuroraCrashPatcher.xex)
- Copy the xex to your RGH's Hdd, as you would any menu or plugin xex
- Set as a plugin (either in your launch.ini, or in JRPC.ini if you use XDRPC)
- Reboot, and you're done
Expand All @@ -16,7 +16,7 @@ If you don't use Aurora/FSD, don't bother. If you do, download the compiled xex
Ye, I know. Hacky af, but it works. It's a quick fix, nothing more, nothing less. Not to be used as a guide to best coding standards; threw it together in a couple hours, and hopefully the Aurora/FSD devs will be able to release an official patch soon, deprecating this. Use at your own risk.

## Note to Aurora/FSD devs
When an official patch is released, launch Aurora with this module loaded, and check DbgOut for the killswitch address in mem. Writing the value `0xDEADC0DE` at this address will unload and wipe this patch from the user's console.
When an official patch is released, launch Aurora with this module loaded, and check DbgOut for the killswitch address in mem. Writing the value `0xDEADC0DE` at this address will unload and wipe this patch from the user's console. As of v0.3-beta, AuroraCrashPatcher will automatically disable itself if an updated version of Aurora or FSD is detected, but removal of the plugin from the system requires the flag being set.

## Disclaimer
Neither this repo, nor myself, are directly affiliated with Aurora or FSD, or their development teams.

0 comments on commit 7c9fb61

Please sign in to comment.