Skip to content

Commit

Permalink
Bepinex port (#20)
Browse files Browse the repository at this point in the history
* Rework start

* Prevent crashing

* The newest working BepInEx with the game

* There, now it should be fine

* Log passing, unload false?

* Fixed do not delete?

* Partially import setting gui

* Reimported more functionallity

* Restore functionality of many settings

* Meh, before I loose something

* Rewrite done? Probably have to uncomment some stuff and do some cleanup

* There?

* Add those missing things

* Some more

* Hide this

* Scrap vibration controller

* Other missing stuff

* So that is setup on time, cause Start doesnt seem to work :-/

* Because for whatever reason Atlas gets unloaded otherwise

* Should be ready?

* Clean up null references

* Update readme.

* Licence files
  • Loading branch information
SuiMachine authored Nov 6, 2024
1 parent 7ed42d1 commit 5884d87
Show file tree
Hide file tree
Showing 277 changed files with 5,433 additions and 1,242 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Source_old/*
GlobalGameManagersPatcher/bin/*
GlobalGameManagersPatcher/obj/*
Cpp2IlDump/*.exe

Source_Melon/*
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 SuiMachine
Copyright (c) 2024 SuiMachine

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
482 changes: 482 additions & 0 deletions LICENSE_BepInEx.txt

Large diffs are not rendered by default.

38 changes: 14 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Deadly Premonition 2 - Sui's hack
A hack/mod that utilizes ''MelonLoader'' and ''HarmonyX'' to make up for some of the ports shortcomings.
A hack/mod that utilizes ''BepInEx'' and ''HarmonyX'' to make up for some of the ports shortcomings.

# List of features
* Resolution override (the game should no longer start in 1920x1080 maximized window).
Expand Down Expand Up @@ -31,42 +31,32 @@ A hack/mod that utilizes ''MelonLoader'' and ''HarmonyX'' to make up for some of
* An option to add shadows to lights used byt the game.
* Options to configure HBAO.
* Option to modify planar reflections resolution.
* Rumble for controller when shooting
* Basic Keyboard and Mouse support* (see notes)
* Basic Keyboard and Mouse support* (see notes).

# Experimental features
* Hook for SteamInput to read Keyboard and mouse input instead.

# Requirements
* Original copy of the game
* Melon Loader 0.6.x (versions above 0.6 might not be compatible)
* Original copy of the game.
* BepInEx (bundled in the release).

# Installation (Windows)
* Download [MelonLoader](https://github.com/LavaGang/MelonLoader/releases) and install it (prefably using installer).
* Download the [Sui's Hack](https://github.com/SuiMachine/Deadly-Premonition-2---Sui-s-hack/releases) and extract it to game directory (do not change the file structure SuisHack.dll goes into "Mods", "Prompts" directory to a game's "StreamingAssets" folder etc.)
* Download the [Sui's Hack](https://github.com/SuiMachine/Deadly-Premonition-2---Sui-s-hack/releases) and extract it to game directory.
* Launch the game.
* Press F11 to open configuration GUI or close the game and edit "MelonPreferences.cfg" inside the UserData folder.
* Press F11 to open configuration GUI or close the game and edit "SuisHack.cfg" inside the BepInEx/config folder.

# Installation (SteamDeck)
These instructions are written with path assuming you install it on build in drive. They may need to be modified, if installing on SD card.
* Switch to desktop mode.
* Download [MelonLoader](https://github.com/LavaGang/MelonLoader/releases).
* Launch the installer using Protontricks Launcher (if it is missing, install it using Discovery).
* When the screen of protontricks launcher pops up, selected Deadly Premonition 2.
* Select browse and navigate to: `/home/deck/`
* In text field type in `.local` and press enter (it's a hidden folder).
* Further navigate down to: `/home/deck/.local/share/Steam/common/Deadly Premonition 2` (or wherever the games install on SD cards)
* Select `DeadlyPremonition2.exe` and install it.
* Once it is installed download the [Sui's Hack](https://github.com/SuiMachine/Deadly-Premonition-2---Sui-s-hack/releases).
* Navigate to `/home/deck/.local/share/Steam/common/Deadly Premonition 2` (or wherever the games install on SD cards)
* Extract the files from the newly downloaded archive file to that folder.
* Finally right click on the game in Steam libary and choose `Properties`.
* Under launch options paste in the following `WINEDLLOVERRIDES="version.dll=n,b" %command%`
* Launch the game. If the MelonLoader appears you should be all set.

* Download [Sui's Hack](https://github.com/SuiMachine/Deadly-Premonition-2---Sui-s-hack/releases) and extract it.
* Open Steam (in desktop mode) and find Deadly Premonition 2 on the list of games in your library.
* Right click on it and select `Properties`.
* Go to `Installed files` tab and select `Browse...` - this will open a new Dolphin file explorer window.
* Copy extracted files to that directory.
* Now return to Deadly Premonition 2's property window in Steam and go to `General` tab.
* Under launch options paste in the following `WINEDLLOVERRIDES="winhttp.dll=n,b" %command%`
* Launch the game.

# Bugs
* Resolution is not applied to main window on startup, if focus is on console window.
* Final boss doesn't seem to display controller prompts correctly.
* Epilepsy warning! TAA causes issues with shader of phantoms in the otherworld, so if you are prone to suffering epileptic seizures - use SMAA instead.
* Occasionally the protagonist may fall through the terrain when using interpolation. Sorry :(
Expand Down
1 change: 1 addition & 0 deletions Release/.doorstop_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0
168 changes: 168 additions & 0 deletions Release/BepInEx/config/BepInEx.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
[Caching]

## Enable/disable assembly metadata cache
## Enabling this will speed up discovery of plugins and patchers by caching the metadata of all types BepInEx discovers.
# Setting type: Boolean
# Default value: true
EnableAssemblyCache = true

[Detours]

## The native provider to use for managed detours
# Setting type: DetourProvider
# Default value: Default
# Acceptable values: Default, Dobby, Funchook
DetourProviderType = Default

[Harmony.Logger]

## Specifies which Harmony log channels to listen to.
## NOTE: IL channel dumps the whole patch methods, use only when needed!
# Setting type: LogChannel
# Default value: Warn, Error
# Acceptable values: None, Info, IL, Warn, Error, Debug, All
# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning)
LogChannels = Warn, Error

[IL2CPP]

## Whether to run Il2CppInterop automatically to generate Il2Cpp support assemblies when they are outdated.
## If disabled assemblies in `BepInEx/interop` won't be updated between game or BepInEx updates!
##
# Setting type: Boolean
# Default value: true
UpdateInteropAssemblies = true

## URL to the ZIP of managed Unity base libraries.
## The base libraries are used by Il2CppInterop to generate interop assemblies.
## The URL can include {VERSION} template which will be replaced with the game's Unity engine version.
##
# Setting type: String
# Default value: https://unity.bepinex.dev/libraries/{VERSION}.zip
UnityBaseLibrariesSource = https://unity.bepinex.dev/libraries/{VERSION}.zip

## The RegEx string to pass to Il2CppAssemblyUnhollower for renaming obfuscated names.
## All types and members matching this RegEx will get a name based on their signature,
## resulting in names that persist after game updates.
##
# Setting type: String
# Default value:
UnhollowerDeobfuscationRegex =

## If enabled, Il2CppInterop will use xref to find dead methods and generate CallerCount attributes.
# Setting type: Boolean
# Default value: true
ScanMethodRefs = true

## If enabled, BepInEx will save dummy assemblies generated by an Cpp2IL dumper into BepInEx/dummy.
# Setting type: Boolean
# Default value: false
DumpDummyAssemblies = false

[Logging]

## Enables showing unity log messages in the BepInEx logging system.
# Setting type: Boolean
# Default value: true
UnityLogListening = false

[Logging.Console]

## Enables showing a console for log output.
# Setting type: Boolean
# Default value: true
Enabled = false

## If enabled, will prevent closing the console (either by deleting the close button or in other platform-specific way).
# Setting type: Boolean
# Default value: false
PreventClose = false

## If true, console is set to the Shift-JIS encoding, otherwise UTF-8 encoding.
# Setting type: Boolean
# Default value: false
ShiftJisEncoding = false

## Hints console manager on what handle to assign as StandardOut. Possible values:
## Auto - lets BepInEx decide how to redirect console output
## ConsoleOut - prefer redirecting to console output; if possible, closes original standard output
## StandardOut - prefer redirecting to standard output; if possible, closes console out
##
# Setting type: ConsoleOutRedirectType
# Default value: Auto
# Acceptable values: Auto, ConsoleOut, StandardOut
StandardOutType = Auto

## Which log levels to show in the console output.
# Setting type: LogLevel
# Default value: Fatal, Error, Warning, Message, Info
# Acceptable values: None, Fatal, Error, Warning, Message, Info, Debug, All
# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning)
LogLevels = Fatal, Error, Warning, Message, Info

[Logging.Disk]

## Appends to the log file instead of overwriting, on game startup.
# Setting type: Boolean
# Default value: false
AppendLog = false

## Enables writing log messages to disk.
# Setting type: Boolean
# Default value: true
Enabled = true

## Only displays the specified log levels in the disk log output.
# Setting type: LogLevel
# Default value: Fatal, Error, Warning, Message, Info
# Acceptable values: None, Fatal, Error, Warning, Message, Info, Debug, All
# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning)
LogLevels = Fatal, Error, Warning, Message, Info

## If true, instantly writes any received log entries to disk.
## This incurs a major performance hit if a lot of log messages are being written, however it is really useful for debugging crashes.
##
# Setting type: Boolean
# Default value: false
InstantFlushing = false

## The maximum amount of concurrent log files that will be written to disk.
## As one log file is used per open game instance, you may find it necessary to increase this limit when debugging multiple instances at the same time.
##
# Setting type: Int32
# Default value: 5
ConcurrentFileLimit = 5

## Include unity log messages in log file output.
# Setting type: Boolean
# Default value: false
WriteUnityLog = false

[Preloader]

## Specifies which MonoMod backend to use for Harmony patches. Auto uses the best available backend.
## This setting should only be used for development purposes (e.g. debugging in dnSpy). Other code might override this setting.
# Setting type: MonoModBackend
# Default value: auto
# Acceptable values: auto, dynamicmethod, methodbuilder, cecil
HarmonyBackend = auto

## If enabled, BepInEx will save patched assemblies into BepInEx/DumpedAssemblies.
## This can be used by developers to inspect and debug preloader patchers.
# Setting type: Boolean
# Default value: false
DumpAssemblies = false

## If enabled, BepInEx will load patched assemblies from BepInEx/DumpedAssemblies instead of memory.
## This can be used to be able to load patched assemblies into debuggers like dnSpy.
## If set to true, will override DumpAssemblies.
# Setting type: Boolean
# Default value: false
LoadDumpedAssemblies = false

## If enabled, BepInEx will call Debugger.Break() once before loading patched assemblies.
## This can be used with debuggers like dnSpy to install breakpoints into patched assemblies before they are loaded.
# Setting type: Boolean
# Default value: false
BreakBeforeLoadAssemblies = false

Binary file added Release/BepInEx/core/0Harmony.dll
Binary file not shown.
Binary file added Release/BepInEx/core/AsmResolver.DotNet.dll
Binary file not shown.
Binary file added Release/BepInEx/core/AsmResolver.PE.File.dll
Binary file not shown.
Binary file added Release/BepInEx/core/AsmResolver.PE.dll
Binary file not shown.
Binary file added Release/BepInEx/core/AsmResolver.dll
Binary file not shown.
Binary file not shown.
Binary file added Release/BepInEx/core/BepInEx.Core.dll
Binary file not shown.
Loading

0 comments on commit 5884d87

Please sign in to comment.