-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathProgram.cs
More file actions
138 lines (105 loc) · 4.82 KB
/
Copy pathProgram.cs
File metadata and controls
138 lines (105 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using CommandLine;
using CommandLine.Text;
using libdebug;
using PDTools.GTPatcher.MemoryPatches;
using PDTools.GTPatcher.BreakLoggers;
namespace PDTools.GTPatcher;
public class Program
{
public static CancellationTokenSource _cts = new CancellationTokenSource();
public static void Main(string[] args)
{
Console.WriteLine("GTDebugger by Nenkai#9075 for GT Sport");
Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(Options);
}
public static void Options(Options options)
{
var dbg = new GTPatcher(options.IPAddress, GameType.GT7_V136);
if (options.Arguments.Any())
{
string[] args = new string[1 + options.Arguments.Count()];
args[0] = "";
for (var i = 0; i < options.Arguments.Count(); i++)
args[i + 1] = options.Arguments.ElementAt(i);
dbg.AddPatch(new CommandLineInjector(args));
Console.WriteLine($"Command Line Arguments to Inject:");
foreach (var arg in options.Arguments)
Console.WriteLine($"- {arg}");
Console.WriteLine();
}
if (!string.IsNullOrEmpty(options.Build))
{
Console.WriteLine($"Setting game build to: {options.Build}");
dbg.AddPatch(new VersionBuildPatcher(options.Build));
}
if (!string.IsNullOrEmpty(options.Branch))
{
Console.WriteLine($"Setting game branch to: {options.Branch}");
dbg.AddPatch(new VersionBranchPatcher(options.Branch));
}
if (!string.IsNullOrEmpty(options.Environment))
{
Console.WriteLine($"Setting game environment to: {options.Environment}");
dbg.AddPatch(new VersionEnvironmentPatcher(options.Environment));
}
if (options.KernelLogFiles || options.KernelLogMissingFiles)
{
Console.WriteLine($"Will log accessed files from FileDeviceKernel/sceKernelStat");
dbg.AddBreakLogger(new FileDeviceKernelAccessLogger(options.KernelLogMissingFiles));
}
if (options.MPHLogFiles || options.MPHLogMissingFiles)
{
Console.WriteLine($"Will log accessed files from FileDeviceMPH");
dbg.AddBreakLogger(new FileDeviceMPHAccessLogger(options.MPHLogMissingFiles));
}
if (options.FixAdhocExceptionCrash)
{
Console.WriteLine($"Will fix GT7 adhoc exceptions");
dbg.AddBreakLogger(new AdhocExceptionFixer());
}
if (options.DisableTinyWebCaching)
{
Console.WriteLine($"Will disable tinyweb adhoc module caching");
dbg.AddBreakLogger(new TinyWebAdhocModuleCacheDisabler());
}
dbg.AddBreakLogger(new EvalExpressionStringLogger());
dbg.AddBreakLogger(new EvalExpressionCompilationTokenTypeLogger());
Console.CancelKeyPress += delegate {
_cts.Cancel();
};
Console.WriteLine();
dbg.Start(new CancellationTokenSource().Token);
dbg.Dispose();
}
}
public class Options
{
[Option('i', "ip", Required = true, HelpText = "PS4 IP Address")]
public string IPAddress { get; set; }
[Option('a', "args", Required = false, HelpText = "Command Line Arguments for the game")]
public IEnumerable<string> Arguments { get; set; }
[Option("build", Required = false, HelpText = "Sets the game's build")]
public string Build { get; set; }
[Option("branch", Required = false, HelpText = "Sets the game's branch")]
public string Branch { get; set; }
[Option("environment", Required = false, HelpText = "Sets the game's version environment")]
public string Environment { get; set; }
[Option("mph-log-files", Required = false, HelpText = "Whether to log files from GT7 (makes it run slower)")]
public bool MPHLogFiles { get; set; }
[Option("mph-log-missing-files", Required = false, HelpText = "Whether to log missing files from GT7 (makes it run slower)")]
public bool MPHLogMissingFiles { get; set; }
[Option("kernel-log-files", Required = false, HelpText = "Whether to log files from the game (makes it run slower)")]
public bool KernelLogFiles { get; set; }
[Option("kernel-log-missing-files", Required = false, HelpText = "Whether to log missing files from the game (makes it run slower)")]
public bool KernelLogMissingFiles { get; set; }
[Option("fix-gt7-adhoc-exceptions", Required = false, HelpText = "Fixes adhoc exceptions crashing GT7 (removes vegas reporting)")]
public bool FixAdhocExceptionCrash { get; set; }
[Option("disable-tinyweb-caching", Required = false, HelpText = "Disables TinyWeb ADC/Adhoc caching")]
public bool DisableTinyWebCaching { get; set; }
}