- added voicepacks support
- added LauncherUI.updateLauncherState method
  to automatically update launcher state
  it possibly can break clear game installation because I changed the way
  launcher identifies its state after some actions
- changed way the main button identifies what should it do
- now settings button hides when the launcher downloading something
- updated settings button icon
- updated background picture caching algorithm
This commit is contained in:
Observer KRypt0n_ 2021-11-04 16:09:41 +02:00
parent 3a08c91d3d
commit abf2297145
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
25 changed files with 259 additions and 146 deletions

View file

@ -10,7 +10,7 @@
| Game version | Launcher version | Patch version |
| :---: | :---: | :---: |
| 2.2.0 | 1.2.0 | 2.2.0 stable ✅ |
| 2.2.0 | 1.3.0 | 2.2.0 stable ✅ |
Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases)
@ -81,9 +81,9 @@ npm start
* <s>Add runners environmental variables manager</s> *(1.1.0)*
* <s>Add outdated files deletion when new game's update releases</s> *(1.1.0)*
* <s>Add installed packages deletion</s> *(1.2.0)*
* <s>Add voice packs support</s> (Thank @Maroxy for the developments in the previous versions) *(1.3.0)*
* Screenshots explorer
* Set default wine version to download so the wine install requirement is no longer needed.
* Add voice packs support
* Add Patch category in settings menu with
- Always participate in patches testing
- Applying anti login crash patch

View file

@ -113,9 +113,9 @@ app.whenReady().then(() => {
mainWindow.webContents.send('change-lang', { 'lang': args.lang });
});
/*ipcMain.on('updateVP', (event, args) => {
mainWindow.webContents.send('updateVP', { 'oldvp': args.oldvp });
});*/
ipcMain.on('change-voicepack', () => {
mainWindow.webContents.send('change-voicepack');
});
ipcMain.on('rpc-toggle', () => mainWindow.webContents.send('rpc-toggle'));
});

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-linux-launcher",
"version": "1.2.0",
"version": "1.3.0",
"description": "An Anime Game Linux Launcher",
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
"contributors": [

View file

@ -8,6 +8,7 @@
<!-- CSS styles -->
<link rel="stylesheet" href="../css/components.css">
<link rel="stylesheet" href="../css/settings.css">
<link rel="stylesheet" href="../css/hint.min.css">
<!-- JS scripts -->
<script>require('../js/lib/components.js');</script>
@ -28,17 +29,6 @@
<div class="settings-item" id="general">
<h2 i18id="GeneralSettings">General</h2>
<!--<h3 i18id="Voice">Voice Pack</h3>
<select class="dropdown-menu" id="voice-list" disabled>
<option value="en-us">English (US)</option>
<option value="zh-cn">汉语 (Chinese)</option>
<option value="ja-jp">日本語 (Japanese)</option>
<option value="ko-kr">한국어 (Korean)</option>
</select>
<br>-->
<div class="select" id="language">
<span i18id="Language">Language</span>
@ -69,6 +59,27 @@
<br>
<div class="select" id="voicepack">
<span i18id="Voice">Voice Pack</span>
<div class="select-options">
<ul>
<li value="en-us">English (US)</li>
<li value="zh-cn">汉语 (Chinese)</li>
<li value="ja-jp">日本語 (Japanese)</li>
<li value="ko-kr">한국어 (Korean)</li>
</ul>
</div>
<div class="selected-item hint--top hint--medium">
<span>English (US)</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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Sprache",
"Voice": "Sprachpaket",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Einstellungen",
"GeneralSettings": "Generell",
"WineVersion": "Wine Version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"Downloading": "Downloading",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "言語",
"Voice": "ボイスパック",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "設定",
"GeneralSettings": "一般",
"Downloading": "ダウンロード中",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Версии Wine",
"Language": "Язык",
"Voice": "Озвучка",
"VoiceNotification": "Эта настройка требует ручного переключения языка озвучки в настройках игры",
"SettingsTitle": "Настройки",
"GeneralSettings": "Общее",
"WineVersion": "Версии Wine",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "Language",
"Voice": "Voice Pack",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "Settings",
"GeneralSettings": "General",
"WineVersion": "Wine version",

View file

@ -5,6 +5,7 @@
"Runners": "Runners",
"Language": "语言",
"Voice": "语音包",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "设置",
"GeneralSettings": "一般的",
"Downloading": "下载",

View file

@ -5,6 +5,7 @@
"Runners": "執行器",
"Language": "界面語言",
"Voice": "語音包",
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
"SettingsTitle": "設定",
"GeneralSettings": "一般設定",
"Downloading": "下載",

View file

@ -216,7 +216,7 @@ $secondary: #e1e7ff
position: absolute
display: none
height: 230px
max-height: 230px
overflow: auto
background-color: white
@ -225,10 +225,14 @@ $secondary: #e1e7ff
box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
padding: 8px 12px
transform: translateY(calc(50% + 32px)) translateX(208px)
transform: translateY(calc(50% + 32px))
right: 32px
cursor: pointer
z-index: 1
ul
list-style: none

View file

@ -24,6 +24,20 @@ 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);
}
$(() => {
if (LauncherLib.version !== null)
document.title = `${constants.placeholders.uppercase.full} Linux Launcher - ${LauncherLib.version}`;
@ -49,58 +63,9 @@ $(() => {
DiscordRPC.init();
});
// FIXME
/*ipcRenderer.on('updateVP', (event: void, remotedata: any) => {
LauncherLib.getData().then(data => {
LauncherUI.initProgressBar();
let voicePack = data.game.latest.voice_packs[1]; // en-us
let old;
for (let i = 0; i < data.game.latest.voice_packs.length; ++i)
if (data.game.latest.voice_packs[i].language == LauncherLib.getConfig('lang.voice'))
{
voicePack = data.game.latest.voice_packs[i];
break;
}
for (let i = 0; i < data.game.latest.voice_packs.length; ++i)
if (data.game.latest.voice_packs[i].language == remotedata.oldvp)
{
old = data.game.latest.voice_packs[i];
break;
}
let oldstring = old.name.replace(`_${data.game.latest.version}.zip`, '');
// Check if the directory and file exists to prevent errors.
if (fs.existsSync(path.join(LauncherLib.gameDir, oldstring + '_pkg_version')))
fs.rmSync(path.join(LauncherLib.gameDir, oldstring + '_pkg_version'));
if (fs.existsSync(path.join(LauncherLib.gameDir, 'GenshinImpact_Data', 'StreamingAssets', 'Audio', 'GeneratedSoundBanks', 'Windows', oldstring.replace('Audio_', ''))))
fs.rmSync(path.join(LauncherLib.gameDir, 'GenshinImpact_Data', 'StreamingAssets', 'Audio', 'GeneratedSoundBanks', 'Windows', oldstring.replace('Audio_', '')), { recursive: true });
console.log(`%c> Downloading voice data...`, 'font-size: 16px');
// For some reason this keeps breaking and locking up most of the time.
Tools.downloadFile(voicePack.path, path.join(LauncherLib.launcherDir, voicePack.name), (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Downloading'), current, total, difference);
}).then(() => {
console.log(`%c> Unpacking voice data...`, 'font-size: 16px');
LauncherUI.initProgressBar();
Tools.unzip(path.join(LauncherLib.launcherDir, voicePack.name), LauncherLib.gameDir, (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Unpack'), current, total, difference);
}).then(() => {
fs.unlinkSync(path.join(LauncherLib.launcherDir, voicePack.name));
LauncherUI.setState('game-launch-available');
})
});
});
});*/
ipcRenderer.on('change-voicepack', () => {
LauncherUI.updateLauncherState();
});
Tools.getGitTags(constants.uri.launcher).then (tags => {
if (tags.filter(entry => semver.gt(entry.tag, launcher_version)).length > 0)
@ -117,51 +82,7 @@ $(() => {
ipcRenderer.invoke('open-analytics-participation');
LauncherLib.getData().then(async data => {
let patchInfo = await LauncherLib.getPatchInfo();
// Update available
if (LauncherLib.version != data.game.latest.version)
LauncherUI.setState(LauncherLib.version === null ? 'game-installation-available' : 'game-update-available');
// Patch version is incorrect
else if (LauncherLib.getConfig('patch') && LauncherLib.getConfig('patch.version') != patchInfo.version)
{
// Patch is not available
if (patchInfo.version !== data.game.latest.version)
LauncherUI.setState('patch-unavailable');
// Patch available
else if (patchInfo.version === data.game.latest.version)
{
// Patch is stable
if (patchInfo.state == 'stable')
{
console.log(`%c> Applying patch...`, 'font-size: 16px');
LauncherUI.setState('patch-applying');
LauncherLib.patchGame(() => {
LauncherUI.setState('game-launch-available');
}, data => console.log(data.toString()));
}
// Patch is in testing phase
else LauncherUI.setState('test-patch-available');
}
}
// Current patch is in testing phase,
// but stable is available
else if (LauncherLib.getConfig('patch') && LauncherLib.getConfig('patch.version') == patchInfo.version && LauncherLib.getConfig('patch.state') == 'testing' && patchInfo.state == 'stable')
{
console.log(`%c> Applying patch...`, 'font-size: 16px');
LauncherUI.setState('patch-applying');
LauncherLib.patchGame(() => {
LauncherUI.setState('game-launch-available');
}, data => console.log(data.toString()));
}
await LauncherUI.updateLauncherState(data);
$('#launch').on('click', async () => {
// Creating wine prefix
@ -188,7 +109,7 @@ $(() => {
}
// Launching game
if ($('#launch').text() == LauncherUI.i18n.translate('Launch'))
if (LauncherUI.launcherState == 'game-launch-available')
{
console.log(`%c> Starting the game...`, 'font-size: 16px');
@ -265,20 +186,86 @@ $(() => {
}
// Apply test patch
else if ($('#launch').text() == LauncherUI.i18n.translate('TestPatch'))
else if (LauncherUI.launcherState == 'test-patch-available')
{
console.log(`%c> Applying patch...`, 'font-size: 16px');
LauncherUI.setState('patch-applying');
LauncherLib.patchGame(() => {
LauncherUI.setState('game-launch-available');
LauncherUI.updateLauncherState();
}, data => console.log(data.toString()));
}
// Voice pack update
else if (LauncherUI.launcherState == 'game-voice-update-required')
{
// Hide settings button to prevent some unexpected changes
$('#settings').css('display', 'none');
LauncherUI.initProgressBar();
let voicePack = data.game.latest.voice_packs[1], // en-us
installedPack;
for (let i = 0; i < data.game.latest.voice_packs.length; ++i)
if (data.game.latest.voice_packs[i].language == LauncherLib.getConfig('lang.voice.active'))
{
voicePack = data.game.latest.voice_packs[i];
break;
}
for (let i = 0; i < data.game.latest.voice_packs.length; ++i)
if (data.game.latest.voice_packs[i].language == LauncherLib.getConfig('lang.voice.installed'))
{
installedPack = data.game.latest.voice_packs[i];
break;
}
let installedpackName = installedPack.name.replace(`_${data.game.latest.version}.zip`, '');
console.log(`%c> Deleting installed voice pack (${installedpackName})...`, 'font-size: 16px');
// Check if the directory and file exists to prevent errors
if (fs.existsSync(path.join(constants.gameDir, installedpackName + '_pkg_version')))
fs.rmSync(path.join(constants.gameDir, installedpackName + '_pkg_version'));
if (fs.existsSync(path.join(constants.voiceDir, installedpackName.replace('Audio_', ''))))
fs.rmSync(path.join(constants.voiceDir, installedpackName.replace('Audio_', '')), { recursive: true });
console.log(`%c> Downloading voice data...`, 'font-size: 16px');
// For some reason this keeps breaking and locking up most of the time.
Tools.downloadFile(voicePack.path, path.join(constants.launcherDir, voicePack.name), (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Downloading'), current, total, difference);
}).then(() => {
console.log(`%c> Unpacking voice data...`, 'font-size: 16px');
LauncherUI.initProgressBar();
Tools.unzip(path.join(constants.launcherDir, voicePack.name), constants.gameDir, (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Unpack'), current, total, difference);
}).then(() => {
fs.unlinkSync(path.join(constants.launcherDir, voicePack.name));
LauncherLib.updateConfig('lang.voice.installed', LauncherLib.getConfig('lang.voice.active'));
// Show back the settings button
$('#settings').css('display', 'block');
LauncherUI.updateLauncherState();
})
});
}
// Installing game
else
{
// Hide settings button to prevent some unexpected changes
$('#settings').css('display', 'none');
console.log(`%c> Downloading game data...`, 'font-size: 16px');
let diff = {
@ -369,8 +356,13 @@ $(() => {
LauncherLib.updateConfig('version', data.game.latest.version);
// Show back the settings button
$('#settings').css('display', 'block');
LauncherUI.updateLauncherState();
// Patch available
if (patchInfo.version === data.game.latest.version)
/*if (patchInfo.version === data.game.latest.version)
{
// ..but it's in testing state
if (patchInfo.state === 'testing')
@ -398,7 +390,7 @@ $(() => {
}
// Patch is not available
else LauncherUI.setState('patch-unavailable');
else LauncherUI.setState('patch-unavailable');*/
});
}).catch(err => console.log(err));
}).catch(err => console.log(err));

View file

@ -16,7 +16,10 @@ const config = new store ({
defaults: {
lang: {
launcher: 'en-us',
voice: 'en-us'
voice: {
installed: null,
active: 'en-us'
}
},
background: {
time: null,
@ -124,14 +127,14 @@ export class LauncherLib
{
let background = '';
if (!this.getConfig('background.time') || new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate()).toString() >= this.getConfig('background.time')!)
if (!this.getConfig('background.time') || Date.now() > this.getConfig('background.time')!)
{
await fetch(constants.backgroundUri + this.getConfig('lang.launcher'))
.then(res => res.json())
.then(async resdone => {
let prevBackground = this.getConfig('background.file');
this.updateConfig('background.time', new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate() + 7).toString());
this.updateConfig('background.time', Date.now() + 7 * 24 * 60 * 60 * 1000); // 7 days
this.updateConfig('background.file', resdone.data.adv.background.replace(/.*\//, ''));
if (fs.existsSync(path.join(constants.launcherDir, this.getConfig('background.file'))))
@ -139,7 +142,7 @@ export class LauncherLib
else
{
await Tools.downloadFile(resdone.data.adv.background, path.join(constants.launcherDir, this.getConfig('background.file')), (current: number, total: number, difference: number) => null).then(() => {
await Tools.downloadFile(resdone.data.adv.background, path.join(constants.launcherDir, this.getConfig('background.file')), () => null).then(() => {
!prevBackground ?
console.log('No old background found') :
fs.unlinkSync(path.join(constants.launcherDir, prevBackground));

View file

@ -10,6 +10,7 @@ type LauncherState =
'patch-applying' |
'game-update-available' |
'game-installation-available' |
'game-voice-update-required' |
'game-launch-available';
export class LauncherUI
@ -77,6 +78,11 @@ export class LauncherUI
break;
case 'game-voice-update-required':
$('#launch').text(this.i18n.translate('Update'));
break;
case 'game-launch-available':
$('#launch').removeAttr('disabled')
.removeAttr('data-hint');
@ -94,6 +100,62 @@ export class LauncherUI
this._launcherState = state;
}
public static async updateLauncherState(data: any = null)
{
let gameData = data ?? await LauncherLib.getData();
let patchInfo = await LauncherLib.getPatchInfo();
// Update available
if (LauncherLib.version != gameData.game.latest.version)
this.setState(LauncherLib.version === null ? 'game-installation-available' : 'game-update-available');
// Voice pack update required
else if (LauncherLib.getConfig('lang.voice.active') != LauncherLib.getConfig('lang.voice.installed'))
this.setState('game-voice-update-required');
// Patch version is incorrect
else if (LauncherLib.getConfig('patch') && LauncherLib.getConfig('patch.version') != patchInfo.version)
{
// Patch is not available
if (patchInfo.version !== gameData.game.latest.version)
this.setState('patch-unavailable');
// Patch available
else if (patchInfo.version === gameData.game.latest.version)
{
// Patch is stable
if (patchInfo.state == 'stable')
{
console.log(`%c> Applying patch...`, 'font-size: 16px');
this.setState('patch-applying');
LauncherLib.patchGame(() => {
this.setState('game-launch-available');
}, data => console.log(data.toString()));
}
// Patch is in testing phase
else this.setState('test-patch-available');
}
}
// Current patch is in testing phase,
// but stable is available
else if (LauncherLib.getConfig('patch') && LauncherLib.getConfig('patch.version') == patchInfo.version && LauncherLib.getConfig('patch.state') == 'testing' && patchInfo.state == 'stable')
{
console.log(`%c> Applying patch...`, 'font-size: 16px');
this.setState('patch-applying');
LauncherLib.patchGame(() => {
this.setState('game-launch-available');
}, data => console.log(data.toString()));
}
else this.setState('game-launch-available');
}
protected static progressBar = {
beganAt: 0,
prevTime: 0,
@ -130,6 +192,7 @@ export class LauncherUI
let elapsed = (Date.now() - this.progressBar.beganAt) / 1000;
let eta = Math.round(total * elapsed / current - elapsed);
let etaHours: etaType = Math.floor(eta / 3600),
etaMinutes: etaType = Math.floor((eta - etaHours * 3600) / 60),
etaSeconds: etaType = eta - etaHours * 3600 - etaMinutes * 60;

View file

@ -33,6 +33,8 @@ export class constants
public static readonly prefixDir: string = path.join(this.launcherDir, 'game');
public static readonly gameDir: string = path.join(this.prefixDir, 'drive_c', 'Program Files', this.placeholders.uppercase.full);
public static readonly voiceDir: string = path.join(this.gameDir, `${this.placeholders.uppercase.first + this.placeholders.uppercase.second}_Data`, 'StreamingAssets', 'Audio', 'GeneratedSoundBanks', 'Windows');
public static readonly runnersDir: string = path.join(this.launcherDir, 'runners');
public static readonly dxvksDir: string = path.join(this.launcherDir, 'dxvks');

View file

@ -28,26 +28,54 @@ $(() => {
$(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active');
});
/**
* Launcher language
*/
$(`#language li[value=${LauncherLib.getConfig('lang.launcher')}]`).addClass('selected');
$('#language .selected-item span').text($(`#language li[value=${LauncherLib.getConfig('lang.launcher')}]`).text());
$('#language').on('selectionChanged', (e, data: any) => {
let activeLang = LauncherLib.getConfig('lang.launcher');
if (activeLang != data.value)
{
LauncherLib.updateConfig('lang.launcher', data.value);
LauncherLib.updateConfig('background.time', null);
LauncherLib.updateConfig('background.time', null);
LauncherUI.updateLang(data.value);
// Send language updates
// Send language update event
ipcRenderer.send('change-lang', { 'lang': data.value });
}
});
// Select the saved options in launcher.json on load
// $(`#voice-list option[value="${LauncherLib.getConfig('lang.voice')}"]`).prop('selected', true);
/**
* Game voice language
*/
$(`#language li[value=${LauncherLib.getConfig('lang.launcher')}]`).addClass('selected');
$('#language .selected-item span').text($(`#language li[value=${LauncherLib.getConfig('lang.launcher')}]`).text());
$(`#voicepack li[value=${LauncherLib.getConfig('lang.voice.active')}]`).addClass('selected');
$('#voicepack .selected-item span').text($(`#voicepack li[value=${LauncherLib.getConfig('lang.voice.active')}]`).text());
$('#voicepack').on('selectionChanged', (e, data: any) => {
let activeLang = LauncherLib.getConfig('lang.voice.active');
if (activeLang != data.value)
{
LauncherLib.updateConfig('lang.voice.active', data.value);
LauncherUI.setState('game-voice-update-required');
// Send language update event
ipcRenderer.send('change-voicepack');
}
});
$('#voicepack .selected-item').attr('data-hint', LauncherUI.i18n.translate('VoiceNotification'));
/**
* Discord RPC
*/
if (LauncherLib.getConfig('rpc'))
$('#discord-rpc').addClass('checkbox-active');
@ -58,21 +86,9 @@ $(() => {
ipcRenderer.send('rpc-toggle');
});
/*$('#voice-list').on('change', (e) => {
let activeVP = LauncherLib.getConfig('voice');
if (activeVP != e.target.value)
{
LauncherLib.updateConfig('lang.voice', e.target.value);
ipcRenderer.send('updateVP', { 'oldvp': activeVP });
$(`#voice-list option[value="${activeVP}"]`).removeProp('selected');
$(`#voice-list option[value="${e.target.value}"]`).prop('selected', true);
}
else console.log('VP can\' be changed to the already set language');
});*/
/**
* Environmental variables manager
*/
$('#env-list').on('propertyNameChanged', (e, data) => {
if (data.value != '')
@ -107,6 +123,10 @@ $(() => {
td.last().find('span').text(value);
});
/**
* Wine versions manager
*/
let activeRunner = LauncherLib.getConfig('runner');
LauncherLib.getRunners().then(runners => {
@ -205,6 +225,10 @@ $(() => {
});
});
/**
* DXVKs manager
*/
let activeDXVK = LauncherLib.getConfig('dxvk');
LauncherLib.getDXVKs().then(dxvks => {