mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-01-01 22:47:19 +03:00
Added Patch section to the settings menu
- removed excess sass styles - added `Patch.revert()` method
This commit is contained in:
parent
852d4a662c
commit
07b32adaae
16 changed files with 249 additions and 44 deletions
|
@ -274,6 +274,17 @@ settings:
|
||||||
add: Hinzufügen
|
add: Hinzufügen
|
||||||
delete: Löschen
|
delete: Löschen
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: Add
|
add: Add
|
||||||
delete: Delete
|
delete: Delete
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -272,6 +272,17 @@ settings:
|
||||||
add: Añadir
|
add: Añadir
|
||||||
delete: Borrar
|
delete: Borrar
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Actualización del Launcher
|
# Actualización del Launcher
|
||||||
|
|
|
@ -283,6 +283,17 @@ settings:
|
||||||
add: Ajouter
|
add: Ajouter
|
||||||
delete: Supprimer
|
delete: Supprimer
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: Hozzáadás
|
add: Hozzáadás
|
||||||
delete: Törlés
|
delete: Törlés
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: Tambah
|
add: Tambah
|
||||||
delete: Hapus
|
delete: Hapus
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -271,6 +271,17 @@ settings:
|
||||||
add: Aggiungi
|
add: Aggiungi
|
||||||
delete: Rimuovi
|
delete: Rimuovi
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: 追加
|
add: 追加
|
||||||
delete: 削除
|
delete: 削除
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: Legg til
|
add: Legg til
|
||||||
delete: Fjern
|
delete: Fjern
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -272,6 +272,17 @@ settings:
|
||||||
add: Добавить
|
add: Добавить
|
||||||
delete: Удалить
|
delete: Удалить
|
||||||
|
|
||||||
|
# Настроки патча
|
||||||
|
patch:
|
||||||
|
title: Патч
|
||||||
|
items:
|
||||||
|
patch_version: 'Версия патча:'
|
||||||
|
updating_info: 'Обновление информации о патче...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: отменить патч
|
||||||
|
apply_patch: применить патч
|
||||||
|
reapply_patch: переприменить патч
|
||||||
|
|
||||||
# Уведомления
|
# Уведомления
|
||||||
notifications:
|
notifications:
|
||||||
# Обновление лаунчера
|
# Обновление лаунчера
|
||||||
|
|
|
@ -272,6 +272,17 @@ settings:
|
||||||
add: add
|
add: add
|
||||||
delete: dewete
|
delete: dewete
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -273,6 +273,17 @@ settings:
|
||||||
add: 添加
|
add: 添加
|
||||||
delete: 删除
|
delete: 删除
|
||||||
|
|
||||||
|
# Patch-related settings
|
||||||
|
patch:
|
||||||
|
title: Patch
|
||||||
|
items:
|
||||||
|
patch_version: 'Patch version:'
|
||||||
|
updating_info: 'Updating patch info...'
|
||||||
|
buttons:
|
||||||
|
revert_patch: revert patch
|
||||||
|
apply_patch: apply patch
|
||||||
|
reapply_patch: re-apply patch
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
notifications:
|
notifications:
|
||||||
# Launcher update
|
# Launcher update
|
||||||
|
|
|
@ -89,6 +89,18 @@
|
||||||
&:hover
|
&:hover
|
||||||
background: #e5e9f0
|
background: #e5e9f0
|
||||||
|
|
||||||
|
.settings-item#patch
|
||||||
|
.patch-version
|
||||||
|
font-size: 18px
|
||||||
|
|
||||||
|
span
|
||||||
|
margin-left: 8px
|
||||||
|
|
||||||
|
color: map.get($theme-map, "primary")
|
||||||
|
|
||||||
|
span.warning
|
||||||
|
color: #d82148
|
||||||
|
|
||||||
.settings-footer
|
.settings-footer
|
||||||
margin: 24px 0
|
margin: 24px 0
|
||||||
|
|
||||||
|
@ -104,45 +116,6 @@
|
||||||
|
|
||||||
color: map.get($theme-map, "primary")
|
color: map.get($theme-map, "primary")
|
||||||
|
|
||||||
.launcher-stats
|
|
||||||
display: inline-flex
|
|
||||||
margin-bottom: 16px
|
|
||||||
|
|
||||||
> img
|
|
||||||
width: 96px
|
|
||||||
height: 96px
|
|
||||||
|
|
||||||
.level
|
|
||||||
position: absolute
|
|
||||||
width: 96px
|
|
||||||
top: 105px
|
|
||||||
|
|
||||||
text-align: center
|
|
||||||
font-size: 20px
|
|
||||||
color: #71b71b
|
|
||||||
|
|
||||||
.stats
|
|
||||||
margin-left: 32px
|
|
||||||
align-self: center
|
|
||||||
|
|
||||||
> p
|
|
||||||
font-size: 20px
|
|
||||||
font-weight: 600
|
|
||||||
margin: 0
|
|
||||||
|
|
||||||
.time-spent
|
|
||||||
font-size: 18px
|
|
||||||
margin: 8px 0 16px 0
|
|
||||||
|
|
||||||
.badges
|
|
||||||
margin-bottom: 16px
|
|
||||||
|
|
||||||
img
|
|
||||||
width: 24px
|
|
||||||
height: 24px
|
|
||||||
|
|
||||||
margin-right: 4px
|
|
||||||
|
|
||||||
@import "themes/light"
|
@import "themes/light"
|
||||||
@import "themes/dark"
|
@import "themes/dark"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
import Launcher from './ts/Launcher';
|
import Launcher from './ts/Launcher';
|
||||||
import FPSUnlock from './ts/FPSUnlock';
|
import FPSUnlock from './ts/FPSUnlock';
|
||||||
import Runners from './ts/core/Runners';
|
import Runners from './ts/core/Runners';
|
||||||
|
import Patch from './ts/Patch';
|
||||||
|
|
||||||
|
import type { PatchInfo } from './ts/types/Patch';
|
||||||
|
|
||||||
import Button from './components/Button.svelte';
|
import Button from './components/Button.svelte';
|
||||||
import Checkbox from './components/Checkbox.svelte';
|
import Checkbox from './components/Checkbox.svelte';
|
||||||
|
@ -115,7 +118,14 @@
|
||||||
gamemode.tooltip = 'settings.enhancements.game.items.gamemode.tooltip.disabled';
|
gamemode.tooltip = 'settings.enhancements.game.items.gamemode.tooltip.disabled';
|
||||||
});
|
});
|
||||||
|
|
||||||
let borderless_active = Configs.get('borderless_window').then((val) => borderless_active = val);
|
let borderless_active = Configs.get('borderless_window').then((value) => borderless_active = value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch info
|
||||||
|
*/
|
||||||
|
let patchInfo: PatchInfo|null = null;
|
||||||
|
|
||||||
|
Patch.latest.then((value) => patchInfo = value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu items changing
|
* Menu items changing
|
||||||
|
@ -185,7 +195,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (voiceUpdateRequired)
|
if (voiceUpdateRequired)
|
||||||
await IPC.write('voice-update-required');
|
await IPC.write('update-state');
|
||||||
|
|
||||||
Neutralino.app.exit();
|
Neutralino.app.exit();
|
||||||
});
|
});
|
||||||
|
@ -194,7 +204,7 @@
|
||||||
{#if typeof $locale === 'string'}
|
{#if typeof $locale === 'string'}
|
||||||
<main>
|
<main>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{#each ['general', 'enhancements', 'runners', 'dxvks', 'shaders', 'environment'] as item}
|
{#each ['general', 'enhancements', 'runners', 'dxvks', 'shaders', 'environment', 'patch'] as item}
|
||||||
<div
|
<div
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
class:menu-item-active={selectedItem === item}
|
class:menu-item-active={selectedItem === item}
|
||||||
|
@ -467,6 +477,74 @@
|
||||||
<EnvironmentManager />
|
<EnvironmentManager />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="settings-item" id="patch">
|
||||||
|
<h1>{$_('settings.patch.title')}</h1>
|
||||||
|
|
||||||
|
{#if patchInfo !== null}
|
||||||
|
<div class="patch-version">
|
||||||
|
{$_('settings.patch.items.patch_version')}
|
||||||
|
|
||||||
|
<span class:warning={!patchInfo.applied}>
|
||||||
|
{ `${patchInfo.version} ${patchInfo.state}` }
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px">
|
||||||
|
{#if patchInfo.applied}
|
||||||
|
<!-- svelte-ignore missing-declaration -->
|
||||||
|
<Button
|
||||||
|
lang="settings.patch.items.buttons.revert_patch"
|
||||||
|
click={async () => {
|
||||||
|
if (patchInfo)
|
||||||
|
{
|
||||||
|
const prevPatchInfo = patchInfo;
|
||||||
|
|
||||||
|
patchInfo = null;
|
||||||
|
|
||||||
|
patchInfo = await Patch.revert(prevPatchInfo) ?
|
||||||
|
await Patch.latest : prevPatchInfo;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- svelte-ignore missing-declaration -->
|
||||||
|
<Button
|
||||||
|
lang="settings.patch.items.buttons.reapply_patch"
|
||||||
|
click={async () => {
|
||||||
|
if (patchInfo)
|
||||||
|
{
|
||||||
|
const prevPatchInfo = patchInfo;
|
||||||
|
|
||||||
|
patchInfo = null;
|
||||||
|
|
||||||
|
if (await Patch.revert(prevPatchInfo))
|
||||||
|
{
|
||||||
|
await IPC.write('update-state');
|
||||||
|
|
||||||
|
Neutralino.app.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
else patchInfo = prevPatchInfo;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<!-- svelte-ignore missing-declaration -->
|
||||||
|
<Button
|
||||||
|
lang="settings.patch.items.buttons.apply_patch"
|
||||||
|
click={async () => {
|
||||||
|
await IPC.write('update-state');
|
||||||
|
|
||||||
|
Neutralino.app.exit();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<p>Updating patch info...</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="settings-footer">
|
<div class="settings-footer">
|
||||||
<span>An Anime Game Launcher {Launcher.version}</span>
|
<span>An Anime Game Launcher {Launcher.version}</span>
|
||||||
|
|
||||||
|
|
|
@ -122,9 +122,9 @@ export default class Launcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (record.data === 'voice-update-required')
|
else if (record.data === 'update-state')
|
||||||
{
|
{
|
||||||
this.state!.set('game-voice-update-required');
|
this.state?.update();
|
||||||
|
|
||||||
record.pop();
|
record.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,6 +450,28 @@ export default class Patch
|
||||||
.catch((err) => reject(err));
|
.catch((err) => reject(err));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to revert applied patch
|
||||||
|
*
|
||||||
|
* @returns false if the locally installed patch repository is not available or the patch is not applied
|
||||||
|
*/
|
||||||
|
public static revert(patch: PatchInfo): Promise<boolean>
|
||||||
|
{
|
||||||
|
return new Promise(async (resolve) => {
|
||||||
|
const patchRevertFile = `${await constants.paths.launcherDir}/patch/${patch.version.replaceAll('.', '')}/patch_revert.sh`;
|
||||||
|
|
||||||
|
if (!await fs.exists(patchRevertFile))
|
||||||
|
resolve(false);
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const result = await Neutralino.os.execCommand(`chmod +x "${path.addSlashes(patchRevertFile)}" && cd "${path.addSlashes(await constants.paths.gameDir)}" && yes yes yes | bash "${path.addSlashes(patchRevertFile)}"`);
|
||||||
|
|
||||||
|
resolve(result.stdOut.includes('==> Patch reverted'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Stream };
|
export { Stream };
|
||||||
|
|
Loading…
Reference in a new issue