diff --git a/NovetusLauncher/NovetusFuncs/GlobalVars.cs b/NovetusLauncher/NovetusFuncs/GlobalVars.cs
index 7466619..d8a2f7f 100644
--- a/NovetusLauncher/NovetusFuncs/GlobalVars.cs
+++ b/NovetusLauncher/NovetusFuncs/GlobalVars.cs
@@ -147,7 +147,8 @@ public static class GlobalVars
public static bool ReadyToLaunch = false;
//server settings.
public static bool UPnP = false;
- public static string Map = "";
+ public static bool UDP = true;
+ public static string Map = "";
public static string FullMapPath = "";
public static int RobloxPort = 53640;
public static int DefaultRobloxPort = 53640;
diff --git a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs
index cbe2b0e..68b4181 100644
--- a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs
+++ b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs
@@ -58,6 +58,7 @@ public class LauncherFuncs
ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString());
ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
+ ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
}
else
{
@@ -65,7 +66,7 @@ public class LauncherFuncs
string Decryptline1, Decryptline2, Decryptline3, Decryptline4,
Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10,
Decryptline11, Decryptline12, Decryptline13, Decryptline14, Decryptline15,
- Decryptline16, Decryptline17, Decryptline20, Decryptline21;
+ Decryptline16, Decryptline17, Decryptline20, Decryptline21, Decryptline22;
IniFile ini = new IniFile(cfgpath);
@@ -216,6 +217,14 @@ public class LauncherFuncs
Decryptline21 = ini.IniReadValue(section, "OldLayout");
}
+ Decryptline22 = ini.IniReadValue(section, "UDP");
+
+ if (string.IsNullOrWhiteSpace(Decryptline21))
+ {
+ ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
+ Decryptline21 = ini.IniReadValue(section, "UDP");
+ }
+
bool bline1 = Convert.ToBoolean(Decryptline1);
GlobalVars.CloseOnLaunch = bline1;
@@ -275,6 +284,8 @@ public class LauncherFuncs
GlobalVars.QualityLevel = iline20;
bool bline21 = Convert.ToBoolean(Decryptline21);
GlobalVars.OldLayout = bline21;
+ bool bline22 = Convert.ToBoolean(Decryptline22);
+ GlobalVars.UDP = bline22;
}
Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
@@ -674,6 +685,7 @@ public class LauncherFuncs
GlobalVars.PlayerLimit = 12;
GlobalVars.Custom_Extra_ShowHats = false;
GlobalVars.UPnP = false;
+ GlobalVars.UDP = true;
GlobalVars.DisabledHelp = false;
GlobalVars.DiscordPresence = true;
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
diff --git a/NovetusLauncher/NovetusFuncs/UPnP.cs b/NovetusLauncher/NovetusFuncs/NetFuncs.cs
similarity index 56%
rename from NovetusLauncher/NovetusFuncs/UPnP.cs
rename to NovetusLauncher/NovetusFuncs/NetFuncs.cs
index cb7d141..3850f14 100644
--- a/NovetusLauncher/NovetusFuncs/UPnP.cs
+++ b/NovetusLauncher/NovetusFuncs/NetFuncs.cs
@@ -8,6 +8,7 @@
*/
using System;
+using LiteNetLib;
using Mono.Nat;
public static class UPnP
@@ -42,4 +43,52 @@ public static class UPnP
}
}
}
+}
+
+public static class UDP
+{
+ private static NetManager StartUDPListener(int port = -1)
+ {
+ if (GlobalVars.UDP == true)
+ {
+ EventBasedNetListener listener = new EventBasedNetListener();
+ NetManager list = new NetManager(listener);
+ if (port > -1)
+ {
+ list.Start(port);
+ }
+ else
+ {
+ list.Start();
+ }
+
+ return list;
+ }
+
+ return null;
+ }
+
+ public static NetManager StartClient(string ip, int port)
+ {
+ if (GlobalVars.UDP == true)
+ {
+ //we don't need a port here, we are a client.
+ NetManager client = StartUDPListener();
+ client.Connect(ip, port, "");
+ return client;
+ }
+
+ return null;
+ }
+
+ public static NetManager StartServer(int port)
+ {
+ if (GlobalVars.UDP == true)
+ {
+ NetManager server = StartUDPListener(port);
+ return server;
+ }
+
+ return null;
+ }
}
\ No newline at end of file
diff --git a/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems b/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems
index 5e92956..964c58d 100644
--- a/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems
+++ b/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems
@@ -27,7 +27,7 @@
-
+
diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.Designer.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.Designer.cs
index dab0318..168f9dd 100644
--- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.Designer.cs
+++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.Designer.cs
@@ -380,6 +380,7 @@ namespace NovetusLauncher
this.checkBox8.Text = "Toggle UDP Hole Punching (WIP)";
this.checkBox8.UseVisualStyleBackColor = true;
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
+ this.checkBox8.Click += new System.EventHandler(this.CheckBox4Click);
//
// label19
//
diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs
index 48f26c1..c8fc7b8 100644
--- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs
+++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs
@@ -547,8 +547,15 @@ namespace NovetusLauncher
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
label37.Text = GlobalVars.IP;
label38.Text = GlobalVars.RobloxPort.ToString();
- checkBox4.Checked = GlobalVars.UPnP;
- checkBox2.Checked = GlobalVars.DiscordPresence;
+ if (GlobalVars.UDP == false && GlobalVars.UPnP == true)
+ {
+ checkBox4.Checked = GlobalVars.UPnP;
+ }
+ else if (GlobalVars.UDP == true && GlobalVars.UPnP == false)
+ {
+ checkBox8.Checked = GlobalVars.UDP;
+ }
+ checkBox2.Checked = GlobalVars.DiscordPresence;
checkBox5.Checked = GlobalVars.ReShade;
checkBox6.Checked = GlobalVars.ReShadeFPSDisplay;
checkBox7.Checked = GlobalVars.ReShadePerformanceMode;
@@ -1576,7 +1583,7 @@ namespace NovetusLauncher
else if (checkBox4.Checked == false)
{
GlobalVars.UPnP = false;
- //checkBox8.Checked = GlobalVars.UDP;
+ checkBox8.Checked = GlobalVars.UDP;
}
}
@@ -1874,7 +1881,16 @@ namespace NovetusLauncher
private void checkBox8_CheckedChanged(object sender, EventArgs e)
{
-
- }
+ if (checkBox8.Checked == true)
+ {
+ GlobalVars.UDP = true;
+ checkBox4.Checked = false;
+ }
+ else if (checkBox8.Checked == false)
+ {
+ GlobalVars.UDP = false;
+ checkBox4.Checked = GlobalVars.UPnP;
+ }
+ }
}
}
diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.Designer.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.Designer.cs
index 3ab6684..6e3a4b1 100644
--- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.Designer.cs
+++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.Designer.cs
@@ -380,6 +380,7 @@ namespace NovetusLauncher
this.checkBox8.Text = "Toggle UDP\r\nHole Punching (WIP)";
this.checkBox8.UseVisualStyleBackColor = true;
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
+ this.checkBox8.Click += new System.EventHandler(this.CheckBox4Click);
//
// label19
//
diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs
index 9dd866f..0c5795f 100644
--- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs
+++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs
@@ -545,7 +545,14 @@ namespace NovetusLauncher
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
label37.Text = GlobalVars.IP;
label38.Text = GlobalVars.RobloxPort.ToString();
- checkBox4.Checked = GlobalVars.UPnP;
+ if (GlobalVars.UDP == false && GlobalVars.UPnP == true)
+ {
+ checkBox4.Checked = GlobalVars.UPnP;
+ }
+ else if (GlobalVars.UDP == true && GlobalVars.UPnP == false)
+ {
+ checkBox8.Checked = GlobalVars.UDP;
+ }
checkBox2.Checked = GlobalVars.DiscordPresence;
ConsolePrint("Config loaded.", 3);
@@ -1542,7 +1549,7 @@ namespace NovetusLauncher
else if (checkBox4.Checked == false)
{
GlobalVars.UPnP = false;
- //checkBox8.Checked = GlobalVars.UDP;
+ checkBox8.Checked = GlobalVars.UDP;
}
}
@@ -1793,10 +1800,18 @@ namespace NovetusLauncher
Application.Restart();
}
- private void checkBox8_CheckedChanged(object sender, EventArgs e)
- {
-
-
- }
- }
+ private void checkBox8_CheckedChanged(object sender, EventArgs e)
+ {
+ if (checkBox8.Checked == true)
+ {
+ GlobalVars.UDP = true;
+ checkBox4.Checked = false;
+ }
+ else if (checkBox8.Checked == false)
+ {
+ GlobalVars.UDP = false;
+ checkBox4.Checked = GlobalVars.UPnP;
+ }
+ }
+ }
}