Skip to content

Commit

Permalink
Improved: Platform Specific Documentation, Especially Native Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Mar 31, 2024
1 parent c676520 commit 75de29e
Show file tree
Hide file tree
Showing 16 changed files with 450 additions and 61 deletions.
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
],
"cSpell.words": [
"ALACARTE",
"alacritty",
"alloc",
"APPINSTALLER",
"autopopulated",
Expand All @@ -24,7 +25,9 @@
"decompiler",
"Denuvo",
"discordrpc",
"distro",
"DYLD",
"eprintln",
"evenodd",
"Exlaunch",
"FARPROC",
Expand All @@ -50,36 +53,55 @@
"midnighthill",
"Minidump",
"minwindef",
"misalign",
"mkdocs",
"modders",
"msvc",
"NONPACKAGED",
"ntdll",
"nullptr",
"openpt",
"PDESKTOP",
"PHANDLE",
"pillarcard",
"pillarseparator",
"pillartitle",
"pillarwrapper",
"posix",
"postprocess",
"println",
"Pseudocode",
"pseudoterminal",
"pseudoterminals",
"ptname",
"ptrace",
"ptsname",
"Puyo",
"PVOID",
"PWSTR",
"pymdownx",
"radicalhighway",
"RDWR",
"recognisable",
"Redirector",
"REFIID",
"reloadedii",
"rfind",
"riid",
"runtimes",
"seasidehill",
"seasidehillmidnight",
"SIGABRT",
"sigaction",
"SIGBUS",
"SIGFPE",
"SIGILL",
"siginfo",
"SIGSEGV",
"SIGSYS",
"SIGTRAP",
"skyrim",
"solveable",
"sonicheroes",
"STDMETHODCALLTYPE",
"Steamless",
Expand All @@ -92,13 +114,17 @@
"tsonic",
"twemoji",
"Typora",
"ucontext",
"ULONG",
"Uninitialize",
"unlockpt",
"USEU",
"usize",
"Vulkan",
"webp",
"winapi",
"winget",
"writeln",
"Yeppers"
]
}
6 changes: 3 additions & 3 deletions docs/Loader/Copy-Protection/Windows-MSStore.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Many actions performed by Reloaded require access to the EXE, such as:

- Workflows (TODO: Link Pending)
- App Icon Extraction
- Determining DLL Name for [DLL Hijacking](../Bootloaders/Windows-DllHijack.md)
- Determining DLL Name for [DLL Hijacking](../../Research/Bootloaders/Windows-DllHijack.md)

#### Binary Path at Runtime Doesn't Match Real Location

Expand All @@ -36,7 +36,7 @@ Use only for cache purposes at best.

#### Do not use DLL Injection

!!! warning "Although it is technically possible to do so, [DLL Injection](../Bootloaders/Windows-InjectIntoSuspended.md) should be avoided for MS Store games."
!!! warning "Although it is technically possible to do so, [DLL Injection](../../Research/Bootloaders/Windows-InjectIntoSuspended.md) should be avoided for MS Store games."

Launching many centennial games will invoke a binary called `gamelaunchhelper.exe`.

Expand All @@ -49,7 +49,7 @@ This binary is responsible for, among other things, syncing cloud saves. Therefo
**1. Dumping the EXE from memory of a running game:**
- We could do this, but it'd be very poor User Experience.

**2. Using a known DLL name with [DLL Hijacking](../Bootloaders/Windows-DllHijack.md):**
**2. Using a known DLL name with [DLL Hijacking](../../Research/Bootloaders/Windows-DllHijack.md):**
- Possible via [Community Repository](../../Services/Community-Repository.md), but this is not a good solution for unknown apps.
- Possible via dumping the EXE from memory, but leads to poor UX.
- Does not fix the issue of the binary being encrypted, leading to limited functionality.
Expand Down
4 changes: 2 additions & 2 deletions docs/Loader/Copy-Protection/Windows-Steam.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This holds true for all currently known versions of SteamStub.

Most loaders use either of the two approaches:

- [DLL Hijack](../Bootloaders/Windows-DllHijack.md) a known DLL and init in one of the library's Init functions e.g. `d3d9.CreateDevice`.
- [DLL Hijack](../../Research/Bootloaders/Windows-DllHijack.md) a known DLL and init in one of the library's Init functions e.g. `d3d9.CreateDevice`.
- Hook a library's init function (e.g. `d3d9.CreateDevice`), load Reloaded in the hook, and unhook.

!!! danger "We can't do this in R3, we should assume no knowledge of target game."
Expand Down Expand Up @@ -88,7 +88,7 @@ This has historically worked well and has only overhead of 3 x86 instructions po
!!! tip

The SteamWorks API forces games to reboot if they have not been launched via Steam; this can be problematic
for [DLL Injection](../Bootloaders/Windows-InjectIntoSuspended.md).
for [DLL Injection](../../Research/Bootloaders/Windows-InjectIntoSuspended.md).

1. Set `SteamAppID` env var.
2. Hook `steam_api.SteamAPI_RestartAppIfNecessary`.
Expand Down
4 changes: 2 additions & 2 deletions docs/Loader/Core-Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,5 @@ sequenceDiagram
[load-order]: ../Server/Load-Ordering.md
[p3p-gamebanana]: https://gamebanana.com/games/16613
[reloaded-ii]: https://github.com/Reloaded-Project/Reloaded-II
[win-dll-hijacking]: ./Bootloaders/Windows-DllHijack.md
[win-dll-inject]: ./Bootloaders/Windows-InjectIntoSuspended.md
[win-dll-hijacking]: ../Research/Bootloaders/Windows-DllHijack.md
[win-dll-inject]: ../Research/Bootloaders/Windows-InjectIntoSuspended.md
59 changes: 48 additions & 11 deletions docs/Loader/Platforms/About.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,58 @@
# Platform Support

!!! info "These pages contain miscellaneous notes regarding support on each platform."

| Operating System | Status |
| ----------------------------------- | ---------------------- |
| [Windows](./Windows.md) ||
| [Linux (Wine/Proton)](./Windows.md) ||
| [Native Linux](./Linux.md) | ⚡ Implement on Demand |
| [Native OSX](./OSX.md) | ⚡ Implement on Demand |
| [Other](./Other.md) | 🔍 Investigation Needed |

`Implement on Demand` means; it'll be done when there's game to test.
The code will always be written with cross platform in mind; worry not.

## Minimum Requirements

As the core loader is written in Rust, it is theoretically possible to support any platform provided:

- You have access to sufficient amount of libc.
- LLVM supports the machine code for your target (e.g. ARM, x86 etc.).
- Executable format reverse engineered, so you can make linker produce libraries.
- You can dynamically load libraries.
- You can arbitrarily execute code in a game process ([write a Bootloader](../Bootloaders/About.md)).
- You can arbitrarily execute code in a game process ([write a Bootloader](../../Research/Bootloaders/About.md)).

| Operating System | Status |
|-------------------------------------|-------------------------|
| [Windows](./Windows.md) ||
| [Linux (Wine/Proton)](./Windows.md) ||
| [Switch](./Switch.md) | 🔍 Investigation Needed |
| [Native Linux](./Linux.md) | ⚡ Implement on Demand |
| [Native OSX](./OSX.md) | ⚡ Implement on Demand |
| Other | ❓ Unknown. |
## Categories Covered in Each Platform

`Implement on Demand` means; it'll be done when there's game to test.
The code will always be written with cross platform in mind; worry not.
!!! note "Note: Info on bootstrapping the loader itself is covered under [Bootloader](../Platforms/About.md)."

These topic instead include platform specific caveats and strategies, such as:

1. Running existing code mods (`.asi` and friends), if applicable.
2. Crash Handling
3. Intercepting Process Exit

And of course, anything else that's interesting.
The pages are more of a 'Cheat Sheet'.

## Crash Handling

!!! info "Each Platform should Make A Crash Dump"

After a crash has been encountered; the code should (if possible):

- Generate a Crash Dump.
- Dump Log to Same Location as Crash Dump.
- Display Crash Address (incl. Module/DLL name).
- Open a file manager in the location of the dump.

Dumps will be written out to [TODO: Link Pending] as:

- `dump.dmp` The crash dump.
- `log.txt` The log of the recent run.
- `info.json` Contextual information (e.g. Mod list game was started with).

The server should clean old crash dumps after some time (for instance, 7 days).

!!! note "Crash handling should be opt-out in loader, in case you want to use an external handler."
Loading

0 comments on commit 75de29e

Please sign in to comment.