- added HUD option with DXVK HUD and MangoHud support
- added shaders manager based on vkBasalt
- updated readme
  + added patch's update delation notification
  + game's name replacement request moved to the top of the repository
    because readme became too large
  + added additional requirements table
  + updated goals
- updated statistics
- added additional horizontal padding for selectable options
- removed old config file compatibilities checks
- now selectable options can be dynamically extended
- some let variables changed to const
- added constants.appDir / chadersDir properties
- added i18n.language property
- updated electron version to 15.3.1
This commit is contained in:
Observer KRypt0n_ 2021-11-12 22:29:31 +02:00
parent 84d5eca4a5
commit d8f2531ee8
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
31 changed files with 373 additions and 50 deletions

View file

@ -6,14 +6,20 @@
<br><br>
### Please, try to use "An Anime Game" phrase instead of the real game name to avoid search engines parsing
<br><br>
# 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
<br>
### ⚠️ 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
* <s>Add voice packs support</s> (Thank @Maroxy for the developments in the previous versions) *(1.3.0)*
* <s>Color variants for progress bar's downloading text dependent on the background picture primary color</s> *(1.4.0)*
* <s>Playing statistics</s> *(1.4.1)*
* Game's update pre-installation
* Make force launch button when the launcher's repository is unavailable
* <s>MangoHud support</s> (added HUD selector) *(1.5.0)*
* <s>Add vkBasalt support and "shaders library"</s> *(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
<br>
### Please, try to use "An Anime Game" phrase instead of the real game name to avoid search engines parsing
And don't forget to change the patch's URI when it will be changed

View file

@ -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 <suimin.tu.mu.ga.mi@gmail.com>",
"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"

View file

@ -22,6 +22,7 @@
<div class="menu-item menu-item-active" anchor="general" i18id="GeneralSettings">General</div>
<div class="menu-item" anchor="runners" i18id="WineVersion">Wine version</div>
<div class="menu-item" anchor="dxvks" i18id="DXVK">DXVK</div>
<div class="menu-item" anchor="shaders" i18id="Shaders">Shaders</div>
<div class="menu-item" anchor="environment" i18id="Environment">Environment</div>
<div class="menu-item" anchor="statistics" i18id="Statistics">Statistics</div>
</div>
@ -81,6 +82,26 @@
<br>
<div class="select" id="hud">
<span>HUD</span>
<div class="select-options">
<ul>
<li value="none">None</li>
<li value="dxvk">DXVK</li>
<li value="mangohud" class="hint--top hint--small">MangoHud</li>
</ul>
</div>
<div class="selected-item">
<span>None</span>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 330.002 330.002" xml:space="preserve"><path id="XMLID_226_" d="M233.252,155.997L120.752,6.001c-4.972-6.628-14.372-7.97-21-3c-6.628,4.971-7.971,14.373-3,21 l105.75,140.997L96.752,306.001c-4.971,6.627-3.627,16.03,3,21c2.698,2.024,5.856,3.001,8.988,3.001 c4.561,0,9.065-2.072,12.012-6.001l112.5-150.004C237.252,168.664,237.252,161.33,233.252,155.997z"/></svg>
</div>
</div>
<br>
<div class="checkbox" id="discord-rpc">
Discord RPC
@ -114,6 +135,28 @@
<div class="list" id="dxvk-list"></div>
</div>
<div class="settings-item" id="shaders">
<h2 i18id="Shaders">Shaders</h2>
<div class="select" id="shaders-list">
<span i18id="Shaders">Shaders</span>
<div class="select-options">
<ul>
<li value="none">None</li>
</ul>
</div>
<div class="selected-item hint--top hint--small">
<span>None</span>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 330.002 330.002" xml:space="preserve"><path id="XMLID_226_" d="M233.252,155.997L120.752,6.001c-4.972-6.628-14.372-7.97-21-3c-6.628,4.971-7.971,14.373-3,21 l105.75,140.997L96.752,306.001c-4.971,6.627-3.627,16.03,3,21c2.698,2.024,5.856,3.001,8.988,3.001 c4.561,0,9.065-2.072,12.012-6.001l112.5-150.004C237.252,168.664,237.252,161.33,233.252,155.997z"/></svg>
</div>
</div>
<br>
</div>
<div class="settings-item" id="environment">
<h2 i18id="EnvironmentalVariables">Environmental variables</h2>

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -6,7 +6,12 @@
"Language": "言語",
"Voice": "ボイスパック",
"VoiceNotification": "この機能を使用するには、ゲーム内の新しいボイスパックを手動で選択する必要があります",
"PreInstallationRequired": "事前インストールが必要",
"AutoTheme": "テーマの自動切り替え",
"ToggleShadersText": "ホームボタンを使用してゲーム内のシェーダを切り替えます",
"Shaders": "シェーダ",
"Author": "著者",
"NoImages": "画像は追加されていません",
"SettingsTitle": "設定",
"GeneralSettings": "一般",
"Downloading": "ダウンロード中",

View file

@ -6,7 +6,12 @@
"Language": "언어",
"Voice": "음성 팩",
"VoiceNotification": "이 기능을 사용하려면 게임에서 새 음성 팩을 수동으로 선택해야합니다",
"PreInstallationRequired": "사전 설치 필요",
"AutoTheme": "자동 테마 전환",
"ToggleShadersText": "홈 버튼을 사용하여 게임에서 쉐이더를 전환하십시오",
"Shaders": "쉐이더",
"Author": "저자",
"NoImages": "추가 된 이미지 없음",
"SettingsTitle": "설정",
"GeneralSettings": "일반",
"WineVersion": "와인 버전",

View file

@ -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",

View file

@ -6,7 +6,12 @@
"Language": "Язык",
"Voice": "Озвучка",
"VoiceNotification": "Эта настройка требует ручного переключения языка озвучки в настройках игры",
"PreInstallationRequired": "требуется предустановка",
"AutoTheme": "Автопереключение темы",
"ToggleShadersText": "Используйте кнопку Home для переключения шейдеров в игре",
"Shaders": "Шейдеры",
"Author": "Автор",
"NoImages": "Изображения не добавлены",
"SettingsTitle": "Настройки",
"GeneralSettings": "Общее",
"WineVersion": "Версии Wine",

View file

@ -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",

View file

@ -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",

View file

@ -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": "下载",

View file

@ -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": "下載",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

View file

@ -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": "Лица персонажей"
}
}
]
}

View file

@ -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

View file

@ -0,0 +1,6 @@
{
"name": "Basic sharpening preset",
"author": "yagocl",
"uri": null,
"images": []
}

View file

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -244,7 +244,7 @@ $secondary: #e1e7ff
font-size: smaller
border-radius: 8px
padding: 8px
padding: 8px 12px
&:hover
background-color: $light2

View file

@ -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');

View file

@ -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
}
}
});

View file

@ -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 = $(`<tr>
const newRow = $(`<tr>
<td>
<span></span>
<input>

View file

@ -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');

View file

@ -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'

View file

@ -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')));
$(`<li value="${folder}">${shaders.name}</li>`).appendTo('#shaders-list ul');
$(`<h3>${shaders.name}</h3>`).appendTo('#shaders');
$(`<p>${LauncherUI.i18n.translate('Author')}: ${shaders.author}</p>`).appendTo('#shaders');
if (shaders.images.length == 0)
$(`<p>${LauncherUI.i18n.translate('NoImages')}</p>`).appendTo('#shaders');
else shaders.images.forEach((image: any) => {
const img = $(`<img src="${ path.join(constants.shadersDir, folder, image.file) }">`).appendTo('#shaders');
const imageCaption = typeof image.caption === 'string' ?
image.caption : (image.caption[LauncherUI.i18n.language] ?? image.caption['en']);
const p = $(`<p>${imageCaption}</p>`).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
*/