diff --git a/.gitmodules b/.gitmodules index 5fcd8a4..df2cd3d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "deps/ifs_layeredfs"] path = deps/ifs_layeredfs url = https://github.com/GEEKiDoS/ifs_layeredfs.git +[submodule "deps/zstd"] + path = deps/zstd + url = https://github.com/facebook/zstd.git diff --git a/assets/launcher-ui/bin/gen-asset b/assets/launcher-ui/bin/gen-asset index da3c423..f03da04 100644 --- a/assets/launcher-ui/bin/gen-asset +++ b/assets/launcher-ui/bin/gen-asset @@ -1,26 +1,49 @@ #!/usr/bin/env node import io from 'node:fs'; import mime from 'mime'; +import { compress } from '@mongodb-js/zstd'; -const assets = io.readdirSync('./dist', { - recursive: true, -}).filter(v => io.statSync('./dist/' + v).isFile()); +(async () => { + const assets = io.readdirSync('./dist', { + recursive: true, + }).filter(v => io.statSync('./dist/' + v).isFile()); -const rc = '// GENERATED BY npm build\r\n// DO NOT MODIFY\r\n\r\n#include "resource.hpp"\r\n\r\n' + assets - .map((v, i) => `ID_ASSET_${i}\tRCDATA\t"resources/ui-dist/${v.replaceAll('\\', '/')}"`) - .join('\r\n') + '\r\n'; + const isCompressed = {}; -io.writeFileSync('../../src/client/resource.g.rc', rc); -console.log(rc); + if (io.existsSync('../../src/client/resources/ui-dist/')) + io.rmSync('../../src/client/resources/ui-dist/', { recursive: true, force: true }); -const resource = '// GENERATED BY npm build\r\n// DO NOT MODIFY\r\n\r\n' + assets - .map((v, i) => `#define ID_ASSET_${i} ${350 + i}`) - .join('\r\n') + '\r\n'; + io.mkdirSync('../../src/client/resources/ui-dist/'); + io.mkdirSync('../../src/client/resources/ui-dist/assets'); -io.writeFileSync('../../src/client/resource.g.hpp', resource); -console.log(resource); + for (const v of assets) { + const buffer = io.readFileSync('./dist/' + v); + const compressed = await compress(buffer, 22); -const header = `// GENERATED BY npm build + if (compressed.length < buffer.length) { + isCompressed[v] = true; + io.writeFileSync('../../src/client/resources/ui-dist/' + v + '.zst', compressed) + } else { + isCompressed[v] = false; + io.writeFileSync('../../src/client/resources/ui-dist/' + v, buffer) + } + } + + const rc = '// GENERATED BY npm build\r\n// DO NOT MODIFY\r\n\r\n#include "resource.hpp"\r\n\r\n' + assets + .map((v, i) => isCompressed[v] ? `ID_ASSET_${i}\tRCDATA\t"resources/ui-dist/${v.replaceAll('\\', '/')}.zst"` : `ID_ASSET_${i}\tRCDATA\t"resources/ui-dist/${v.replaceAll('\\', '/')}"`) + .join('\r\n') + '\r\n'; + + io.writeFileSync('../../src/client/resource.g.rc', rc); + console.log(rc); + + const resource = '// GENERATED BY npm build\r\n// DO NOT MODIFY\r\n\r\n' + assets + .map((v, i) => `#define ID_ASSET_${i} ${350 + i}`) + .join('\r\n') + '\r\n'; + + io.writeFileSync('../../src/client/resource.g.hpp', resource); + console.log(resource); + + const header = `// GENERATED BY npm build // DO NOT MODIFY #pragma once @@ -31,6 +54,9 @@ const header = `// GENERATED BY npm build #define WIN32_LEAN_AND_MEAN #include +#include +#include + #include "resource.hpp" namespace laochan::embedded @@ -46,26 +72,37 @@ namespace laochan::embedded return std::span(reinterpret_cast(LockResource(handle)), SizeofResource(nullptr, res)); } + auto read_resource_zstd(const int id) + { + auto resource = read_resource(id); + + auto decompressed = utils::compression::zstd::decompress(std::string{ LPSTR(resource.data()), resource.size()}); + auto buf = utils::memory::allocate(decompressed.size()); + std::memcpy(buf, decompressed.data(), decompressed.size()); + + return std::span{ buf, decompressed.size() }; + } + inline auto all() { std::map rtn; ` + assets - .map((v, i) => { - const type = mime.getType(v); - const id = `ID_ASSET_${i}`; - const path = v.replaceAll('\\', '/'); - - if (v === "index.html") - return ` - auto root = read_resource(${id}); + .map((v, i) => { + const type = mime.getType(v); + const id = `ID_ASSET_${i}`; + const path = v.replaceAll('\\', '/'); + + if (v === "index.html") + return ` + auto root = read_resource${isCompressed[v] ? '_zstd' : ''}(${id}); rtn.emplace("${path}", saucer::embedded_file{"${type}", root}); rtn.emplace("", saucer::embedded_file{"${type}", root}); `; - else - return ` rtn.emplace("${path}", saucer::embedded_file{"${type}", read_resource(${id})});` - }) - .join('\r\n') + ` + else + return ` rtn.emplace("${path}", saucer::embedded_file{"${type}", read_resource${isCompressed[v] ? '_zstd' : ''}(${id})});` + }) + .join('\r\n') + ` return rtn; } @@ -73,15 +110,6 @@ namespace laochan::embedded ` -io.writeFileSync('../../src/client/resources/all.hpp', header); -console.log(header); - -if(io.existsSync('../../src/client/resources/ui-dist/')) - io.rmSync('../../src/client/resources/ui-dist/', { recursive: true, force: true }); - -io.mkdirSync('../../src/client/resources/ui-dist/'); -io.mkdirSync('../../src/client/resources/ui-dist/assets'); - -assets.forEach(v => { - io.copyFileSync('./dist/' + v, '../../src/client/resources/ui-dist/' + v); -}); + io.writeFileSync('../../src/client/resources/all.hpp', header); + console.log(header); +})(); diff --git a/assets/launcher-ui/package-lock.json b/assets/launcher-ui/package-lock.json index 5b7e576..7d11fb3 100644 --- a/assets/launcher-ui/package-lock.json +++ b/assets/launcher-ui/package-lock.json @@ -13,6 +13,7 @@ "@fortawesome/free-regular-svg-icons": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/vue-fontawesome": "^3.0.8", + "@mongodb-js/zstd": "^2.0.0", "@vueuse/sound": "^2.0.1", "dedent": "^1.5.3", "saucer-app": "^4.2.3", @@ -1182,6 +1183,19 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mongodb-js/zstd": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/@mongodb-js/zstd/-/zstd-2.0.0.tgz", + "integrity": "sha512-Tcx42XboNLDW9IBxyBxd+m1Wwk1Bdm33oLD5s1phQcmkg1eN0gDx7Z8uJUJjwz35kF2UNd/EsXXT0C7Ckm0Y6g==", + "hasInstallScript": true, + "dependencies": { + "node-addon-api": "^4.3.0", + "prebuild-install": "^7.1.2" + }, + "engines": { + "node": ">= 16.20.1" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2028,6 +2042,35 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -2083,6 +2126,29 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmmirror.com/callsites/-/callsites-3.1.0.tgz", @@ -2145,6 +2211,11 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmmirror.com/ci-info/-/ci-info-3.9.0.tgz", @@ -2355,6 +2426,20 @@ } } }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/dedent": { "version": "1.5.3", "resolved": "https://registry.npmmirror.com/dedent/-/dedent-1.5.3.tgz", @@ -2369,6 +2454,14 @@ } } }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmmirror.com/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmmirror.com/deep-is/-/deep-is-0.1.4.tgz", @@ -2376,6 +2469,14 @@ "license": "MIT", "peer": true }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "engines": { + "node": ">=8" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2395,6 +2496,14 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "license": "MIT" }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz", @@ -2822,6 +2931,14 @@ "url": "https://github.com/eta-dev/eta?sponsor=1" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "engines": { + "node": ">=6" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2975,6 +3092,11 @@ "license": "ISC", "peer": true }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, "node_modules/fs-extra": { "version": "11.2.0", "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-11.2.0.tgz", @@ -3014,6 +3136,11 @@ "node": ">=6.9.0" } }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmmirror.com/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz", @@ -3082,6 +3209,25 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmmirror.com/ignore/-/ignore-5.3.2.tgz", @@ -3138,6 +3284,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmmirror.com/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, "node_modules/ink": { "version": "4.4.1", "resolved": "https://registry.npmmirror.com/ink/-/ink-4.4.1.tgz", @@ -3569,6 +3725,17 @@ "node": ">=6" } }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.5.tgz", @@ -3584,6 +3751,19 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmmirror.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", @@ -3615,6 +3795,11 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmmirror.com/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3628,6 +3813,33 @@ "integrity": "sha512-POR1FACqdK9jH0S2kRPzaZEvzT11wsOxLW520PQV/+vKi9dQe+hXq19EiOvYx7lSRaF5VB9lYGsPInynrnN05w==", "license": "MIT" }, + "node_modules/node-abi": { + "version": "3.71.0", + "resolved": "https://registry.npmmirror.com/node-abi/-/node-abi-3.71.0.tgz", + "integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-4.3.0.tgz", + "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==" + }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.18.tgz", @@ -3684,6 +3896,14 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmmirror.com/onetime/-/onetime-5.1.2.tgz", @@ -3857,6 +4077,31 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/prebuild-install": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/prebuild-install/-/prebuild-install-7.1.2.tgz", + "integrity": "sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -3867,6 +4112,15 @@ "node": ">= 0.8.0" } }, + "node_modules/pump": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", @@ -3898,6 +4152,28 @@ "license": "MIT", "peer": true }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmmirror.com/react/-/react-18.3.1.tgz", @@ -3940,6 +4216,19 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "4.0.1", "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-4.0.1.tgz", @@ -4058,6 +4347,25 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/sass": { "version": "1.79.1", "resolved": "https://registry.npmmirror.com/sass/-/sass-1.79.1.tgz", @@ -4157,6 +4465,49 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "license": "ISC" }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/slice-ansi": { "version": "6.0.0", "resolved": "https://registry.npmmirror.com/slice-ansi/-/slice-ansi-6.0.0.tgz", @@ -4215,6 +4566,14 @@ "node": ">=8" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz", @@ -4304,6 +4663,32 @@ "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", "dev": true }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmmirror.com/text-table/-/text-table-0.2.0.tgz", @@ -4373,6 +4758,17 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "license": "0BSD" }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmmirror.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/type-check/-/type-check-0.4.0.tgz", @@ -4468,6 +4864,11 @@ "punycode": "^2.1.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/vite": { "version": "5.4.6", "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.6.tgz", @@ -4698,6 +5099,11 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, "node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz", diff --git a/assets/launcher-ui/package.json b/assets/launcher-ui/package.json index 7f61021..93adce4 100644 --- a/assets/launcher-ui/package.json +++ b/assets/launcher-ui/package.json @@ -17,6 +17,7 @@ "@fortawesome/free-regular-svg-icons": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/vue-fontawesome": "^3.0.8", + "@mongodb-js/zstd": "^2.0.0", "@vueuse/sound": "^2.0.1", "dedent": "^1.5.3", "saucer-app": "^4.2.3", diff --git a/assets/launcher-ui/src/assets/iidx.jpg b/assets/launcher-ui/src/assets/iidx.jpg index dad40a0..824825b 100644 Binary files a/assets/launcher-ui/src/assets/iidx.jpg and b/assets/launcher-ui/src/assets/iidx.jpg differ diff --git a/assets/launcher-ui/src/assets/moai-bg.jpg b/assets/launcher-ui/src/assets/moai-bg.jpg index f57f558..9c14d05 100644 Binary files a/assets/launcher-ui/src/assets/moai-bg.jpg and b/assets/launcher-ui/src/assets/moai-bg.jpg differ diff --git a/assets/launcher-ui/src/assets/msyhsb.woff2 b/assets/launcher-ui/src/assets/msyhsb.woff2 index 0e36ede..2fe1cc1 100644 Binary files a/assets/launcher-ui/src/assets/msyhsb.woff2 and b/assets/launcher-ui/src/assets/msyhsb.woff2 differ diff --git a/assets/launcher-ui/src/assets/num.jpg b/assets/launcher-ui/src/assets/num.jpg new file mode 100644 index 0000000..dd44898 Binary files /dev/null and b/assets/launcher-ui/src/assets/num.jpg differ diff --git a/assets/launcher-ui/src/assets/num.png b/assets/launcher-ui/src/assets/num.png deleted file mode 100644 index 0328881..0000000 Binary files a/assets/launcher-ui/src/assets/num.png and /dev/null differ diff --git a/assets/launcher-ui/src/assets/sdvx.jpg b/assets/launcher-ui/src/assets/sdvx.jpg index b38b2b7..17ea1bd 100644 Binary files a/assets/launcher-ui/src/assets/sdvx.jpg and b/assets/launcher-ui/src/assets/sdvx.jpg differ diff --git a/assets/launcher-ui/src/components/Num.vue b/assets/launcher-ui/src/components/Num.vue index 1bf9e9f..0871699 100644 --- a/assets/launcher-ui/src/components/Num.vue +++ b/assets/launcher-ui/src/components/Num.vue @@ -71,7 +71,7 @@ window.laochan.num = () => { } .num { - background-image: url(../assets/num.png); + background-image: url(../assets/num.jpg); width: 100%; height: 100%; opacity: 0; diff --git a/assets/launcher-ui/src/main.ts b/assets/launcher-ui/src/main.ts index a441de4..2b86030 100644 --- a/assets/launcher-ui/src/main.ts +++ b/assets/launcher-ui/src/main.ts @@ -87,15 +87,14 @@ window.laochan = { }; (async () => { - await launcher.loadConfig(); await iidx.loadConfig(); await sdvx.loadConfig(); - await iidx.UpdateMeta(); - await sdvx.UpdateMeta(); - await gitadora.UpdateMeta(); + await iidx.updateMeta(); + await sdvx.updateMeta(); + await gitadora.updateMeta(); })(); const app = createApp(App) app.use(router) -app.mount('#app') \ No newline at end of file +app.mount('#app') diff --git a/assets/launcher-ui/src/modules/gameClass.ts b/assets/launcher-ui/src/modules/gameClass.ts index 7f7ea95..01fdb65 100644 --- a/assets/launcher-ui/src/modules/gameClass.ts +++ b/assets/launcher-ui/src/modules/gameClass.ts @@ -1,7 +1,7 @@ import { ref, type Ref } from "vue"; -import { VersionState } from "./launcher"; +import { launcher, VersionState } from "./launcher"; -export class GameClass { +export abstract class GameClass { public meta: Ref = ref(undefined); public versionState: Ref = ref(VersionState.Unknown); @@ -9,8 +9,10 @@ export class GameClass { return this.meta.value?.installed ?? false; } + abstract get gameIndex(): number; + async updateMeta() { - this.meta.value = await window.laochan.detectGameInstall(0); + this.meta.value = await window.laochan.detectGameInstall(this.gameIndex); this.versionState.value = this.checkVersion(); } @@ -70,4 +72,17 @@ export class GameClass { window.laochan.shellExecute(this.meta.value!.updater_module_path); } + + abstract loadConfig(): Promise; + abstract applyConfig(): Promise; + + async start() { + await this.loadConfig(); + await window.laochan.setGame(this.gameIndex); + + await this.applyConfig(); + await launcher.applyConfig(); + + window.laochan.close(); + } } diff --git a/assets/launcher-ui/src/modules/gitadora.ts b/assets/launcher-ui/src/modules/gitadora.ts index 871c0de..f3e96bf 100644 --- a/assets/launcher-ui/src/modules/gitadora.ts +++ b/assets/launcher-ui/src/modules/gitadora.ts @@ -10,7 +10,11 @@ export interface GITADORAConfig { export class GITADORA extends GameClass { private _config: Ref = ref(undefined); private _dirty: boolean = false; - + + get gameIndex(): number { + return 2; + } + get config() { return this._config; } @@ -58,16 +62,6 @@ export class GITADORA extends GameClass { return; } } - - async start() { - await this.loadConfig(); - await window.laochan.setGame(2); - - await this.applyConfig(); - await launcher.applyConfig(); - - window.laochan.close(); - } }; export const gitadora = new GITADORA(); diff --git a/assets/launcher-ui/src/modules/iidx.ts b/assets/launcher-ui/src/modules/iidx.ts index ccdca5f..782667b 100644 --- a/assets/launcher-ui/src/modules/iidx.ts +++ b/assets/launcher-ui/src/modules/iidx.ts @@ -43,6 +43,10 @@ export class IIDX extends GameClass { private _config: Ref = ref(undefined); private _dirty: boolean = false; + get gameIndex(): number { + return 0; + } + get config() { return this._config; } @@ -127,16 +131,6 @@ export class IIDX extends GameClass { window.laochan.shellExecute('http://laochan.ugreen.sbs/cp'); } - async start() { - await this.loadConfig(); - await window.laochan.setGame(0); - - await this.applyConfig(); - await launcher.applyConfig(); - - window.laochan.close(); - } - async generateBat() { const config = this._config.value; if (!config) { diff --git a/assets/launcher-ui/src/modules/sdvx.ts b/assets/launcher-ui/src/modules/sdvx.ts index b2a9d38..f0ac6cf 100644 --- a/assets/launcher-ui/src/modules/sdvx.ts +++ b/assets/launcher-ui/src/modules/sdvx.ts @@ -9,6 +9,10 @@ export class SDVX extends GameClass { private _config: Ref = ref(undefined); private _dirty: boolean = false; + get gameIndex(): number { + return 1; + } + get config() { return this._config; } @@ -56,16 +60,6 @@ export class SDVX extends GameClass { return; } } - - async start() { - await this.loadConfig(); - await window.laochan.setGame(1); - - await this.applyConfig(); - await launcher.applyConfig(); - - window.laochan.close(); - } }; export const sdvx = new SDVX(); diff --git a/assets/launcher-ui/src/views/HomeView.vue b/assets/launcher-ui/src/views/HomeView.vue index 3b0dbb9..b3ac04d 100644 --- a/assets/launcher-ui/src/views/HomeView.vue +++ b/assets/launcher-ui/src/views/HomeView.vue @@ -8,49 +8,49 @@ import { VersionState } from "@/modules/launcher";