Skip to content

Commit

Permalink
Console hide and enable thing again
Browse files Browse the repository at this point in the history
  • Loading branch information
TheStachelfisch committed Mar 31, 2021
1 parent f000642 commit a44f601
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 33 deletions.
8 changes: 5 additions & 3 deletions patches/64bit/Properties/launchSettings.json.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
--- src/tModLoader/Properties/launchSettings.json
+++ src/64bit/Properties/launchSettings.json
@@ -1,9 +_,8 @@
@@ -1,9 +_,9 @@
{
"profiles": {
"Terraria": {
- "commandName": "Executable",
- "executablePath": "$(tModLoaderSteamPath)/$(OutputName).exe",
- "workingDirectory": "$(tModLoaderSteamPath)"
- }
+ "commandName": "Project",
+ "workingDirectory": "D:\\SteamLibrary\\steamapps\\common\\tModLoader"
}
+ "workingDirectory": "D:\\SteamLibrary\\steamapps\\common\\tModLoader",
+ "commandLineArgs": "-console"
+ }
}
}
66 changes: 38 additions & 28 deletions patches/64bit/Terraria.csproj.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,61 @@
+ <Configurations>XNADebug;XNAServerDebug;XNARelease;XNAServerRelease;FNARelease;FNADebug;FNAServerRelease;FNAServerDebug</Configurations>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.3</LangVersion>
+ <OutputType>WinExe</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>
<Optimize>true</Optimize>
- <LangVersion>7.3</LangVersion>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <Optimize>true</Optimize>
- <OutputName>tModLoader</OutputName>
+ <OutputName>tModLoader64Bit</OutputName>
</PropertyGroup>
- </PropertyGroup>
- <PropertyGroup Condition="$(Configuration.Contains('Server'))">
+ <PropertyGroup Condition="$(Configuration.Contains('FNAServerRelease'))">
<OutputType>Exe</OutputType>
- <OutputType>Exe</OutputType>
- <DefineConstants>$(DefineConstants);SERVER</DefineConstants>
+ <DefineConstants>TRACE;SERVER;FNA</DefineConstants>
+ <ApplicationIcon>IconFNAServer.ico</ApplicationIcon>
<OutputName>$(OutputName)Server</OutputName>
</PropertyGroup>
- <OutputName>$(OutputName)Server</OutputName>
- </PropertyGroup>
- <PropertyGroup Condition="!$(Configuration.Contains('Server'))">
+ <PropertyGroup Condition="$(Configuration.Contains('XNAServerRelease'))">
- <DefineConstants>$(DefineConstants);CLIENT</DefineConstants>
- </PropertyGroup>
+ <OutputType>Exe</OutputType>
- <PropertyGroup Condition="$(Configuration.Contains('Debug'))">
+ <DefineConstants>DEBUG;TRACE;SERVER;XNA</DefineConstants>
- <Optimize>false</Optimize>
+ <ApplicationIcon>IconXNA.ico</ApplicationIcon>
- <DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
- <OutputName>$(OutputName)Debug</OutputName>
+ <OutputName>$(OutputName)Server</OutputName>
</PropertyGroup>
- </PropertyGroup>
- <PropertyGroup Condition="$(Configuration.Contains('Windows'))">
+ <PropertyGroup Condition="$(Configuration.Contains('XNAServerDebug'))">
+ <Optimize>false</Optimize>
<PlatformTarget>x86</PlatformTarget>
- <PlatformTarget>x86</PlatformTarget>
- <AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
- <DefineConstants>$(DefineConstants);WINDOWS;XNA</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;SERVER;XNA</DefineConstants>
- </PropertyGroup>
+ <OutputName>$(OutputName)Debug</OutputName>
- <PropertyGroup Condition="$(Configuration.Contains('Mac'))">
+ <ApplicationIcon>IconXNA.ico</ApplicationIcon>
- <DefineConstants>$(DefineConstants);MAC;FNA</DefineConstants>
+ <OutputType>Exe</OutputType>
</PropertyGroup>
- </PropertyGroup>
- <PropertyGroup Condition="$(Configuration.Contains('Linux'))">
+ <PropertyGroup Condition="$(Configuration.Contains('FNAServerDebug'))">
- <DefineConstants>$(DefineConstants);LINUX;FNA</DefineConstants>
+ <LangVersion>9</LangVersion>
+ <OutputType>WinExe</OutputType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <Optimize>true</Optimize>
+ <OutputName>tModLoader64Bit</OutputName>
+ </PropertyGroup>
+ <PropertyGroup Condition="$(Configuration.Contains('FNAServerRelease'))">
+ <OutputType>Exe</OutputType>
+ <DefineConstants>TRACE;SERVER;FNA</DefineConstants>
+ <ApplicationIcon>IconFNAServer.ico</ApplicationIcon>
+ <OutputName>$(OutputName)Server</OutputName>
+ </PropertyGroup>
+ <PropertyGroup Condition="$(Configuration.Contains('XNAServerRelease'))">
+ <OutputType>Exe</OutputType>
+ <DefineConstants>DEBUG;TRACE;SERVER;XNA</DefineConstants>
+ <ApplicationIcon>IconXNA.ico</ApplicationIcon>
+ <OutputName>$(OutputName)Server</OutputName>
+ </PropertyGroup>
+ <PropertyGroup Condition="$(Configuration.Contains('XNAServerDebug'))">
+ <Optimize>false</Optimize>
+ <PlatformTarget>x86</PlatformTarget>
+ <DefineConstants>TRACE;DEBUG;SERVER;XNA</DefineConstants>
+ <OutputName>$(OutputName)Debug</OutputName>
+ <ApplicationIcon>IconXNA.ico</ApplicationIcon>
+ <OutputType>Exe</OutputType>
+ </PropertyGroup>
+ <PropertyGroup Condition="$(Configuration.Contains('FNAServerDebug'))">
+ <Optimize>false</Optimize>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DefineConstants>TRACE;DEBUG;DSERVER;FNA</DefineConstants>
Expand Down Expand Up @@ -97,7 +107,7 @@
+ <DefineConstants>TRACE;CLIENT;FNA</DefineConstants>
+ <OutputName>$(OutputName)Release</OutputName>
+ <ApplicationIcon>IconFNA.ico</ApplicationIcon>
+ <OutputType>WinExe</OutputType>
+ <OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<PdbFile>bin\$(OutputName)</PdbFile>
Expand Down
29 changes: 27 additions & 2 deletions patches/64bit/Terraria/Program.cs.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
--- src/tModLoader/Terraria/Program.cs
+++ src/64bit/Terraria/Program.cs
@@ -20,10 +_,12 @@
@@ -11,6 +_,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

@@ -20,17 +_,18 @@
using Terraria.Initializers;
using Terraria.Localization;
using Terraria.ModLoader;
Expand All @@ -13,6 +21,13 @@
namespace Terraria
{
public static class Program
{
#if CLIENT
public const bool IsServer = false;
-
#else
public const bool IsServer = true;
#endif
@@ -104,7 +_,7 @@

private static void ForceJITOnMethod(MethodInfo method)
Expand All @@ -31,7 +46,7 @@
return type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
#else
return type.GetMethods();
@@ -204,89 +_,137 @@
@@ -204,89 +_,147 @@
// some versions of the .NET runtime will run the Main static initilizer as soon as LaunchGame is invoked
// causing Main.SavePath to be initialized before LaunchParameters is parsed.
// moving arg parsing to a separate function avoids this
Expand Down Expand Up @@ -158,6 +173,16 @@
- Main.OnEnginePreload += StartForceLoad;
+ Main.OnEnginePreload += StartForceLoad;
#if CLIENT
+ [DllImport("kernel32.dll")]
+ static extern IntPtr GetConsoleWindow();
+
+ // 0 to hide, 5 to show
+ [DllImport("user32.dll")]
+ static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
+
+ if (!LaunchParameters.ContainsKey("-console"))
+ ShowWindow(GetConsoleWindow(), 0);
+
- main.Run();
+ main.Run();
#else
Expand Down

0 comments on commit a44f601

Please sign in to comment.