mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-20 04:57:38 -04:00
cleanup: remove some now irrelevant files
This commit is contained in:
parent
41c580954e
commit
7808e185df
|
@ -1,71 +0,0 @@
|
|||
import { appDir, join } from '@tauri-apps/api/path';
|
||||
import { Command } from '@tauri-apps/api/shell';
|
||||
import { platform } from '@tauri-apps/api/os';
|
||||
|
||||
// extract game files from iso -> into jak-project/iso_data/jak1 dir
|
||||
export async function extract() {
|
||||
const userDir = await appDir();
|
||||
const workingDir = await join(userDir, '/');
|
||||
const outputDir = await join(userDir, '/jak-project/iso_data/jak1/');
|
||||
const isoDir = await join(userDir, '/iso/jak.iso');
|
||||
|
||||
console.log(workingDir);
|
||||
console.log(outputDir);
|
||||
console.log(isoDir);
|
||||
|
||||
const extract = new Command('extract-windows', ['x', isoDir, 'y', `-w${userDir}`, `-o${outputDir}`]);
|
||||
extract.on('close', data => {
|
||||
console.log(`Extraction finished with code ${data.code} and signal ${data.signal}`);
|
||||
if (data.code === 0) {
|
||||
return 'Extraction finished';
|
||||
}
|
||||
throw new Error('Extraction exited with code:', data.code);
|
||||
});
|
||||
extract.on('error', error => {
|
||||
console.log(`Decomp error: "${error}"`);
|
||||
throw new Error('Extraction failed!');
|
||||
});
|
||||
extract.stdout.on('data', line => {
|
||||
console.log(`Extract stdout: "${line}"`)
|
||||
});
|
||||
|
||||
const child = await extract.spawn();
|
||||
}
|
||||
|
||||
// x: extract with full paths
|
||||
// -y: yes to all prompts
|
||||
// -w: working directory (appdata/opengoal-launcher dir)
|
||||
// -o: output directory (appdata/opengoal-launcher dir/jak-project/iso_data/jak1/)
|
||||
|
||||
|
||||
// const task = spawn(_7z, ['x', isoFilePath, '-y', `-w${workingDirPath}`, `-o${outputDirPath}`]);
|
||||
|
||||
|
||||
// task.stdout.on('data', (data) => {
|
||||
// console.log('stdout: ', data.toString('utf8'));
|
||||
// });
|
||||
// task.stderr.on('data', (data) => {
|
||||
// console.log('stderr: ', data.toString('utf8'));
|
||||
// });
|
||||
// task.on('close', (code, signal) => {
|
||||
// console.log('Exited with code: ', code);
|
||||
// if (code === 0) {
|
||||
// callback(null, 'ISO assests extracted successfully');
|
||||
// return;
|
||||
// } else {
|
||||
// callback(signal, null);
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
|
||||
// function macISOExtract() {
|
||||
// if (process.platform === 'darwin') {
|
||||
// const isoFile = path.join(isoSavePath, '/jak.iso');
|
||||
// const output = path.join(isoSavePath, '/jak1');
|
||||
// const archive = new ArchiveHdi(isoFile);
|
||||
// await archive.read(async entry => {
|
||||
// console.log(entry.path);
|
||||
// await entry.extract(`${output}/${entry.path}`);
|
||||
// });
|
||||
// }
|
||||
// }
|
|
@ -1,91 +0,0 @@
|
|||
import { extract } from './extract';
|
||||
import { message, open } from '@tauri-apps/api/dialog';
|
||||
import { platform } from '@tauri-apps/api/os';
|
||||
import { appDir, join } from '@tauri-apps/api/path';
|
||||
import { copyFile, createDir, readDir } from '@tauri-apps/api/fs';
|
||||
import { Command } from '@tauri-apps/api/shell';
|
||||
import { buildGame } from './launch';
|
||||
|
||||
const userDir = await appDir();
|
||||
let jakISOPath;
|
||||
|
||||
async function getISO() {
|
||||
const isoPath = await open({ multiple: false, directory: false, filters: [{ extensions: ['ISO'], name: 'Jak ISO File' }] });
|
||||
|
||||
if (isoPath) {
|
||||
jakISOPath = isoPath;
|
||||
return 'Got the ISO File';
|
||||
}
|
||||
throw new Error('No ISO File Selected');
|
||||
}
|
||||
|
||||
async function copyJakISO() {
|
||||
const destinationPath = await join(userDir, '/iso/');
|
||||
|
||||
try {
|
||||
const files = await readDir(destinationPath);
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
await createDir(destinationPath);
|
||||
}
|
||||
|
||||
const destination = await join(userDir, '/iso/jak.iso');
|
||||
console.log("Copy Destination:", destination);
|
||||
const copyout = await copyFile(jakISOPath, destination);
|
||||
return 'Copied ISO to proper directory!';
|
||||
|
||||
}
|
||||
|
||||
async function runDecompiler() {
|
||||
const userPlatform = await platform();
|
||||
const jakprojectPath = await join(await userDir, '/jak-project');
|
||||
const jakDecompPath = await join(userDir, '/jak-project/scripts/batch/');
|
||||
let decompCommand;
|
||||
|
||||
switch (userPlatform) {
|
||||
case 'win32':
|
||||
decompCommand = 'decomp-windows';
|
||||
break;
|
||||
case 'darwin':
|
||||
decompCommand = 'decomp-mac';
|
||||
throw new Error('Unsupported OS');
|
||||
break;
|
||||
case 'linux':
|
||||
decompCommand = 'decomp-linux';
|
||||
throw new Error('Unsupported OS');
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported OS');
|
||||
break;
|
||||
}
|
||||
|
||||
const decomp = new Command(decompCommand, null, { cwd: jakDecompPath });
|
||||
decomp.on('close', data => {
|
||||
console.log(`Decomp finished with code ${data.code} and signal ${data.signal}`);
|
||||
return 'Decomp finished close';
|
||||
});
|
||||
decomp.on('error', error => {
|
||||
console.log(`Decomp error: "${error}"`);
|
||||
});
|
||||
decomp.stdout.on('data', line => {
|
||||
console.log(`Decomp stdout: "${line}"`)
|
||||
if (line.includes('Disassembly has completed successfully')) {
|
||||
return 'Decomp finished successful';
|
||||
}
|
||||
});
|
||||
|
||||
const child = await decomp.execute();
|
||||
}
|
||||
|
||||
export async function isoSeries() {
|
||||
return await Promise.resolve()
|
||||
.then(getISO)
|
||||
.then(copyJakISO)
|
||||
.then(runDecompiler)
|
||||
.then(buildGame)
|
||||
.then(res => message(res))
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
message(err.message);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue