const { app, BrowserWindow } = require('electron'); const path = require('path'); // --- STABILITY FIXES --- // Fix for "GPU process exited unexpectedly" and black screen issues // app.disableHardwareAcceleration(); // CAUSES GARBAGE TEXT? app.commandLine.appendSwitch('no-sandbox'); app.commandLine.appendSwitch('disable-gpu'); // Try just disabling GPU // app.commandLine.appendSwitch('disable-software-rasterizer'); function createWindow() { const win = new BrowserWindow({ width: 1280, height: 720, webPreferences: { nodeIntegration: false, contextIsolation: true, webSecurity: false, // DISABLE SECURITY to allow local file loading // preload: path.join(__dirname, 'preload.js') // Optional }, icon: path.join(__dirname, 'assets/DEMO_FAZA1/Characters/gronk_walk_sheet.png') }); // Revert to relative path which usually works better in ASAR // win.loadFile('index.html'); // Robust file loading using loadURL and absolute path win.loadURL('file://' + path.join(__dirname, 'index.html')); // Redirect renderer logs to terminal win.webContents.on('console-message', (event, level, message, line, sourceId) => { console.log(`[Renderer] ${message} (${sourceId}:${line})`); }); // Uncomment to open DevTools by default win.webContents.openDevTools(); } app.whenReady().then(() => { createWindow(); app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow(); } }); }); app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } });