From a80414adb9b19c4ec446aabaf6a16d3980c82f66 Mon Sep 17 00:00:00 2001 From: trippjoe Date: Sun, 27 Mar 2022 22:55:07 -0400 Subject: [PATCH] getting the iso file from the user and extracting the assets working properly --- src/assets/scripts/batch/extract-iso.bat | 8 ++++++++ src/html/index.html | 2 +- src/index.js | 5 +++-- src/js/render.js | 5 +++++ src/js/utils/iso.js | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 src/assets/scripts/batch/extract-iso.bat diff --git a/src/assets/scripts/batch/extract-iso.bat b/src/assets/scripts/batch/extract-iso.bat new file mode 100644 index 0000000..69c768c --- /dev/null +++ b/src/assets/scripts/batch/extract-iso.bat @@ -0,0 +1,8 @@ +:: mount the ISO File +PowerShell Mount-DiskImage -ImagePath "%USERPROFILE%\AppData\Roaming\opengoal-launcher\iso\jak.iso" + +:: extract the folders & files from the ISO File +xcopy G:\*.* %USERPROFILE%\AppData\Roaming\opengoal-launcher\iso\jak1\. /E /Y + +:: unmount the ISO File +PowerShell Dismount-DiskImage -ImagePath "%USERPROFILE%\AppData\Roaming\opengoal-launcher\iso\jak.iso" \ No newline at end of file diff --git a/src/html/index.html b/src/html/index.html index e40f6a6..325af0e 100644 --- a/src/html/index.html +++ b/src/html/index.html @@ -35,7 +35,7 @@
- +
diff --git a/src/index.js b/src/index.js index 127d7a5..b834409 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ const { app, BrowserWindow, ipcMain } = require('electron'); const path = require('path'); const isDev = !app.isPackaged; const { launchGame, buildGame, isoSeries, fetchLatestCommit } = require('./js/utils/utils.js'); +let mainWindow; // Handle creating/removing shortcuts on Windows when installing/uninstalling. if (require('electron-squirrel-startup')) { @@ -11,7 +12,7 @@ if (require('electron-squirrel-startup')) { const createWindow = () => { // Create the browser window. - const mainWindow = new BrowserWindow({ + mainWindow = new BrowserWindow({ width: 800, height: 600, resizable: false, @@ -71,5 +72,5 @@ ipcMain.on('build', buildGame); ipcMain.on('launch', launchGame); app.on('status', (status) => { - win.webContents.send('status', status); + mainWindow.webContents.send('status', status); }); \ No newline at end of file diff --git a/src/js/render.js b/src/js/render.js index af1ef70..4313d41 100644 --- a/src/js/render.js +++ b/src/js/render.js @@ -9,6 +9,7 @@ const offcanvas = document.querySelector(".offcanvas-start"); let backdrop = document.querySelector('.offcanvas-backdrop'); const background = document.querySelector('#background'); const logo = document.querySelector('#logo'); +const configButton = document.querySelector("#config"); const { recieve, send } = window.api; @@ -57,4 +58,8 @@ function changeGame(game) { logo.src = "../assets/images/jak1-logo.png"; break; } +} + +function config() { + send('getISO'); } \ No newline at end of file diff --git a/src/js/utils/iso.js b/src/js/utils/iso.js index 98e07b4..dc8ff5a 100644 --- a/src/js/utils/iso.js +++ b/src/js/utils/iso.js @@ -70,7 +70,7 @@ function extractISOFile(callback) { // } if (process.platform === 'win32') { - const extractISOScript = path.join(__dirname, '../../src/assets/scripts/batch/extract-iso.bat'); + const extractISOScript = path.join(__dirname, '../../assets/scripts/batch/extract-iso.bat'); shell.openPath(extractISOScript); // copy the iso contents to the jak1 folder created above