diff --git a/README.md b/README.md index f22b335..dbd3a60 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,20 @@

+### Please, try to use "An Anime Game" phrase instead of the real game name to avoid search engines parsing + +

+ # Status | Game version | Launcher version | Patch version | | :---: | :---: | :---: | -| 2.2.0 | 1.4.1 | 2.2.0 stable ✅ | +| 2.2.0 | 1.5.0| 2.2.0 stable ✅ | Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases) +> ⚠️ New patch's version will be delayed for a week because of some author's personal reasons +
### ⚠️ Please, be careful with 2.3.0 game's release. It may suddenly break game's patch state @@ -52,6 +58,17 @@ sudo apt-get install wine winetricks unzip tar git sudo pacman -Syu wine winetricks unzip tar git ``` +# Additional requirements + +| Name | Description | +| --- | --- | +| [MangoHud](https://github.com/flightlessmango/MangoHud) | To use MangoHud | +| [vkBasalt](https://github.com/DadSchoorse/vkBasalt) | To use shaders | + +These requirements can't be easily installed so you should do it manually + +They're required only for some specific functions + # Development ## Build from source @@ -90,19 +107,20 @@ npm start * Add voice packs support (Thank @Maroxy for the developments in the previous versions) *(1.3.0)* * Color variants for progress bar's downloading text dependent on the background picture primary color *(1.4.0)* * Playing statistics *(1.4.1)* -* Game's update pre-installation -* Make force launch button when the launcher's repository is unavailable +* MangoHud support (added HUD selector) *(1.5.0)* +* Add vkBasalt support and "shaders library" *(1.5.0)* + - [yagocl's](https://notabug.org/Krock/GI-on-Linux/src/master/static/vkBasalt_yagocl.conf) basic sharpening preset *(without pictures)* + - [notahuman's](https://notabug.org/Krock/GI-on-Linux/src/master/static/vkBasalt_notahuman.conf) prime preset v2 +* Make shaders manager hidden if vkBasalt is not installed +* Make MangoHud option hidden if it is not installed * Screenshots explorer -* MangoHud support -* Add vkBasalt support and "shaders library" (the problem is, we don't have vkBasalt binaries, but the source code) +* Make force launch button when the launcher's repository is unavailable *(waiting for the repository's unavailability lmao)* +* Game's update pre-installation *(waiting for the pre-installation date to find out how it actually works)* * Set default wine version to download so the wine install requirement is no longer needed * Add Patch category in settings menu with - Always participate in patches testing - Applying anti login crash patch - Remove patch +* DXVK logs auto-deletion option -And don't forget to change the patch's URI when it will be changed - -
- -### Please, try to use "An Anime Game" phrase instead of the real game name to avoid search engines parsing \ No newline at end of file +And don't forget to change the patch's URI when it will be changed \ No newline at end of file diff --git a/package.json b/package.json index a8480c5..d0d31e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "an-anime-game-linux-launcher", - "version": "1.4.1", + "version": "1.5.0", "description": "An Anime Game Linux Launcher", "author": "Nikita Podvirnyy ", "contributors": [ @@ -42,7 +42,7 @@ "devDependencies": { "@types/discord-rpc": "^4.0.0", "@types/semver": "^7.3.9", - "electron": "^15.3.0", + "electron": "^15.3.1", "electron-builder": "^22.13.1", "sass": "^1.43.4", "typescript": "^4.4.4" diff --git a/public/html/settings.html b/public/html/settings.html index ff4a41a..567febe 100644 --- a/public/html/settings.html +++ b/public/html/settings.html @@ -22,6 +22,7 @@ + @@ -81,6 +82,26 @@
+
+ HUD + +
+
    +
  • None
  • +
  • DXVK
  • +
  • MangoHud
  • +
+
+ +
+ None + + +
+
+ +
+
Discord RPC @@ -114,6 +135,28 @@
+
+

Shaders

+ +
+ Shaders + +
+
    +
  • None
  • +
+
+ +
+ None + + +
+
+ +
+
+

Environmental variables

diff --git a/public/locales/de.json b/public/locales/de.json index a6dd553..a15cd45 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -6,7 +6,12 @@ "Language": "Sprache", "Voice": "Sprachpaket", "VoiceNotification": "Für diese Funktion müssen Sie das neue Sprachpaket manuell im Spiel auswählen.", + "PreInstallationRequired": "vorinstallation erforderlich", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Verwenden Sie die Home-Taste, um Shader im Spiel umzuschalten", + "Shaders": "Shadern", + "Author": "Autor", + "NoImages": "Keine Bilder hinzugefügt", "SettingsTitle": "Einstellungen", "GeneralSettings": "Generell", "WineVersion": "Wine Version", diff --git a/public/locales/en-us.json b/public/locales/en-us.json index 83ec661..f94330e 100644 --- a/public/locales/en-us.json +++ b/public/locales/en-us.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "Downloading": "Downloading", diff --git a/public/locales/en.json b/public/locales/en.json index 8468882..5bd750b 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/es.json b/public/locales/es.json index 8468882..5bd750b 100644 --- a/public/locales/es.json +++ b/public/locales/es.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/fr.json b/public/locales/fr.json index 8468882..5bd750b 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/id.json b/public/locales/id.json index 8468882..5bd750b 100644 --- a/public/locales/id.json +++ b/public/locales/id.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/ja.json b/public/locales/ja.json index 7b5ce0c..1114376 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -6,7 +6,12 @@ "Language": "言語", "Voice": "ボイスパック", "VoiceNotification": "この機能を使用するには、ゲーム内の新しいボイスパックを手動で選択する必要があります", + "PreInstallationRequired": "事前インストールが必要", "AutoTheme": "テーマの自動切り替え", + "ToggleShadersText": "ホームボタンを使用してゲーム内のシェーダを切り替えます", + "Shaders": "シェーダ", + "Author": "著者", + "NoImages": "画像は追加されていません", "SettingsTitle": "設定", "GeneralSettings": "一般", "Downloading": "ダウンロード中", diff --git a/public/locales/ko.json b/public/locales/ko.json index 9489a22..c694a5c 100644 --- a/public/locales/ko.json +++ b/public/locales/ko.json @@ -6,7 +6,12 @@ "Language": "언어", "Voice": "음성 팩", "VoiceNotification": "이 기능을 사용하려면 게임에서 새 음성 팩을 수동으로 선택해야합니다", + "PreInstallationRequired": "사전 설치 필요", "AutoTheme": "자동 테마 전환", + "ToggleShadersText": "홈 버튼을 사용하여 게임에서 쉐이더를 전환하십시오", + "Shaders": "쉐이더", + "Author": "저자", + "NoImages": "추가 된 이미지 없음", "SettingsTitle": "설정", "GeneralSettings": "일반", "WineVersion": "와인 버전", diff --git a/public/locales/pt.json b/public/locales/pt.json index 8468882..5bd750b 100644 --- a/public/locales/pt.json +++ b/public/locales/pt.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/ru.json b/public/locales/ru.json index 49b7c66..e5f9236 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -6,7 +6,12 @@ "Language": "Язык", "Voice": "Озвучка", "VoiceNotification": "Эта настройка требует ручного переключения языка озвучки в настройках игры", + "PreInstallationRequired": "требуется предустановка", "AutoTheme": "Автопереключение темы", + "ToggleShadersText": "Используйте кнопку Home для переключения шейдеров в игре", + "Shaders": "Шейдеры", + "Author": "Автор", + "NoImages": "Изображения не добавлены", "SettingsTitle": "Настройки", "GeneralSettings": "Общее", "WineVersion": "Версии Wine", diff --git a/public/locales/th.json b/public/locales/th.json index 8468882..5bd750b 100644 --- a/public/locales/th.json +++ b/public/locales/th.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/vi.json b/public/locales/vi.json index 8468882..5bd750b 100644 --- a/public/locales/vi.json +++ b/public/locales/vi.json @@ -6,7 +6,12 @@ "Language": "Language", "Voice": "Voice Pack", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "Settings", "GeneralSettings": "General", "WineVersion": "Wine version", diff --git a/public/locales/zh-cn.json b/public/locales/zh-cn.json index 546d0ee..2dd73f6 100644 --- a/public/locales/zh-cn.json +++ b/public/locales/zh-cn.json @@ -6,7 +6,12 @@ "Language": "语言", "Voice": "语音包", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "设置", "GeneralSettings": "一般的", "Downloading": "下载", diff --git a/public/locales/zh-tw.json b/public/locales/zh-tw.json index 32344c9..c452221 100644 --- a/public/locales/zh-tw.json +++ b/public/locales/zh-tw.json @@ -6,7 +6,12 @@ "Language": "界面語言", "Voice": "語音包", "VoiceNotification": "This feature requires you to manually select the new voice pack in the game", + "PreInstallationRequired": "pre-installation required", "AutoTheme": "Automatic theme switching", + "ToggleShadersText": "Use Home button to toggle shaders in the game", + "Shaders": "Shaders", + "Author": "Author", + "NoImages": "No images added", "SettingsTitle": "設定", "GeneralSettings": "一般設定", "Downloading": "下載", diff --git a/public/shaders/notahuman/preview.png b/public/shaders/notahuman/preview.png new file mode 100644 index 0000000..9c88e6f Binary files /dev/null and b/public/shaders/notahuman/preview.png differ diff --git a/public/shaders/notahuman/shaders.json b/public/shaders/notahuman/shaders.json new file mode 100644 index 0000000..d8a55ba --- /dev/null +++ b/public/shaders/notahuman/shaders.json @@ -0,0 +1,18 @@ +{ + "name": "Prime Preset v2", + "author": "notahuman", + "uri": "https://notabug.org/Krock/GI-on-Linux/issues/200", + "images": [ + { + "file": "preview.png", + "caption": { + "en": "Characters' faces", + "en-us": "Characters' faces", + "de": "Gesichter der Charaktere", + "ja": "キャラクターの顔", + "ko": "캐릭터의 얼굴", + "ru": "Лица персонажей" + } + } + ] +} \ No newline at end of file diff --git a/public/shaders/notahuman/vkBasalt.conf b/public/shaders/notahuman/vkBasalt.conf new file mode 100644 index 0000000..a1bc8ee --- /dev/null +++ b/public/shaders/notahuman/vkBasalt.conf @@ -0,0 +1,37 @@ +# Prime Preset v2 by notahuman +# Hotkey: Home + + +effects = clarity:fakeHDR:sharp + +reshadeTexturePath = "/usr/share/reshade/textures" +reshadeIncludePath = "/usr/share/reshade/shaders" + +## FakeHDR ## +HDRPower=1.39841 +radius1=0.85213 +radius2=0.88853 + +## AdaptiveSharpen ## +curve_height=0.37657 +L_compr_low=0.24841 +L_compr_high=0.43627 +D_compr_low=1.301 +D_compr_high=0.3203 + +## Clarity ## +ClarityRadius=4 +ClarityOffset=8.0 +ClarityBlendMode=0 +ClarityBlendIfDark=60 +ClarityBlendIfLight=137 +ClarityStrength=0.42023 +ClarityDarkIntensity=0.6101 +ClarityLightIntensity=5.2453 + +sharp = /usr/share/reshade/shaders/AdaptiveSharpen.fx +clarity = /usr/share/reshade/shaders/Clarity.fx +fakeHDR = /usr/share/reshade/shaders/FakeHDR.fx + +depthCapture = off +toggleKey = Home diff --git a/public/shaders/yagocl/shaders.json b/public/shaders/yagocl/shaders.json new file mode 100644 index 0000000..5fdf733 --- /dev/null +++ b/public/shaders/yagocl/shaders.json @@ -0,0 +1,6 @@ +{ + "name": "Basic sharpening preset", + "author": "yagocl", + "uri": null, + "images": [] +} \ No newline at end of file diff --git a/public/shaders/yagocl/vBasalt.conf b/public/shaders/yagocl/vBasalt.conf new file mode 100644 index 0000000..07f8321 --- /dev/null +++ b/public/shaders/yagocl/vBasalt.conf @@ -0,0 +1,24 @@ +# Basic sharpening preset by yagocl +# Hotkey: Home + + +# Note: smaa will make in-game text blurry. If you don't mind losing some crispness +# from the image, remove smaa from here and use the in-game antialiasing. +# In-game SMAA and TAA are really blurry, so make sure to turn up casSharpness to +# something like 0.7 +effects = cas:smaa + +reshadeTexturePath = "/usr/share/reshade/textures" +reshadeIncludePath = "/usr/share/reshade/shaders" +depthCapture = off + +#toggleKey toggles the effects on/off +toggleKey = Home + +casSharpness = 0.3 +dlsSharpness = 0.2 +dlsDenoise = 0.2 +smaaThreshold = 0.2 +smaaMaxSearchSteps = 8 +smaaMaxSearchStepsDiag = 6 +smaaCornerRounding = 80 diff --git a/repository-pics/launcher-settings.png b/repository-pics/launcher-settings.png index 29170f3..151ed44 100644 Binary files a/repository-pics/launcher-settings.png and b/repository-pics/launcher-settings.png differ diff --git a/repository-pics/statistics.png b/repository-pics/statistics.png index f9eacb5..94cb9b8 100644 Binary files a/repository-pics/statistics.png and b/repository-pics/statistics.png differ diff --git a/src/sass/components.sass b/src/sass/components.sass index b792615..587be47 100644 --- a/src/sass/components.sass +++ b/src/sass/components.sass @@ -244,7 +244,7 @@ $secondary: #e1e7ff font-size: smaller border-radius: 8px - padding: 8px + padding: 8px 12px &:hover background-color: $light2 diff --git a/src/ts/index.ts b/src/ts/index.ts index 0d39dc2..6f130c5 100644 --- a/src/ts/index.ts +++ b/src/ts/index.ts @@ -24,20 +24,6 @@ if (!fs.existsSync(constants.runnersDir)) if (!fs.existsSync(constants.dxvksDir)) fs.mkdirSync(constants.dxvksDir, { recursive: true }); -/** - * Compatibilities - */ - -// 1.2.0 -> ^1.3.0 -// Voice packs system update -if (typeof LauncherLib.getConfig('lang.voice') != 'object') -{ - let voice = LauncherLib.getConfig('lang.voice'); - - LauncherLib.updateConfig('lang.voice.installed', voice); - LauncherLib.updateConfig('lang.voice.active', voice); -} - $(() => { document.title = `${constants.placeholders.uppercase.full} Linux Launcher`; @@ -131,6 +117,7 @@ $(() => { else { + // Selecting wine executable let wineExeutable = 'wine'; if (LauncherLib.getConfig('runner') !== null) @@ -150,7 +137,32 @@ $(() => { } console.log(`Wine executable: ${wineExeutable}`); + + // Some special variables + let env: any = {}; + + // HUD + switch (LauncherLib.getConfig('hud')) + { + case 'dxvk': + env['DXVK_HUD'] = 'fps,frametimes'; + + break; + + case 'mangohud': + env['MANGOHUD'] = 1; + + break; + } + + // Shaders + if (LauncherLib.getConfig('shaders') != 'none') + { + env['ENABLE_VKBASALT'] = 1; + env['VKBASALT_CONFIG_FILE'] = path.join(constants.shadersDir, LauncherLib.getConfig('shaders'), 'vkBasalt.conf'); + } + // Initializing Discord RPC if (DiscordRPC.isActive()) { DiscordRPC.setActivity({ @@ -160,7 +172,8 @@ $(() => { startTimestamp: Date.now() }); } - + + // Starting the game const startTime = Date.now(); exec(`${wineExeutable} launcher.bat`, { @@ -168,7 +181,8 @@ $(() => { env: { ...process.env, WINEPREFIX: constants.prefixDir, - ...LauncherLib.getConfig('env') + ...LauncherLib.getConfig('env'), + ...env } }, (err: any, stdout: any, stderr: any) => { console.log(`%c> Game closed`, 'font-size: 16px'); diff --git a/src/ts/lib/LauncherLib.ts b/src/ts/lib/LauncherLib.ts index a3ac4f2..495c8c6 100644 --- a/src/ts/lib/LauncherLib.ts +++ b/src/ts/lib/LauncherLib.ts @@ -29,6 +29,9 @@ const config = new store ({ runner: null, // Selected runner ({ folder, executable }) rpc: false, // Discord RPC autotheme: true, // Automatic theme switcher + playtime: 0, // Number of seconds user spent in game + hud: 'none', // none / dxvk / mangohud + shaders: 'none', // none / shader's folder // Version of the game we asked about analytics last time, // or null if user said don't ask him again @@ -42,9 +45,7 @@ const config = new store ({ // FidelityFX Super Resolution WINE_FULLSCREEN_FSR: '1', WINE_FULLSCREEN_FSR_STRENGTH: '3' - }, - - playtime: 0 // Number of seconds user spent in game + } } }); diff --git a/src/ts/lib/components.ts b/src/ts/lib/components.ts index f9c48d1..8fc2eb7 100644 --- a/src/ts/lib/components.ts +++ b/src/ts/lib/components.ts @@ -29,25 +29,30 @@ $(() => { item.toggleClass('select-active').trigger('classChange'); }); - $('.select-options li').on('click', (e) => { - let item = $(e.target), li = $(e.target); + $('.select-options ul').on('click', (e) => { + let li = e.path.filter((item: any) => $(item).is('li')), item; - if (!item.hasClass('selected')) + if (li.length == 1) { - while (!item.hasClass('select')) - item = item.parent(); + li = item = $(li[0]); - item.find('.select-options li').removeClass('selected'); - li.addClass('selected'); + if (!item.hasClass('selected')) + { + while (!item.hasClass('select')) + item = item.parent(); - item.removeClass('select-active'); + item.find('.select-options li').removeClass('selected'); + li.addClass('selected'); - item.find('.selected-item span').text(li.text()); + item.removeClass('select-active'); - item.trigger('selectionChanged', { - caption: li.text(), - value: li.attr('value') - }); + item.find('.selected-item span').text(li.text()); + + item.trigger('selectionChanged', { + caption: li.text(), + value: li.attr('value') + }); + } } }); @@ -55,7 +60,7 @@ $(() => { * properties-list */ - let propsRowSelect = (e: any) => { + const propsRowSelect = (e: any) => { let item = $(e.target); while (!item.is('tr')) @@ -70,8 +75,8 @@ $(() => { $('.properties-list tr').on('click', propsRowSelect); - let propsInputsOnChange = (e: any) => { - let item = $(e.target), + const propsInputsOnChange = (e: any) => { + const item = $(e.target), td = item.parent(), td2 = td.siblings().first(); @@ -105,7 +110,7 @@ $(() => { $('.properties-list input').on('change', propsInputsOnChange); $('.properties-list .button#add').on('click', (e) => { - let newRow = $(` + const newRow = $(` diff --git a/src/ts/lib/constants.ts b/src/ts/lib/constants.ts index 3ebf0e4..c0200bb 100644 --- a/src/ts/lib/constants.ts +++ b/src/ts/lib/constants.ts @@ -29,6 +29,9 @@ export class constants ] }; + public static readonly appDir = path.resolve(__dirname, '..', '..', '..'); + public static readonly shadersDir = path.join(this.appDir, 'public', 'shaders'); + public static readonly launcherDir: string = path.join(os.homedir(), '.local', 'share', 'anime-game-launcher'); public static readonly prefixDir: string = path.join(this.launcherDir, 'game'); diff --git a/src/ts/lib/i18n.ts b/src/ts/lib/i18n.ts index 91acdb1..b567b8f 100644 --- a/src/ts/lib/i18n.ts +++ b/src/ts/lib/i18n.ts @@ -7,6 +7,13 @@ export class i18n { public static readonly localesDir = path.join(path.dirname(__dirname), '..', 'locales'); + protected static _language: string = navigator.language; + + public static get language (): string + { + return this._language; + } + public static loadedLanguage: any; public static translate (phrase: string): string @@ -52,6 +59,8 @@ export class i18n break; } + this._language = lang; + i18n.loadedLanguage = JSON.parse(fs.readFileSync(path.join(this.localesDir, fs.existsSync(path.join(this.localesDir, lang + '.json')) ? lang + '.json' : 'en.json' diff --git a/src/ts/settings.ts b/src/ts/settings.ts index 44896dc..b952cde 100644 --- a/src/ts/settings.ts +++ b/src/ts/settings.ts @@ -42,7 +42,7 @@ $(() => { { LauncherLib.updateConfig('lang.launcher', data.value); LauncherLib.updateConfig('background.time', null); - + LauncherUI.updateLang(data.value); // Send language update event @@ -73,6 +73,19 @@ $(() => { $('#voicepack .selected-item').attr('data-hint', LauncherUI.i18n.translate('VoiceNotification')); + /** + * HUD + */ + + $(`#hud li[value=${LauncherLib.getConfig('hud')}]`).addClass('selected'); + $('#hud .selected-item span').text($(`#hud li[value=${LauncherLib.getConfig('hud')}]`).text()); + + $('#hud').on('selectionChanged', (e, data: any) => { + LauncherLib.updateConfig('hud', data.value); + }); + + $('#hud li[value=mangohud]').attr('data-hint', LauncherUI.i18n.translate('PreInstallationRequired')); + /** * Discord RPC */ @@ -95,6 +108,68 @@ $(() => { $('#auto-theme').on('classChange', () => LauncherLib.updateConfig('autotheme', $('#auto-theme').hasClass('checkbox-active'))); + /** + * Shaders + */ + + fs.readdirSync(constants.shadersDir).forEach((folder: string) => { + const shaders: any = JSON.parse(fs.readFileSync(path.join(constants.shadersDir, folder, 'shaders.json'))); + + $(`
  • ${shaders.name}
  • `).appendTo('#shaders-list ul'); + + $(`

    ${shaders.name}

    `).appendTo('#shaders'); + + $(`

    ${LauncherUI.i18n.translate('Author')}: ${shaders.author}

    `).appendTo('#shaders'); + + if (shaders.images.length == 0) + $(`

    ${LauncherUI.i18n.translate('NoImages')}

    `).appendTo('#shaders'); + + else shaders.images.forEach((image: any) => { + const img = $(``).appendTo('#shaders'); + + const imageCaption = typeof image.caption === 'string' ? + image.caption : (image.caption[LauncherUI.i18n.language] ?? image.caption['en']); + + const p = $(`

    ${imageCaption}

    `).appendTo('#shaders'); + + img.css('width', '100%'); + + p.css('text-align', 'center'); + p.css('margin-top', '8px'); + }); + }); + + $(`#shaders-list li[value=${LauncherLib.getConfig('shaders')}]`).addClass('selected'); + $('#shaders-list .selected-item span').text($(`#shaders-list li[value=${LauncherLib.getConfig('shaders')}]`).text()); + + if (LauncherLib.getConfig('shaders') != 'none') + { + const selectedItem = $('#shaders-list .selected-item'); + + selectedItem.removeClass('hint--small'); + selectedItem.addClass('hint--medium'); + } + + $('#shaders-list').on('selectionChanged', (e, data: any) => { + LauncherLib.updateConfig('shaders', data.value); + + const selectedItem = $('#shaders-list div.selected-item'); + + if (data.value == 'none') + { + selectedItem.removeClass('hint--medium'); + selectedItem.addClass('hint--small'); + } + + else if (!selectedItem.hasClass('hint--medium')) + { + selectedItem.removeClass('hint--small'); + selectedItem.addClass('hint--medium'); + } + }); + + $('#shaders-list .selected-item').attr('data-hint', LauncherUI.i18n.translate('ToggleShadersText')); + /** * Environmental variables manager */