mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 17:53:01 +02:00
added default clientinfo generation
This commit is contained in:
parent
476c8c456a
commit
84af43ea4a
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -526,7 +527,7 @@ public class GlobalFuncs
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
#endif
|
#endif
|
||||||
ReShadeValues(cfgpath, true, setglobals);
|
ReShadeValues(cfgpath, true, setglobals);
|
||||||
}
|
}
|
||||||
@ -562,18 +563,41 @@ public class GlobalFuncs
|
|||||||
|
|
||||||
if (!File.Exists(clientpath))
|
if (!File.Exists(clientpath))
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
#if LAUNCHER
|
#if LAUNCHER
|
||||||
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2, box);
|
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2, box);
|
||||||
#elif CMD
|
#elif CMD
|
||||||
GlobalFuncs.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
|
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2);
|
||||||
#elif URI
|
|
||||||
#endif
|
#endif
|
||||||
name = GlobalVars.ProgramInformation.DefaultClient;
|
GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath));
|
||||||
|
|
||||||
#if LAUNCHER
|
#if LAUNCHER
|
||||||
ReadClientValues(name, box, initial);
|
ReadClientValues(name, box, initial);
|
||||||
#else
|
#else
|
||||||
ReadClientValues(name, initial);
|
ReadClientValues(name, initial);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
#if LAUNCHER || CMD || URI
|
||||||
|
LogExceptions(ex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LAUNCHER
|
||||||
|
ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2, box);
|
||||||
|
ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4, box);
|
||||||
|
#elif CMD
|
||||||
|
ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2);
|
||||||
|
ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4);
|
||||||
|
#endif
|
||||||
|
name = GlobalVars.ProgramInformation.DefaultClient;
|
||||||
|
#if LAUNCHER
|
||||||
|
ReadClientValues(name, box, initial);
|
||||||
|
#else
|
||||||
|
ReadClientValues(name, initial);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -584,8 +608,7 @@ public class GlobalFuncs
|
|||||||
#if LAUNCHER
|
#if LAUNCHER
|
||||||
ConsolePrint("Client '" + name + "' successfully loaded.", 3, box);
|
ConsolePrint("Client '" + name + "' successfully loaded.", 3, box);
|
||||||
#elif CMD
|
#elif CMD
|
||||||
GlobalFuncs.ConsolePrint("Client '" + name + "' successfully loaded.", 3);
|
ConsolePrint("Client '" + name + "' successfully loaded.", 3);
|
||||||
#elif URI
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,6 +632,75 @@ public class GlobalFuncs
|
|||||||
ChangeGameSettings(ClientName);
|
ChangeGameSettings(ClientName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GenerateDefaultClientInfo(string path)
|
||||||
|
{
|
||||||
|
FileFormat.ClientInfo DefaultClientInfo = new FileFormat.ClientInfo();
|
||||||
|
bool placeholder = false;
|
||||||
|
|
||||||
|
string ClientName = "";
|
||||||
|
|
||||||
|
if (File.Exists(path + "\\RobloxApp_client.exe"))
|
||||||
|
{
|
||||||
|
ClientName = "\\RobloxApp_client.exe";
|
||||||
|
}
|
||||||
|
else if (File.Exists(path + "\\RobloxApp.exe"))
|
||||||
|
{
|
||||||
|
ClientName = "\\RobloxApp.exe";
|
||||||
|
DefaultClientInfo.LegacyMode = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation.");
|
||||||
|
throw clientNotFoundEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ClientMD5 = File.Exists(path + ClientName) ? SecurityFuncs.GenerateMD5(path + ClientName) : "";
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(ClientMD5))
|
||||||
|
{
|
||||||
|
DefaultClientInfo.ClientMD5 = ClientMD5.ToUpper(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation.");
|
||||||
|
throw clientNotFoundEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ClientScriptMD5 = File.Exists(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") ? SecurityFuncs.GenerateMD5(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(ClientScriptMD5))
|
||||||
|
{
|
||||||
|
DefaultClientInfo.ScriptMD5 = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation.");
|
||||||
|
throw clientNotFoundEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient +
|
||||||
|
"' was pre-generated by Novetus for your convienence.\nIf you experience any issues with the default settings, load this clientinfo.nov file into the Client SDK.";
|
||||||
|
|
||||||
|
DefaultClientInfo.Description = desc;
|
||||||
|
|
||||||
|
string[] lines = {
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.UsesPlayerName.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.UsesID.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.Warning.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.LegacyMode.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.ClientMD5.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.ScriptMD5.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.Description.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(placeholder.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.Fix2007.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.AlreadyHasSecurity.ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(((int)DefaultClientInfo.ClientLoadOptions).ToString()),
|
||||||
|
SecurityFuncs.Base64Encode(DefaultClientInfo.CommandLineArgs.ToString())
|
||||||
|
};
|
||||||
|
|
||||||
|
File.WriteAllText(path + "\\clientinfo.nov", SecurityFuncs.Base64Encode(string.Join("|", lines)));
|
||||||
|
}
|
||||||
|
|
||||||
public static void FixedFileCopy(string src, string dest, bool overwrite, bool overwritewarning = false)
|
public static void FixedFileCopy(string src, string dest, bool overwrite, bool overwritewarning = false)
|
||||||
{
|
{
|
||||||
if (File.Exists(dest))
|
if (File.Exists(dest))
|
||||||
@ -707,7 +799,7 @@ public class GlobalFuncs
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
#endif
|
#endif
|
||||||
if (!string.IsNullOrWhiteSpace(fallbackFileFullName))
|
if (!string.IsNullOrWhiteSpace(fallbackFileFullName))
|
||||||
image = LoadImage(fallbackFileFullName);
|
image = LoadImage(fallbackFileFullName);
|
||||||
@ -727,10 +819,21 @@ public class GlobalFuncs
|
|||||||
public static FileFormat.ClientInfo GetClientInfoValues(string ClientName)
|
public static FileFormat.ClientInfo GetClientInfoValues(string ClientName)
|
||||||
{
|
{
|
||||||
string name = ClientName;
|
string name = ClientName;
|
||||||
FileFormat.ClientInfo info = new FileFormat.ClientInfo();
|
|
||||||
string clientpath = GlobalPaths.ClientDir + @"\\" + name + @"\\clientinfo.nov";
|
try
|
||||||
LoadClientValues(info, clientpath);
|
{
|
||||||
return info;
|
FileFormat.ClientInfo info = new FileFormat.ClientInfo();
|
||||||
|
string clientpath = GlobalPaths.ClientDir + @"\\" + name + @"\\clientinfo.nov";
|
||||||
|
LoadClientValues(info, clientpath);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
#if LAUNCHER || CMD || URI
|
||||||
|
LogExceptions(ex);
|
||||||
|
#endif
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://social.msdn.microsoft.com/Forums/vstudio/en-US/b0c31115-f6f0-4de5-a62d-d766a855d4d1/directorygetfiles-with-searchpattern-to-get-all-dll-and-exe-files-in-one-call?forum=netfxbcl
|
//https://social.msdn.microsoft.com/Forums/vstudio/en-US/b0c31115-f6f0-4de5-a62d-d766a855d4d1/directorygetfiles-with-searchpattern-to-get-all-dll-and-exe-files-in-one-call?forum=netfxbcl
|
||||||
@ -1031,196 +1134,196 @@ public class GlobalFuncs
|
|||||||
|
|
||||||
public static void ChangeGameSettings(string ClientName)
|
public static void ChangeGameSettings(string ClientName)
|
||||||
{
|
{
|
||||||
FileFormat.ClientInfo info = GetClientInfoValues(ClientName);
|
try
|
||||||
|
|
||||||
string filterPath = GlobalPaths.ConfigDir + @"\\" + GlobalPaths.FileDeleteFilterName;
|
|
||||||
string[] fileListToDelete = File.ReadAllLines(filterPath);
|
|
||||||
|
|
||||||
foreach (string file in fileListToDelete)
|
|
||||||
{
|
{
|
||||||
string fullFilePath = Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + file;
|
FileFormat.ClientInfo info = GetClientInfoValues(ClientName);
|
||||||
FixedFileDelete(fullFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GlobalVars.UserConfiguration.QualityLevel != Settings.Level.Custom)
|
string filterPath = GlobalPaths.ConfigDir + @"\\" + GlobalPaths.FileDeleteFilterName;
|
||||||
{
|
string[] fileListToDelete = File.ReadAllLines(filterPath);
|
||||||
int GraphicsMode = 0;
|
|
||||||
|
|
||||||
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
foreach (string file in fileListToDelete)
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
|
||||||
{
|
{
|
||||||
GraphicsMode = 1;
|
string fullFilePath = Settings.GetPathForClientLoadOptions(info.ClientLoadOptions) + @"\" + file;
|
||||||
|
FixedFileDelete(fullFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GlobalVars.UserConfiguration.QualityLevel != Settings.Level.Custom)
|
||||||
|
{
|
||||||
|
int GraphicsMode = 0;
|
||||||
|
|
||||||
|
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
||||||
|
{
|
||||||
|
GraphicsMode = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
||||||
|
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
||||||
|
{
|
||||||
|
case Settings.Mode.OpenGLStable:
|
||||||
|
switch (info.ClientLoadOptions)
|
||||||
|
{
|
||||||
|
case Settings.ClientLoadOptions.Client_2007:
|
||||||
|
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
||||||
|
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
||||||
|
GraphicsMode = 2;
|
||||||
|
break;
|
||||||
|
case Settings.ClientLoadOptions.Client_2008AndUp:
|
||||||
|
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
||||||
|
GraphicsMode = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Settings.Mode.OpenGLExperimental:
|
||||||
|
GraphicsMode = 4;
|
||||||
|
break;
|
||||||
|
case Settings.Mode.DirectX:
|
||||||
|
GraphicsMode = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
GraphicsMode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//default values are ultra settings
|
||||||
|
int MeshDetail = 100;
|
||||||
|
int ShadingQuality = 100;
|
||||||
|
int GFXQualityLevel = 19;
|
||||||
|
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21)
|
||||||
|
{
|
||||||
|
GFXQualityLevel = 21;
|
||||||
|
}
|
||||||
|
int MaterialQuality = 3;
|
||||||
|
int AASamples = 8;
|
||||||
|
int Bevels = 1;
|
||||||
|
int Shadows_2008 = 1;
|
||||||
|
int AA = 1;
|
||||||
|
bool Shadows_2007 = true;
|
||||||
|
|
||||||
|
switch (GlobalVars.UserConfiguration.QualityLevel)
|
||||||
|
{
|
||||||
|
case Settings.Level.Automatic:
|
||||||
|
//set everything to automatic. Some ultra settings will still be enabled.
|
||||||
|
AA = 0;
|
||||||
|
Bevels = 0;
|
||||||
|
Shadows_2008 = 0;
|
||||||
|
GFXQualityLevel = 0;
|
||||||
|
MaterialQuality = 0;
|
||||||
|
break;
|
||||||
|
case Settings.Level.VeryLow:
|
||||||
|
AA = 2;
|
||||||
|
MeshDetail = 50;
|
||||||
|
ShadingQuality = 50;
|
||||||
|
GFXQualityLevel = 1;
|
||||||
|
MaterialQuality = 1;
|
||||||
|
AASamples = 1;
|
||||||
|
Bevels = 2;
|
||||||
|
Shadows_2008 = 2;
|
||||||
|
Shadows_2007 = false;
|
||||||
|
break;
|
||||||
|
case Settings.Level.Low:
|
||||||
|
AA = 2;
|
||||||
|
MeshDetail = 50;
|
||||||
|
ShadingQuality = 50;
|
||||||
|
GFXQualityLevel = 5;
|
||||||
|
MaterialQuality = 1;
|
||||||
|
AASamples = 1;
|
||||||
|
Bevels = 2;
|
||||||
|
Shadows_2008 = 2;
|
||||||
|
Shadows_2007 = false;
|
||||||
|
break;
|
||||||
|
case Settings.Level.Medium:
|
||||||
|
MeshDetail = 75;
|
||||||
|
ShadingQuality = 75;
|
||||||
|
GFXQualityLevel = 10;
|
||||||
|
MaterialQuality = 2;
|
||||||
|
AASamples = 4;
|
||||||
|
Bevels = 2;
|
||||||
|
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21 ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL)
|
||||||
|
{
|
||||||
|
Shadows_2008 = 3;
|
||||||
|
}
|
||||||
|
Shadows_2007 = false;
|
||||||
|
break;
|
||||||
|
case Settings.Level.High:
|
||||||
|
MeshDetail = 75;
|
||||||
|
ShadingQuality = 75;
|
||||||
|
GFXQualityLevel = 15;
|
||||||
|
AASamples = 4;
|
||||||
|
break;
|
||||||
|
case Settings.Level.Ultra:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality, AA, AASamples, Bevels,
|
||||||
|
Shadows_2008, Shadows_2007, "", GFXQualityLevel, "800x600", "1024x768", 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
//save graphics mode.
|
||||||
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
int GraphicsMode = 0;
|
||||||
{
|
|
||||||
|
|
||||||
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
||||||
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
||||||
|
{
|
||||||
|
GraphicsMode = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
||||||
|
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
||||||
{
|
{
|
||||||
case Settings.Mode.OpenGLStable:
|
|
||||||
switch (info.ClientLoadOptions)
|
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
||||||
{
|
{
|
||||||
case Settings.ClientLoadOptions.Client_2007:
|
case Settings.Mode.OpenGLStable:
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
switch (info.ClientLoadOptions)
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
{
|
||||||
GraphicsMode = 2;
|
case Settings.ClientLoadOptions.Client_2007:
|
||||||
break;
|
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp:
|
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
GraphicsMode = 2;
|
||||||
GraphicsMode = 4;
|
break;
|
||||||
break;
|
case Settings.ClientLoadOptions.Client_2008AndUp:
|
||||||
default:
|
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
||||||
break;
|
GraphicsMode = 4;
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
case Settings.Mode.OpenGLExperimental:
|
break;
|
||||||
GraphicsMode = 4;
|
}
|
||||||
break;
|
break;
|
||||||
case Settings.Mode.DirectX:
|
case Settings.Mode.OpenGLExperimental:
|
||||||
GraphicsMode = 3;
|
GraphicsMode = 4;
|
||||||
break;
|
break;
|
||||||
default:
|
case Settings.Mode.DirectX:
|
||||||
GraphicsMode = 1;
|
GraphicsMode = 3;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
GraphicsMode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//default values are ultra settings
|
ApplyClientSettings(info, ClientName, GraphicsMode, 0, 0, 0, 0, 0, 0, 0, false, "", 0, "800x600", "1024x768", 0, true);
|
||||||
int MeshDetail = 100;
|
|
||||||
int ShadingQuality = 100;
|
|
||||||
int GFXQualityLevel = 19;
|
|
||||||
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21)
|
|
||||||
{
|
|
||||||
GFXQualityLevel = 21;
|
|
||||||
}
|
|
||||||
int MaterialQuality = 3;
|
|
||||||
int AASamples = 8;
|
|
||||||
int Bevels = 1;
|
|
||||||
int Shadows_2008 = 1;
|
|
||||||
int AA = 1;
|
|
||||||
bool Shadows_2007 = true;
|
|
||||||
|
|
||||||
switch (GlobalVars.UserConfiguration.QualityLevel)
|
//just copy the file.
|
||||||
{
|
string terms = "_" + ClientName;
|
||||||
case Settings.Level.Automatic:
|
string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients);
|
||||||
//set everything to automatic. Some ultra settings will still be enabled.
|
|
||||||
AA = 0;
|
|
||||||
Bevels = 0;
|
|
||||||
Shadows_2008 = 0;
|
|
||||||
GFXQualityLevel = 0;
|
|
||||||
MaterialQuality = 0;
|
|
||||||
break;
|
|
||||||
case Settings.Level.VeryLow:
|
|
||||||
AA = 2;
|
|
||||||
MeshDetail = 50;
|
|
||||||
ShadingQuality = 50;
|
|
||||||
GFXQualityLevel = 1;
|
|
||||||
MaterialQuality = 1;
|
|
||||||
AASamples = 1;
|
|
||||||
Bevels = 2;
|
|
||||||
Shadows_2008 = 2;
|
|
||||||
Shadows_2007 = false;
|
|
||||||
break;
|
|
||||||
case Settings.Level.Low:
|
|
||||||
AA = 2;
|
|
||||||
MeshDetail = 50;
|
|
||||||
ShadingQuality = 50;
|
|
||||||
GFXQualityLevel = 5;
|
|
||||||
MaterialQuality = 1;
|
|
||||||
AASamples = 1;
|
|
||||||
Bevels = 2;
|
|
||||||
Shadows_2008 = 2;
|
|
||||||
Shadows_2007 = false;
|
|
||||||
break;
|
|
||||||
case Settings.Level.Medium:
|
|
||||||
MeshDetail = 75;
|
|
||||||
ShadingQuality = 75;
|
|
||||||
GFXQualityLevel = 10;
|
|
||||||
MaterialQuality = 2;
|
|
||||||
AASamples = 4;
|
|
||||||
Bevels = 2;
|
|
||||||
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic ||
|
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21 ||
|
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL)
|
|
||||||
{
|
|
||||||
Shadows_2008 = 3;
|
|
||||||
}
|
|
||||||
Shadows_2007 = false;
|
|
||||||
break;
|
|
||||||
case Settings.Level.High:
|
|
||||||
MeshDetail = 75;
|
|
||||||
ShadingQuality = 75;
|
|
||||||
GFXQualityLevel = 15;
|
|
||||||
AASamples = 4;
|
|
||||||
break;
|
|
||||||
case Settings.Level.Ultra:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality, AA, AASamples, Bevels,
|
|
||||||
Shadows_2008, Shadows_2007, "", GFXQualityLevel, "800x600", "1024x768", 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//save graphics mode.
|
|
||||||
int GraphicsMode = 0;
|
|
||||||
|
|
||||||
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
|
||||||
{
|
|
||||||
GraphicsMode = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
|
||||||
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
|
||||||
{
|
|
||||||
|
|
||||||
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
|
||||||
{
|
|
||||||
case Settings.Mode.OpenGLStable:
|
|
||||||
switch (info.ClientLoadOptions)
|
|
||||||
{
|
|
||||||
case Settings.ClientLoadOptions.Client_2007:
|
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
|
||||||
GraphicsMode = 2;
|
|
||||||
break;
|
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp:
|
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
|
||||||
GraphicsMode = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Settings.Mode.OpenGLExperimental:
|
|
||||||
GraphicsMode = 4;
|
|
||||||
break;
|
|
||||||
case Settings.Mode.DirectX:
|
|
||||||
GraphicsMode = 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
GraphicsMode = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplyClientSettings(info, ClientName, GraphicsMode, 0, 0, 0, 0, 0, 0, 0, false, "", 0, "800x600", "1024x768", 0, true);
|
|
||||||
|
|
||||||
//just copy the file.
|
|
||||||
string terms = "_" + ClientName;
|
|
||||||
string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (string dir in dirs)
|
foreach (string dir in dirs)
|
||||||
{
|
{
|
||||||
if (dir.Contains(terms) && !dir.Contains("_default"))
|
if (dir.Contains(terms) && !dir.Contains("_default"))
|
||||||
@ -1231,13 +1334,13 @@ public class GlobalFuncs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
#if URI || LAUNCHER || CMD
|
{
|
||||||
LogExceptions(ex);
|
#if LAUNCHER || CMD || URI
|
||||||
|
LogExceptions(ex);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1247,51 +1350,61 @@ public class GlobalFuncs
|
|||||||
int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, string Style_2007, int GFXQualityLevel, string WindowResolution, string FullscreenResolution,
|
int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, string Style_2007, int GFXQualityLevel, string WindowResolution, string FullscreenResolution,
|
||||||
int ModernResolution)
|
int ModernResolution)
|
||||||
{
|
{
|
||||||
int GraphicsMode = 0;
|
try
|
||||||
|
{
|
||||||
|
int GraphicsMode = 0;
|
||||||
|
|
||||||
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
if (info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21 ||
|
||||||
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
info.ClientLoadOptions == Settings.ClientLoadOptions.Client_2008AndUp_ForceAutomatic)
|
||||||
{
|
|
||||||
GraphicsMode = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
|
||||||
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
|
||||||
{
|
{
|
||||||
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
GraphicsMode = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
|
||||||
|
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
|
||||||
{
|
{
|
||||||
case Settings.Mode.OpenGLStable:
|
switch (GlobalVars.UserConfiguration.GraphicsMode)
|
||||||
switch (info.ClientLoadOptions)
|
{
|
||||||
{
|
case Settings.Mode.OpenGLStable:
|
||||||
case Settings.ClientLoadOptions.Client_2007:
|
switch (info.ClientLoadOptions)
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
{
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
case Settings.ClientLoadOptions.Client_2007:
|
||||||
GraphicsMode = 2;
|
case Settings.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
|
||||||
break;
|
case Settings.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp:
|
GraphicsMode = 2;
|
||||||
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
break;
|
||||||
GraphicsMode = 4;
|
case Settings.ClientLoadOptions.Client_2008AndUp:
|
||||||
break;
|
case Settings.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
|
||||||
default:
|
GraphicsMode = 4;
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
break;
|
break;
|
||||||
case Settings.Mode.OpenGLExperimental:
|
}
|
||||||
GraphicsMode = 4;
|
break;
|
||||||
break;
|
case Settings.Mode.OpenGLExperimental:
|
||||||
case Settings.Mode.DirectX:
|
GraphicsMode = 4;
|
||||||
GraphicsMode = 3;
|
break;
|
||||||
break;
|
case Settings.Mode.DirectX:
|
||||||
default:
|
GraphicsMode = 3;
|
||||||
GraphicsMode = 1;
|
break;
|
||||||
break;
|
default:
|
||||||
|
GraphicsMode = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality,
|
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality,
|
||||||
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution);
|
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
#if LAUNCHER || CMD || URI
|
||||||
|
LogExceptions(ex);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//it's worse.
|
//it's worse.
|
||||||
|
@ -819,8 +819,40 @@ namespace NovetusLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GenerateIfInvalid()
|
||||||
|
{
|
||||||
|
string clientpath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\clientinfo.nov";
|
||||||
|
|
||||||
|
if (!File.Exists(clientpath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.\n\nNovetus will attempt to generate one.", "Novetus - Client Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
GlobalFuncs.GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
MessageBox.Show("Failed to generate default clientinfo.nov. Info: " + ex.Message + "\n\nLoading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", "Novetus - Client Info Generation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void ReadClientValues(bool initial = false)
|
public void ReadClientValues(bool initial = false)
|
||||||
{
|
{
|
||||||
|
//reset clients
|
||||||
|
if (!GenerateIfInvalid())
|
||||||
|
{
|
||||||
|
if (Tabs.SelectedTab == Tabs.TabPages[TabPageClients])
|
||||||
|
{
|
||||||
|
ClientBox.SelectedItem = GlobalVars.UserConfiguration.SelectedClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GlobalFuncs.ReadClientValues(ConsoleBox, initial);
|
GlobalFuncs.ReadClientValues(ConsoleBox, initial);
|
||||||
|
|
||||||
PlayerNameTextBox.Enabled = GlobalVars.SelectedClientInfo.UsesPlayerName;
|
PlayerNameTextBox.Enabled = GlobalVars.SelectedClientInfo.UsesPlayerName;
|
||||||
|
@ -197,6 +197,22 @@ namespace NovetusLauncher
|
|||||||
|
|
||||||
public void ReadClientValues(bool initial = false)
|
public void ReadClientValues(bool initial = false)
|
||||||
{
|
{
|
||||||
|
//reset clients
|
||||||
|
if (!launcherFormStylishInterface1.launcherForm.GenerateIfInvalid())
|
||||||
|
{
|
||||||
|
if (launcherFormStylishInterface1.clientTab != null && launcherFormStylishInterface1.clientTab.IsSelected)
|
||||||
|
{
|
||||||
|
foreach (object o in launcherFormStylishInterface1.clientListBox.Items)
|
||||||
|
{
|
||||||
|
if ((o is ClientListItem) && (o as ClientListItem).ClientName.Contains(GlobalVars.UserConfiguration.SelectedClient))
|
||||||
|
{
|
||||||
|
launcherFormStylishInterface1.clientListBox.SelectedItem = o;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GlobalFuncs.ReadClientValues(null, initial);
|
GlobalFuncs.ReadClientValues(null, initial);
|
||||||
|
|
||||||
launcherFormStylishInterface1.userNameBox.IsEnabled = GlobalVars.SelectedClientInfo.UsesPlayerName;
|
launcherFormStylishInterface1.userNameBox.IsEnabled = GlobalVars.SelectedClientInfo.UsesPlayerName;
|
||||||
|
Loading…
Reference in New Issue
Block a user