- fixed integrated AppImage's icons
- fixed launcher updates notification
- config.js now saves in the launcher's local directory
- removed excess installation step in the installPrefix function
- fixed and improved game patching process
This commit is contained in:
Observer KRypt0n_ 2021-10-29 15:08:56 +02:00
parent f07edfd832
commit 62c6b1acc4
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
20 changed files with 103 additions and 96 deletions

View file

@ -17,8 +17,7 @@ ipcMain.handle('hide-window', () => mainWindow.hide());
ipcMain.handle('show-window', () => mainWindow.show());
ipcMain.on('notification', (event, args) => {
if (args.icon !== undefined)
args.icon = nativeImage.createFromPath(args.icon);
args.icon = nativeImage.createFromPath(args.icon ?? path.join(__dirname, 'public', 'images', 'baal64-transparent.png'));
new Notification(args).show();
});
@ -31,7 +30,7 @@ ipcMain.handle('open-settings', () => {
nodeIntegration: true,
contextIsolation: false
},
icon: path.join(__dirname, 'public', 'images', 'icon64.png'),
icon: path.join(__dirname, 'public', 'images', 'icons', '64x64.png'),
autoHideMenuBar: true,
resizable: false,
parent: mainWindow,
@ -51,7 +50,7 @@ ipcMain.handle('open-analytics-participation', () => {
nodeIntegration: true,
contextIsolation: false
},
icon: path.join(__dirname, 'public', 'images', 'icon64.png'),
icon: path.join(__dirname, 'public', 'images', 'icons', '64x64.png'),
autoHideMenuBar: true,
resizable: false,
parent: mainWindow,
@ -75,7 +74,7 @@ function createWindow ()
nodeIntegration: true,
contextIsolation: false
},
icon: path.join(__dirname, 'public', 'images', 'icon64.png'),
icon: path.join(__dirname, 'public', 'images', 'icons', '64x64.png'),
autoHideMenuBar: true,
resizable: false
});

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-linux-launcher",
"version": "1.0.0-rc1",
"version": "1.0.0",
"description": "An Anime Game Linux Launcher",
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
"contributors": [
@ -26,7 +26,7 @@
"package.json"
],
"linux": {
"icon": "public/images/icon256.png",
"icon": "public/images/icons",
"category": "Game",
"target": [
{

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -24,6 +24,6 @@
"Participate": "Teilnehmen",
"Skip": "Überspringen",
"SkipAndDontAsk": "Überspingen und nicht noch mal fragen",
"LUpdateNotiTitle": "Launcher update verfügbar: ",
"LUpdateNotiBody": "Sie können eine neue Version des Launchers aus dem Repository des Projekts unter https://notabug.org/nobody/an-anime-game-launcher herunterladen."
"LauncherUpdateTitle": "Launcher update verfügbar: ",
"LauncherUpdateBody": "Sie können eine neue Version des Launchers aus dem Repository des Projekts unter https://notabug.org/nobody/an-anime-game-launcher herunterladen."
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "匿名でのデータ収集に参加",
"Skip": "スキップ",
"SkipAndDontAsk": "スキップして二度と聞かない",
"LUpdateNotiTitle": "ランチャーのアップデートが可能 ",
"LUpdateNotiBody": "ランチャーの新バージョンは、プロジェクトのリポジトリhttps://notabug.org/nobody/an-anime-game-launcherからダウンロードできます。"
"LauncherUpdateTitle": "ランチャーのアップデートが可能 ",
"LauncherUpdateBody": "ランチャーの新バージョンは、プロジェクトのリポジトリhttps://notabug.org/nobody/an-anime-game-launcherからダウンロードできます。"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Участвовать",
"Skip": "Пропустить",
"SkipAndDontAsk": "Пропустить и не спрашивать",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Доступно обновление лаунчера: ",
"LauncherUpdateBody": "Вы можете скачать новую версию лаунчера с репозитория проекта: https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again",
"LUpdateNotiTitle": "Launcher update available: ",
"LUpdateNotiBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "Launcher update available: ",
"LauncherUpdateBody": "You can download a new version of the launcher from the project's repository at https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "参与",
"Skip": "省略",
"SkipAndDontAsk": "跳过,不要再问",
"LUpdateNotiTitle": "启动器更新可用:",
"LUpdateNotiBody": "你可以从项目的资源库中下载新版本的启动器网址是https://notabug.org/nobody/an-anime-game-launcher"
"LauncherUpdateTitle": "启动器更新可用:",
"LauncherUpdateBody": "你可以从项目的资源库中下载新版本的启动器网址是https://notabug.org/nobody/an-anime-game-launcher"
}

View file

@ -24,6 +24,6 @@
"Participate": "參與",
"Skip": "省略",
"SkipAndDontAsk": "跳過,不要再問",
"LUpdateNotiTitle": "啟動器更新可用:",
"LUpdateNotiBody": "你可以從項目的資源庫中下載新版本的啟動器網址是https://notabug.org/nobody/an-anime-game-launcher "
"LauncherUpdateTitle": "啟動器更新可用:",
"LauncherUpdateBody": "你可以從項目的資源庫中下載新版本的啟動器網址是https://notabug.org/nobody/an-anime-game-launcher "
}

View file

@ -105,10 +105,9 @@ $(() => {
if (tags.filter(entry => semver.gt(entry.tag, launcher_version)).length > 0)
{
ipcRenderer.send('notification', {
title: `${LauncherUI.i18n.translate('LaunchLUpdateNotiTitle')} (${launcher_version} -> ${tags[tags.length - 1].tag})`,
body: LauncherUI.i18n.translate('LUpdateNotiBody'),
timeoutType: 'never',
icon: path.join(__dirname, '..', 'images', 'baal64-transparent.png')
title: `${LauncherUI.i18n.translate('LauncherUpdateTitle')} (${launcher_version} -> ${tags[tags.length - 1].tag})`,
body: LauncherUI.i18n.translate('LauncherUpdateBody'),
timeoutType: 'never'
});
}
});
@ -140,7 +139,7 @@ $(() => {
LauncherUI.setState('patch-applying');
Genshinlib.patchGame(data.game.latest.version, () => {
Genshinlib.patchGame(() => {
LauncherUI.setState('game-launch-available');
}, data => console.log(data.toString()));
}
@ -158,7 +157,7 @@ $(() => {
LauncherUI.setState('patch-applying');
Genshinlib.patchGame(data.game.latest.version, () => {
Genshinlib.patchGame(() => {
LauncherUI.setState('game-launch-available');
}, data => console.log(data.toString()));
}
@ -198,8 +197,7 @@ $(() => {
ipcRenderer.send('notification', {
title: document.title,
body: 'miHoYo\'s telemetry servers doesn\'t disabled!',
icon: path.join(__dirname, '..', 'images', 'baal64-transparent.png')
body: 'miHoYo\'s telemetry servers doesn\'t disabled!'
});
}
@ -271,7 +269,7 @@ $(() => {
LauncherUI.setState('patch-applying');
Genshinlib.patchGame(data.game.latest.version, () => {
Genshinlib.patchGame(() => {
LauncherUI.setState('game-launch-available');
}, data => console.log(data.toString()));
}
@ -368,14 +366,15 @@ $(() => {
// patch-applying state changes only button text
$('#downloaded').text(LauncherUI.i18n.translate('ApplyPatch'));
$('#speed').text('');
$('#eta').text('');
Genshinlib.patchGame(data.game.latest.version, () => {
Genshinlib.patchGame(() => {
LauncherUI.setState('game-launch-available');
ipcRenderer.send('notification', {
title: document.title,
body: LauncherUI.i18n.translate('GameDownloaded'),
icon: path.join(__dirname, '..', 'images', 'baal64-transparent.png')
body: LauncherUI.i18n.translate('GameDownloaded')
});
}, data => console.log(data.toString()));
}

View file

@ -11,6 +11,7 @@ const { spawn, exec } = require('child_process');
const dns = require('dns');
const config = new store ({
cwd: path.join(os.homedir(), '.local', 'share', 'anime-game-launcher'),
defaults: {
lang: {
launcher: 'en-us',
@ -20,10 +21,13 @@ const config = new store ({
time: null,
file: null
},
version: null,
patch: null,
runner: null,
version: null, // Installed game version
patch: null, // Installed patch info ({ version, state } - related game's version and patch's state)
runner: null, // Selected runner ({ folder, executable })
rpc: false,
// Version of the game we asked about analytics last time,
// or null if user said don't ask him again
analytics: '0'
}
});
@ -47,8 +51,6 @@ export class Genshinlib
{
public static readonly launcherDir: string = path.join(os.homedir(), '.local', 'share', 'anime-game-launcher');
public static readonly tmpPatchDir: string = path.join(this.launcherDir, 'patch-tmp');
public static readonly prefixDir: string = path.join(this.launcherDir, 'game');
public static readonly gameDir: string = path.join(this.prefixDir, 'drive_c', 'Program Files', Buffer.from('R2Vuc2hpbiBJbXBhY3Q=', 'base64').toString('utf-8'));
public static readonly runnersDir: string = path.join(this.launcherDir, 'runners');
@ -226,6 +228,7 @@ export class Genshinlib
public static async installPrefix (prefixpath: string, progress: (output: string, current: number, total: number) => void): Promise<void>
{
let installationSteps = [
// corefonts
'Executing w_do_call corefonts',
'Executing load_corefonts',
'Executing load_andale',
@ -238,8 +241,9 @@ export class Genshinlib
'Executing load_trebuchet',
'Executing load_verdana',
'Executing load_webdings',
'Executing load_usetakefocus n',
'Executing load_dxvk'
// usetakefocus=n (fullscreen input issues fix)
'Executing load_usetakefocus n'
];
return new Promise((resolve) => {
@ -275,61 +279,66 @@ export class Genshinlib
return fs.existsSync(path.join(prefixPath, 'drive_c'));
}
public static patchGame (version: string, onFinish: () => void, onData: (data: string) => void)
public static patchGame (onFinish: () => void, onData: (data: string) => void)
{
Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'patch.zip'), (current: number, total: number, difference: number) => null).then(() => {
Tools.unzip(path.join(this.launcherDir, 'patch.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => {
// Delete zip file and assign patch directory.
fs.unlinkSync(path.join(this.launcherDir, 'patch.zip'));
Genshinlib.getPatchInfo().then(pathInfo => {
Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'patch.zip'), (current: number, total: number, difference: number) => null).then(() => {
Tools.unzip(path.join(this.launcherDir, 'patch.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => {
// Delete zip file and assign patch directory.
fs.unlinkSync(path.join(this.launcherDir, 'patch.zip'));
let patchDir = path.join(this.tmpPatchDir, version.replace(/\./g, ''));
let patchDir = path.join(this.launcherDir, 'gi-on-linux', 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')}`);
// 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: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
patcherProcess.stdout.on('data', (data: string) => onData(data));
patcherProcess.on('close', () => {
// Make sure that launcher.bat exists if not run patch.sh again.
if (!path.join(this.gameDir, 'launcher.bat'))
exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
cwd: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
// 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')}`, {
// 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: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
patcherAntiCrashProcess.stdout.on('data', (data: string) => onData(data));
patcherAntiCrashProcess.on('close', () => {
fs.rmSync(this.tmpPatchDir, { 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 (!path.join(this.gameDir, 'launcher.bat'))
exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
cwd: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
// 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: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
patcherAntiCrashProcess.stdout.on('data', (data: string) => onData(data));
patcherAntiCrashProcess.on('close', () => {
Genshinlib.updateConfig('patch.version', pathInfo.version);
Genshinlib.updateConfig('patch.state', pathInfo.state);
fs.rmSync(path.join(this.launcherDir, 'gi-on-linux'), { recursive: true });
onFinish();
});
});
});
});
})
});
}
}