Add FPS Unlocker as an option and Fix Voice Data install

This commit is contained in:
Marie 2021-12-13 10:30:45 +00:00 committed by Observer KRypt0n_
parent 301d766623
commit d8fa4c6073
6 changed files with 64 additions and 4 deletions

View file

@ -135,8 +135,8 @@ npm start
* <s>Wine prefix folder selection ([notabug issue 37](https://notabug.org/nobody/an-anime-game-launcher/issues/37))</s> *(1.8.0)*
* Use auto-downloaded winetricks in settings menu *(done in main branch by @Maroxy, !14)*
* Use `winecfg.exe` from the installed runner in settings menu *(done in main branch by @Maroxy, !14)*
* Fix voice data installation
* Add fps unlocker option
* Fix voice data installation *(done in main branch by @Maroxy, !15)*
* Add fps unlocker option *(done in main branch by @Maroxy, !15)*
* Add downloading pause button
* Move project to Vue
* Use `LauncherLib.getGameVersion` function instead of the `config.json`'s `version` property

View file

@ -229,6 +229,16 @@
<br>
<div class="checkbox" id="fps-unlocker">
FPS Unlocker
<div class="checkbox-mark">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="45.701px" height="45.7px" viewBox="0 0 45.701 45.7" xml:space="preserve"><g><g><path d="M20.687,38.332c-2.072,2.072-5.434,2.072-7.505,0L1.554,26.704c-2.072-2.071-2.072-5.433,0-7.504 c2.071-2.072,5.433-2.072,7.505,0l6.928,6.927c0.523,0.522,1.372,0.522,1.896,0L36.642,7.368c2.071-2.072,5.433-2.072,7.505,0 c0.995,0.995,1.554,2.345,1.554,3.752c0,1.407-0.559,2.757-1.554,3.752L20.687,38.332z"/></g></g></svg>
</div>
</div>
<br>
<div class="checkbox" id="autodelete-dxvk-logs">
<span i18id="AutoDeleteDXVKLogs">Auto-delete DXVK logs</span>
@ -254,6 +264,8 @@
<br>
<div class="list" id="runners-list"></div>
<br>
</div>
<div class="settings-item" id="dxvks">
@ -270,6 +282,8 @@
<br><br>
<div class="list" id="dxvk-list"></div>
<br>
</div>
<div class="settings-item" id="shaders">
@ -310,7 +324,10 @@
<button class="button" id="delete" i18id="Delete">Delete</button>
</div>
</div>
<br>
</div>
<div class="settings-item" id="discord-rpc-conf" style="display: none;">
<h2 i18id="DRPConf">Discord RPC</h2>

View file

@ -280,7 +280,7 @@ $(() => {
else console.warn(`GPU ${LauncherLib.getConfig('gpu')} not found. Launching on the default GPU`);
}
let command = `${wineExeutable} launcher.bat`;
let command = `${wineExeutable} ${LauncherLib.getConfig('fpsunlock') ? 'fpsunlock.bat' : 'launcher.bat'}`;
/**
* Gamemode integration
@ -484,7 +484,7 @@ $(() => {
let voicePack = diff.voice_packs[1]; // en-us
for (let i = 0; i < diff.voice_packs.length; ++i)
if (diff.voice_packs[i].language == LauncherLib.getConfig('lang.voice'))
if (diff.voice_packs[i].language == LauncherLib.getConfig('lang.voice.active'))
{
voicePack = diff.voice_packs[i];
@ -521,6 +521,7 @@ $(() => {
}
LauncherLib.updateConfig('version', data.game.latest.version);
LauncherLib.updateConfig('lang.voice.installed', LauncherLib.getConfig('lang.voice.active'));
// Show back the settings button
$('#settings').css('display', 'block');

View file

@ -46,6 +46,7 @@ const config = new store ({
hud: 'none', // none / dxvk / mangohud
shaders: 'none', // none / shader's folder
gamemode: false, // GameMode
fpsunlock: false, // FPS Unlocker
gpu: 'default', // GPU
autodelete_dxvk_logs: false, // Auto-delete DXVK logs
theme: 'system', // light / dark / system

View file

@ -90,6 +90,11 @@ export default class constants
return path.join(this.prefixDir.get(), 'drive_c', 'Program Files', this.placeholders.uppercase.full);
}
public static get fpsunlockerDir(): string
{
return path.join(this.prefixDir.get(), 'drive_c', 'Program Files', Buffer.from('R0lfRlBTVW5sb2NrZXI=', 'base64').toString());
}
public static get voiceDir(): string
{
return path.join(this.gameDir, `${this.placeholders.uppercase.first + this.placeholders.uppercase.second}_Data`, 'StreamingAssets', 'Audio', 'GeneratedSoundBanks', 'Windows');

View file

@ -318,6 +318,42 @@ $(() => {
LauncherLib.updateConfig('gamemode', $('#gamemode').hasClass('checkbox-active'));
});
/**
* FPS Unlocker
*/
// Hide FPS Unlock until Prefix is installed
if (!LauncherLib.isPrefixInstalled(constants.prefixDir.get()))
$('#fps-unlocker').toggle();
else if(LauncherLib.isPrefixInstalled(constants.prefixDir.get()) && !$('#fps-unlocker').is(':visible'))
$('#fps-unlocker').toggle();
if (LauncherLib.getConfig('fpsunlock'))
if (!fs.existsSync(constants.fpsunlockerDir))
LauncherLib.updateConfig('fpsunlock', false);
else
$('#fps-unlocker').addClass('checkbox-active');
$('#fps-unlocker').on('classChange', async () => {
if (LauncherLib.getConfig('fpsunlock') && !$('#fps-unlocker').hasClass('checkbox-active') && fs.existsSync(constants.fpsunlockerDir))
{
fs.rmdirSync(constants.fpsunlockerDir, { recursive: true });
fs.rmSync(path.join(constants.gameDir, 'fps_config.ini'));
}
else if(!LauncherLib.getConfig('fpsunlock') && $('#fps-unlocker').hasClass('checkbox-active') && !fs.existsSync(constants.fpsunlockerDir))
{
fs.mkdirSync(constants.fpsunlockerDir);
let fpsunlockexe = Buffer.from('aHR0cHM6Ly9naXRodWIuY29tLzM0NzM2Mzg0L2dlbnNoaW4tZnBzLXVubG9jay9yZWxlYXNlcy9kb3dubG9hZC92MS40LjIvdW5sb2NrZnBzLmV4ZQ==', 'base64').toString();
let fpsunlockbat = Buffer.from('aHR0cHM6Ly9kZXYua2FpZmEuY2gvTWFyb3h5L2FuLWFuaW1lLWdhbWUtYXVyL3Jhdy9icmFuY2gvZnBzdW5sb2NrL2Zwc3VubG9jay5iYXQ=', 'base64').toString();
await Tools.downloadFile(fpsunlockbat, path.join(constants.gameDir, 'fpsunlock.bat'), (current: number, total: number, difference: number) => null);
await Tools.downloadFile(fpsunlockexe, path.join(constants.fpsunlockerDir, 'unlockfps.exe'), (current: number, total: number, difference: number) => null);
}
LauncherLib.updateConfig('fpsunlock', $('#fps-unlocker').hasClass('checkbox-active'));
});
/**
* GPU selection
*/