Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.
Open
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
12 changes: 7 additions & 5 deletions Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using System;
using Windows;
using UnityEngine;

namespace VRCModLoader
{
Expand All @@ -27,6 +24,11 @@ void Awake()
{
loadmods = false;
}
if (!Environment.CommandLine.Contains("--notitle"))
{
var windowPtr = GuiConsole.FindWindow(null, "VRChat");
GuiConsole.SetWindowText(windowPtr, GuiConsole.Title);
}
}

void Start()
Expand Down
16 changes: 11 additions & 5 deletions ConsoleWindow.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using UnityEngine;

namespace Windows
Expand All @@ -20,6 +18,14 @@ class GuiConsole
[DllImport("kernel32.dll")]
private static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll", EntryPoint = "SetWindowText")]
public static extern bool SetWindowText(IntPtr hwnd, String lpString);

[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern IntPtr FindWindow(string className, string windowName);

public static string Title = $"{Application.productName} v{Application.version} on {Enum.GetName(typeof(RuntimePlatform), Application.platform).Replace("Player", "")} [VRCModloader]";

private static void ShowConsole()
{
SetForegroundWindow(GetConsoleWindow());
Expand All @@ -31,7 +37,7 @@ internal static void CreateConsole()
Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true });
Console.SetIn(new StreamReader(Console.OpenStandardInput()));
// Console.Clear(); Maybe something else wrote to Console before.
Console.Title = $"{Application.productName} v{Application.version} on {Enum.GetName(typeof(RuntimePlatform), Application.platform).Replace("Player", "")} [VRCModloader]";
Console.Title = Title;
ShowConsole();
}
}
Expand Down