mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-20 04:57:38 -04:00
pushing console messages to the front-end
This commit is contained in:
parent
81035e5854
commit
e3b755536d
10
src/index.js
10
src/index.js
|
@ -71,6 +71,12 @@ ipcMain.handle('checkUpdates', async () => {
|
|||
ipcMain.on('build', buildGame);
|
||||
ipcMain.on('launch', launchGame);
|
||||
|
||||
app.on('status', (status) => {
|
||||
mainWindow.webContents.send('status', status);
|
||||
// handle config status updates
|
||||
app.on('status', (value) => {
|
||||
mainWindow.webContents.send('status', value);
|
||||
});
|
||||
|
||||
// handle console messages
|
||||
app.on('console', (value) => {
|
||||
mainWindow.webContents.send('console', value);
|
||||
});
|
||||
|
|
|
@ -15,5 +15,6 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
|||
ipcRenderer.on(channel, (event, ...args) => func(...args));
|
||||
}
|
||||
},
|
||||
handleStatus: (callback) => ipcRenderer.on('status', callback)
|
||||
handleStatus: (callback) => ipcRenderer.on('status', callback),
|
||||
handleConsole: (callback) => ipcRenderer.on('console', callback)
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@ const background = document.querySelector('#background');
|
|||
// const logo = document.querySelector('#logo');
|
||||
const configButton = document.querySelector("#config");
|
||||
|
||||
const { send, receive, handleStatus } = window.electronAPI;
|
||||
const { send, receive, handleStatus, handleConsole } = window.electronAPI;
|
||||
|
||||
function openNav() {
|
||||
container.style.marginLeft = "100px";
|
||||
|
@ -71,4 +71,8 @@ function launch() {
|
|||
|
||||
handleStatus((event, value) => {
|
||||
console.log(value);
|
||||
});
|
||||
|
||||
handleConsole((event, value) => {
|
||||
console.log(value);
|
||||
});
|
|
@ -111,7 +111,10 @@ function runDecompiler(callback) {
|
|||
updateStatus('Decompiling the ISO File');
|
||||
let decomp = exec(decompScript, { shell: true, cwd: path.join(jakprojectPath, '/scripts/batch/') });
|
||||
|
||||
decomp.stdout.on('data', data => console.log(data));
|
||||
decomp.stdout.on('data', data => {
|
||||
console.log(data);
|
||||
app.emit('console', data);
|
||||
});
|
||||
|
||||
// i see people online saying to use decomp.on('exit'), but thats triggering this listener immediately upon running
|
||||
decomp.on('close', (code => {
|
||||
|
|
|
@ -30,6 +30,7 @@ function buildGame(callback) {
|
|||
let build = execFile(compilerScript, ['-v', '-auto-user'], { timeout: 30000 });
|
||||
build.stdout.on('data', data => {
|
||||
console.log(data.toString().trim());
|
||||
app.emit('console', data);
|
||||
if (data.includes('[100%]')) {
|
||||
updateStatus('Compiled game successfully!');
|
||||
callback(null, 'Compiled game successfully!');
|
||||
|
@ -66,7 +67,10 @@ function launchGame() {
|
|||
|
||||
if (launchScript) {
|
||||
let launcher = execFile(launchScript, ['-boot', '-fakeiso', '-debug', '-v'], { shell: true });
|
||||
launcher.stdout.on('data', data => console.log(data));
|
||||
launcher.stdout.on('data', data => {
|
||||
console.log(data);
|
||||
app.emit('console', data);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue