mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-30 05:28:15 +03:00
Improved Launcher.state.update()
method performance
This commit is contained in:
parent
ee66769cb1
commit
66f852ddea
1 changed files with 94 additions and 79 deletions
|
@ -180,7 +180,6 @@ export default class State
|
|||
let state: LauncherState|null = null;
|
||||
|
||||
const runner = await Runners.current();
|
||||
const dxvk = await DXVK.current();
|
||||
|
||||
// Check if the wine is installed
|
||||
if (runner === null)
|
||||
|
@ -216,8 +215,12 @@ export default class State
|
|||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
const dxvk = await DXVK.current();
|
||||
|
||||
// Check if the DXVK is installed
|
||||
else if (dxvk === null)
|
||||
if (dxvk === null)
|
||||
{
|
||||
debugThread.log('DXVK is not specified');
|
||||
|
||||
|
@ -253,9 +256,19 @@ export default class State
|
|||
else
|
||||
{
|
||||
const gameCurrent = await Game.current;
|
||||
const gameLatest = await Game.getLatestData();
|
||||
const patch = await Patch.latest;
|
||||
|
||||
if (gameCurrent === null)
|
||||
state = 'game-installation-available';
|
||||
|
||||
else
|
||||
{
|
||||
const gameLatest = await Game.getLatestData();
|
||||
|
||||
if (gameCurrent != gameLatest.game.latest.version)
|
||||
state = 'game-update-available';
|
||||
|
||||
else
|
||||
{
|
||||
const installedVoices = await Voice.installed;
|
||||
const selectedVoices = await Voice.selected;
|
||||
|
||||
|
@ -272,17 +285,15 @@ export default class State
|
|||
}
|
||||
}
|
||||
|
||||
if (gameCurrent === null)
|
||||
state = 'game-installation-available';
|
||||
|
||||
else if (gameCurrent != gameLatest.game.latest.version)
|
||||
state = 'game-update-available';
|
||||
|
||||
// TODO: download default voice language if user removed all of them
|
||||
else if (voiceUpdateRequired)
|
||||
if (voiceUpdateRequired)
|
||||
state = 'game-voice-update-required';
|
||||
|
||||
else if (!patch.applied)
|
||||
else
|
||||
{
|
||||
const patch = await Patch.latest;
|
||||
|
||||
if (!patch.applied)
|
||||
{
|
||||
state = patch.state == 'preparation' ?
|
||||
'patch-unavailable' : (patch.state == 'testing' ?
|
||||
|
@ -296,6 +307,9 @@ export default class State
|
|||
state = 'game-voice-pre-installation-available';
|
||||
|
||||
else state = 'game-launch-available';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debugThread.log(`Updated state: ${state}`);
|
||||
|
||||
|
@ -303,6 +317,7 @@ export default class State
|
|||
|
||||
resolve(state);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue