mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-23 18:20:19 +03:00
Merge branch 'marie/winetricks-winecfg-settings' into 'main'
Fix Winetricks and Winecfg in Settings See merge request KRypt0n_/an-anime-game-launcher!14
This commit is contained in:
commit
172f9d40a4
5 changed files with 90 additions and 41 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@ node_modules
|
|||
dist
|
||||
|
||||
public/css/*
|
||||
!public/css/hint.min.css
|
||||
|
||||
public/js
|
||||
|
||||
|
|
5
public/css/hint.min.css
vendored
Normal file
5
public/css/hint.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,7 @@
|
|||
|
||||
<!-- CSS styles -->
|
||||
<link rel="stylesheet" href="../css/index.css">
|
||||
<link rel="stylesheet" href="../css/hint.min.css">
|
||||
|
||||
<!-- JS scripts -->
|
||||
<script>require('../js/index.js');</script>
|
||||
|
|
|
@ -346,6 +346,22 @@ export default class LauncherLib
|
|||
else return null;
|
||||
}
|
||||
|
||||
public static async getWinetricks (): Promise<string>
|
||||
{
|
||||
return new Promise((resolve) => {
|
||||
if (!fs.existsSync(path.join(constants.launcherDir, 'winetricks.sh')))
|
||||
{
|
||||
Tools.downloadFile(constants.uri.winetricks, path.join(constants.launcherDir, 'winetricks.sh')).then(() => {
|
||||
resolve(path.join(constants.launcherDir, 'winetricks.sh'));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
resolve(path.join(constants.launcherDir, 'winetricks.sh'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// WINEPREFIX='...../wineprefix' winetricks corefonts usetakefocus=n
|
||||
public static async installPrefix (prefixPath: string, progress: (output: string, current: number, total: number) => void): Promise<void>
|
||||
{
|
||||
|
@ -369,9 +385,7 @@ export default class LauncherLib
|
|||
];
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const winetricksSh = path.join(constants.launcherDir, 'winetricks.sh');
|
||||
|
||||
Tools.downloadFile(constants.uri.winetricks, winetricksSh).then(() => {
|
||||
LauncherLib.getWinetricks().then((winetricksSh) => {
|
||||
let installationProgress = 0;
|
||||
|
||||
let env: any = {
|
||||
|
@ -412,8 +426,6 @@ export default class LauncherLib
|
|||
});
|
||||
|
||||
installerProcess.on('close', () => {
|
||||
fs.unlinkSync(winetricksSh);
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -139,48 +139,78 @@ $(() => {
|
|||
/**
|
||||
* winetricks button
|
||||
*/
|
||||
if (commandExists('winetricks'))
|
||||
{
|
||||
$('#general-action-buttons #winetricks').on('click', () => {
|
||||
exec('winetricks', {
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$('#general-action-buttons #winetricks')
|
||||
.addClass('hint--top hint--small')
|
||||
.attr('data-hint', LauncherUI.i18n.translate('IsNotInstalled', ['winetricks']))
|
||||
.attr('disabled', 'disabled');
|
||||
}
|
||||
$('#general-action-buttons #winetricks').on('click', async () => {
|
||||
let winetricks = await LauncherLib.getWinetricks();
|
||||
$('#general-action-buttons #winetricks').attr('disabled', 'disabled');
|
||||
|
||||
let env: any = {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
};
|
||||
|
||||
if (!commandExists('wine') && LauncherLib.getConfig('runner') !== null)
|
||||
{
|
||||
env['WINE'] = path.join(
|
||||
constants.runnersDir,
|
||||
LauncherLib.getConfig('runner.folder'),
|
||||
LauncherLib.getConfig('runner.executable')
|
||||
);
|
||||
|
||||
env['WINESERVER'] = path.join(path.dirname(env['WINE']), 'wineserver');
|
||||
|
||||
if (!fs.existsSync(env['WINE']))
|
||||
console.error(`Patcher supposed to use ${LauncherLib.getConfig('runner.name')} runner, but it doesn't installed`);
|
||||
}
|
||||
|
||||
const winetrickshell = spawn('bash', [winetricks], {
|
||||
env: env
|
||||
})
|
||||
|
||||
winetrickshell.on('close', () => {
|
||||
$('#general-action-buttons #winetricks').removeAttr('disabled');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* winecfg button
|
||||
*/
|
||||
if (commandExists('winecfg'))
|
||||
{
|
||||
$('#general-action-buttons #winecfg').on('click', () => {
|
||||
exec('winecfg', {
|
||||
env: {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$('#general-action-buttons #winecfg')
|
||||
.addClass('hint--top hint--small')
|
||||
.attr('data-hint', LauncherUI.i18n.translate('IsNotInstalled', ['winecfg']))
|
||||
.attr('disabled', 'disabled');
|
||||
}
|
||||
$('#general-action-buttons #winecfg').on('click', () => {
|
||||
$('#general-action-buttons #winecfg').attr('disabled', 'disabled');
|
||||
|
||||
let env: any = {
|
||||
...process.env,
|
||||
WINEPREFIX: constants.prefixDir.get()
|
||||
};
|
||||
|
||||
if (!commandExists('wine') && LauncherLib.getConfig('runner') !== null)
|
||||
{
|
||||
env['WINE'] = path.join(
|
||||
constants.runnersDir,
|
||||
LauncherLib.getConfig('runner.folder'),
|
||||
LauncherLib.getConfig('runner.executable')
|
||||
);
|
||||
|
||||
env['WINESERVER'] = path.join(path.dirname(env['WINE']), 'wineserver');
|
||||
|
||||
if (!fs.existsSync(env['WINE']))
|
||||
console.error(`Patcher supposed to use ${LauncherLib.getConfig('runner.name')} runner, but it doesn't installed`);
|
||||
}
|
||||
|
||||
const winecfg = LauncherLib.getConfig('runner.name').startsWith == 'Proton' ?
|
||||
path.join(LauncherLib.getConfig('runner.folder'), 'files', 'lib64', 'wine', 'x86_64-windows', 'winecfg.exe') :
|
||||
LauncherLib.getConfig('runner.name').startsWith == 'Lutris' ?
|
||||
path.join(LauncherLib.getConfig('runner.folder'), 'lib64', 'wine', 'x86_64-windows', 'winecfg.exe') : 'winecfg'
|
||||
|
||||
const winecfgshell = exec(winecfg, {
|
||||
env: env
|
||||
});
|
||||
|
||||
winecfgshell.on('close', () => {
|
||||
$('#general-action-buttons #winecfg').removeAttr('disabled');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* HUD
|
||||
|
|
Loading…
Reference in a new issue