Skip to content

Commit

Permalink
Version 2.1
Browse files Browse the repository at this point in the history
Old Settings tab is now named Extras
Settings tab corresponds now to the default settings on the frontend
Added restore infinite speed trick
OOB now doesn't get you stuck into the ceiling if you bomb jump once
Added PB formatting ammo/max patch
Hypermode difficulty is now unlocked at the beginning
Fixed Progressive Suit Damage Reduction
Removed Plandomizer tab
Updated assembly parser module
  • Loading branch information
UltiNaruto committed Sep 7, 2021
1 parent ad869f1 commit d91a852
Show file tree
Hide file tree
Showing 35 changed files with 2,587 additions and 1,206 deletions.
27 changes: 14 additions & 13 deletions MP1_Trilogy_Rando_Generator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP1_Trilogy_Rando_Generator", "MP1_Trilogy_Rando_Generator\MP1_Trilogy_Rando_Generator.csproj", "{A14DAA8F-8AD5-4130-910F-94227ADB57F3}"
EndProject
#Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP1_Trilogy_New_Frontend", "MP1_Trilogy_New_Frontend\MP1_Trilogy_New_Frontend.vcxproj", "{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}"
#EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ppcasm_cs", "ppcasm_cs\ppcasm_cs\ppcasm_cs.csproj", "{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -29,17 +29,18 @@ Global
{A14DAA8F-8AD5-4130-910F-94227ADB57F3}.Release|x64.Build.0 = Release|Any CPU
{A14DAA8F-8AD5-4130-910F-94227ADB57F3}.Release|x86.ActiveCfg = Release|Any CPU
{A14DAA8F-8AD5-4130-910F-94227ADB57F3}.Release|x86.Build.0 = Release|Any CPU
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Debug|Any CPU.ActiveCfg = Debug|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Debug|x64.ActiveCfg = Debug|x64
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Debug|x64.Build.0 = Debug|x64
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Debug|x86.ActiveCfg = Debug|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Debug|x86.Build.0 = Debug|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|Any CPU.ActiveCfg = Release|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|Any CPU.Build.0 = Release|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|x64.ActiveCfg = Release|x64
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|x64.Build.0 = Release|x64
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|x86.ActiveCfg = Release|Win32
#{EFD40434-D20C-432A-BFF1-79BDAE1FDB6B}.Release|x86.Build.0 = Release|Win32
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|x64.ActiveCfg = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|x64.Build.0 = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Debug|x86.Build.0 = Debug|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|Any CPU.Build.0 = Release|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|x64.ActiveCfg = Release|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|x64.Build.0 = Release|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|x86.ActiveCfg = Release|Any CPU
{D7B05604-9633-4E57-9FD3-1E6F5956B0F6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 3 additions & 3 deletions MP1_Trilogy_Rando_Generator/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
161 changes: 112 additions & 49 deletions MP1_Trilogy_Rando_Generator/Config/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,125 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Text.RegularExpressions;

namespace MP1_Trilogy_Rando_Generator.Config
{
class AppSettings
{
public String prime1RandomizerPath;
public String prime1PlandomizerPath;
public String prime1PlandomizerLastJsonPath;
public bool disableSpringBall;
public bool enableMapFromStart;
public String outputPath;
public String outputType;
public PrimeSettings primeSettings;

public AppSettings()
static AppSettings LoadDefaultSettings()
{
var line = default(String);
var kvp = default(MatchCollection);
try
{
String CurDir = Directory.GetCurrentDirectory();
using (var sR = new StreamReader(File.OpenRead(CurDir + @"\settings.json")))
{
while (!sR.EndOfStream)
{
line = sR.ReadLine().Trim().Trim(' ');
kvp = new Regex("\"(.*?)\"").Matches(line);
if (kvp.Count == 2)
{
if (kvp[0].Groups[1].Value == "prime1RandomizerPath")
this.prime1RandomizerPath = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "prime1PlandomizerPath")
this.prime1PlandomizerPath = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "prime1PlandomizerLastJsonPath")
this.prime1PlandomizerLastJsonPath = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "outputPath")
this.outputPath = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "outputType")
this.outputType = kvp[1].Groups[1].Value;
}
}
AppSettings appSettings = new AppSettings();
appSettings.prime1RandomizerPath = "";
appSettings.outputPath = "";
appSettings.outputType = ".ciso";
appSettings.primeSettings = new PrimeSettings();
appSettings.SaveToJson();
return appSettings;
}

public static AppSettings LoadFromJson()
{
AppSettings appSettings = null;
String CurDir = Directory.GetCurrentDirectory();
if (!File.Exists(CurDir+@"\settings.json"))
return LoadDefaultSettings();

appSettings = new AppSettings();

try {
dynamic json = JObject.Parse(File.ReadAllText(CurDir + @"\settings.json"));

try {
appSettings.prime1RandomizerPath = json.prime1RandomizerPath;
} catch {
appSettings.prime1RandomizerPath = "";
}
}
catch
{
this.prime1RandomizerPath = "";
this.prime1PlandomizerPath = "";
this.prime1PlandomizerLastJsonPath = "";
this.outputPath = "";
this.outputType = ".ciso";
this.SaveToJson();

try {
appSettings.outputPath = json.outputPath;
} catch {
appSettings.outputPath = "";
}

try {
appSettings.outputType = json.outputType;
} catch {
appSettings.outputType = ".ciso";
}

try {
appSettings.disableSpringBall = json.disableSpringBall;
} catch {
appSettings.disableSpringBall = false;
}

try {
appSettings.enableMapFromStart = json.enableMapFromStart;
} catch {
appSettings.enableMapFromStart = false;
}

appSettings.primeSettings = new PrimeSettings();

try {
appSettings.primeSettings.SetSensitivity((Config.PrimeSettings.SensitivityEnum)Convert.ToUInt32(json.primeSettings.controller.Sensitivity));
} catch { }

try {
appSettings.primeSettings.SetLockOnFreeAim(json.primeSettings.controller.LockOnFreeAim == "true");
} catch { }

try {
appSettings.primeSettings.SetRumble(json.primeSettings.controller.Rumble == "true");
} catch { }

try {
appSettings.primeSettings.SetSwapJumpFire(json.primeSettings.controller.SwapJumpFire == "true");
} catch { }

try {
appSettings.primeSettings.SetSwapVisorAndBeam(json.primeSettings.controller.SwapVisorAndBeamHyper == "true");
} catch { }

try {
appSettings.primeSettings.SetBrightness(Convert.ToUInt32(json.primeSettings.display.Brightness));
} catch { }

try {
appSettings.primeSettings.SetBonusCreditMessages(json.primeSettings.display.BonusCreditMessages == "true");
} catch { }

try {
appSettings.primeSettings.SetVisorOpacity(Convert.ToUInt32(json.primeSettings.visor.VisorOpacity));
} catch { }

try {
appSettings.primeSettings.SetHelmetOpacity(Convert.ToUInt32(json.primeSettings.visor.HelmetOpacity));
} catch { }

try {
appSettings.primeSettings.SetHudLag(json.primeSettings.visor.HudLag == "true");
} catch { }

try {
appSettings.primeSettings.SetSoundFXVolume(Convert.ToUInt32(json.primeSettings.sound.SoundFXVolume));
} catch { }

try {
appSettings.primeSettings.SetMusicVolume(Convert.ToUInt32(json.primeSettings.sound.MusicVolume));
} catch { }

return appSettings;
} catch {
return LoadDefaultSettings();
}
}

Expand All @@ -57,16 +128,8 @@ public void SaveToJson()
String CurDir = Directory.GetCurrentDirectory();
if (File.Exists(CurDir + @"\settings.json"))
File.Delete(CurDir + @"\settings.json");
using (var sW = new StreamWriter(File.OpenWrite(CurDir + @"\settings.json")))
{
sW.WriteLine("{");
sW.WriteLine("\t\"prime1RandomizerPath\": \"" + this.prime1RandomizerPath + "\",");
sW.WriteLine("\t\"prime1PlandomizerPath\": \"" + this.prime1PlandomizerPath + "\",");
sW.WriteLine("\t\"prime1PlandomizerLastJsonPath\": \"" + this.prime1PlandomizerLastJsonPath + "\",");
sW.WriteLine("\t\"outputPath\": \"" + this.outputPath + "\",");
sW.WriteLine("\t\"outputType\": \"" + this.outputType + "\"");
sW.WriteLine("}");
}

File.WriteAllText(CurDir + @"\settings.json", JsonConvert.SerializeObject(this, Formatting.Indented));
}
}
}
58 changes: 24 additions & 34 deletions MP1_Trilogy_Rando_Generator/Config/PatchSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Text.RegularExpressions;

Expand All @@ -13,34 +15,30 @@ class PatchSettings

public PatchSettings()
{
var line = default(String);
var kvp = default(MatchCollection);
try
{
String AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
using (var sR = new StreamReader(File.OpenRead(AppData + @"\metroid-prime-randomizer\patch-settings.json")))
{
while (!sR.EndOfStream)
{
line = sR.ReadLine().Trim().Trim(' ');
kvp = new Regex("\"(.*?)\"").Matches(line);
if (kvp.Count == 2)
{
if (kvp[0].Groups[1].Value == "baseIso")
this.baseIso = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "outputFolder")
this.outputFolder = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "outputType")
this.outputType = kvp[1].Groups[1].Value;
if (kvp[0].Groups[1].Value == "trilogyIso")
this.trilogyIso = kvp[1].Groups[1].Value;
}
}
}
String AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
dynamic json = JObject.Parse(File.ReadAllText(AppData + @"\metroid-prime-randomizer\patch-settings.json"));

try {
this.baseIso = json.baseIso;
} catch {
this.baseIso = "";
}

try {
this.outputFolder = json.outputFolder;
} catch {
this.outputFolder = "";
}

try {
this.outputType = json.outputType;
} catch {
this.outputType = "iso";
}

try {
this.trilogyIso = json.trilogyIso;
} catch {
this.trilogyIso = "";
}
}
Expand All @@ -58,15 +56,7 @@ public void SaveToJson()
String AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (File.Exists(AppData + @"\metroid-prime-randomizer\patch-settings.json"))
File.Delete(AppData + @"\metroid-prime-randomizer\patch-settings.json");
using (var sW = new StreamWriter(File.OpenWrite(AppData + @"\metroid-prime-randomizer\patch-settings.json")))
{
sW.WriteLine("{");
sW.WriteLine("\t\"baseIso\": \""+this.baseIso+"\",");
sW.WriteLine("\t\"outputFolder\": \"" + this.outputFolder + "\",");
sW.WriteLine("\t\"outputType\": \"" + this.outputType + "\",");
sW.WriteLine("\t\"trilogyIso\": \"" + this.trilogyIso + "\"");
sW.WriteLine("}");
}
File.WriteAllText(AppData + @"\metroid-prime-randomizer\patch-settings.json", JsonConvert.SerializeObject(this, Formatting.Indented));
}
}
}
Loading

0 comments on commit d91a852

Please sign in to comment.