Add GameMode integration

This commit is contained in:
Laurin Neff 2021-11-24 22:02:41 +01:00
parent e97a54c9f5
commit 4c8f40a941
No known key found for this signature in database
GPG key ID: ACC6088154D0F6C7
18 changed files with 51 additions and 1 deletions

View file

@ -111,6 +111,16 @@
</div> </div>
<br> <br>
<div class="checkbox" id="gamemode">
GameMode
<div class="checkbox-mark">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="45.701px" height="45.7px" viewBox="0 0 45.701 45.7" xml:space="preserve"><g><g><path d="M20.687,38.332c-2.072,2.072-5.434,2.072-7.505,0L1.554,26.704c-2.072-2.071-2.072-5.433,0-7.504 c2.071-2.072,5.433-2.072,7.505,0l6.928,6.927c0.523,0.522,1.372,0.522,1.896,0L36.642,7.368c2.071-2.072,5.433-2.072,7.505,0 c0.995,0.995,1.554,2.345,1.554,3.752c0,1.407-0.559,2.757-1.554,3.752L20.687,38.332z"/></g></g></svg>
</div>
</div>
<br>
</div> </div>
<div class="settings-item" id="runners"> <div class="settings-item" id="runners">

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Verwenden Sie die Home-Taste (POS 1), um Shader im Spiel ein/aus-zuschalten", "ToggleShadersText": "Verwenden Sie die Home-Taste (POS 1), um Shader im Spiel ein/aus-zuschalten",
"Shaders": "Shadern", "Shaders": "Shadern",
"ReshadeNotInstalled": "Sie haben vkBasalt und Reshade-Shader nicht installiert", "ReshadeNotInstalled": "Sie haben vkBasalt und Reshade-Shader nicht installiert",
"GameModeNotInstalled": "Sie haben GameMode nicht installiert",
"Author": "Autor", "Author": "Autor",
"NoImages": "Bilder sind nicht verfügbar", "NoImages": "Bilder sind nicht verfügbar",
"SettingsTitle": "Einstellungen", "SettingsTitle": "Einstellungen",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Gunakan tombol Home untuk menyalakan/mematikan shader di dalam Game", "ToggleShadersText": "Gunakan tombol Home untuk menyalakan/mematikan shader di dalam Game",
"Shaders": "Shader", "Shaders": "Shader",
"ReshadeNotInstalled": "Kamu belum memasang vkBasalt dan library reshade-shaders", "ReshadeNotInstalled": "Kamu belum memasang vkBasalt dan library reshade-shaders",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Pembuat", "Author": "Pembuat",
"NoImages": "Tidak ada gambar ditambahkan", "NoImages": "Tidak ada gambar ditambahkan",
"SettingsTitle": "Pengaturan", "SettingsTitle": "Pengaturan",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "ホームボタンを使用してゲーム内のシェーダを切り替えます", "ToggleShadersText": "ホームボタンを使用してゲーム内のシェーダを切り替えます",
"Shaders": "シェーダ", "Shaders": "シェーダ",
"ReshadeNotInstalled": "vkBasaltとreshade-shadersライブラリをインストールしていません", "ReshadeNotInstalled": "vkBasaltとreshade-shadersライブラリをインストールしていません",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "著者", "Author": "著者",
"NoImages": "画像は追加されていません", "NoImages": "画像は追加されていません",
"SettingsTitle": "設定", "SettingsTitle": "設定",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "홈 버튼을 사용하여 게임에서 쉐이더를 전환하십시오", "ToggleShadersText": "홈 버튼을 사용하여 게임에서 쉐이더를 전환하십시오",
"Shaders": "쉐이더", "Shaders": "쉐이더",
"ReshadeNotInstalled": "vkBasalt 및 reshade-shaders 라이브러리를 설치하지 않았습니다", "ReshadeNotInstalled": "vkBasalt 및 reshade-shaders 라이브러리를 설치하지 않았습니다",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "저자", "Author": "저자",
"NoImages": "추가 된 이미지 없음", "NoImages": "추가 된 이미지 없음",
"SettingsTitle": "설정", "SettingsTitle": "설정",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Используйте кнопку Home для переключения шейдеров в игре", "ToggleShadersText": "Используйте кнопку Home для переключения шейдеров в игре",
"Shaders": "Шейдеры", "Shaders": "Шейдеры",
"ReshadeNotInstalled": "Вы не установили vkBasalt и библиотеку reshade-shaders", "ReshadeNotInstalled": "Вы не установили vkBasalt и библиотеку reshade-shaders",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Автор", "Author": "Автор",
"NoImages": "Изображения не добавлены", "NoImages": "Изображения не добавлены",
"SettingsTitle": "Настройки", "SettingsTitle": "Настройки",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "Settings", "SettingsTitle": "Settings",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "设置", "SettingsTitle": "设置",

View file

@ -10,6 +10,7 @@
"ToggleShadersText": "Use Home button to toggle shaders in the game", "ToggleShadersText": "Use Home button to toggle shaders in the game",
"Shaders": "Shaders", "Shaders": "Shaders",
"ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library", "ReshadeNotInstalled": "You haven't installed vkBasalt and reshade-shaders library",
"GameModeNotInstalled": "You don't have GameMode installed",
"Author": "Author", "Author": "Author",
"NoImages": "No images added", "NoImages": "No images added",
"SettingsTitle": "設定", "SettingsTitle": "設定",

View file

@ -178,10 +178,16 @@ $(() => {
fs.writeFileSync(launcherShadersFile, fs.readFileSync(userShadersFile)); fs.writeFileSync(launcherShadersFile, fs.readFileSync(userShadersFile));
} }
let cmd = `${wineExeutable} launcher.bat`;
if (LauncherLib.getConfig('gamemode')) {
cmd = `gamemoderun ${cmd}`;
}
// Starting the game // Starting the game
const startTime = Date.now(); const startTime = Date.now();
exec(`${wineExeutable} launcher.bat`, { exec(cmd, {
cwd: constants.gameDir, cwd: constants.gameDir,
env: { env: {
...process.env, ...process.env,

View file

@ -32,6 +32,7 @@ const config = new store ({
playtime: 0, // Number of seconds user spent in game playtime: 0, // Number of seconds user spent in game
hud: 'none', // none / dxvk / mangohud hud: 'none', // none / dxvk / mangohud
shaders: 'none', // none / shader's folder shaders: 'none', // none / shader's folder
gamemode: false,
// Version of the game we asked about analytics last time, // Version of the game we asked about analytics last time,
// or null if user said don't ask him again // or null if user said don't ask him again

View file

@ -107,6 +107,25 @@ $(() => {
ipcRenderer.send('rpc-toggle'); ipcRenderer.send('rpc-toggle');
}); });
/**
* GameMode
*/
let gameModeAvailable = 0;
process.env.PATH?.split(':').forEach(path => gameModeAvailable |= fs.existsSync(`${path}/gamemoderun`));
if(!gameModeAvailable)
$(`<p>⚠️ ${LauncherUI.i18n.translate('GameModeNotInstalled')}</p>`).insertAfter('#gamemode');
if (LauncherLib.getConfig("gamemode"))
$("#gamemode").addClass("checkbox-active");
$("#gamemode").on("classChange", () => {
LauncherLib.updateConfig("gamemode",$("#gamemode").hasClass("checkbox-active"));
ipcRenderer.send("rpc-toggle");
});
/** /**
* Shaders * Shaders
*/ */