-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSONSchema.cs
378 lines (362 loc) · 17.5 KB
/
JSONSchema.cs
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Linq;
using Newtonsoft.Json;
namespace GenshinConfigurator
{
internal class JSONSchema
{
public class InputData
{
public string scriptVersion { get; set; }
public double mouseSensitivity { get; set; }
public int joypadSenseIndex { get; set; }
public int joypadFocusSenseIndex { get; set; }
public bool joypadInvertCameraX { get; set; }
public bool joypadInvertCameraY { get; set; }
public bool joypadInvertFocusCameraX { get; set; }
public bool joypadInvertFocusCameraY { get; set; }
public int mouseSenseIndex { get; set; }
public int mouseFocusSenseIndex { get; set; }
public int touchpadSenseIndex { get; set; }
public int touchpadFocusSenseIndex { get; set; }
public bool enableTouchpadFocusAcceleration { get; set; }
public double lastJoypadDefaultScale { get; set; }
public double lastJoypadFocusScale { get; set; }
public double lastPCDefaultScale { get; set; }
public double lastPCFocusScale { get; set; }
public double lastTouchDefaultScale { get; set; }
public double lastTouchFcousScale { get; set; }
public bool switchWalkRunByBtn { get; set; }
public bool skiffCameraAutoFix { get; set; }
public bool skiffCameraAutoFixInCombat { get; set; }
public double cameraDistanceRatio { get; set; }
public bool wwiseVibration { get; set; }
public bool isYInited { get; set; }
public int joypadSenseIndexY { get; set; }
public int joypadFocusSenseIndexY { get; set; }
public int mouseSenseIndexY { get; set; }
public int mouseFocusSenseIndexY { get; set; }
public int touchpadSenseIndexY { get; set; }
public int touchpadFocusSenseIndexY { get; set; }
public double lastJoypadDefaultScaleY { get; set; }
public double lastJoypadFocusScaleY { get; set; }
public double lastPCDefaultScaleY { get; set; }
public double lastPCFocusScaleY { get; set; }
public double lastTouchDefaultScaleY { get; set; }
public double lastTouchFcousScaleY { get; set; }
}
public class GraphicsSetting
{
public int key { get; set; }
public int value { get; set; }
}
public class GraphicsData
{
public int currentVolatielGrade { get; set; }
public IList<GraphicsSetting> customVolatileGrades { get; set; }
public string volatileVersion { get; set; }
}
public class perfItem
{
public int entryType { get; set; }
public int index { get; set; }
public string itemVersion { get; set; }
}
public class globalPerfData
{
public IList<perfItem> saveItems { get; set; }
public bool truePortedFromGraphicData { get; set; }
public string portedVersion { get; set; }
public bool portedFromGraphicData { get; set; }
}
public class MainJSON
{
[OnSerializing]
internal void dumpJSON(StreamingContext context)
{
if (__graphicsLoaded)
{
_graphicsData = JsonConvert.SerializeObject(graphicsData);
_globalPerfData = JsonConvert.SerializeObject(globalPerfData);
_inputData = JsonConvert.SerializeObject(inputData);
}
if (__controlsLoaded)
{
__overrideControllerMapValueList = new List<string>();
foreach (Controller cntrl in _overrideControllerMapValueList.List())
{
string xml_string = cntrl.DumpToString(false);
__overrideControllerMapValueList.Add(xml_string);
}
}
}
[OnDeserialized]
internal void loadJSON(StreamingContext context)
{
try
{
graphicsData = JsonConvert.DeserializeObject<GraphicsData>(_graphicsData);
globalPerfData = JsonConvert.DeserializeObject<globalPerfData>(_globalPerfData);
} catch
{
__graphicsLoaded = false;
}
try
{
inputData = JsonConvert.DeserializeObject<InputData>(_inputData);
} catch
{
__inputLoaded = false;
}
if (__graphicsLoaded)
{
__graphicsInRange = true;
foreach (GraphicsSetting setting in graphicsData.customVolatileGrades)
{
__graphicsInRange &= GraphicsSettings.Check(setting.key, setting.value);
}
}
Controllers controllers = new Controllers();
_overrideControllerMapValueList = controllers;
try
{
foreach (string xml_string in __overrideControllerMapValueList)
{
XDocument xml_doc = XDocument.Parse(xml_string);
XNamespace ns = "http://guavaman.com/rewired";
if (xml_doc.Root.Name == (ns + "KeyboardMap"))
{
KeyboardController kbd = new KeyboardController();
kbd.LoadFromString(xml_string);
controllers.Add(kbd);
}
else if (xml_doc.Root.Name == (ns + "MouseMap"))
{
MouseController mouse = new MouseController();
mouse.LoadFromString(xml_string);
controllers.Add(mouse);
}
else if (xml_doc.Root.Name == (ns + "JoystickMap"))
{
// GUID is tied to controller type.
// Probably, configuration is same for all controllers of same type.
// Controller type is detected by GUID.
// Mouse + kbd + unknown controllers doesn't have a GUID.
// Name is populated only sometimes.
if (xml_doc.Descendants(ns + "hardwareGuid").First().Value == "d74a350e-fe8b-4e9e-bbcd-efff16d34115")
{
XBoxController xbc = new XBoxController();
xbc.LoadFromString(xml_string);
controllers.Add(xbc);
}
else if (xml_doc.Descendants(ns + "hardwareGuid").First().Value == "cd9718bf-a87a-44bc-8716-60a0def28a9f")
{
DS4Controller ds4c = new DS4Controller();
ds4c.LoadFromString(xml_string);
controllers.Add(ds4c);
}
else if (xml_doc.Root.Attribute("hardwareName") != null && xml_doc.Root.Attribute("hardwareName").Value == "Wireless Controller" && xml_doc.Descendants(ns + "hardwareGuid").First().Value == "00000000-0000-0000-0000-000000000000")
{
DualSenseController dsc = new DualSenseController();
dsc.LoadFromString(xml_string);
controllers.Add(dsc);
}
else
{
UnknownController c = new UnknownController();
c.LoadFromString(xml_string);
controllers.Add(c);
}
}
}
} catch
{
__controlsLoaded = false;
}
}
[JsonIgnore]
public bool __inputLoaded { get; set; } = true;
[JsonIgnore]
public bool __controlsLoaded { get; set; } = true;
[JsonIgnore]
public bool __graphicsLoaded { get; set; } = true;
[JsonIgnore]
public bool __graphicsInRange { get; set; } = false;
public string deviceUUID { get; set; }
public string userLocalDataVersionId { get; set; }
public int deviceLanguageType { get; set; }
public int deviceVoiceLanguageType { get; set; }
public string selectedServerName { get; set; }
public int localLevelIndex { get; set; }
public string deviceID { get; set; }
public string targetUID { get; set; }
public string curAccountName { get; set; }
public string uiSaveData { get; set; }
[JsonProperty(PropertyName = "inputData")]
public string _inputData { get; set; }
[JsonIgnore]
public InputData inputData { get; set; }
[JsonProperty(PropertyName = "graphicsData")]
public string _graphicsData { get; set; }
[JsonIgnore]
public GraphicsData graphicsData { get; set; }
[JsonProperty(PropertyName = "globalPerfData")]
public string _globalPerfData { get; set; }
[JsonIgnore]
public globalPerfData globalPerfData { get; set; }
public int miniMapConfig { get; set; }
public bool enableCameraSlope { get; set; }
public bool enableCameraCombatLock { get; set; }
public bool completionPkg { get; set; }
public bool completionPlayGoPkg { get; set; }
public bool onlyPlayWithPSPlayer { get; set; }
public bool needPlayGoFullPkgPatch { get; set; }
public bool resinNotification { get; set; }
public bool exploreNotification { get; set; }
public int volumeGlobal { get; set; }
public int volumeSFX { get; set; }
public int volumeMusic { get; set; }
public int volumeVoice { get; set; }
public int audioAPI { get; set; }
public int audioDynamicRange { get; set; }
public int audioOutput { get; set; }
public bool _audioSuccessInit { get; set; }
public bool enableAudioChangeAndroidMinimumBufferCapacity { get; set; }
public int audioAndroidMiniumBufferCapacity { get; set; }
public int vibrationLevel { get; set; }
public int vibrationIntensity { get; set; }
public bool usingNewVibrationSetting { get; set; }
public bool motionBlur { get; set; }
public bool gyroAiming { get; set; }
public int gyroHorMoveSpeedIndex { get; set; }
public int gyroVerMoveSpeedIndex { get; set; }
public bool gyroHorReverse { get; set; }
public bool gyroVerReverse { get; set; }
public int gyroRotateType { get; set; }
public bool gyroExcludeRightStickVerInput { get; set; }
public bool firstHDRSetting { get; set; }
public double maxLuminosity { get; set; }
public double uiPaperWhite { get; set; }
public double scenePaperWhite { get; set; }
public double gammaValue { get; set; }
public bool enableHDR { get; set; }
public List<string> _overrideControllerMapKeyList { get; set; }
[JsonProperty(PropertyName = "_overrideControllerMapValueList")]
public List<string> __overrideControllerMapValueList { get; set; }
[JsonIgnore]
public Controllers _overrideControllerMapValueList { get; set; }
public bool rewiredDisableKeyboard { get; set; }
public bool rewiredEnableKeyboard { get; set; }
public bool rewiredEnableEDS { get; set; }
public bool disableRewiredDelayInit { get; set; }
public bool disableRewiredInitProtection { get; set; }
public List<string> conflictKeyBindingElementId { get; set; }
public List<string> conflictKeyBindingActionId { get; set; }
public int lastSeenPreDownloadTime { get; set; }
public string lastSeenSettingResourceTabScriptVersion { get; set; }
public bool enableEffectAssembleInEditor { get; set; }
public bool forceDisableQuestResourceManagement { get; set; }
public bool needReportQuestResourceDeleteStatusFiles { get; set; }
public bool disableTeamPageBackgroundSwitch { get; set; }
public bool disableHttpDns { get; set; }
public bool mtrCached { get; set; }
public bool mtrIsOpen { get; set; }
public int mtrMaxTTL { get; set; }
public int mtrTimeOut { get; set; }
public int mtrTraceCount { get; set; }
public int mtrAbortTimeOutCount { get; set; }
public int mtrAutoTraceInterval { get; set; }
public int mtrTraceCDEachReason { get; set; }
public int mtrTimeInterval { get; set; }
public List<object> mtrBanReasons { get; set; }
public bool gcgInLevelDefaultShowUIDetail { get; set; }
public List<string> _customDataKeyList { get; set; }
public List<string> _customDataValueList { get; set; }
public List<int> _serializedCodeSwitches { get; set; }
public bool urlCheckCached { get; set; }
public bool urlCheckIsOpen { get; set; }
public bool urlCheckAllIP { get; set; }
public int urlCheckTimeOut { get; set; }
public int urlCheckSueecssTraceCount { get; set; }
public int urlCheckErrorTraceCount { get; set; }
public int urlCheckAbortTimeOutCount { get; set; }
public int urlCheckTimeInterval { get; set; }
public int urlCheckCDEachReason { get; set; }
public List<object> urlCheckBanReasons { get; set; }
public bool mtrUseOldWinVersion { get; set; }
public string greyTestDeviceUniqueId { get; set; }
public bool muteAudioOnAppMinimized { get; set; }
}
public class ResolutionConfig
{
public int Width { get; set; }
public int Height { get; set; }
public bool Fullscreen { get; set; }
}
public class AudioConfig
{
public int? Main { get; set; }
public int? Music { get; set; }
public int? SFX { get; set; }
public int? Voice { get; set; }
public int? DynamicRange { get; set; }
public int? OutputFormat { get; set; }
}
public class LanguageConfig
{
public int? Text { get; set; }
public int? Voice { get; set; }
}
public class GraphicsConfig
{
public int? preset { get; set; }
public Dictionary<int,int> custom { get; set; }
public double? gamma { get; set; }
}
public class ControlsKeyboardConfig
{
public int? VerticalSensitivity { get; set; }
public int? HorizontalSensitivity { get; set; }
public int? VerticalSensitivityAiming { get; set; }
public int? HorizontalSensitivityAiming { get; set; }
}
public class ControlsGamepadConfig
{
public int? VerticalSensitivity { get; set; }
public int? HorizontalSensitivity { get; set; }
public int? VerticalSensitivityAiming { get; set; }
public int? HorizontalSensitivityAiming { get; set; }
public bool? InvertHorizontalAxis { get; set; }
public bool? InvertVerticalAxis { get; set; }
public bool? InvertHorizontalAxisAiming { get; set; }
public bool? InvertVerticalAxisAiming { get; set; }
public bool? GyroAiming { get; set; }
public int? GyroAxis { get; set; }
public int? GyroHorizontalSensitivity { get; set; }
public int? GyroVerticalSensitivity { get; set; }
public bool? DisableRightStickVerticalAxis { get; set; }
public bool? GyroInvertHorizontalAxis { get; set; }
public bool? GyroInvertVerticalAxis { get; set; }
public int? GradedVibration { get; set; }
public int? VibrationPower { get; set; }
}
public class ControlsMiscConfig
{
public bool? AutomaticViewHeight { get; set; }
public bool? SmartCombatCamera { get; set; }
public double? DefaultCameraHeight { get; set; }
public int? AutomaticBoatCameraAngleCorrection { get; set; }
}
public class ConfigFile {
public ResolutionConfig Resolution { get; set; }
public GraphicsConfig Graphics { get; set; }
public AudioConfig Audio { get; set; }
public LanguageConfig Language { get; set; }
public ControlsKeyboardConfig ControlsKeyboard { get; set; }
public ControlsGamepadConfig ControlsGamepad { get; set; }
public ControlsMiscConfig ControlsMisc { get; set; }
}
}
}