mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-24 18:48:14 +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
|
dist
|
||||||
|
|
||||||
public/css/*
|
public/css/*
|
||||||
|
!public/css/hint.min.css
|
||||||
|
|
||||||
public/js
|
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 -->
|
<!-- CSS styles -->
|
||||||
<link rel="stylesheet" href="../css/index.css">
|
<link rel="stylesheet" href="../css/index.css">
|
||||||
|
<link rel="stylesheet" href="../css/hint.min.css">
|
||||||
|
|
||||||
<!-- JS scripts -->
|
<!-- JS scripts -->
|
||||||
<script>require('../js/index.js');</script>
|
<script>require('../js/index.js');</script>
|
||||||
|
|
|
@ -346,6 +346,22 @@ export default class LauncherLib
|
||||||
else return null;
|
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
|
// WINEPREFIX='...../wineprefix' winetricks corefonts usetakefocus=n
|
||||||
public static async installPrefix (prefixPath: string, progress: (output: string, current: number, total: number) => void): Promise<void>
|
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) => {
|
return new Promise((resolve) => {
|
||||||
const winetricksSh = path.join(constants.launcherDir, 'winetricks.sh');
|
LauncherLib.getWinetricks().then((winetricksSh) => {
|
||||||
|
|
||||||
Tools.downloadFile(constants.uri.winetricks, winetricksSh).then(() => {
|
|
||||||
let installationProgress = 0;
|
let installationProgress = 0;
|
||||||
|
|
||||||
let env: any = {
|
let env: any = {
|
||||||
|
@ -412,8 +426,6 @@ export default class LauncherLib
|
||||||
});
|
});
|
||||||
|
|
||||||
installerProcess.on('close', () => {
|
installerProcess.on('close', () => {
|
||||||
fs.unlinkSync(winetricksSh);
|
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -139,48 +139,78 @@ $(() => {
|
||||||
/**
|
/**
|
||||||
* winetricks button
|
* winetricks button
|
||||||
*/
|
*/
|
||||||
if (commandExists('winetricks'))
|
|
||||||
{
|
$('#general-action-buttons #winetricks').on('click', async () => {
|
||||||
$('#general-action-buttons #winetricks').on('click', () => {
|
let winetricks = await LauncherLib.getWinetricks();
|
||||||
exec('winetricks', {
|
$('#general-action-buttons #winetricks').attr('disabled', 'disabled');
|
||||||
env: {
|
|
||||||
|
let env: any = {
|
||||||
...process.env,
|
...process.env,
|
||||||
WINEPREFIX: constants.prefixDir.get()
|
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`);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
const winetrickshell = spawn('bash', [winetricks], {
|
||||||
{
|
env: env
|
||||||
$('#general-action-buttons #winetricks')
|
})
|
||||||
.addClass('hint--top hint--small')
|
|
||||||
.attr('data-hint', LauncherUI.i18n.translate('IsNotInstalled', ['winetricks']))
|
winetrickshell.on('close', () => {
|
||||||
.attr('disabled', 'disabled');
|
$('#general-action-buttons #winetricks').removeAttr('disabled');
|
||||||
}
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* winecfg button
|
* winecfg button
|
||||||
*/
|
*/
|
||||||
if (commandExists('winecfg'))
|
|
||||||
{
|
|
||||||
$('#general-action-buttons #winecfg').on('click', () => {
|
$('#general-action-buttons #winecfg').on('click', () => {
|
||||||
exec('winecfg', {
|
$('#general-action-buttons #winecfg').attr('disabled', 'disabled');
|
||||||
env: {
|
|
||||||
|
let env: any = {
|
||||||
...process.env,
|
...process.env,
|
||||||
WINEPREFIX: constants.prefixDir.get()
|
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`);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
const winecfg = LauncherLib.getConfig('runner.name').startsWith == 'Proton' ?
|
||||||
{
|
path.join(LauncherLib.getConfig('runner.folder'), 'files', 'lib64', 'wine', 'x86_64-windows', 'winecfg.exe') :
|
||||||
$('#general-action-buttons #winecfg')
|
LauncherLib.getConfig('runner.name').startsWith == 'Lutris' ?
|
||||||
.addClass('hint--top hint--small')
|
path.join(LauncherLib.getConfig('runner.folder'), 'lib64', 'wine', 'x86_64-windows', 'winecfg.exe') : 'winecfg'
|
||||||
.attr('data-hint', LauncherUI.i18n.translate('IsNotInstalled', ['winecfg']))
|
|
||||||
.attr('disabled', 'disabled');
|
const winecfgshell = exec(winecfg, {
|
||||||
}
|
env: env
|
||||||
|
});
|
||||||
|
|
||||||
|
winecfgshell.on('close', () => {
|
||||||
|
$('#general-action-buttons #winecfg').removeAttr('disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HUD
|
* HUD
|
||||||
|
|
Loading…
Reference in a new issue