feat: Add option to toggle hardware acceleration for launcher #170

This commit is contained in:
Rahul-Sahani04
2026-01-25 21:08:47 +05:30
parent 2a5780c2d4
commit f0f19f690f
8 changed files with 422 additions and 308 deletions

View File

@@ -166,13 +166,22 @@ function loadCloseLauncherOnStart() {
return config.closeLauncherOnStart !== undefined ? config.closeLauncherOnStart : false;
}
function saveLauncherHardwareAcceleration(enabled) {
saveConfig({ launcherHardwareAcceleration: !!enabled });
}
function loadLauncherHardwareAcceleration() {
const config = loadConfig();
return config.launcherHardwareAcceleration !== undefined ? config.launcherHardwareAcceleration : true;
}
function saveModsToConfig(mods) {
try {
const config = loadConfig();
// Config migration handles structure, but mod saves must go to the ACTIVE profile.
// Global installedMods is kept mainly for reference/migration.
// The profile is the source of truth for enabled mods.
// Config migration handles structure, but mod saves must go to the ACTIVE profile.
// Global installedMods is kept mainly for reference/migration.
// The profile is the source of truth for enabled mods.
if (config.activeProfileId && config.profiles && config.profiles[config.activeProfileId]) {
@@ -369,6 +378,11 @@ module.exports = {
// Close Launcher export
saveCloseLauncherOnStart,
loadCloseLauncherOnStart,
// Hardware Acceleration functions
saveLauncherHardwareAcceleration,
loadLauncherHardwareAcceleration,
// Version Management exports
saveVersionClient,
loadVersionClient,

View File

@@ -19,6 +19,12 @@ const {
loadLanguage,
saveCloseLauncherOnStart,
loadCloseLauncherOnStart,
// Hardware Acceleration
saveLauncherHardwareAcceleration,
loadLauncherHardwareAcceleration,
saveModsToConfig,
loadModsFromConfig,
getUuidForUser,
@@ -125,20 +131,24 @@ module.exports = {
// Discord RPC functions
saveDiscordRPC,
loadDiscordRPC,
// Language functions
saveLanguage,
loadLanguage,
// Close Launcher functions
saveCloseLauncherOnStart,
loadCloseLauncherOnStart,
// Hardware Acceleration functions
saveLauncherHardwareAcceleration,
loadLauncherHardwareAcceleration,
// GPU Preference functions
saveGpuPreference,
loadGpuPreference,
detectGpu,
// Version functions
getLatestClientVersion,
saveVersionClient,