diff --git a/AppApi.cs b/AppApi.cs index 64f97fe8..cec86e42 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -54,6 +54,25 @@ namespace VRCX return fileData.Length.ToString(); } + public string ReadConfigFile() + { + var logPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"Low\VRChat\VRChat\"; + var configFile = Path.Combine(logPath, @"config.json"); + if (!Directory.Exists(logPath) || !File.Exists(configFile)) + { + return ""; + } + var json = System.IO.File.ReadAllText(configFile); + return json; + } + + public void WriteConfigFile(string json) + { + var logPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"Low\VRChat\VRChat\"; + var configFile = Path.Combine(logPath, @"config.json"); + System.IO.File.WriteAllText(configFile, json); + } + public void ShowDevTools() { MainForm.Instance.Browser.ShowDevTools(); diff --git a/html/src/app.js b/html/src/app.js index 85e3fbfd..780ac5c0 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -10905,6 +10905,83 @@ speechSynthesis.getVoices(); this.userDialogLastActiveTab = obj.label; }; + // VRChat Config JSON + + $app.data.VRChatConfigFile = {}; + + $app.data.VRChatConfigList = { + cache_size: 'Max Cache Size in Gigabytes (minimum 20)', + cache_expiry_delay: 'Expire Cache in Days (minimum 30)', + dynamic_bone_max_affected_transform_count: 'Dynamic Bones Limit Max Transforms (0 disables all components)', + dynamic_bone_max_collider_check_count: 'Dynamic Bones Limit Max Collider Collisions (0 disables all components)' + }; + + $app.methods.ReadVRChatConfigFile = async function () { + this.VRChatConfigFile = {}; + var config = await AppApi.ReadConfigFile(); + if (config) { + this.VRChatConfigFile = JSON.parse(config); + } + }; + + $app.methods.WriteVRChatConfigFile = async function () { + var json = JSON.stringify(this.VRChatConfigFile, null, "\t"); + AppApi.WriteConfigFile(json); + }; + + + $app.data.VRChatConfigDialog = { + visible: false, + cameraRes: false, + screenshotRes: false + }; + + API.$on('LOGOUT', function () { + $app.VRChatConfigDialog.visible = false; + }); + + $app.methods.showVRChatConfig = async function () { + await this.ReadVRChatConfigFile(); + this.$nextTick(() => adjustDialogZ(this.$refs.VRChatConfigDialog.$el)); + this.VRChatConfigDialog = { + cameraRes: false, + screenshotRes: false, + visible: true + } + if ((this.VRChatConfigFile.camera_res_height === 2160) && + (this.VRChatConfigFile.camera_res_width === 3840)) { + this.VRChatConfigDialog.cameraRes = true; + } + if ((this.VRChatConfigFile.screenshot_res_height === 2160) && + (this.VRChatConfigFile.screenshot_res_width === 3840)) { + this.VRChatConfigDialog.screenshotRes = true; + } + }; + + $app.methods.SaveVRChatConfigFile = function () { + if (this.VRChatConfigDialog.cameraRes) { + this.VRChatConfigFile.camera_res_height = 2160; + this.VRChatConfigFile.camera_res_width = 3840; + } else { + delete this.VRChatConfigFile.camera_res_height; + delete this.VRChatConfigFile.camera_res_width; + } + if (this.VRChatConfigDialog.screenshotRes) { + this.VRChatConfigFile.screenshot_res_height = 2160; + this.VRChatConfigFile.screenshot_res_width = 3840; + } else { + delete this.VRChatConfigFile.screenshot_res_height; + delete this.VRChatConfigFile.screenshot_res_width; + } + for (var item in this.VRChatConfigFile) { + if (!this.VRChatConfigFile[item]) { + delete this.VRChatConfigFile[item]; + } + } + this.VRChatConfigDialog.visible = false; + this.WriteVRChatConfigFile(); + }; + $app = new Vue($app); window.$app = $app; }()); diff --git a/html/src/index.pug b/html/src/index.pug index e50787f6..140218a0 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -866,6 +866,7 @@ html div.options-container-item el-button-group el-button(size="small" icon="el-icon-s-operation" @click="showLaunchOptions()") Launch Options + el-button(size="small" icon="el-icon-s-operation" @click="showVRChatConfig()") VRChat config.json div.options-container(style="margin-top:45px;border-top:1px solid #eee;padding-top:30px") span.header Legal Notice div.options-container-item @@ -1465,6 +1466,24 @@ html el-button(size="small" @click="openExternalLink('https://docs.vrchat.com/docs/launch-options')") VRChat Docs el-button(size="small" @click="openExternalLink('https://docs.unity3d.com/Manual/CommandLineArguments.html')") Unity Manual el-button(type="primary" size="small" :disabled="launchOptionsDialog.loading" @click="updateLaunchOptions" style="margin-left:auto") OK + + //- dialog: VRChat Config JSON + el-dialog.x-dialog(ref="VRChatConfigDialog" :visible.sync="VRChatConfigDialog.visible" title="VRChat Config JSON" width="420px") + div(style='font-size:12px;') + | These options are for advanced users only. #[br] + | Leave field empty to set as default. + br + div(style="display:inline-block" v-for="(name, value) in VRChatConfigList" :key="value") + span(v-text="name" style="word-break:keep-all") + |: + el-input(v-model="VRChatConfigFile[value]" size="mini" style="margin-top:10px") + el-checkbox(v-model="VRChatConfigFile.disableRichPresence" style="margin-top:5px;display:block") Disable Discord Rich Presence + el-checkbox(v-model="VRChatConfigDialog.cameraRes" style="margin-top:5px") 4K Camera + el-checkbox(v-model="VRChatConfigDialog.screenshotRes" style="margin-top:5px") 4K Screenshots + template(#footer) + el-button(size="small" @click="openExternalLink('https://docs.vrchat.com/docs/configuration-file')") VRChat Docs + el-button(size="small" @click="VRChatConfigDialog.visible = false") Cancel + el-button(type="primary" size="small" :disabled="VRChatConfigDialog.loading" @click="SaveVRChatConfigFile") Save //- dialog: launch el-dialog.x-dialog(ref="launchDialog" :visible.sync="launchDialog.visible" title="Launch" width="400px")