mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-26 06:41:47 -03:00
fix hardcoded branch + pre-release/release issue
This commit is contained in:
@@ -168,6 +168,8 @@ function setupSettingsElements() {
|
|||||||
gpuPreferenceRadios = document.querySelectorAll('input[name="gpuPreference"]');
|
gpuPreferenceRadios = document.querySelectorAll('input[name="gpuPreference"]');
|
||||||
gameBranchRadios = document.querySelectorAll('input[name="gameBranch"]');
|
gameBranchRadios = document.querySelectorAll('input[name="gameBranch"]');
|
||||||
|
|
||||||
|
console.log('[Settings] gameBranchRadios found:', gameBranchRadios.length);
|
||||||
|
|
||||||
|
|
||||||
// UUID Management elements
|
// UUID Management elements
|
||||||
currentUuidDisplay = document.getElementById('currentUuid');
|
currentUuidDisplay = document.getElementById('currentUuid');
|
||||||
@@ -541,7 +543,8 @@ document.addEventListener('DOMContentLoaded', initSettings);
|
|||||||
|
|
||||||
window.SettingsAPI = {
|
window.SettingsAPI = {
|
||||||
getCurrentJavaPath,
|
getCurrentJavaPath,
|
||||||
getCurrentPlayerName
|
getCurrentPlayerName,
|
||||||
|
reloadBranch: loadVersionBranch
|
||||||
};
|
};
|
||||||
|
|
||||||
async function loadCurrentUuid() {
|
async function loadCurrentUuid() {
|
||||||
@@ -1078,11 +1081,13 @@ async function loadVersionBranch() {
|
|||||||
console.log('[Settings] Selected branch:', selectedBranch);
|
console.log('[Settings] Selected branch:', selectedBranch);
|
||||||
|
|
||||||
// Update radio buttons
|
// Update radio buttons
|
||||||
if (gameBranchRadios) {
|
if (gameBranchRadios && gameBranchRadios.length > 0) {
|
||||||
gameBranchRadios.forEach(radio => {
|
gameBranchRadios.forEach(radio => {
|
||||||
radio.checked = radio.value === selectedBranch;
|
radio.checked = radio.value === selectedBranch;
|
||||||
console.log(`[Settings] Radio ${radio.value}: ${radio.checked ? 'checked' : 'unchecked'}`);
|
console.log(`[Settings] Radio ${radio.value}: ${radio.checked ? 'checked' : 'unchecked'}`);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.warn('[Settings] gameBranchRadios not found or empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedBranch;
|
return selectedBranch;
|
||||||
|
|||||||
@@ -29,6 +29,15 @@ function showPage(pageId) {
|
|||||||
if (page.id === pageId) {
|
if (page.id === pageId) {
|
||||||
page.classList.add('active');
|
page.classList.add('active');
|
||||||
page.style.display = '';
|
page.style.display = '';
|
||||||
|
|
||||||
|
// Reload settings when settings page becomes visible
|
||||||
|
if (pageId === 'settings-page') {
|
||||||
|
console.log('[UI] Settings page activated, reloading branch...');
|
||||||
|
// Dynamically import and call loadVersionBranch from settings
|
||||||
|
if (window.SettingsAPI && window.SettingsAPI.reloadBranch) {
|
||||||
|
window.SettingsAPI.reloadBranch();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
page.classList.remove('active');
|
page.classList.remove('active');
|
||||||
page.style.display = 'none';
|
page.style.display = 'none';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const { loadVersionBranch } = require('./config');
|
||||||
|
|
||||||
function getAppDir() {
|
function getAppDir() {
|
||||||
const home = os.homedir();
|
const home = os.homedir();
|
||||||
@@ -48,8 +49,20 @@ function expandHome(inputPath) {
|
|||||||
const APP_DIR = DEFAULT_APP_DIR;
|
const APP_DIR = DEFAULT_APP_DIR;
|
||||||
const CACHE_DIR = path.join(APP_DIR, 'cache');
|
const CACHE_DIR = path.join(APP_DIR, 'cache');
|
||||||
const TOOLS_DIR = path.join(APP_DIR, 'butler');
|
const TOOLS_DIR = path.join(APP_DIR, 'butler');
|
||||||
const GAME_DIR = path.join(APP_DIR, 'release', 'package', 'game', 'latest');
|
|
||||||
const JRE_DIR = path.join(APP_DIR, 'release', 'package', 'jre', 'latest');
|
// Dynamic GAME_DIR and JRE_DIR based on version_branch from config
|
||||||
|
function getGameDir() {
|
||||||
|
const branch = loadVersionBranch();
|
||||||
|
return path.join(APP_DIR, branch, 'package', 'game', 'latest');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getJreDir() {
|
||||||
|
const branch = loadVersionBranch();
|
||||||
|
return path.join(APP_DIR, branch, 'package', 'jre', 'latest');
|
||||||
|
}
|
||||||
|
|
||||||
|
const GAME_DIR = getGameDir();
|
||||||
|
const JRE_DIR = getJreDir();
|
||||||
const PLAYER_ID_FILE = path.join(APP_DIR, 'player_id.json');
|
const PLAYER_ID_FILE = path.join(APP_DIR, 'player_id.json');
|
||||||
|
|
||||||
function getClientCandidates(gameLatest) {
|
function getClientCandidates(gameLatest) {
|
||||||
@@ -156,7 +169,8 @@ async function getModsPath(customInstallPath = null) {
|
|||||||
installPath = getAppDir();
|
installPath = getAppDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
const gameLatest = path.join(installPath, 'release', 'package', 'game', 'latest');
|
const branch = loadVersionBranch();
|
||||||
|
const gameLatest = path.join(installPath, branch, 'package', 'game', 'latest');
|
||||||
|
|
||||||
const userDataPath = findUserDataPath(gameLatest);
|
const userDataPath = findUserDataPath(gameLatest);
|
||||||
|
|
||||||
@@ -195,7 +209,8 @@ function getProfilesDir(customInstallPath = null) {
|
|||||||
}
|
}
|
||||||
if (!installPath) installPath = getAppDir();
|
if (!installPath) installPath = getAppDir();
|
||||||
|
|
||||||
const gameLatest = path.join(installPath, 'release', 'package', 'game', 'latest');
|
const branch = loadVersionBranch();
|
||||||
|
const gameLatest = path.join(installPath, branch, 'package', 'game', 'latest');
|
||||||
const userDataPath = findUserDataPath(gameLatest);
|
const userDataPath = findUserDataPath(gameLatest);
|
||||||
const profilesDir = path.join(userDataPath, 'Profiles');
|
const profilesDir = path.join(userDataPath, 'Profiles');
|
||||||
|
|
||||||
@@ -219,6 +234,8 @@ module.exports = {
|
|||||||
TOOLS_DIR,
|
TOOLS_DIR,
|
||||||
GAME_DIR,
|
GAME_DIR,
|
||||||
JRE_DIR,
|
JRE_DIR,
|
||||||
|
getGameDir,
|
||||||
|
getJreDir,
|
||||||
PLAYER_ID_FILE,
|
PLAYER_ID_FILE,
|
||||||
getClientCandidates,
|
getClientCandidates,
|
||||||
findClientPath,
|
findClientPath,
|
||||||
|
|||||||
@@ -446,7 +446,11 @@ function isGameInstalled(branchOverride = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function installGame(playerName = 'Player', progressCallback, javaPathOverride, installPathOverride, branchOverride = null) {
|
async function installGame(playerName = 'Player', progressCallback, javaPathOverride, installPathOverride, branchOverride = null) {
|
||||||
const branch = branchOverride || loadVersionBranch();
|
console.log(`[InstallGame] branchOverride parameter received: ${branchOverride}`);
|
||||||
|
const loadedBranch = loadVersionBranch();
|
||||||
|
console.log(`[InstallGame] loadVersionBranch() returned: ${loadedBranch}`);
|
||||||
|
const branch = branchOverride || loadedBranch;
|
||||||
|
console.log(`[InstallGame] Final branch selected: ${branch}`);
|
||||||
const customAppDir = getResolvedAppDir(installPathOverride);
|
const customAppDir = getResolvedAppDir(installPathOverride);
|
||||||
const customCacheDir = path.join(customAppDir, 'cache');
|
const customCacheDir = path.join(customAppDir, 'cache');
|
||||||
const customToolsDir = path.join(customAppDir, 'butler');
|
const customToolsDir = path.join(customAppDir, 'butler');
|
||||||
|
|||||||
12
main.js
12
main.js
@@ -392,7 +392,12 @@ ipcMain.handle('launch-game', async (event, playerName, javaPath, installPath, g
|
|||||||
|
|
||||||
ipcMain.handle('install-game', async (event, playerName, javaPath, installPath, branch) => {
|
ipcMain.handle('install-game', async (event, playerName, javaPath, installPath, branch) => {
|
||||||
try {
|
try {
|
||||||
console.log(`[IPC] install-game called with branch: ${branch || 'default'}`);
|
console.log(`[IPC] install-game called with parameters:`);
|
||||||
|
console.log(` - playerName: ${playerName}`);
|
||||||
|
console.log(` - javaPath: ${javaPath}`);
|
||||||
|
console.log(` - installPath: ${installPath}`);
|
||||||
|
console.log(` - branch: ${branch}`);
|
||||||
|
console.log(`[IPC] branch type: ${typeof branch}, value: ${JSON.stringify(branch)}`);
|
||||||
|
|
||||||
// Signal installation start
|
// Signal installation start
|
||||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
@@ -747,8 +752,9 @@ ipcMain.handle('open-external', async (event, url) => {
|
|||||||
|
|
||||||
ipcMain.handle('open-game-location', async () => {
|
ipcMain.handle('open-game-location', async () => {
|
||||||
try {
|
try {
|
||||||
const { getResolvedAppDir } = require('./backend/launcher');
|
const { getResolvedAppDir, loadVersionBranch } = require('./backend/launcher');
|
||||||
const gameDir = path.join(getResolvedAppDir(), 'release', 'package', 'game');
|
const branch = loadVersionBranch();
|
||||||
|
const gameDir = path.join(getResolvedAppDir(), branch, 'package', 'game');
|
||||||
|
|
||||||
if (fs.existsSync(gameDir)) {
|
if (fs.existsSync(gameDir)) {
|
||||||
await shell.openPath(gameDir);
|
await shell.openPath(gameDir);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const { contextBridge, ipcRenderer } = require('electron');
|
|||||||
|
|
||||||
contextBridge.exposeInMainWorld('electronAPI', {
|
contextBridge.exposeInMainWorld('electronAPI', {
|
||||||
launchGame: (playerName, javaPath, installPath, gpuPreference) => ipcRenderer.invoke('launch-game', playerName, javaPath, installPath, gpuPreference),
|
launchGame: (playerName, javaPath, installPath, gpuPreference) => ipcRenderer.invoke('launch-game', playerName, javaPath, installPath, gpuPreference),
|
||||||
installGame: (playerName, javaPath, installPath) => ipcRenderer.invoke('install-game', playerName, javaPath, installPath),
|
installGame: (playerName, javaPath, installPath, branch) => ipcRenderer.invoke('install-game', playerName, javaPath, installPath, branch),
|
||||||
closeWindow: () => ipcRenderer.invoke('window-close'),
|
closeWindow: () => ipcRenderer.invoke('window-close'),
|
||||||
minimizeWindow: () => ipcRenderer.invoke('window-minimize'),
|
minimizeWindow: () => ipcRenderer.invoke('window-minimize'),
|
||||||
maximizeWindow: () => ipcRenderer.invoke('window-maximize'),
|
maximizeWindow: () => ipcRenderer.invoke('window-maximize'),
|
||||||
|
|||||||
Reference in New Issue
Block a user