Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/action-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
build:
name: Build SubTitans
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Create Timestamp
id: create_timestamp
Expand All @@ -23,15 +23,16 @@ jobs:

- name: Compile
shell: cmd
run: msbuild SubTitans.sln -p:Configuration=Release -p:Platform=x86
run: msbuild SubTitans.sln -p:Configuration=Release -p:Platform=x86 -p:PlatformToolset=v142

- name: Create Zip
shell: powershell
run: |
Rename-Item -Path README.md -NewName readme.txt
Rename-Item -Path PROTON-v1_0-v1_1.md -NewName PROTON-v1_0-v1_1.txt
Rename-Item -Path LICENSE -NewName license.txt
$compress = @{
Path = "Release/*.dll", "readme.txt", "license.txt", "Release/*.ini"
Path = "Release/*.dll", "readme.txt", "PROTON-v1_0-v1_1.txt", "license.txt", "Release/*.ini"
DestinationPath = "SubTitans.zip"
Force = $True
}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/action-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
build:
name: Build SubTitans
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Create Timestamp
id: create_timestamp
Expand All @@ -21,15 +21,16 @@ jobs:

- name: Compile
shell: cmd
run: msbuild SubTitans.sln -p:Configuration=Release -p:Platform=x86
run: msbuild SubTitans.sln -p:Configuration=Release -p:Platform=x86 -p:PlatformToolset=v142

- name: Create Zip
shell: powershell
run: |
Rename-Item -Path README.md -NewName readme.txt
Rename-Item -Path PROTON-v1_0-v1_1.md -NewName PROTON-v1_0-v1_1.txt
Rename-Item -Path LICENSE -NewName license.txt
$compress = @{
Path = "Release/*.dll", "readme.txt", "license.txt", "Release/*.ini"
Path = "Release/*.dll", "readme.txt", "PROTON-v1_0-v1_1.txt", "license.txt", "Release/*.ini"
DestinationPath = "SubTitans.zip"
Force = $True
}
Expand Down
10 changes: 9 additions & 1 deletion Debug/subtitans.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ MovieHeap=true
; Replaces the default FPS limiter with a better implementation.
ImprovedFPSLimiter=true
; Improves the smoothness of scrolling in-game.
SmoothScroll=true
SmoothScroll=true

[SECURITY]
; Stop the execution of the game when a path of SubTitans has been hit that is not implemented.
; Setting this flag to false could result in undefined behavior, advised is to keep this as-is.
PreventExecutingUnimplemented=true
; EXPERIMENTAL! Patches the executable to enable ASLR and DEP, these are modern security mitigations.
; Could crash the game as it was never designed to run with ASLR or DEP enabled.
EnableASLRAndDEP=false
12 changes: 12 additions & 0 deletions PROTON-v1_0-v1_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Linux & Proton (Steam) -> Upgrade from v1.0 to v1.1
If you are running the game on Linux via Steam/Proton, the upgrade to v1.1 requires a workaround.

### How to Run the Patch via Steam/Proton
Because the patcher needs to run within your game's specific Wine context, use this renaming workaround to launch it through Steam:

0. **Download:** Ignore the guide and just download the patch file from https://steamcommunity.com/sharedfiles/filedetails/?id=2129291420
1. **Register fix:** Before attempting to patch, **launch the game at least once** with `subtitans.dll` already placed in your game folder. This will fix the version registry key.
2. **Create a Backup:** Navigate to your game folder and find `STEditor.exe`. Create a backup copy of it.
3. **Rename the Patcher:** Copy the patch file `st1_mj0to0_1_usa.exe` to the game folder and rename it to `STEditor.exe`.
4. **Launch the Patcher:** Launch the game and select the **"Game Editor"** option in Steam. This tricks Proton into executing the patcher with the correct context.
5. **Restore Original Files:** Once patching is finished you must delete the patch file `STEditor.exe`. Don't forget to restore your backup copy of `STEditor.exe`
90 changes: 54 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,67 @@
# SubTitans
Unofficial Submarine Titans patch \
![GitHub all releases](https://img.shields.io/github/downloads/UnknownException/SubTitans/total)
# SubTitans ![GitHub all releases](https://img.shields.io/github/downloads/UnknownException/SubTitans/total)
## Unofficial patch for Submarine Titans

**Requirements**
* Windows 7, Windows 10, Windows 11 or Wine (+ Ubuntu)
* Supports Steam/Retail v1.0, Retail v1.1 and GOG v1.1
### Requirements
* Windows 11 or a Linux distribution with Wine or Proton
* Retail v1.1 or GOG v1.1

**Features**
> Support for v1.0, Demo, and the Technology Demo is limited.
> These versions are not actively tested, and some features may be missing.

### Instructions
1. Copy & paste d3drm.dll, subtitans.dll and subtitans.ini into your Submarine Titans folder.
2. Open STConfig.exe and select 1280x1024.
3. Run the game.

> **For Steam users**: At least start the game once before applying this patch. steam_installscript.vdf will not be applied if you skip this step.

### Features
* Support for any resolution in-game (tested up to 3840x2160)
* OpenGL and Software rendering replacement for DirectDraw to improve compatibility and performance
* DInput replacement
* Improved scrolling
* Added mission skip cheat (Retail/GOG v1.1; workaround for progression bugs)
* Fixes various internal errors
* Fixes alt-tab crashes
* Fixes video issues
* Support for display scaling
* Windows 7 palette color fix
* Palette color fix

**Instructions**
1. Copy & paste d3drm.dll, subtitans.dll and subtitans.ini into your Submarine Titans folder.
2. Open STConfig.exe and select 1280x1024.
3. Run the game.

**Q&A** \
Q: How do I use the mission skip cheat? \
A: Load the mission you want to skip and write 'orbiton' without quotes in the chatbox. \
Exit to the menu and select a random campaign to start the next mission. \
\
Q: Help, I'm getting MSVCP140.dll errors! \
A: Install vc_redist.x86.exe ( https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads ). \
\
Q: How to update Submarine Titans to version 1.1? \
A: https://steamcommunity.com/sharedfiles/filedetails/?id=2129291420 \
\
Q: I've got a problem in-game with my mouse and/or keyboard. \
A: Open SubTitans.ini and set CustomInput to false, this should revert the input handling changes. \
\
Q: I've got a problem with the OpenGL/Software renderer and want to use a custom DDraw wrapper. \
A: Open SubTitans.ini and set Renderer to 1. \
\
Q: The Submarine Titans demo crashes with or without this patch. \
A: The support for the demo version of Submarine Titans is bare minimum. Please don't report issues regarding the demo, it will be ignored.

**Known bugs**
### Known bugs
* Regions next to the in-game command panel aren't selectable/clickable.

**Uninstall**
* Deleting SubTitans.dll will disable the in-game patches.
## Question and Answers
### How to update Submarine Titans to version 1.1?
> Window: https://steamcommunity.com/sharedfiles/filedetails/?id=2129291420 \
> Linux: See [PROTON-v1_0-v_1_1.md](PROTON-v1_0-v1_1.md)

### Why am I getting MSVCP140.dll errors?
> You're missing some libraries on your computer, you'll need to install the Visual C++ redistributable provided by Microsoft. \
> vc_redist.x86.exe ( https://aka.ms/vc14/vc_redist.x86.exe )

### I've got a problem in-game with my mouse and/or keyboard.
> Open SubTitans.ini and set CustomInput to *false*. \
> This will turn off the DInput reimplementation.

### How can I use a custom or GOG's DDraw wrapper?
> Open SubTitans.ini and set Renderer to **1**.
>
> Only the OpenGL renderer and Software renderer are tested while developing this patch. \
> Custom wrappers might introduce new issues, please validate if issues you observe also occur under the OpenGL/Software renderer.

### The Submarine Titans (technology) demo crashes with or without this patch.
> The support for the demo versions of Submarine Titans is bare minimum. Please don't report issues regarding the demo, it will be ignored.

### Why would I want to enable the experimental ASLR/DEP option?
> Many (older) applications have inherent vulnerabilities, and exposing them over the internet (such as in multiplayer modes) increases the attack vector by a huge margin.
>
> By enabling **ASLR (Address Space Layout Randomization)** and **DEP (Data Execution Prevention)**, you tighten security by making the application's memory space less predictable. While this doesn't patch the vulnerabilities within the game itself, it makes them significantly harder for an attacker to successfully exploit

### How do I use the mission skip cheat?
> Load the mission you want to skip and write 'orbiton' without quotes in the chatbox. \
> Exit to the menu and select a random campaign to start the next mission. \

### How do I uninstall the patch?
> Deleting SubTitans.dll will disable the in-game patches.
>
> Do **NOT** delete d3drm.dll, the game will stop working without it.
10 changes: 9 additions & 1 deletion Release/subtitans.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ MovieHeap=true
; Replaces the default FPS limiter with a better implementation.
ImprovedFPSLimiter=true
; Improves the smoothness of scrolling in-game.
SmoothScroll=true
SmoothScroll=true

[SECURITY]
; Stop the execution of the game when a path of SubTitans has been hit that is not implemented.
; Setting this flag to false could result in undefined behavior, advised is to keep this as-is.
PreventExecutingUnimplemented=true
; EXPERIMENTAL! Patches the executable to enable ASLR and DEP, these are modern security mitigations.
; Could crash the game as it was never designed to run with ASLR or DEP enabled.
EnableASLRAndDEP=false
19 changes: 8 additions & 11 deletions d3drm/d3drm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#include "../shared/file.h"
#include "injector.h"

#ifdef _DEBUG
#pragma comment(lib, "../Debug/shared.lib")
#else
#pragma comment(lib, "../Release/shared.lib")
#endif

#pragma comment(linker, "/EXPORT:D3DRMVectorModulus=_D3DRMVectorModulus@4")
extern "C" float __stdcall D3DRMVectorModulus(D3DVector3* vector)
{
Expand All @@ -26,14 +20,17 @@ uint32_t GetSubTitansVersion()
WCHAR applicationPath[MAX_PATH];
GetModuleFileName(NULL, applicationPath, MAX_PATH);

uint32_t checkSum = File::CalculateChecksum(applicationPath);
uint32_t checkSum = File::CalculateChecksumW(applicationPath);

switch (checkSum)
{
case Shared::ST_GAMEVERSION_RETAIL_UNPATCHED:
case Shared::ST_GAMEVERSION_RETAIL_PATCHED:
case Shared::ST_GAMEVERSION_GOG_MODIFIED:
case Shared::ST_GAMEVERSION_DEMO:
case Shared::ST_GAMEVERSION_0_0_6:
case Shared::ST_GAMEVERSION_0_1_6:
case Shared::ST_GAMEVERSION_1_0_0:
case Shared::ST_GAMEVERSION_1_1_0:
case Shared::ST_GAMEVERSION_1_1_0_ASLR_DEP:
case Shared::ST_GAMEVERSION_1_1_0_GOG:
case Shared::ST_GAMEVERSION_1_1_0_GOG_ASLR_DEP:
return checkSum;
default:
return 0;
Expand Down
5 changes: 5 additions & 0 deletions d3drm/d3drm.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
<ClCompile Include="d3drm.cpp" />
<ClCompile Include="injector.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\shared\shared.vcxproj">
<Project>{5f2c7921-4b31-4712-8722-c99eff304ec4}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
39 changes: 32 additions & 7 deletions d3drm/injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,27 @@ namespace Injector {
GameVersion = gameVersion;
switch (GameVersion)
{
case Shared::ST_GAMEVERSION_RETAIL_UNPATCHED:
case Shared::ST_GAMEVERSION_0_0_6:
{
LoadModule_JmpFrom = 0x005CE3CE;
LoadModule_JmpBack = LoadModule_JmpFrom + LoadModule_DetourSize;

UnloadModule_JmpFrom = 0x005CE3D3;
UnloadModule_JmpBack = UnloadModule_JmpFrom + UnloadModule_DetourSize;

StartApplicationAddress = 0x00401ACD;
} break;
case Shared::ST_GAMEVERSION_0_1_6:
{
LoadModule_JmpFrom = 0x0071A25E;
LoadModule_JmpBack = LoadModule_JmpFrom + LoadModule_DetourSize;

UnloadModule_JmpFrom = 0x0071A263;
UnloadModule_JmpBack = UnloadModule_JmpFrom + UnloadModule_DetourSize;

StartApplicationAddress = 0x00401FF0;
} break;
case Shared::ST_GAMEVERSION_1_0_0:
{
LoadModule_JmpFrom = 0x00734B6E;
LoadModule_JmpBack = LoadModule_JmpFrom + LoadModule_DetourSize;
Expand All @@ -135,8 +155,8 @@ namespace Injector {

StartApplicationAddress = 0x00401FEB;
} break;
case Shared::ST_GAMEVERSION_RETAIL_PATCHED:
case Shared::ST_GAMEVERSION_GOG_MODIFIED:
case Shared::ST_GAMEVERSION_1_1_0:
case Shared::ST_GAMEVERSION_1_1_0_GOG:
{
LoadModule_JmpFrom = 0x007337FE;
LoadModule_JmpBack = LoadModule_JmpFrom + LoadModule_DetourSize;
Expand All @@ -146,15 +166,20 @@ namespace Injector {

StartApplicationAddress = 0x00401FF5;
} break;
case Shared::ST_GAMEVERSION_DEMO:
case Shared::ST_GAMEVERSION_1_1_0_ASLR_DEP:
case Shared::ST_GAMEVERSION_1_1_0_GOG_ASLR_DEP:
{
LoadModule_JmpFrom = 0x0071A25E;
const unsigned int originalBaseAddress = Shared::IMAGE_BASE;
const unsigned int baseAddress = (unsigned int)GetModuleHandle(NULL);

LoadModule_JmpFrom = 0x007337FE - originalBaseAddress + baseAddress;
LoadModule_JmpBack = LoadModule_JmpFrom + LoadModule_DetourSize;

UnloadModule_JmpFrom = 0x0071A263;
UnloadModule_JmpFrom = 0x00733803 - originalBaseAddress + baseAddress;
UnloadModule_JmpBack = UnloadModule_JmpFrom + UnloadModule_DetourSize;

StartApplicationAddress = 0x00401FF0;
StartApplicationAddress = 0x00401FF5 - originalBaseAddress + baseAddress;

} break;
default:
return false;
Expand Down
10 changes: 9 additions & 1 deletion game/subtitans.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ MovieHeap=true
; Replaces the default FPS limiter with a better implementation.
ImprovedFPSLimiter=true
; Improves the smoothness of scrolling in-game.
SmoothScroll=true
SmoothScroll=true

[SECURITY]
; Stop the execution of the game when a path of SubTitans has been hit that is not implemented.
; Setting this flag to false could result in undefined behavior, advised is to keep this as-is.
PreventExecutingUnimplemented=true
; EXPERIMENTAL! Patches the executable to enable ASLR and DEP, these are modern security mitigations.
; Could crash the game as it was never designed to run with ASLR or DEP enabled.
EnableASLRAndDEP=false
Loading
Loading