Skip to content

Commit

Permalink
Mac/Linux Forms fix, load 1.3.5.3 things fix, hide resources and code…
Browse files Browse the repository at this point in the history
… fix.
  • Loading branch information
JavidPack committed Jun 7, 2017
1 parent e5ef493 commit b9537fa
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

namespace Terraria.GameInput
{
@@ -158,7 +_,7 @@
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
Dictionary<string, object> dictionary2 = new Dictionary<string, object>();
- dictionary.Add("Last Launched Version", 193);
+ dictionary.Add("Last Launched Version", 194);
dictionary2.Add("Edittable", this.AllowEditting);
dictionary2.Add("Gamepad - HotbarRadialHoldTime", this.HotbarRadialHoldTimeRequired);
dictionary2.Add("Gamepad - LeftThumbstickDeadzoneX", this.LeftThumbstickDeadzoneX);
@@ -292,6 +_,18 @@
this.CopyKeysFrom(profile, mode, keysToCopy);
}
Expand Down
63 changes: 63 additions & 0 deletions patches/tModLoader/Terraria.IO/WorldFile.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@
WorldGen.saveLock = false;
}
Main.serverGenLock = false;
@@ -411,7 +_,7 @@
{
Main.WorldFileMetadata = FileMetadata.FromCurrentSettings(FileType.World);
int num = WorldFile.versionNumber;
- if (num > 193)
+ if (num > 194)
{
return 1;
}
@@ -965,7 +_,7 @@
{
short num = 470;
short num2 = 10;
- writer.Write(193);
+ writer.Write(194);
Main.WorldFileMetadata.IncrementAndWrite(writer);
writer.Write(num2);
for (int i = 0; i < (int)num2; i++)
@@ -1002,7 +_,7 @@
private static int SaveHeaderPointers(BinaryWriter writer, int[] pointers)
{
writer.BaseStream.Position = 0L;
- writer.Write(193);
+ writer.Write(194);
writer.BaseStream.Position += 20L;
writer.Write((short)pointers.Length);
for (int i = 0; i < pointers.Length; i++)
@@ -1109,7 +_,14 @@
writer.Write(Main.anglerWhoFinishedToday[i]);
}
Expand Down Expand Up @@ -114,6 +141,42 @@
{
writer.Write(nPC2.active);
writer.Write(nPC2.netID);
@@ -2302,7 +_,7 @@
{
Stream baseStream = fileIO.BaseStream;
int num = fileIO.ReadInt32();
- if (num == 0 || num > 193)
+ if (num == 0 || num > 194)
{
result = false;
}
@@ -2562,7 +_,7 @@
using (BinaryReader binaryReader = new BinaryReader(fileStream))
{
int num = binaryReader.ReadInt32();
- if (num > 0 && num <= 193)
+ if (num > 0 && num <= 194)
{
string text;
string result;
@@ -2615,7 +_,7 @@
{
binaryReader.BaseStream.Position += 20L;
}
- if (num >= 112 && num <= 193)
+ if (num >= 112 && num <= 194)
{
binaryReader.ReadInt16();
fileStream.Position = (long)binaryReader.ReadInt32();
@@ -2671,7 +_,7 @@
{
worldFileData.Metadata = FileMetadata.FromCurrentSettings(FileType.World);
}
- if (num <= 193)
+ if (num <= 194)
{
binaryReader.ReadInt16();
stream.Position = (long)binaryReader.ReadInt32();
@@ -2880,10 +_,13 @@

private static int SaveTileEntities(BinaryWriter writer)
Expand Down
9 changes: 9 additions & 0 deletions patches/tModLoader/Terraria.Map/MapHelper.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
return MapTile.Create((ushort)num16, (byte)num2, (byte)num);
}

@@ -2060,7 +_,7 @@
{
int num = 0;
byte[] array = new byte[16384];
- binaryWriter.Write(193);
+ binaryWriter.Write(194);
Main.MapFileMetadata.IncrementAndWrite(binaryWriter);
binaryWriter.Write(Main.worldName);
binaryWriter.Write(Main.worldID);
@@ -2162,7 +_,7 @@
int num5;
ushort num6;
Expand Down
9 changes: 9 additions & 0 deletions patches/tModLoader/Terraria.Map/WorldMap.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
return;
}
using (MemoryStream memoryStream = new MemoryStream(FileUtilities.ReadAllBytes(text, isCloudSave)))
@@ -112,7 +_,7 @@
try
{
int num = binaryReader.ReadInt32();
- if (num <= 193)
+ if (num <= 194)
{
if (num <= 91)
{
@@ -122,6 +_,7 @@
{
MapHelper.LoadMapVersion2(binaryReader, num);
Expand Down
2 changes: 2 additions & 0 deletions patches/tModLoader/Terraria.ModLoader/BuildProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ internal byte[] ToBytes()
internal static BuildProperties ReadModFile(TmodFile modFile)
{
BuildProperties properties = new BuildProperties();
properties.hideCode = true;
properties.hideResources = true;
byte[] data = modFile.GetFile("Info");

if (data.Length == 0)
Expand Down
2 changes: 1 addition & 1 deletion patches/tModLoader/Terraria.ModLoader/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class ModLoader
{
//change Terraria.Main.DrawMenu change drawn version number string to include this
/// <summary>The name and version number of tModLoader.</summary>
public static readonly Version version = new Version(0, 10);
public static readonly Version version = new Version(0, 10, 0, 1);
public static readonly string versionedName = "tModLoader v" + version;
#if WINDOWS
public static readonly bool windows = true;
Expand Down
16 changes: 11 additions & 5 deletions patches/tModLoader/Terraria.csproj.patch
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</PropertyGroup>
</When>
<Otherwise>
@@ -81,17 +_,43 @@
@@ -81,19 +_,47 @@
<HintPath>Terraria.Libraries\JSON.NET\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -86,6 +86,8 @@
<Reference Include="System.Drawing" />
- <Reference Include="Ionic.Zip.CF">
- <HintPath>Terraria.Libraries\DotNetZip\Ionic.Zip.CF.dll</HintPath>
- </Reference>
- <Reference Include="System.Windows.Forms" />
+ <Reference Include="Ionic.Zip.Reduced">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\references\Ionic.Zip.Reduced.dll</HintPath>
Expand All @@ -98,9 +100,13 @@
+ </Reference>
+ <Reference Include="MP3Sharp">
+ <HintPath>..\..\references\MP3Sharp.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
+ </Reference>
+ <Reference Include="System.Windows.Forms">
+ <HintPath Condition="!$(DefineConstants.Contains('WINDOWS'))" >..\..\references\System.Windows.Forms.Mono.dll</HintPath>
+ </Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
@@ -327,8 +_,11 @@
<Compile Include="Terraria.ID\InvasionID.cs" />
<Compile Include="Terraria.ID\ItemAlternativeFunctionID.cs" />
Expand Down Expand Up @@ -315,7 +321,6 @@
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-</Project>
+ <PropertyGroup>
+ <PostBuildEvent>SET CONFIGNAME=$(ConfigurationName)
+
Expand Down Expand Up @@ -348,4 +353,5 @@
+ <PreBuildEvent>
+ </PreBuildEvent>
+ </PropertyGroup>
+</Project>
</Project>

56 changes: 56 additions & 0 deletions patches/tModLoader/Terraria/Main.cs.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
--- src/Terraria\Terraria\Main.cs
+++ src/tModLoader\Terraria\Main.cs
@@ -29,7 +_,9 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
+#if WINDOWS
using System.Windows.Forms;
+#endif
using Terraria.Achievements;
using Terraria.Audio;
using Terraria.Chat;
@@ -54,6 +_,8 @@
using Terraria.IO;
using Terraria.Localization;
Expand All @@ -9,6 +19,15 @@
using Terraria.Net;
using Terraria.ObjectData;
using Terraria.Social;
@@ -77,7 +_,7 @@
{
public delegate void OnPlayerSelected(PlayerFileData player);

- public const int curRelease = 193;
+ public const int curRelease = 194;
public const ulong WorldGeneratorVersion = 828928688129uL;
private const string versionStringBecauseTheyreTheSame = "v1.3.5.2";
public const int offLimitBorderTiles = 40;
@@ -166,13 +_,13 @@
public static Main instance;
public static string versionNumber = "v1.3.5.2";
Expand Down Expand Up @@ -207,6 +226,24 @@
}
NetMessage.SendAnglerQuest(-1);
}
@@ -2804,7 +_,7 @@
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
- binaryWriter.Write(193);
+ binaryWriter.Write(194);
for (int i = 0; i < 10; i++)
{
binaryWriter.Write(Main.recentWorld[i]);
@@ -2846,7 +_,7 @@
Main.Configuration.Put("LightingThreads", Lighting.LightingThreads);
Main.Configuration.Put("Parallax", Main.caveParallax);
Main.Configuration.Put("ShowItemText", Main.showItemText);
- Main.Configuration.Put("LastLaunchedVersion", 193);
+ Main.Configuration.Put("LastLaunchedVersion", 194);
Main.Configuration.Put("ClientUUID", Main.clientUUID);
Main.Configuration.Put("UseSmartCursorForCommonBlocks", Player.SmartCursorSettings.SmartBlocksEnabled);
Main.Configuration.Put("UseSmartAxeAfterSmartPickaxe", Player.SmartCursorSettings.SmartAxeAfterPickaxe);
@@ -2903,6 +_,7 @@
Main.Configuration.Put("QuickLaunch", Main.SkipAssemblyLoad);
Main.Configuration.Put("Zoom", Main.GameZoomTarget);
Expand All @@ -223,6 +260,15 @@
PlayerInput.Load();
if (num2 < 165)
{
@@ -3239,7 +_,7 @@
Main.mouseColorSlider.SetHSL(Main.mouseColor);
Main.mouseBorderColorSlider.SetHSL(Main.MouseBorderColor);
Main.mouseBorderColorSlider.Alpha = (float)Main.MouseBorderColor.A / 255f;
- if (num2 != 193)
+ if (num2 != 194)
{
Main.SaveSettings();
}
@@ -3392,9 +_,11 @@
FileUtilities.Delete(Main.PlayerList[i].Path, Main.PlayerList[i].IsCloudSave);
FileUtilities.Delete(Main.PlayerList[i].Path + ".bak", Main.PlayerList[i].IsCloudSave);
Expand Down Expand Up @@ -606,6 +652,16 @@
if (CaptureManager.Instance.IsCapturing)
{
return;
@@ -12239,7 +_,9 @@
Liquid.cycles = 1;
}
Main.hasFocus = base.IsActive;
+#if WINDOWS
Main.hasFocus = (Form.ActiveForm == Control.FromHandle(base.Window.Handle) as Form);
+#endif
if (!Main.gameMenu || Main.netMode == 2)
{
WorldFile.tempRaining = Main.raining;
@@ -12435,6 +_,10 @@
{
flag = true;
Expand Down
2 changes: 1 addition & 1 deletion patches/tModLoader/Terraria/MessageBuffer.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
string a = this.reader.ReadString();
- if (!(a == "Terraria" + 193))
+ ModNet.isModdedClient[whoAmI] = a == ModLoader.ModLoader.versionedName;
+ if (!ModNet.isModdedClient[whoAmI] && !(a == "Terraria" + 193 && ModNet.AllowVanillaClients))
+ if (!ModNet.isModdedClient[whoAmI] && !(a == "Terraria" + 194 && ModNet.AllowVanillaClients))
{
NetMessage.SendData(2, this.whoAmI, -1, Lang.mp[4].ToNetworkText(), 0, 0f, 0f, 0f, 0, 0, 0);
return;
Expand Down
18 changes: 18 additions & 0 deletions patches/tModLoader/Terraria/Player.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4929,6 +4929,15 @@
{
return false;
}
@@ -38543,7 +_,7 @@
{
using (BinaryWriter binaryWriter = new BinaryWriter(cryptoStream))
{
- binaryWriter.Write(193);
+ binaryWriter.Write(194);
playerFile.Metadata.Write(binaryWriter);
binaryWriter.Write(player.name);
binaryWriter.Write(player.difficulty);
@@ -38594,49 +_,49 @@
binaryWriter.Write(player.shoeColor.B);
for (int k = 0; k < player.armor.Length; k++)
Expand Down Expand Up @@ -4996,6 +5005,15 @@
}

public static PlayerFileData LoadPlayer(string playerPath, bool cloudSave)
@@ -38719,7 +_,7 @@
{
playerFileData.Metadata = FileMetadata.FromCurrentSettings(FileType.Player);
}
- if (num > 193)
+ if (num > 194)
{
player.loadStatus = 1;
player.name = binaryReader.ReadString();
@@ -39179,6 +_,7 @@
player.bartenderQuestLog = binaryReader.ReadInt32();
}
Expand Down
Binary file added references/System.Windows.Forms.Mono.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion solutions/CompleteRelease.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:: After Pulling, Patching, and making sure the version number is changed in src, this bat will compile and create zips for all release.
:: It will also create a zip for ExampleMod

set version=v0.10
set version=v0.10.0.1
set destinationFolder=.\tModLoader %version% Release

:: Compile/Build exe
Expand Down
2 changes: 2 additions & 0 deletions solutions/ReleaseExtras/README_Linux.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
If you are upgrading from 0.9.2.3 for 1.3.5, please use steam to "verify integrity of game files" before attempting to install.

To install tModLoader, simply run the tModLoaderInstaller.jar file. Java 1.7 or higher is required for the installer to run. The installer will make a window pop up, informing you of either success or failure.

If the installer for some reason does not work, or if you do not want to install/upgrade Java, you may also do a manual install. You may wish to back-up your vanilla Terraria.exe first.
Expand Down
2 changes: 2 additions & 0 deletions solutions/ReleaseExtras/README_Mac.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
If you are upgrading from 0.9.2.3 for 1.3.5, please use steam to "verify integrity of game files" before attempting to install.

To install tModLoader, simply run the tModLoaderInstaller.jar file. Java 1.7 or higher is required for the installer to run. The installer will make a window pop up, informing you of either success or failure.

If the installer for some reason does not work, or if you do not want to install/upgrade Java, you may also do a manual install. Go to your Terraria's Steam folder; for most people, this will be "Library/Application Support/Steam/steamapps/common/Terraria/Terraria.app/Contents/MacOS". Then, copy all these files into that folder. You may wish to back-up your vanilla Terraria.exe first.
Expand Down
2 changes: 2 additions & 0 deletions solutions/ReleaseExtras/README_Windows.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
If you are upgrading from 0.9.2.3 for 1.3.5, please use steam to "verify integrity of game files" before attempting to install.

To install tModLoader, simply run the tModLoaderInstaller.jar file. Java 1.7 or higher is required for the installer to run. The installer will make a window pop up, informing you of either success or failure.

If the installer for some reason does not work, or if you do not want to install/upgrade Java, you may also do a manual install. Go to your Terraria's Steam folder; for most people, this will be "C:\Program Files (x86)\Steam\SteamApps\common\Terraria". Then, copy all these files into that folder. You may wish to back-up your vanilla Terraria.exe first.

0 comments on commit b9537fa

Please sign in to comment.