diff --git a/assets/launcher-ui/src/assets/gitadora.webm b/assets/launcher-ui/src/assets/gitadora.webm new file mode 100644 index 0000000..8edf9fc Binary files /dev/null and b/assets/launcher-ui/src/assets/gitadora.webm differ diff --git a/assets/launcher-ui/src/modules/gitadora.ts b/assets/launcher-ui/src/modules/gitadora.ts new file mode 100644 index 0000000..572c3f0 --- /dev/null +++ b/assets/launcher-ui/src/modules/gitadora.ts @@ -0,0 +1,110 @@ +import { ref, type Ref } from "vue"; +import { launcher } from "./launcher"; + +export interface GITADORAConfig { +} + +export class GITADORA { + private _config: Ref = ref(undefined); + private _dirty: boolean = false; + + get config() { + return this._config; + } + + installed() { + return !!window.laochan.ctx.gamePaths.value[2].length; + } + + get installPath() { + if (!this.installed()) { + return; + } + + const [installPath] = window.laochan.ctx.gamePaths.value[2]; + return installPath; + } + + get configPath() { + const installPath = this.installPath; + if (!installPath) { + return; + } + + return installPath + 'laochan-config.json'; + } + + async resetConfig() { + this._config.value = {} + this._dirty = true; + } + + async saveConfig() { + const path = this.configPath; + if (!path) { + return; + } + + const result = JSON.stringify(this._config.value); + await window.laochan.writeFile(path, result); + this._dirty = false; + } + + async loadConfig() { + const path = this.configPath; + if (!path) { + return; + } + + const configJson = await window.laochan.readFile(path); + + if (configJson) { + this._config.value = JSON.parse(configJson); + } + + if (!this._config.value) { + await this.resetConfig(); + } + + if (this._dirty) { + await this.saveConfig(); + } + } + + async applyConfig() { + const config = this._config.value; + if (!config) { + return; + } + } + + async start() { + await this.loadConfig(); + await window.laochan.setGame(2); + + await this.applyConfig(); + await launcher.applyConfig(); + + window.laochan.close(); + } + + async settings() { + const installPath = this.installPath; + if (!installPath) { + return; + } + + window.laochan.shellExecute(installPath + '\\launcher\\modules\\settings.exe'); + } + + async updater() { + const installPath = this.installPath; + if (!installPath) { + return; + } + + window.laochan.shellExecute(installPath + '\\launcher\\modules\\updater.exe', '-t DUMMY'); + } +}; + +export const gitadora = new GITADORA(); diff --git a/assets/launcher-ui/src/modules/sdvx.ts b/assets/launcher-ui/src/modules/sdvx.ts index 9d5c334..f935ab9 100644 --- a/assets/launcher-ui/src/modules/sdvx.ts +++ b/assets/launcher-ui/src/modules/sdvx.ts @@ -78,10 +78,6 @@ export class SDVX { } } - openCustomize() { - window.laochan.shellExecute('http://laochan.ugreen.sbs/cp'); - } - async start() { await this.loadConfig(); await window.laochan.setGame(1); diff --git a/assets/launcher-ui/src/views/HomeView.vue b/assets/launcher-ui/src/views/HomeView.vue index 504da58..b655350 100644 --- a/assets/launcher-ui/src/views/HomeView.vue +++ b/assets/launcher-ui/src/views/HomeView.vue @@ -1,6 +1,7 @@