Skip to content

Commit c5426ea

Browse files
author
ComputerElite
committed
fix app not being added to config when resuming download (untested). Yes I love to not test things
1 parent 07093f2 commit c5426ea

File tree

5 files changed

+64
-53
lines changed

5 files changed

+64
-53
lines changed

App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</dependentAssembly>
1212
<dependentAssembly>
1313
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
14+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
1515
</dependentAssembly>
1616
</assemblyBinding>
1717
</runtime>

Package.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public string MakeFilenameSafe(string filename)
6262

6363
public void ExecuteAction(Package package)
6464
{
65-
bool execute = false;
6665
Logger.Log("Starting " + actionName);
6766
Console.WriteLine("Starting " + actionName);
6867
foreach(PackageOn o in on)

Program.cs

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void Main(string[] args)
3939
{
4040
Logger.SetLogFile(AppDomain.CurrentDomain.BaseDirectory + "Log.log");
4141
SetupExceptionHandlers();
42-
DowngradeManager.updater = new Updater("1.9.0", "https://github.com/ComputerElite/Oculus-downgrader", "Oculus downgrader", Assembly.GetExecutingAssembly().Location);
42+
DowngradeManager.updater = new Updater("1.9.1", "https://github.com/ComputerElite/Oculus-downgrader", "Oculus downgrader", Assembly.GetExecutingAssembly().Location);
4343
Logger.LogRaw("\n\n");
4444
Logger.Log("Starting Oculus downgrader version " + DowngradeManager.updater.version);
4545
if (args.Length == 1 && args[0] == "--update")
@@ -70,7 +70,12 @@ static void Main(string[] args)
7070
DowngradeManager.commands.AddCommandLineArgument(new List<string> { "--versionstring" }, false, "VersionString of the game version to download/launch. Less precise than other version selecting", "versionstring"); // Done
7171
DowngradeManager.commands.AddCommandLineArgument(new List<string> { "--copyold" }, true, "If you want to backup your current install"); // Done
7272

73-
if (DowngradeManager.commands.HasArgument("help") || DowngradeManager.commands.HasArgument("?") || DowngradeManager.commands.HasArgument("imconfused"))
73+
if(DowngradeManager.commands.HasArgument("imconfused"))
74+
{
75+
Console.WriteLine("How DARE you be confused. Get unconfused! https://youtu.be/TMrtLsQbaok?t=188");
76+
return;
77+
}
78+
if (DowngradeManager.commands.HasArgument("help") || DowngradeManager.commands.HasArgument("?"))
7479
{
7580
DowngradeManager.commands.ShowHelp(DowngradeManager.updater.AppName);
7681
return;
@@ -82,16 +87,16 @@ static void Main(string[] args)
8287
public static void SetupExceptionHandlers()
8388
{
8489
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
85-
HandleExtenption((Exception)e.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException");
90+
HandleExtenption((Exception)e.ExceptionObject);
8691

8792
TaskScheduler.UnobservedTaskException += (s, e) =>
8893
{
89-
HandleExtenption(e.Exception, "TaskScheduler.UnobservedTaskException");
94+
HandleExtenption(e.Exception);
9095
e.SetObserved();
9196
};
9297
}
9398

94-
public static void HandleExtenption(Exception e, string source)
99+
public static void HandleExtenption(Exception e)
95100
{
96101
Logger.Log("An unhandled exception has occured:\n" + e.ToString(), LoggingType.Crash);
97102
DowngradeManager.Error("\n\nAn unhandled exception has occured. Check the log for more info and send it to ComputerElite for the (probably) bug to get fixed. Press any key to close out.");
@@ -110,8 +115,8 @@ public class DowngradeManager
110115
public static string password = "";
111116
public static Updater updater = new Updater();
112117
public static CommandLineCommandContainer commands = null;
113-
string qPVersion = "2.2.4";
114-
string qPDownloadLink = "https://github.com/ComputerElite/QuestPatcherBuilds/releases/download/2.2.4/QuestPatcher.zip";
118+
public string qPVersion = "2.2.4";
119+
public string qPDownloadLink = "https://github.com/ComputerElite/QuestPatcherBuilds/releases/download/2.2.4/QuestPatcher.zip";
115120
public bool first = true;
116121
public bool auto = false;
117122
public bool cont = false;
@@ -235,7 +240,6 @@ public void Menu()
235240
HandleCLIArgs();
236241
while (true)
237242
{
238-
239243
Console.WriteLine();
240244
//if(!IsTokenValid(config.access_token)) Console.WriteLine("Hello. For Oculus downgrader to function you need to provide your access_token in order to do requests to Oculus and basically use this tool");
241245
if (UpdateAccessToken(true))
@@ -306,7 +310,7 @@ public void Menu()
306310
}
307311
}
308312

309-
// This almost works. I can get a token but can't sign in to oculus with it.
313+
// It just works. But it complains that Edge is new and not V 96 (=> Downgrade Edge). I hate this shit. Please help me. Why does this have to be so complicated. >:(
310314
public string LoginWithFacebook()
311315
{
312316
Logger.Log("Starting login via Facebook");
@@ -542,6 +546,7 @@ public AppReturnVersion SelectFromInstalledApps()
542546
Logger.Log("Downloaded versions of " + selected.name);
543547

544548
Dictionary<string, ReleaseChannelReleaseBinary> versionBinary = new Dictionary<string, ReleaseChannelReleaseBinary>();
549+
545550
foreach (ReleaseChannelReleaseBinary b in selected.versions)
546551
{
547552
bool exists = false;
@@ -559,6 +564,14 @@ public AppReturnVersion SelectFromInstalledApps()
559564
Logger.Log(" - " + displayName);
560565
Console.WriteLine(t.Day.ToString("D2") + "." + t.Month.ToString("D2") + "." + t.Year + " " + displayName);
561566
}
567+
/*
568+
if (Directory.Exists(exe + "apps\\" + selected.id + "\\original_install"))
569+
{
570+
versionBinary.Add("original_install", new ReleaseChannelReleaseBinary { id = "original_install" });
571+
Logger.Log(" - original_install");
572+
Console.WriteLine("UNKNOWN DATE" + " original_install");
573+
}
574+
*/
562575
choosen = false;
563576
string ver = "";
564577
while (!choosen)
@@ -660,7 +673,7 @@ public void LaunchApp(AppReturnVersion selected, bool openDir = false)
660673
}
661674
p.WaitForExit();
662675
Logger.Log("QP exit code: " + p.ExitCode);
663-
if(File.Exists(apk + ".patched.apk") && p.ExitCode == 0) apk = apk + ".patched.apk";
676+
if(File.Exists(apk + ".patched.apk") && p.ExitCode == 0) apk += ".patched.apk";
664677
else
665678
{
666679
Logger.Log("QuestPatcher exited with exit code " + p.ExitCode + " which is not 0 indicating an error. Vanilla version will be installed.");
@@ -730,7 +743,7 @@ public void LaunchApp(AppReturnVersion selected, bool openDir = false)
730743
{
731744
Logger.Log("Version is already copied. Launching: " + appDir + manifest.launchFile);
732745
Console.WriteLine("Version is already in the library folder. Launching");
733-
Process.Start(appDir + manifest.launchFile, (manifest.launchParameters != null ? manifest.launchParameters : "") + " " + selected.version.extraLaunchArgs);
746+
Process.Start(appDir + manifest.launchFile, (manifest.launchParameters ?? "") + " " + selected.version.extraLaunchArgs);
734747
return;
735748
} else if(File.Exists(appDir + "RiftDowngrader_appId.txt"))
736749
{
@@ -769,15 +782,15 @@ public void LaunchApp(AppReturnVersion selected, bool openDir = false)
769782
File.WriteAllText(appDir + "RiftDowngrader_appId.txt", selected.version.id);
770783
Good("Finished.\nLaunching");
771784
Logger.Log("Copying finished. Launching.");
772-
Process.Start(appDir + manifest.launchFile, (manifest.launchParameters != null ? manifest.launchParameters : "") + " " + selected.version.extraLaunchArgs);
785+
Process.Start(appDir + manifest.launchFile, (manifest.launchParameters ?? "") + " " + selected.version.extraLaunchArgs);
773786
}
774787

775788
public bool CheckOculusFolder(bool set = false)
776789
{
777790
if(!config.oculusSoftwareFolderSet || set)
778791
{
779792
Logger.Log("Asking user for Oculus folder");
780-
if (!config.oculusSoftwareFolderSet) config.oculusSoftwareFolder = (string)Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus").GetValue("Base") + "Software";
793+
if (!config.oculusSoftwareFolderSet && Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus") != null) config.oculusSoftwareFolder = (string)Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus").GetValue("Base") + "Software";
781794
string f = ConsoleUiController.QuestionString("I need to move all the files to your Oculus software folder. " + (set ? "" : "You haven't set it yet. ") + "Please enter it now (default: " + config.oculusSoftwareFolder + "): ");
782795
string before = config.oculusSoftwareFolder;
783796
config.oculusSoftwareFolder = f == "" ? config.oculusSoftwareFolder : f;
@@ -1058,8 +1071,7 @@ public void ShowVersions(string appId)
10581071
Console.WriteLine("Failed to repair/download game");
10591072
return;
10601073
}
1061-
Console.ForegroundColor= ConsoleColor.Green;
1062-
Console.WriteLine("Finished. App downloaded and ready to get launched.");
1074+
StartDownload(selected, appId, appName, true);
10631075
return;
10641076
}
10651077
}
@@ -1078,29 +1090,32 @@ public string DecryptToken()
10781090
return config.access_token.Substring(0, 5) + PasswordEncryption.Decrypt(config.access_token.Substring(5), password);
10791091
}
10801092

1081-
public void StartDownload(AndroidBinary binary, string appId, string appName)
1093+
public void StartDownload(AndroidBinary binary, string appId, string appName, bool skipDownload = false)
10821094
{
1083-
Console.ForegroundColor = ConsoleColor.White;
1084-
if (!UpdateAccessToken(true))
1095+
if(!skipDownload)
10851096
{
1086-
Logger.Log("Access token not provided. aborting.", LoggingType.Warning);
1087-
Error("Valid access token is needed to proceed. Aborting.");
1088-
return;
1089-
}
1090-
string baseDirectory = commands.HasArgument("--destination") ? commands.GetValue("--destination") : exe + "apps\\" + appId + "\\" + binary.id + "\\";
1091-
Logger.Log("Creating " + baseDirectory);
1092-
Directory.CreateDirectory(baseDirectory);
1093-
bool success = false;
1094-
GameDownloader.customManifestError = "If you do, check if you got the right headset selected in the main menu. If that's the case update your access_token in case it's expired.";
1095-
if (config.headset == Headset.MONTEREY) success = GameDownloader.DownloadMontereyGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1096-
else if (config.headset == Headset.GEARVR) success = GameDownloader.DownloadGearVRGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1097-
else if (config.headset == Headset.PACIFIC) success = GameDownloader.DownloadPacificGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1098-
else success = GameDownloader.DownloadRiftGame(baseDirectory, DecryptToken(), binary.id);
1099-
if(!success)
1100-
{
1101-
Logger.Log("Download failed", LoggingType.Warning);
1102-
Error("Download failed");
1103-
return;
1097+
Console.ForegroundColor = ConsoleColor.White;
1098+
if (!UpdateAccessToken(true))
1099+
{
1100+
Logger.Log("Access token not provided. aborting.", LoggingType.Warning);
1101+
Error("Valid access token is needed to proceed. Aborting.");
1102+
return;
1103+
}
1104+
string baseDirectory = commands.HasArgument("--destination") ? commands.GetValue("--destination") : exe + "apps\\" + appId + "\\" + binary.id + "\\";
1105+
Logger.Log("Creating " + baseDirectory);
1106+
Directory.CreateDirectory(baseDirectory);
1107+
bool success;
1108+
GameDownloader.customManifestError = "If you do, check if you got the right headset selected in the main menu. If that's the case update your access_token in case it's expired.";
1109+
if (config.headset == Headset.MONTEREY) success = GameDownloader.DownloadMontereyGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1110+
else if (config.headset == Headset.GEARVR) success = GameDownloader.DownloadGearVRGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1111+
else if (config.headset == Headset.PACIFIC) success = GameDownloader.DownloadPacificGame(baseDirectory + "app.apk", DecryptToken(), binary.id);
1112+
else success = GameDownloader.DownloadRiftGame(baseDirectory, DecryptToken(), binary.id);
1113+
if (!success)
1114+
{
1115+
Logger.Log("Download failed", LoggingType.Warning);
1116+
Error("Download failed");
1117+
return;
1118+
}
11041119
}
11051120
Console.ForegroundColor = ConsoleColor.White;
11061121
Logger.Log("Adding version to config");
@@ -1123,10 +1138,7 @@ public void StartDownload(AndroidBinary binary, string appId, string appName)
11231138
if(!exists) config.apps[aa].versions.Add(ReleaseChannelReleaseBinary.FromAndroidBinary(binary));
11241139
}
11251140
}
1126-
App a = new App();
1127-
a.name = appName;
1128-
a.id = appId;
1129-
a.headset = config.headset;
1141+
App a = new App() { name = appName, id = appId, headset = config.headset};
11301142
a.versions.Add(ReleaseChannelReleaseBinary.FromAndroidBinary(binary));
11311143
if (!found)
11321144
{
@@ -1173,7 +1185,7 @@ public bool UpdateAccessToken(bool onlyIfNeeded = false)
11731185
Logger.Log("Asking user if they want to use the new selenium sign in method.");
11741186
string choice = ConsoleUiController.QuestionString("Do you want to login with facebook/oculus? (Y/n): ");
11751187
Console.ForegroundColor = ConsoleColor.White;
1176-
string at = "";
1188+
string at;
11771189
if (choice.ToLower() == "y" || choice == "")
11781190
{
11791191
at = LoginWithFacebook();
@@ -1252,7 +1264,7 @@ public bool ShowUsername()
12521264
return true;
12531265
} catch (Exception ex)
12541266
{
1255-
Logger.Log("Error while requesting Username. Token is probably expired.");
1267+
Logger.Log("Error while requesting Username. Token is probably expired: \n" + ex.ToString());
12561268
Error("Error while requesting username. Your token is probably expired. Please update it with option 5 (update access_token) to be able to download games again.");
12571269
return false;
12581270
}

RIFT Downgrader.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@
6868
<HintPath>..\packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
6969
<Private>True</Private>
7070
</Reference>
71-
<Reference Include="System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
72-
<HintPath>..\packages\System.Text.Json.6.0.1\lib\net461\System.Text.Json.dll</HintPath>
73-
<Private>True</Private>
71+
<Reference Include="System.Text.Json, Version=6.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
72+
<HintPath>..\packages\System.Text.Json.6.0.2\lib\net461\System.Text.Json.dll</HintPath>
7473
</Reference>
7574
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
7675
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -113,6 +112,7 @@
113112
<ItemGroup>
114113
<None Include="App.config" />
115114
<None Include="app.manifest" />
115+
<Content Include="Log.txt" />
116116
<None Include="packages.config" />
117117
<None Include="QuestPatcher.Axaml\LICENSE" />
118118
<None Include="QuestPatcher.Axaml\QuestPatcher.Axml.csproj" />
@@ -129,13 +129,13 @@
129129
</ProjectReference>
130130
</ItemGroup>
131131
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
132-
<Import Project="..\packages\Selenium.WebDriver.MSEdgeDriver.96.0.1054.26\build\Selenium.WebDriver.MSEdgeDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.MSEdgeDriver.96.0.1054.26\build\Selenium.WebDriver.MSEdgeDriver.targets')" />
132+
<Import Project="..\packages\Selenium.WebDriver.MSEdgeDriver.97.0.1072.55\build\Selenium.WebDriver.MSEdgeDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.MSEdgeDriver.97.0.1072.55\build\Selenium.WebDriver.MSEdgeDriver.targets')" />
133133
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
134134
<PropertyGroup>
135135
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
136136
</PropertyGroup>
137-
<Error Condition="!Exists('..\packages\Selenium.WebDriver.MSEdgeDriver.96.0.1054.26\build\Selenium.WebDriver.MSEdgeDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.MSEdgeDriver.96.0.1054.26\build\Selenium.WebDriver.MSEdgeDriver.targets'))" />
138-
<Error Condition="!Exists('..\packages\System.Text.Json.6.0.1\build\System.Text.Json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Text.Json.6.0.1\build\System.Text.Json.targets'))" />
137+
<Error Condition="!Exists('..\packages\Selenium.WebDriver.MSEdgeDriver.97.0.1072.55\build\Selenium.WebDriver.MSEdgeDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.MSEdgeDriver.97.0.1072.55\build\Selenium.WebDriver.MSEdgeDriver.targets'))" />
138+
<Error Condition="!Exists('..\packages\System.Text.Json.6.0.2\build\System.Text.Json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Text.Json.6.0.2\build\System.Text.Json.targets'))" />
139139
</Target>
140-
<Import Project="..\packages\System.Text.Json.6.0.1\build\System.Text.Json.targets" Condition="Exists('..\packages\System.Text.Json.6.0.1\build\System.Text.Json.targets')" />
140+
<Import Project="..\packages\System.Text.Json.6.0.2\build\System.Text.Json.targets" Condition="Exists('..\packages\System.Text.Json.6.0.2\build\System.Text.Json.targets')" />
141141
</Project>

0 commit comments

Comments
 (0)