mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-26 06:47:07 +03:00
1.9.0 preparations
- reworked statistics menu, added launcher's level system - fixed gpu selection (by Laurin Neff) - added patch's repo timeout notification - made some secret preparations :)
This commit is contained in:
parent
e0c42859e8
commit
2292e2720c
23 changed files with 318 additions and 111 deletions
|
@ -43,9 +43,9 @@
|
|||
"@types/command-exists": "^1.2.0",
|
||||
"@types/discord-rpc": "^4.0.0",
|
||||
"@types/semver": "^7.3.9",
|
||||
"electron": "^16.0.2",
|
||||
"electron": "^16.0.4",
|
||||
"electron-builder": "^22.14.5",
|
||||
"sass": "^1.43.5",
|
||||
"sass": "^1.44.0",
|
||||
"typescript": "^4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -25,13 +25,49 @@
|
|||
<div class="menu-item" anchor="dxvks" i18id="DXVK">DXVK</div>
|
||||
<div class="menu-item" anchor="shaders" i18id="Shaders">Shaders</div>
|
||||
<div class="menu-item" anchor="environment" i18id="Environment">Environment</div>
|
||||
<div class="menu-item" anchor="statistics" i18id="Statistics">Statistics</div>
|
||||
</div>
|
||||
|
||||
<div class="settings">
|
||||
<div class="settings-item" id="general">
|
||||
<h2 i18id="General">General</h2>
|
||||
|
||||
<div class="launcher-stats">
|
||||
<img src="../images/rank.png">
|
||||
|
||||
<div class="level hint--bottom hint--medium">1</div>
|
||||
|
||||
<div class="stats">
|
||||
<p i18id="Statistics">Statistics</p>
|
||||
|
||||
<div class="time-spent">
|
||||
<span i18id="YouPlayedFor">You've played for</span>
|
||||
<span id="play-hours"></span>
|
||||
<span i18id="hours">hours</span>
|
||||
<span id="play-minutes"></span>
|
||||
<span i18id="minutes">minutes</span>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
This is an instrument-surprise which will be used later :D
|
||||
Please, don't mention it in our discord server
|
||||
I wanna make a great update at christmas
|
||||
-->
|
||||
<!-- <div class="badges">
|
||||
<div class="hint--bottom hint--medium" data-hint="Pioneer: be one of the first launcher users">
|
||||
<img src="../images/badges/torch.png">
|
||||
</div>
|
||||
|
||||
<div class="hint--bottom hint--medium" data-hint="Pioneer: be one of the first launcher users">
|
||||
<img src="../images/badges/torch.png">
|
||||
</div>
|
||||
|
||||
<div class="hint--bottom hint--medium" data-hint="Pioneer: be one of the first launcher users">
|
||||
<img src="../images/badges/torch.png">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="select" id="language">
|
||||
<span i18id="Language">Language</span>
|
||||
|
||||
|
@ -274,18 +310,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-item" id="statistics">
|
||||
<h2 i18id="Statistics">Statistics</h2>
|
||||
|
||||
<div>
|
||||
<span i18id="YouPlayedFor">You've played for</span>
|
||||
<span id="play-hours"></span>
|
||||
<span i18id="hours">hours</span>
|
||||
<span id="play-minutes"></span>
|
||||
<span i18id="minutes">minutes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
BIN
public/images/badges/torch.png
Normal file
BIN
public/images/badges/torch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
public/images/rank.png
Normal file
BIN
public/images/rank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "Sie haben ungefähr",
|
||||
"hours": "Stunden und",
|
||||
"minutes": "Minuten gespielt",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "wird Heruntergeladen",
|
||||
"Unpacking": "wird Entpackt",
|
||||
"GameDownloaded": "Spiel würde erfolgreich heruntergeladen",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update verfügbar: ",
|
||||
"LauncherUpdateBody": "Sie können eine neue Version des Launchers aus dem Repository des Projekts unter {uri.launcher} herunterladen.",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company} Telemetrieserver sind nicht deaktiviert!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Zurücksetzen zum Standard-Prefix",
|
||||
"ChangePrefix": "Prefix ändern"
|
||||
}
|
|
@ -41,6 +41,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
"ApplyPatch": "Applying patch...",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -19,11 +19,11 @@
|
|||
"GameModeNotInstalled": "Kamu belum memasang GameMode",
|
||||
"SwitcherooNotInstalled": "Kamu belum memasang switcheroo-control",
|
||||
"AutoDeleteDXVKLogs": "Otomatis hapus log DXVK",
|
||||
"RecommendableOnly": "Show recommendable versions",
|
||||
"LauncherFolder": "launcher folder",
|
||||
"RecommendableOnly": "Tampilkan pilihan yang direkomendasikan",
|
||||
"LauncherFolder": "folder peluncur",
|
||||
"Prefix": "Prefix",
|
||||
"SelectDir": "Select dir",
|
||||
"ResetDir": "Reset dir",
|
||||
"SelectDir": "Pilih direktori",
|
||||
"ResetDir": "Setel ulang direktori",
|
||||
"Author": "Pembuat",
|
||||
"NoImages": "Tidak ada gambar ditambahkan",
|
||||
"SettingsTitle": "Pengaturan",
|
||||
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "Kamu sudah bermain selama",
|
||||
"hours": "jam",
|
||||
"minutes": "menit",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Mengunduh",
|
||||
"Unpacking": "Membuka paket",
|
||||
"GameDownloaded": "Game berhasil dipasang",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Pembaruan Peluncur tersedia: ",
|
||||
"LauncherUpdateBody": "Kamu dapat mengunduh versi baru peluncur dari repositori di {uri.launcher}",
|
||||
"TelemetryNotDisabled": "Peladen telemetri {placeholders.uppercase.company} tidak dimatikan!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -41,6 +41,7 @@
|
|||
"YouPlayedFor": "あなたはのためにプレーしてきました",
|
||||
"hours": "時間",
|
||||
"minutes": "分",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Unpacking": "開梱",
|
||||
"GameDownloaded": "ゲームのインストールに成功しました",
|
||||
"ApplyPatch": "パッチの適用...",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "ランチャーのアップデートが可能 ",
|
||||
"LauncherUpdateBody": "ランチャーの新バージョンは、プロジェクトのリポジトリ({uri.launcher})からダウンロードできます。",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}のテレメトリサーバは無効になっていません!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "デフォルトへのリセット",
|
||||
"ChangePrefix": "プレフィックスを変更"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "당신은 위해 연주했습니다",
|
||||
"hours": "시간",
|
||||
"minutes": "분",
|
||||
"YourLauncherLevel": "런처의 레벨",
|
||||
"Downloading": "다운로드 중",
|
||||
"Unpacking": "풀기",
|
||||
"GameDownloaded": "게임이 성공적으로 설치되었습니다",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "실행기 업데이트 가능: ",
|
||||
"LauncherUpdateBody": "에서 프로젝트의 저장소에서 실행기의 새 버전을 다운로드 할 수 있습니다 {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company} 의 원격 측정 서버가 비활성화되지 않음!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "Вы играли",
|
||||
"hours": "часов",
|
||||
"minutes": "минут",
|
||||
"YourLauncherLevel": "Уровень вашего лаунчера",
|
||||
"Downloading": "Загрузка",
|
||||
"Unpacking": "Распаковка",
|
||||
"GameDownloaded": "Игра была успешно установлена",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Доступно обновление лаунчера: ",
|
||||
"LauncherUpdateBody": "Вы можете скачать новую версию лаунчера с репозитория проекта: {uri.launcher}",
|
||||
"TelemetryNotDisabled": "Серверы сбора телеметрии {placeholders.uppercase.company} не отключены!",
|
||||
"PatchRepoUnavailableTitle": "Репозиторий патча недоступен",
|
||||
"PatchRepoUnavailableBody": "Скорее всего notabug находится под атакой и не отвечает",
|
||||
"DefPrefix": "Сбросить до умолчания",
|
||||
"ChangePrefix": "Изменить префикс"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Downloading": "Downloading",
|
||||
"Unpacking": "Unpacking",
|
||||
"GameDownloaded": "Game was successfully installed",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "Launcher update available: ",
|
||||
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at {uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -41,6 +41,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Unpacking": "开箱",
|
||||
"GameDownloaded": "游戏安装成功",
|
||||
"ApplyPatch": "应用补丁...",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "启动器更新可用:",
|
||||
"LauncherUpdateBody": "你可以从项目的资源库中下载新版本的启动器,网址是:{uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -41,6 +41,7 @@
|
|||
"YouPlayedFor": "You've played for",
|
||||
"hours": "hours",
|
||||
"minutes": "minutes",
|
||||
"YourLauncherLevel": "Your launcher's level",
|
||||
"Unpacking": "解壓縮中...",
|
||||
"GameDownloaded": "遊戲安裝成功",
|
||||
"ApplyPatch": "套用補丁...",
|
||||
|
@ -59,6 +60,8 @@
|
|||
"LauncherUpdateTitle": "啟動器有新的更新可用:",
|
||||
"LauncherUpdateBody": "您可以從此專案的資源庫中下載新版本的啟動器,網址是:{uri.launcher}",
|
||||
"TelemetryNotDisabled": "{placeholders.uppercase.company}'s telemetry servers don't disabled!",
|
||||
"PatchRepoUnavailableTitle": "Patch's repository is not available",
|
||||
"PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding",
|
||||
"DefPrefix": "Reset to Default",
|
||||
"ChangePrefix": "Change Prefix"
|
||||
}
|
|
@ -82,5 +82,45 @@
|
|||
.settings-item:last-child
|
||||
margin-bottom: 24px
|
||||
|
||||
.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
|
||||
|
||||
|
||||
@include themable(light, $light)
|
||||
@include themable(dark, $dark)
|
||||
|
|
|
@ -352,9 +352,8 @@ $(() => {
|
|||
|
||||
LauncherUI.setState('patch-applying');
|
||||
|
||||
LauncherLib.patchGame(() => {
|
||||
LauncherUI.updateLauncherState();
|
||||
}, data => console.log(data.toString()));
|
||||
LauncherLib.patchGame((data) => console.log(data.toString()))
|
||||
.then(() => LauncherUI.updateLauncherState());
|
||||
}
|
||||
|
||||
// Voice pack update
|
||||
|
|
|
@ -7,6 +7,9 @@ const path = require('path');
|
|||
const os = require('os');
|
||||
const { spawn, exec } = require('child_process');
|
||||
|
||||
// TODO: This is an instrument-surprise which will be used later :)
|
||||
// const crypto = require('crypto');
|
||||
|
||||
const store = require('electron-store');
|
||||
const https = require('follow-redirects').https;
|
||||
const got = require('got');
|
||||
|
@ -85,6 +88,38 @@ export default class LauncherLib
|
|||
return this.getConfig('version');
|
||||
}
|
||||
|
||||
/*public static getKeypair(): { public: string, private: string }
|
||||
{
|
||||
const keypairFile = path.join(constants.launcherDir, 'keypair.json');
|
||||
|
||||
if (fs.existsSync(keypairFile))
|
||||
return JSON.parse(fs.readFileSync(keypairFile));
|
||||
|
||||
else
|
||||
{
|
||||
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
|
||||
namedCurve: 'secp224r1'
|
||||
});
|
||||
|
||||
fs.writeFileSync(keypairFile, JSON.stringify({
|
||||
public: publicKey.export({
|
||||
type: 'spki',
|
||||
format: 'der'
|
||||
}).toString('base64'),
|
||||
|
||||
private: privateKey.export({
|
||||
type: 'sec1',
|
||||
format: 'der'
|
||||
}).toString('base64')
|
||||
}));
|
||||
|
||||
return {
|
||||
public: publicKey,
|
||||
private: privateKey
|
||||
};
|
||||
}
|
||||
}*/
|
||||
|
||||
public static getRunners (): Promise<[{ title: string, runners: Runner[] }]>
|
||||
{
|
||||
/*return new Promise((resolve, reject) => {
|
||||
|
@ -173,20 +208,30 @@ export default class LauncherLib
|
|||
return background;
|
||||
}
|
||||
|
||||
public static async getPatchInfo (): Promise<{ version: string, state: 'testing' | 'stable' }>
|
||||
/**
|
||||
* Get patch's state and version from the repository
|
||||
* @returns information about the patch, or null if repository is not available
|
||||
*/
|
||||
public static async getPatchInfo(): Promise<{ version: string, state: 'testing' | 'stable' }|null>
|
||||
{
|
||||
return new Promise(resolve => {
|
||||
this.getData().then(async (data) => {
|
||||
let gameLatest: string = data.game.latest.version;
|
||||
|
||||
got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch.sh`)
|
||||
.then((patch: any) => {
|
||||
got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch.sh`, {
|
||||
timeout: {
|
||||
request: 4000
|
||||
}
|
||||
}).then((patch: any) => {
|
||||
/**
|
||||
* [game version]/patch.sh file exists
|
||||
* so it's testing or stable version
|
||||
*/
|
||||
got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch_files/unityplayer_patch.vcdiff`)
|
||||
.then(() => {
|
||||
got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch_files/unityplayer_patch.vcdiff`, {
|
||||
timeout: {
|
||||
request: 4000
|
||||
}
|
||||
}).then(() => {
|
||||
/**
|
||||
* [game version]/patch_files/unityplayer_patch
|
||||
* exists so it's testing or stable
|
||||
|
@ -197,27 +242,49 @@ export default class LauncherLib
|
|||
'stable' : 'testing'
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error: Error) => {
|
||||
console.error(error);
|
||||
|
||||
/**
|
||||
* Notabug is not responding
|
||||
*/
|
||||
if (error.message.includes('Timeout awaiting'))
|
||||
resolve(null);
|
||||
|
||||
/**
|
||||
* [game version]/patch_files/unityplayer_patch
|
||||
* doesn't exist so it's just a preparation
|
||||
*
|
||||
* TODO: add preparation state
|
||||
*/
|
||||
resolve({
|
||||
version: data.game.diffs[0].version,
|
||||
state: 'stable'
|
||||
});
|
||||
else
|
||||
{
|
||||
resolve({
|
||||
version: data.game.diffs[0].version,
|
||||
state: 'stable'
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error: Error) => {
|
||||
console.error(error);
|
||||
|
||||
/**
|
||||
* Notabug is not responding
|
||||
*/
|
||||
if (error.message.includes('Timeout awaiting'))
|
||||
resolve(null);
|
||||
|
||||
/**
|
||||
* Otherwise it's definitely preparation
|
||||
*/
|
||||
resolve({
|
||||
version: data.game.diffs[0].version,
|
||||
state: 'stable'
|
||||
});
|
||||
else
|
||||
{
|
||||
resolve({
|
||||
version: data.game.diffs[0].version,
|
||||
state: 'stable'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -331,71 +398,76 @@ export default class LauncherLib
|
|||
});
|
||||
}
|
||||
|
||||
public static isPrefixInstalled (prefixPath: string): boolean
|
||||
public static isPrefixInstalled(prefixPath: string): boolean
|
||||
{
|
||||
return fs.existsSync(path.join(prefixPath, 'drive_c'));
|
||||
}
|
||||
|
||||
public static patchGame (onFinish: () => void, onData: (data: string) => void)
|
||||
public static patchGame(onData: (data: string) => void): Promise<boolean>
|
||||
{
|
||||
this.getPatchInfo().then(pathInfo => {
|
||||
Tools.downloadFile(constants.patchUri, path.join(constants.launcherDir, 'patch.zip')).then(() => {
|
||||
Tools.unzip(path.join(constants.launcherDir, 'patch.zip'), constants.launcherDir).then(() => {
|
||||
// Delete zip file and assign patch directory.
|
||||
fs.unlinkSync(path.join(constants.launcherDir, 'patch.zip'));
|
||||
return new Promise((resolve) => {
|
||||
this.getPatchInfo().then(pathInfo => {
|
||||
if (pathInfo === null)
|
||||
resolve(false);
|
||||
|
||||
const patchDir = path.join(constants.launcherDir, 'dawn', pathInfo.version.replaceAll('.', ''));
|
||||
|
||||
// Patch out the testing phase content from the shell files if active and make sure the shell files are executable.
|
||||
exec(`cd ${patchDir} && sed -i '/^echo "If you would like to test this patch, modify this script and remove the line below this one."/,+5d' patch.sh`);
|
||||
exec(`cd ${patchDir} && sed -i '/^echo " necessary afterwards (Friday?). If that's the case, comment the line below."/,+2d' patch_anti_logincrash.sh`);
|
||||
exec(`chmod +x ${path.join(patchDir, 'patch.sh')}`);
|
||||
exec(`chmod +x ${path.join(patchDir, 'patch_anti_logincrash.sh')}`);
|
||||
|
||||
// Execute the patch file with "yes yes" in the beginning to agree to the choices.
|
||||
let patcherProcess = exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
|
||||
cwd: constants.gameDir,
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
|
||||
patcherProcess.stdout.on('data', (data: string) => onData(data));
|
||||
|
||||
patcherProcess.on('close', () => {
|
||||
// Make sure that launcher.bat exists if not run patch.sh again.
|
||||
if (!fs.existsSync(path.join(constants.gameDir, 'launcher.bat')))
|
||||
exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
|
||||
cwd: constants.gameDir,
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
|
||||
// Execute the patch file with "yes" in the beginning to agree to the choice.
|
||||
let patcherAntiCrashProcess = exec(`yes | ${path.join(patchDir, 'patch_anti_logincrash.sh')}`, {
|
||||
else Tools.downloadFile(constants.patchUri, path.join(constants.launcherDir, 'patch.zip')).then(() => {
|
||||
Tools.unzip(path.join(constants.launcherDir, 'patch.zip'), constants.launcherDir).then(() => {
|
||||
// Delete zip file and assign patch directory.
|
||||
fs.unlinkSync(path.join(constants.launcherDir, 'patch.zip'));
|
||||
|
||||
const patchDir = path.join(constants.launcherDir, 'dawn', pathInfo.version.replaceAll('.', ''));
|
||||
|
||||
// Patch out the testing phase content from the shell files if active and make sure the shell files are executable.
|
||||
exec(`cd ${patchDir} && sed -i '/^echo "If you would like to test this patch, modify this script and remove the line below this one."/,+5d' patch.sh`);
|
||||
exec(`cd ${patchDir} && sed -i '/^echo " necessary afterwards (Friday?). If that's the case, comment the line below."/,+2d' patch_anti_logincrash.sh`);
|
||||
exec(`chmod +x ${path.join(patchDir, 'patch.sh')}`);
|
||||
exec(`chmod +x ${path.join(patchDir, 'patch_anti_logincrash.sh')}`);
|
||||
|
||||
// Execute the patch file with "yes yes" in the beginning to agree to the choices.
|
||||
let patcherProcess = exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
|
||||
cwd: constants.gameDir,
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
|
||||
patcherAntiCrashProcess.stdout.on('data', (data: string) => onData(data));
|
||||
|
||||
patcherAntiCrashProcess.on('close', () => {
|
||||
this.updateConfig('patch.version', pathInfo.version);
|
||||
this.updateConfig('patch.state', pathInfo.state);
|
||||
|
||||
fs.rmSync(path.join(constants.launcherDir, 'dawn'), { recursive: true });
|
||||
|
||||
onFinish();
|
||||
|
||||
patcherProcess.stdout.on('data', (data: string) => onData(data));
|
||||
|
||||
patcherProcess.on('close', () => {
|
||||
// Make sure that launcher.bat exists if not run patch.sh again.
|
||||
if (!fs.existsSync(path.join(constants.gameDir, 'launcher.bat')))
|
||||
exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
|
||||
cwd: constants.gameDir,
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
|
||||
// Execute the patch file with "yes" in the beginning to agree to the choice.
|
||||
let patcherAntiCrashProcess = exec(`yes | ${path.join(patchDir, 'patch_anti_logincrash.sh')}`, {
|
||||
cwd: constants.gameDir,
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
|
||||
patcherAntiCrashProcess.stdout.on('data', (data: string) => onData(data));
|
||||
|
||||
patcherAntiCrashProcess.on('close', () => {
|
||||
this.updateConfig('patch.version', pathInfo.version);
|
||||
this.updateConfig('patch.state', pathInfo.state);
|
||||
|
||||
fs.rmSync(path.join(constants.launcherDir, 'dawn'), { recursive: true });
|
||||
|
||||
resolve(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,8 +114,22 @@ export default class LauncherUI
|
|||
|
||||
public static async updateLauncherState(data: any = null)
|
||||
{
|
||||
const gameData = data ?? await LauncherLib.getData();
|
||||
const patchInfo = await LauncherLib.getPatchInfo();
|
||||
const gameData = data ?? await LauncherLib.getData();
|
||||
let patchInfo = await LauncherLib.getPatchInfo();
|
||||
|
||||
// If patch's repo is not available
|
||||
if (patchInfo === null)
|
||||
{
|
||||
patchInfo = {
|
||||
version: LauncherLib.getConfig('patch.version'),
|
||||
state: LauncherLib.getConfig('patch.state')
|
||||
};
|
||||
|
||||
ipcRenderer.send('notification', {
|
||||
title: this.i18n.translate('PatchRepoUnavailableTitle'),
|
||||
body: this.i18n.translate('PatchRepoUnavailableBody')
|
||||
});
|
||||
}
|
||||
|
||||
// Update available
|
||||
if (LauncherLib.version != gameData.game.latest.version)
|
||||
|
@ -151,9 +165,8 @@ export default class LauncherUI
|
|||
|
||||
this.setState('patch-applying');
|
||||
|
||||
LauncherLib.patchGame(() => {
|
||||
this.setState('game-launch-available');
|
||||
}, data => console.log(data.toString()));
|
||||
LauncherLib.patchGame((data) => console.log(data.toString()))
|
||||
.then(() => this.setState('game-launch-available'));
|
||||
}
|
||||
|
||||
// Patch is in testing phase
|
||||
|
@ -169,9 +182,8 @@ export default class LauncherUI
|
|||
|
||||
this.setState('patch-applying');
|
||||
|
||||
LauncherLib.patchGame(() => {
|
||||
this.setState('game-launch-available');
|
||||
}, data => console.log(data.toString()));
|
||||
LauncherLib.patchGame((data) => console.log(data.toString()))
|
||||
.then(() => this.setState('game-launch-available'));
|
||||
}
|
||||
|
||||
else this.setState('game-launch-available');
|
||||
|
@ -183,7 +195,7 @@ export default class LauncherUI
|
|||
temp: 0
|
||||
};
|
||||
|
||||
public static initProgressBar (): void
|
||||
public static initProgressBar(): void
|
||||
{
|
||||
this.progressBar = {
|
||||
beganAt: Date.now(),
|
||||
|
@ -201,7 +213,7 @@ export default class LauncherUI
|
|||
$('#launch').css('display', 'none');
|
||||
}
|
||||
|
||||
public static updateProgressBar (prefix: string, current: number, total: number, difference: number): void
|
||||
public static updateProgressBar(prefix: string, current: number, total: number, difference: number): void
|
||||
{
|
||||
$('#downloaded').text(`${prefix}: ${ Math.round(current / total * 100) }% (${Tools.prettifyBytes(current)} / ${Tools.prettifyBytes(total)})`);
|
||||
|
||||
|
@ -248,7 +260,7 @@ export default class LauncherUI
|
|||
$('#downloader .progress').css('width', '0');
|
||||
}
|
||||
|
||||
public static updateBackground (): void
|
||||
public static updateBackground(): void
|
||||
{
|
||||
LauncherLib.getBackgroundUri().then(uri => {
|
||||
if ($('img.background').attr('src') != uri)
|
||||
|
@ -299,14 +311,14 @@ export default class LauncherUI
|
|||
});
|
||||
}
|
||||
|
||||
public static updateSocial (): void
|
||||
public static updateSocial(): void
|
||||
{
|
||||
const socialUri = `https://${constants.placeholders.lowercase.first}.${constants.placeholders.lowercase.company}.com/launcher/10/${LauncherLib.getConfig('lang.launcher')}?api_url=https%3A%2F%2Fapi-os-takumi.${constants.placeholders.lowercase.company}.com%2Fhk4e_global&key=gcStgarh&prev=false`;
|
||||
|
||||
$('#launcher-content #social').attr('src', socialUri);
|
||||
}
|
||||
|
||||
public static updateLang (lang: string|null = null): void
|
||||
public static updateLang(lang: string|null = null): void
|
||||
{
|
||||
if (lang !== null)
|
||||
this.i18n.setLang(lang);
|
||||
|
|
|
@ -34,6 +34,26 @@ $(() => {
|
|||
$(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active');
|
||||
});
|
||||
|
||||
/**
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
const playedHours = Math.floor(LauncherLib.getConfig('playtime') / 3600);
|
||||
const playedMinutes = Math.floor((LauncherLib.getConfig('playtime') - playedHours * 3600) / 60);
|
||||
|
||||
$('#play-hours').text(playedHours.toString());
|
||||
$('#play-minutes').text(playedMinutes.toString());
|
||||
|
||||
const levelHours = (level: number) => 0.000441332 * Math.pow(level + 10, 3.10628);
|
||||
|
||||
let level = 1;
|
||||
|
||||
while (level < 91 && levelHours(level) < playedHours)
|
||||
++level;
|
||||
|
||||
$('.launcher-stats .level').text(level.toString());
|
||||
$('.launcher-stats .level').attr('data-hint', LauncherUI.i18n.translate('YourLauncherLevel'));
|
||||
|
||||
/**
|
||||
* Launcher language
|
||||
*/
|
||||
|
@ -241,6 +261,14 @@ $(() => {
|
|||
|
||||
for (const gpu of gpus.value)
|
||||
$(`<li value="${gpu.Name.value}">${gpu.Name.value}</li>`).appendTo('#gpu .select-options ul');
|
||||
|
||||
SwitcherooControl.getGpuByName(LauncherLib.getConfig('gpu')).then((gpu) => {
|
||||
if (gpu)
|
||||
{
|
||||
$(`#gpu li[value=${gpu.Name.value}]`).addClass('selected');
|
||||
$('#gpu .selected-item span').text(gpu.Name.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, () => {
|
||||
console.log('switcheroo-control not running');
|
||||
|
@ -368,16 +396,6 @@ $(() => {
|
|||
td.last().find('span').text(value);
|
||||
});
|
||||
|
||||
/**
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
const playedHours = Math.floor(LauncherLib.getConfig('playtime') / 3600);
|
||||
const playedMinutes = Math.floor((LauncherLib.getConfig('playtime') - playedHours * 3600) / 60);
|
||||
|
||||
$('#play-hours').text(playedHours.toString());
|
||||
$('#play-minutes').text(playedMinutes.toString());
|
||||
|
||||
/**
|
||||
* Wine recommendable only
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue