Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Version 1.5
Browse files Browse the repository at this point in the history
This is the largest version update yet.
Among several minor fixes in the code,
- A Logging Functionality has been added (logs to file and console)
- Most Coding Conventions have been corrected
- Quality of Life changes (Settings won't apply if there is no change, disabling the apply button if no changes are made, new PhysX hint)
- Further clarifications in the readme file
  • Loading branch information
neatodev committed Jun 27, 2020
1 parent e8435f4 commit 5101fd9
Show file tree
Hide file tree
Showing 29 changed files with 1,010 additions and 667 deletions.
13 changes: 12 additions & 1 deletion BmLauncherWForm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,22 @@
<AssemblyOriginatorKeyFile>BmLauncherWForm_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>packages\NLog.4.7.2\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="NvAPIWrapper, Version=0.7.0.57, Culture=neutral, PublicKeyToken=310fd07b25df79b3, processorArchitecture=MSIL">
<HintPath>packages\NvAPIWrapper.Net.0.7.0.57\lib\net45\NvAPIWrapper.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -171,7 +180,7 @@
<DependentUpon>KeyHelpForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
Expand Down Expand Up @@ -219,6 +228,8 @@
<ItemGroup>
<None Include="Resources\NVSetter.exe" />
<None Include="bin\Debug\NvAPIWrapper.dll" />
<EmbeddedResource Include="bin\Debug\NLog.dll" />
<None Include="bin\Debug\NLog.xml" />
<Content Include="favicon.ico" />
<None Include="Resources\favicon.ico" />
</ItemGroup>
Expand Down
77 changes: 60 additions & 17 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System;
using BmLauncherWForm.infrastructure;
using BmLauncherWForm.ui;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Windows.Forms;

Expand All @@ -12,41 +19,77 @@ namespace BmLauncherWForm
/// any requirement to manually edit .ini files. Guarantees a much more comfortable user experience.
/// @author frofoo (https://steamcommunity.com/id/frofoo)
/// </summary>
static class Program
internal static class Program
{
public static Factory myFactory;
// logger for easy debugging
private static Logger logger = LogManager.GetCurrentClassLogger();

public static BmLauncherForm client;
public static Factory MyFactory;

public static NvidiaWorker nvWorker;
public static BmLauncherForm Client;

public static NvidiaWorker NvWorker;

private static readonly string CurrentTime = DateTime.Now.ToString("dd-MM-yy__h-mm-ss");

// Mutex with this applications GUID as name
static readonly Mutex mutex = new Mutex(true, "{cbb275f6-724f-4e82-a403-e333dcf6c0bf}");
private static readonly Mutex Mutex = new Mutex(true, "{cbb275f6-724f-4e82-a403-e333dcf6c0bf}");

[STAThread]
static void Main()
private static void Main()
{
if (mutex.WaitOne(TimeSpan.Zero, true))
if (Mutex.WaitOne(TimeSpan.Zero, true))
{
runWindow();
mutex.ReleaseMutex();
SetupLogger();
logger.Info("Main - Starting logs at {0}, on {1}.",
DateTime.Now.ToString("HH:mm:ss"), DateTime.Now.ToString("D", new CultureInfo("en-GB")));
RunWindow();
Mutex.ReleaseMutex();
}
else
{
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero,
NativeMethods.PostMessage((IntPtr)NativeMethods.HwndBroadcast, NativeMethods.WmShowme, IntPtr.Zero,
IntPtr.Zero);
}
}

public static void runWindow()
private static void SetupLogger()
{
var config = new LoggingConfiguration();
var logconsole = new ConsoleTarget("logconsole");
if (!Directory.Exists("logs"))
{
Directory.CreateDirectory("logs");
}

var logfile = new FileTarget("logfile")
{
FileName = Directory.GetCurrentDirectory() + "\\logs\\bmlauncher_report__" + CurrentTime + ".log"
};
var logDirectory = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\logs");
var oldestAllowedArchive = DateTime.Now - new TimeSpan(3, 0, 0, 0);
foreach (FileInfo file in logDirectory.GetFiles())
{
if (file.CreationTime < oldestAllowedArchive)
{
file.Delete();
}
}

config.AddRule(LogLevel.Debug, LogLevel.Warn, logconsole);
config.AddRule(LogLevel.Debug, LogLevel.Warn, logfile);
LogManager.Configuration = config;
}

public static void RunWindow()
{
SysResolutions.getResolutions();
new SysResolutions().getResolutions();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
client = new BmLauncherForm();
myFactory = new Factory(client);
myFactory.readFiles();
Application.Run(client);
Client = new BmLauncherForm();
MyFactory = new Factory(Client);
MyFactory.readFiles();
Application.Run(Client);
}
}
}
42 changes: 19 additions & 23 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ This is a replacement application for the original BmLauncher of the game. Along
- Option to disable Startup Movies
- Compatibility Fixes for [HD Texture Packs](https://steamcommunity.com/sharedfiles/filedetails/?id=1159691355)
- NVIDIA API Implementation (Enable HBAO+ using the Launcher!) (Powered by [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper))
- Extensive Logging Functionality (Powered by [NLog](https://github.com/NLog/NLog))

Works with both the Steam and EGS Version!

**This Application depends on .NET Framework 4.5**. If you are using Windows 8 (or newer), you shouldn't have any issues executing it. Windows 7 SP1 (and older) might need to install [.NET Framework 4.5](https://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_setup.exe) manually. Environments other than Windows aren't officially supported at this time.
**This Application depends on .NET Framework 4.5**. If you are using Windows 8 (or newer), you shouldn't have any issues executing it. Windows 7 SP1 (and older) might need to install [.NET Framework 4.5](https://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_setup.exe) manually. Other Environments than Windows are currently not supported.

## Preview

Expand All @@ -21,7 +22,7 @@ See: [Current Release](https://github.com/neatodev/BmLauncher/releases)

## Installation

Drag the BmLauncher.exe into the 'Batman Arkham Asylum GOTY\Binaries' folder.
Drag the contents of the .zip file into the 'Batman Arkham Asylum GOTY\Binaries' folder.

To find this folder for the *Steam* version, just right-click the game in Steam, select Properties->Local Files->Browse Local Files.

Expand All @@ -30,16 +31,16 @@ Since *EGS* doesn't have an option like this, your best bet is to just open your

## Usage

You can just launch your game via Steam or EGS as you normally would, though in some cases you might need to unblock this application for it to work properly.
You can just launch your game via Steam or EGS as you normally would, though in some cases you might need to unblock the BmLauncher application for it to work properly.

To do that, just right-click the application, select Properties and enable the highlighted checkbox as seen in the image below:

![Unblock Image](https://user-images.githubusercontent.com/49599979/75610370-e2268100-5b10-11ea-978d-c257a2466dc8.png)

## Bug Reports

To file a bug report, or if you have suggestions for the Launcher in general, please file an [issue](https://github.com/neatodev/BmLauncher/issues/new). I read these regularly and should normally be able to respond within a day.
To file a bug report, or if you have suggestions for the Launcher in general, please file an [issue](https://github.com/neatodev/BmLauncher/issues/new). I read these regularly and should normally be able to respond within a day. If you are using version 1.5+ (which you should), please also include the most recent bmlauncher_report in the issue (if available). You can find the reports in the 'Batman Arkham Asylum GOTY\Binaries\logs' folder.

## About this Project

This is my first programming project using C#. I created it in the span of a few days for multiple, ultimately irrelevant reasons. So for any fellow coder looking through the source code, expect messy implementations and the use of Java code conventions & practices. I might clean up the code in the future, but as it stands it works just fine and I am occupied with other projects. For anyone who seeks to criticize my code, please keep this in mind.
This is my first programming project using C#. I created it in a very short timespan and only incrementally patched up issues. So for any fellow programmer looking through the source code, expect some messy implementations and the occasional disregard for C# Code Conventions. I have cleaned up the code quite a bit, it's not perfect yet, but as it stands it works just fine and I am occupied with other projects. Please keep this in mind.
3 changes: 2 additions & 1 deletion Resources/BmUI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ UISoundCueNames=CheckboxUnchecked
[Engine.GameUISceneClient]
OverlaySceneAlphaModulation=0.45
bRestrictActiveControlToFocusedScene=true
bCaptureUnprocessedInput=True
bCaptureUn
Input=True
bEnableDebugInput=true
bRenderDebugInfo=false
bRenderActiveControlInfo=true
Expand Down
Loading

0 comments on commit 5101fd9

Please sign in to comment.