Skip to content

Commit

Permalink
C# Port
Browse files Browse the repository at this point in the history
ported the launcher to C# with the help of Code Converter, GitHub Copilot, and copious debugging. likely to have issues, definitely will not be good code, but a large chunk of the worst stuff is now being replaced.
  • Loading branch information
kran27 committed Feb 14, 2024
1 parent 74263f7 commit 415ad55
Show file tree
Hide file tree
Showing 57 changed files with 15,764 additions and 11,986 deletions.
2 changes: 1 addition & 1 deletion .run/Publish.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Publish" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" platform="x64" produce_single_file="true" ready_to_run="true" runtime="win-x64" target_folder="$PROJECT_DIR$/VBLauncher/bin/Release" target_framework="net8.0-windows10.0.17763.0" uuid_high="4903499188036191289" uuid_low="-4847728403474763751" />
<riderPublish configuration="Release" platform="x64" produce_single_file="true" ready_to_run="true" runtime="win-x64" target_folder="$PROJECT_DIR$/VBLauncher/bin/Release" target_framework="net8.0-windows10.0.17763.0" uuid_high="-709251091559609400" uuid_low="4531081705452700857" />
<method v="2" />
</configuration>
</component>
34 changes: 17 additions & 17 deletions VBExtender/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,26 @@ int WINAPI main()
}
}

void PatchInstaCrash()
{
// Patch out the insta crash when multiple instances of the game are running
// this is done by patching jnz to jmp so errors aren't thrown when the socket is already in use
DWORD oldProtect;
auto addr1 = reinterpret_cast<LPVOID>(F3 + 0x1b8f46);
auto addr2 = reinterpret_cast<LPVOID>(F3 + 0x1b8de7);

if (VirtualProtect(addr1, 1, PAGE_EXECUTE_READWRITE, &oldProtect))
void PatchInstaCrash()
{
Write<BYTE>(reinterpret_cast<uintptr_t>(addr1), 0xEB);
VirtualProtect(addr1, 1, oldProtect, &oldProtect);
}
// Patch out the insta crash when multiple instances of the game are running
// this is done by patching jnz to jmp so errors aren't thrown when the socket is already in use
DWORD oldProtect;
auto addr1 = reinterpret_cast<LPVOID>(F3 + 0x1b8f46);
auto addr2 = reinterpret_cast<LPVOID>(F3 + 0x1b8de7);

if (VirtualProtect(addr2, 1, PAGE_EXECUTE_READWRITE, &oldProtect))
{
Write<BYTE>(reinterpret_cast<uintptr_t>(addr2), 0xEB);
VirtualProtect(addr2, 1, oldProtect, &oldProtect);
if (VirtualProtect(addr1, 1, PAGE_EXECUTE_READWRITE, &oldProtect))
{
Write<BYTE>(reinterpret_cast<uintptr_t>(addr1), 0xEB);
VirtualProtect(addr1, 1, oldProtect, &oldProtect);
}

if (VirtualProtect(addr2, 1, PAGE_EXECUTE_READWRITE, &oldProtect))
{
Write<BYTE>(reinterpret_cast<uintptr_t>(addr2), 0xEB);
VirtualProtect(addr2, 1, oldProtect, &oldProtect);
}
}
}

BOOL APIENTRY DllMain(HMODULE hModule, const DWORD dwReason, LPVOID lpReserved)
{
Expand Down
169 changes: 169 additions & 0 deletions VBLauncher/Chunk Editors/EEN2Editor.Designer.cs

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

156 changes: 0 additions & 156 deletions VBLauncher/Chunk Editors/EEN2Editor.Designer.vb

This file was deleted.

16 changes: 16 additions & 0 deletions VBLauncher/Chunk Editors/EEN2Editor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Windows.Forms;

Check warning on line 1 in VBLauncher/Chunk Editors/EEN2Editor.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Redundant using directive

Using directive is not required by the code and can be safely removed

namespace VBLauncher

Check warning on line 3 in VBLauncher/Chunk Editors/EEN2Editor.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Namespace does not correspond to file location

Namespace does not correspond to file location, must be: 'VBLauncher.Chunk_Editors'
{
public partial class EEN2Editor : UserControl
{

// init function
public EEN2Editor()
{
BackColor = AltUI.Config.ThemeProvider.BackgroundColour;
InitializeComponent();
}

}
}
Loading

0 comments on commit 415ad55

Please sign in to comment.