mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-01-01 22:47:19 +03:00
Implemented files verification feature (!45)
This commit is contained in:
parent
f80399bb55
commit
ebe22485e6
17 changed files with 113 additions and 95 deletions
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Unpacking game...
|
unpacking: Unpacking game...
|
||||||
applying_changes: Applying changes...
|
applying_changes: Applying changes...
|
||||||
deleting_outdated: Deleting outdated files...
|
deleting_outdated: Deleting outdated files...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Launch
|
launch: Launch
|
||||||
predownload: Pre-download update
|
predownload: Pre-download update
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Descomprimiendo el juego...
|
unpacking: Descomprimiendo el juego...
|
||||||
applying_changes: Applying changes...
|
applying_changes: Applying changes...
|
||||||
deleting_outdated: Borrando archivos viejos...
|
deleting_outdated: Borrando archivos viejos...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Instalación de paquetes de voz
|
# Instalación de paquetes de voz
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Jugar
|
launch: Jugar
|
||||||
predownload: Pre-descargar actualización
|
predownload: Pre-descargar actualización
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Ventana de opciones
|
# Ventana de opciones
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Décompression du jeu...
|
unpacking: Décompression du jeu...
|
||||||
applying_changes: Application des changements...
|
applying_changes: Application des changements...
|
||||||
deleting_outdated: Suppression des fichiers non à jour...
|
deleting_outdated: Suppression des fichiers non à jour...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -75,7 +75,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Lancer
|
launch: Lancer
|
||||||
predownload: Pre-téléchargement de mise à jour
|
predownload: Pre-téléchargement de mise à jour
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Játék kibontása folyamatban...
|
unpacking: Játék kibontása folyamatban...
|
||||||
applying_changes: Változások alkalmazása...
|
applying_changes: Változások alkalmazása...
|
||||||
deleting_outdated: Lejárt fájlok kitörlése...
|
deleting_outdated: Lejárt fájlok kitörlése...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Indítás
|
launch: Indítás
|
||||||
predownload: Frissítés előtöltése
|
predownload: Frissítés előtöltése
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Membongkar game...
|
unpacking: Membongkar game...
|
||||||
applying_changes: Applying changes...
|
applying_changes: Applying changes...
|
||||||
deleting_outdated: Menghapus file lama...
|
deleting_outdated: Menghapus file lama...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Luncurkan
|
launch: Luncurkan
|
||||||
predownload: Pembaruan pra-unduh
|
predownload: Pembaruan pra-unduh
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Decomprimendo il gioco...
|
unpacking: Decomprimendo il gioco...
|
||||||
applying_changes: Applicando i cambiamenti...
|
applying_changes: Applicando i cambiamenti...
|
||||||
deleting_outdated: Cancellando file vecchi...
|
deleting_outdated: Cancellando file vecchi...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Avvia
|
launch: Avvia
|
||||||
predownload: Pre-scarica aggiornamento
|
predownload: Pre-scarica aggiornamento
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,7 +25,7 @@ launcher:
|
||||||
unpacking: Pakker ut spill...
|
unpacking: Pakker ut spill...
|
||||||
applying_changes: Applying changes...
|
applying_changes: Applying changes...
|
||||||
deleting_outdated: Fjerner utdaterte filer...
|
deleting_outdated: Fjerner utdaterte filer...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Verifying files...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Downloading mismatched files...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Start
|
launch: Start
|
||||||
predownload: Forhånds-nedlast oppdatering
|
predownload: Forhånds-nedlast oppdatering
|
||||||
integrity: Verify Files & Repair
|
integrity: Verify and repair files
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -25,8 +25,8 @@ launcher:
|
||||||
unpacking: Распаковка игры...
|
unpacking: Распаковка игры...
|
||||||
applying_changes: Применение изменений...
|
applying_changes: Применение изменений...
|
||||||
deleting_outdated: Удаление устаревших файлов...
|
deleting_outdated: Удаление устаревших файлов...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: Проверка файлов...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: Исправление неисправных файлов...
|
||||||
|
|
||||||
# Установка звуковых пакетов
|
# Установка звуковых пакетов
|
||||||
voice:
|
voice:
|
||||||
|
@ -72,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: Запустить
|
launch: Запустить
|
||||||
predownload: Предзагрузить обновление
|
predownload: Предзагрузить обновление
|
||||||
integrity: Verify Files & Repair
|
integrity: Проверить и исправить файлы
|
||||||
|
|
||||||
# Окно настроек
|
# Окно настроек
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -3,6 +3,7 @@ splash:
|
||||||
title: 启动器加载中
|
title: 启动器加载中
|
||||||
phrases:
|
phrases:
|
||||||
- 一些重要的事情...
|
- 一些重要的事情...
|
||||||
|
- 欺负派蒙
|
||||||
- 抽神子...
|
- 抽神子...
|
||||||
- 捡材料...
|
- 捡材料...
|
||||||
- 凹深渊...
|
- 凹深渊...
|
||||||
|
@ -24,8 +25,8 @@ launcher:
|
||||||
unpacking: 解压游戏中...
|
unpacking: 解压游戏中...
|
||||||
applying_changes: 应用更改...
|
applying_changes: 应用更改...
|
||||||
deleting_outdated: 删除过期文件...
|
deleting_outdated: 删除过期文件...
|
||||||
integrity_check: Verifying Files...
|
integrity_check: 校验文件中...
|
||||||
download_mismatch_files: Downloading mismatched files...
|
download_mismatch_files: 重新下载校验失败的文件...
|
||||||
|
|
||||||
# Voice packages installation
|
# Voice packages installation
|
||||||
voice:
|
voice:
|
||||||
|
@ -71,7 +72,7 @@ launcher:
|
||||||
ready:
|
ready:
|
||||||
launch: 启动
|
launch: 启动
|
||||||
predownload: 预下载更新
|
predownload: 预下载更新
|
||||||
integrity: Verify Files & Repair
|
integrity: 验证并修复文件
|
||||||
|
|
||||||
# Settings window
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
Binary file not shown.
Before Width: | Height: | Size: 64 KiB |
BIN
src/assets/images/wrench.png
Normal file
BIN
src/assets/images/wrench.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -13,10 +13,10 @@
|
||||||
import Game from './ts/Game';
|
import Game from './ts/Game';
|
||||||
import Background from './ts/launcher/Background';
|
import Background from './ts/launcher/Background';
|
||||||
|
|
||||||
import Gear from './assets/images/gear.png';
|
import GearIcon from './assets/images/gear.png';
|
||||||
import GearActive from './assets/images/gear-active.png';
|
import GearActiveIcon from './assets/images/gear-active.png';
|
||||||
import Download from './assets/images/cloud-download.png';
|
import DownloadIcon from './assets/images/cloud-download.png';
|
||||||
import Integrity from './assets/images/integrity.png';
|
import WrenchIcon from './assets/images/wrench.png';
|
||||||
|
|
||||||
const launcher = new Launcher(onMount);
|
const launcher = new Launcher(onMount);
|
||||||
|
|
||||||
|
@ -141,17 +141,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="settings">
|
<div id="settings">
|
||||||
<img src={Gear} class="unactive" alt="Settings">
|
<img src={GearIcon} class="unactive" alt="Settings">
|
||||||
|
|
||||||
<img src={GearActive} class="active" alt="Settings">
|
<img src={GearActiveIcon} class="active" alt="Settings">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.states.ready.integrity') : ''}" id="integrity">
|
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.states.ready.integrity') : ''}" id="integrity">
|
||||||
<img src={Integrity} alt="Integrity" />
|
<img src={WrenchIcon} alt="Integrity" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.states.ready.predownload') : ''}" id="predownload">
|
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.states.ready.predownload') : ''}" id="predownload">
|
||||||
<img src={Download} alt="Download" />
|
<img src={DownloadIcon} alt="Download" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="button hint--top hint--large" aria-label="" id="launch">Launch</button>
|
<button class="button hint--top hint--large" aria-label="" id="launch">Launch</button>
|
||||||
|
|
|
@ -54,7 +54,7 @@ img.background
|
||||||
#pause
|
#pause
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
#predownload
|
#predownload, #integrity
|
||||||
position: absolute
|
position: absolute
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
@ -70,22 +70,6 @@ img.background
|
||||||
width: 60%
|
width: 60%
|
||||||
margin: auto
|
margin: auto
|
||||||
|
|
||||||
#integrity
|
|
||||||
position: absolute
|
|
||||||
display: none
|
|
||||||
|
|
||||||
width: 52px
|
|
||||||
height: 52px
|
|
||||||
|
|
||||||
right: 386px
|
|
||||||
bottom: 54px
|
|
||||||
|
|
||||||
border-radius: 8px
|
|
||||||
|
|
||||||
img
|
|
||||||
width: 80%
|
|
||||||
margin: auto
|
|
||||||
|
|
||||||
#settings
|
#settings
|
||||||
width: 76px
|
width: 76px
|
||||||
height: 76px
|
height: 76px
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
runnersRecommendable = true,
|
runnersRecommendable = true,
|
||||||
fpsUnlockerAvailable = true,
|
fpsUnlockerAvailable = true,
|
||||||
voiceUpdateRequired = false;
|
voiceUpdateRequired = false;
|
||||||
|
|
||||||
|
|
||||||
let winevdSettings: object = {},
|
let winevdSettings: object = {},
|
||||||
winevdSettingsUpdater = false;
|
winevdSettingsUpdater = false;
|
||||||
|
@ -296,6 +295,13 @@
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
|
<!-- svelte-ignore missing-declaration -->
|
||||||
|
<Button lang="check files integrity" click={async () => {
|
||||||
|
Neutralino.os.execCommand(`xdg-open "${path.addSlashes(await constants.paths.gameDir)}"`, {
|
||||||
|
background: true
|
||||||
|
});
|
||||||
|
}} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,47 @@
|
||||||
import type Launcher from '../../Launcher';
|
import type Launcher from '../../Launcher';
|
||||||
|
|
||||||
import { Debug, fs, path, Cache, Downloader } from '../../../empathize';
|
import { fs, path, Downloader } from '../../../empathize';
|
||||||
|
import { DebugThread } from '@empathize/framework/dist/meta/Debug';
|
||||||
|
|
||||||
import constants from '../../Constants';
|
import constants from '../../Constants';
|
||||||
import Patch from "../../Patch";
|
import Patch from '../../Patch';
|
||||||
import Locales from '../Locales';
|
import Locales from '../Locales';
|
||||||
import Voice from "../../Voice";
|
import Voice from '../../Voice';
|
||||||
|
import Game from '../../Game';
|
||||||
|
|
||||||
declare const Neutralino;
|
declare const Neutralino;
|
||||||
|
|
||||||
async function download(fileInfo): Promise<boolean>
|
type FileInfo = {
|
||||||
|
remoteName: string;
|
||||||
|
md5: string;
|
||||||
|
fileSize: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to the repair game's file
|
||||||
|
*/
|
||||||
|
function repairFile(fileInfo: FileInfo): Promise<boolean>
|
||||||
{
|
{
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const gameDir = await constants.paths.gameDir;
|
const gameDir = await constants.paths.gameDir;
|
||||||
const cache = await Cache.get('Game.getLatestData.ServerResponse');
|
const fileUri = `${(await Game.getLatestData()).game.latest.decompressed_path}/${fileInfo.remoteName}`;
|
||||||
|
|
||||||
let uri = `${cache!.value['game']['latest']['decompressed_path']}/${fileInfo.remoteName}`;
|
Downloader.download(fileUri, `${gameDir}/${fileInfo.remoteName}.new`).then((stream) => {
|
||||||
|
|
||||||
Downloader.download(uri, `${gameDir}/${fileInfo.remoteName}.new`).then((stream) => {
|
|
||||||
stream.finish(async () => {
|
stream.finish(async () => {
|
||||||
const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(`${gameDir}/${fileInfo.remoteName}.new`)}"`);
|
const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(`${gameDir}/${fileInfo.remoteName}.new`)}"`);
|
||||||
const fileHash = (process.stdOut || process.stdErr).split(' ')[0];
|
|
||||||
|
|
||||||
if (fileHash == fileInfo.md5)
|
if ((process.stdOut || process.stdErr).split(' ')[0] == fileInfo.md5)
|
||||||
{
|
{
|
||||||
await fs.remove(`${gameDir}/${fileInfo.remoteName}`);
|
await fs.remove(`${gameDir}/${fileInfo.remoteName}`);
|
||||||
await fs.move(`${gameDir}/${fileInfo.remoteName}.new`, `${gameDir}/${fileInfo.remoteName}`);
|
await fs.move(`${gameDir}/${fileInfo.remoteName}.new`, `${gameDir}/${fileInfo.remoteName}`);
|
||||||
|
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await fs.remove(`${gameDir}/${fileInfo.remoteName}.new`);
|
await fs.remove(`${gameDir}/${fileInfo.remoteName}.new`);
|
||||||
|
|
||||||
resolve(false);
|
resolve(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -42,31 +53,26 @@ export default (launcher: Launcher): Promise<void> => {
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const gameDir = await constants.paths.gameDir;
|
const gameDir = await constants.paths.gameDir;
|
||||||
|
|
||||||
|
const debugThread = new DebugThread('State/IntegrityCheck', 'Checking files integrity...');
|
||||||
|
|
||||||
|
// Check Game and Voice Pack integrity
|
||||||
Neutralino.filesystem.readFile(`${gameDir}/pkg_version`)
|
Neutralino.filesystem.readFile(`${gameDir}/pkg_version`)
|
||||||
.then(async (files) => {
|
.then(async (files) => {
|
||||||
// Check Game and Voice Pack Integrity
|
|
||||||
|
|
||||||
let mismatchedFiles = new Array();
|
|
||||||
|
|
||||||
files = files.split(/\r\n|\r|\n/).filter((file) => file != '');
|
files = files.split(/\r\n|\r|\n/).filter((file) => file != '');
|
||||||
|
|
||||||
const InstalledVoices = await Voice.installed;
|
// Add voice packages integrity info
|
||||||
|
for (const voice of await Voice.installed)
|
||||||
for (const voice of InstalledVoices)
|
|
||||||
{
|
|
||||||
Neutralino.filesystem.readFile(`${gameDir}/Audio_${Voice.langs[voice.lang]}_pkg_version`)
|
Neutralino.filesystem.readFile(`${gameDir}/Audio_${Voice.langs[voice.lang]}_pkg_version`)
|
||||||
.then(async (vfiles) => {
|
.then(async (voiceFiles) => {
|
||||||
vfiles = vfiles.split(/\r\n|\r|\n/).filter((file) => file != '');
|
files.push(...voiceFiles.split(/\r\n|\r|\n/).filter((file) => file != ''));
|
||||||
files.push(...vfiles);
|
});
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (files.length > 0)
|
if (files.length > 0)
|
||||||
{
|
{
|
||||||
const patch = await Patch.latest;
|
const patch = await Patch.latest;
|
||||||
|
|
||||||
launcher.progressBar?.init({
|
launcher.progressBar?.init({
|
||||||
label: Locales.translate('launcher.progress.game.integrity_check') as string,
|
label: Locales.translate<string>('launcher.progress.game.integrity_check'),
|
||||||
showSpeed: false,
|
showSpeed: false,
|
||||||
showEta: true,
|
showEta: true,
|
||||||
showPercents: true,
|
showPercents: true,
|
||||||
|
@ -76,11 +82,14 @@ export default (launcher: Launcher): Promise<void> => {
|
||||||
launcher.progressBar?.show();
|
launcher.progressBar?.show();
|
||||||
|
|
||||||
let current = 0, total = files.length;
|
let current = 0, total = files.length;
|
||||||
|
let mismatchedFiles = new Array();
|
||||||
|
|
||||||
|
debugThread.log(`Verifying ${total} files...`);
|
||||||
|
|
||||||
for (const file of files)
|
for (const file of files)
|
||||||
{
|
{
|
||||||
// {"remoteName": "AnAnimeGame_Data/StreamingAssets/AssetBundles/blocks/00/16567284.blk", "md5": "79ab71cfff894edeaaef025ef1152b77", "fileSize": 3232361}
|
// {"remoteName": "AnAnimeGame_Data/StreamingAssets/AssetBundles/blocks/00/16567284.blk", "md5": "79ab71cfff894edeaaef025ef1152b77", "fileSize": 3232361}
|
||||||
const fileCheckInfo = JSON.parse(file) as { remoteName: string, md5: string, fileSize: number };
|
const fileCheckInfo: FileInfo = JSON.parse(file);
|
||||||
|
|
||||||
// If the file exists and it's not UnityPlayer.dll
|
// If the file exists and it's not UnityPlayer.dll
|
||||||
// or if it's UnityPlayer.dll but the patch wasn't applied
|
// or if it's UnityPlayer.dll but the patch wasn't applied
|
||||||
|
@ -91,48 +100,66 @@ export default (launcher: Launcher): Promise<void> => {
|
||||||
const fileHash = (process.stdOut || process.stdErr).split(' ')[0];
|
const fileHash = (process.stdOut || process.stdErr).split(' ')[0];
|
||||||
|
|
||||||
if (fileHash != fileCheckInfo.md5)
|
if (fileHash != fileCheckInfo.md5)
|
||||||
|
{
|
||||||
mismatchedFiles.push(fileCheckInfo);
|
mismatchedFiles.push(fileCheckInfo);
|
||||||
|
|
||||||
|
debugThread.log({
|
||||||
|
message: [
|
||||||
|
'Wrong file hash found',
|
||||||
|
`[path] ${fileCheckInfo.remoteName}`,
|
||||||
|
`[hash] ${fileHash}`,
|
||||||
|
`[remote hash] ${fileCheckInfo.md5}`
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
launcher.progressBar?.update(++current, total, 1);
|
launcher.progressBar?.update(++current, total, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.log({
|
debugThread.log({
|
||||||
function: 'Launcher/States/Integrity',
|
|
||||||
message: mismatchedFiles.length == 0 ?
|
message: mismatchedFiles.length == 0 ?
|
||||||
`Checked ${total} files with ${mismatchedFiles.length} mismatches` :
|
`Checked ${total} files with ${mismatchedFiles.length} mismatches` :
|
||||||
[
|
[
|
||||||
`Checked ${total} files with ${mismatchedFiles.length} mismatch(es):`,
|
`Checked ${total} files with ${mismatchedFiles.length} mismatch(es):`,
|
||||||
...mismatchedFiles.map(e => `[${e.md5}] ${e.remoteName}`)
|
...mismatchedFiles.map((mismatch) => `[${mismatch.md5}] ${mismatch.remoteName}`)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
launcher.progressBar?.hide();
|
// Replace mismatched files
|
||||||
|
|
||||||
// Replace mismatched files
|
if (mismatchedFiles.length > 0)
|
||||||
|
{
|
||||||
|
launcher.progressBar?.init({
|
||||||
|
label: Locales.translate<string>('launcher.progress.game.download_mismatch_files'),
|
||||||
|
showSpeed: false,
|
||||||
|
showEta: false,
|
||||||
|
showPercents: true,
|
||||||
|
showTotals: false
|
||||||
|
});
|
||||||
|
|
||||||
mismatchedFiles.forEach(async (fileInfo: { remoteName: string, md5: string, fileSize: number }) =>
|
let current = 0, total = mismatchedFiles.length;
|
||||||
{
|
|
||||||
launcher.progressBar?.init({
|
|
||||||
label: Locales.translate('launcher.progress.game.download_mismatch_files') as string,
|
|
||||||
showSpeed: false,
|
|
||||||
showEta: false,
|
|
||||||
showPercents: false,
|
|
||||||
showTotals: false
|
|
||||||
});
|
|
||||||
|
|
||||||
download(fileInfo).then(async (success) => {
|
for (const fileInfo of mismatchedFiles)
|
||||||
if (!success)
|
{
|
||||||
Debug.log({
|
await repairFile(fileInfo).then((success) => {
|
||||||
function: 'Launcher/States/Integrity',
|
if (!success)
|
||||||
message: `Download of ${fileInfo.remoteName} failed`
|
debugThread.log(`Repair failed: ${fileInfo.remoteName}`);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})
|
launcher.progressBar?.update(++current, total, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
launcher.progressBar?.hide();
|
||||||
|
}
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(() => resolve());
|
.catch(() => {
|
||||||
})
|
debugThread.log('No pkg_version file provided');
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue