janxious / BattleTechModLoader

A simple mod loader and injector for HBS's PC game BattleTech.
The Unlicense
15 stars 1 forks source link

CLI Options #2

Closed janxious closed 6 years ago

janxious commented 6 years ago

Add console options for various things like update, help, version, detect

https://tirania.org/blog/archive/2008/Oct-14.html for background on the options class

gnivler commented 6 years ago

Sorry I don't have better initial results to report. I have not yet revalidated but I think I'm operating on the vanilla assembly. In case it helps. Will continue my trials. Also I have rebooted and checked for handles, no exist. AV was disabled as well.


BattleTechModLoader Injector
----------------------------
Usage: BattleTechModLoaderInjector.exe [OPTIONS]+
Inject the BattleTech game assembly with an entry point for mod enablement.
If no options are specified, the program assumes you want to /install.

Options:
  -d, --detect               Detect if the BTG assembly is already injected
  -h, -?, --help             Print this useful help message
  -i, --install              Install the Mod (Default Behavior)
  -y, --nokeypress           Anwser prompts affirmatively
  -r, --restore              Restore pristine BTG assembly to folder
  -u, --update               Update injected BTG assembly to current version
  -v, --version              Print the BattleTechModInjector version number
PS N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed>
PS N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed> .\BattleTechModLoaderInjector.exe -v
0.3.0.19551
PS N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed> .\BattleTechModLoaderInjector.exe --version
0.3.0.19551
PS N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed> .\BattleTechModLoaderInjector.exe --detect
false
PS N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed> .\BattleTechModLoaderInjector.exe --nokeypress
BattleTechModLoader Injector
----------------------------
Assembly-CSharp.dll backed up to Assembly-CSharp.dll.orig
Injecting Assembly-CSharp.dll with BattleTechModLoader.BTModLoader.Init at BattleTech.Main.Start
ERROR: An exception occured: System.IO.IOException: The process cannot access the file 'N:\SteamLibrary\steamapps\common\BATTLETECH\BattleTech_Data\Managed\Assembly-CSharp.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at BattleTechModLoader.BTMLInjector.Inject(String hookFilePath, String injectFilePath)
   at BattleTechModLoader.BTMLInjector.Main(String[] args)```
gnivler commented 6 years ago

This looks solid to me, injection, switches, reversion. I still had an issue with the missing Jetbrains reference, but I resolved it on my system. One thing I noticed was that /update doesn't tell the user that their assembly is currently not patched. Really good.. the speed is noticeably faster up to the mergings which seems about 'normal'. Subjective observations, haven't timed it.