App: fix some stuff and make this mess run on linux

This commit is contained in:
themitosan 2024-04-07 17:13:21 -03:00
parent a84595874c
commit 30c0a47d01
8 changed files with 125 additions and 117 deletions

4
.gitignore vendored
View file

@ -44,12 +44,16 @@ Thumbs.db
*.wmv
# fpPS4 Temmie's Launcher files / folders
Settings.json
Settings/
Assets/
Games/
Build/
build/
cache/
Cache/
fpPS4/
Nwjs/
Emu/
*.inc
*.ttf

View file

@ -105,7 +105,7 @@
<script type="text/javascript" src="js/settings.js"></script>
<script type="text/javascript" src="js/paramSfo.js"></script>
<script type="text/javascript" src="js/input.js"></script>
<script type="text/javascript" src="js/gamelist.js"></script>
<script type="text/javascript" src="js/gameList.js"></script>
<script type="text/javascript" src="js/emumanager.js"></script>
<script type="text/javascript" src="js/interpreter.js"></script>

View file

@ -378,8 +378,8 @@ temp_DESIGN = {
const settingsData = APP.settings.data;
// Update CSS
TMS.css('APP_CANVAS_BG_COLOR', {'background-image': 'linear-gradient(140deg, ' + settingsData.backgroundGradient.toString() + ')'});
TMS.css('APP_CANVAS', {'box-shadow': '0px 0px 120px ' + settingsData.backgroundGradient[0] + '90'});
TMS.css('APP_CANVAS_BG_COLOR', {'background-image': `linear-gradient(140deg, ${settingsData.backgroundGradient.toString()})`});
TMS.css('APP_CANVAS', {'box-shadow': `0px 0px 120px ${settingsData.backgroundGradient[0]}90`});
// End
return 0;
@ -406,29 +406,21 @@ temp_DESIGN = {
// Cache all images on img dir
cacheImagesBoot: function(){
// Variables
// Create vars and process img path
var htmlTemp = '<div class="none" id="IMG_CACHE_DIV">';
APP.tools.getDirFiles(`${APP.settings.appPath}/img`).forEach(function(cImg){
// Process img path
APP.tools.getDirFiles(APP.settings.appPath + '/img').forEach(function(cImg){
// Fix path
// Fix path and check if current entry is a file
const cDir = APP.tools.fixPath(cImg);
// Check if current entry is a file
if (APP.path.parse(cDir).ext !== '') {
APP.log.add({
data: 'INFO - (Design) Caching image: ' + cDir
});
htmlTemp = htmlTemp + '<img src="' + cDir + '">';
APP.log.add({ data: `INFO - (Design) Caching image: ${cDir}` });
htmlTemp = htmlTemp + `<img src="file://${cDir}">`;
}
});
// Append HTML
TMS.append('ASSETS_LIST', htmlTemp + '</div>');
// End
TMS.append('ASSETS_LIST', `${htmlTemp}</div>`);
return 0;
},
@ -475,7 +467,6 @@ temp_DESIGN = {
var nextBtn = '',
prevBtn = '',
entryClass = '',
metadataTemplate = '',
gList = Object.keys(APP.gameList.list),
displayMode = APP.settings.data.gameListMode,
tempHtml = APP.lang.getVariable('gameList_errorEntryListEmpty');
@ -563,7 +554,6 @@ temp_DESIGN = {
// Get entry name from PARAM.SFO and set metadata html
if (Object.keys(entryMetadata.paramSfo).length !== 0){
entryName = entryMetadata.paramSfo['TITLE' + langId];
metadataHtml = getMetadataInfo(displayMode, {name: entryName, status: entryMetadata.status, missingFiles: APP.tools.convertArrayToString(entryMetadata.missingFiles),
info: entryMetadata.paramSfo.TITLE_ID + ' - ' + APP.lang.getVariable('gameList_entryVersion', [entryMetadata.paramSfo.VERSION])});
@ -686,7 +676,7 @@ temp_DESIGN = {
}
// Set background image
TMS.css('APP_CANVAS_BG', {'background-image': 'url(\"' + entryMetadata.img_background + '\")'});
TMS.css('APP_CANVAS_BG', {'background-image': `url(\"${entryMetadata.img_background}\")`});
// Check if app is loading
if (APP.settings.appIsLoading === !0){

View file

@ -23,7 +23,16 @@ temp_EMUMANAGER = {
loadErrorReason: '',
// Hack list
hackList: {},
hackList: {
'DEPTH_DISABLE_HACK': "Disables depth buffer",
'COMPUTE_DISABLE_HACK': "Disables compute shaders",
'MEMORY_BOUND_HACK': "Limits the amount of GPU allocated memory (iGPU)",
'IMAGE_TEST_HACK': "Always marks that the texture has changed",
'IMAGE_LOAD_HACK': "Never reload textures (improves performance on many games)",
'DISABLE_SRGB_HACK': "Disables hacked SRGB display",
'DISABLE_FMV_HACK': "Disables in-game movies",
'SKIP_UNKNOW_TILING': "Skip unknown tiling texture types"
},
// Selected game metadata
tempSettings: '',

View file

@ -157,6 +157,11 @@ temp_EXEC = {
data['exe'] = APP.path.parse(APP.settings.data.fpPS4_Path).base;
}
// Force running using log window if launcher is running on a non-windows os
if (APP.os.platform() !== 'win32'){
data.useLogWindow = !0;
}
// Run external window
if (data.useLogWindow === !0){
@ -191,15 +196,18 @@ temp_EXEC = {
parseArgs = data.args.toString().replace(RegExp(',', 'gi'), ' ').replace(data.args[data.args.indexOf('-e') + 1], gPath),
execLine = 'start ' + winMode + 'cmd /C ' + data.exe + ' ' + parseArgs + pressAnyKey;
// Check for non-windows OS
if (APP.os.platform() !== 'win32'){
execLine = `wine wineconsole "Z:${data.exe}" ${parseArgs}`;
}
// Exec process
APP.exec['processData'] = APP.childProcess.exec(execLine);
} else {
// Log on window console
// Log on window console and set stream as string (utf-8)
APP.exec['processData'] = APP.childProcess.spawn(APP.tools.fixPath(data.exe), data.args, {detached: !0});
// Set stream as string (UTF-8)
APP.exec.processData.stdout.setEncoding('utf8');
APP.exec.processData.stderr.setEncoding('utf8');

View file

@ -235,7 +235,7 @@ temp_GAMELIST = {
// Seek entry icon
for (var i = 0; i < iconList.length; i++){
if (APP.fs.existsSync(sceSysPath + iconList[i]) === !0){
finalMetadata.img_icon = sceSysPath + iconList[i];
finalMetadata.img_icon = `file://${sceSysPath}${iconList[i]}`;
break;
}
}
@ -243,7 +243,7 @@ temp_GAMELIST = {
// Seek entry background image
for (var i = 0; i < bgList.length; i++){
if (APP.fs.existsSync(sceSysPath + bgList[i]) === !0){
finalMetadata.img_background = sceSysPath + bgList[i];
finalMetadata.img_background = `file://${sceSysPath}${bgList[i]}`;
break;
}
}
@ -270,7 +270,7 @@ temp_GAMELIST = {
}
// Add image to be cached
var newImg = '<img src="' + finalMetadata.img_background + '">';
var newImg = `<img src="${finalMetadata.img_background}">`;
if (tempHtml.indexOf(newImg) === -1){
tempHtml = tempHtml + newImg;
}

View file

@ -160,6 +160,7 @@ window['APP'] = {
// Load modules
APP['fs'] = require('fs');
APP['os'] = require('os');
APP['win'] = nw.Window.get();
APP['path'] = require('path');
APP['https'] = require('https');

View file

@ -481,10 +481,8 @@ temp_SETTINGS = {
// Check if fpPS4 exists on selected path
if (APP.fs.existsSync(emuPath) === !1){
// Set default path
emuPath = APP.settings.nwPath + '/fpPS4/fpPS4.exe';
// Check if emu is found
// Set fpPS4 default path and check if it was found
emuPath = `${APP.settings.nwPath}/fpPS4/fpPS4.exe`;
if (APP.fs.existsSync(emuPath) === !1){
// Push error
@ -514,93 +512,91 @@ temp_SETTINGS = {
res, nextAction = 'fetchGitHubData',
enableHackString = ' -h <name> //enable hack\r';
// Create promise
return new Promise(function(resolve){
// HACK: For non-windows os
if (APP.os.platform() !== 'win32'){
APP.settings[nextAction](!0);
} else {
return new Promise(function(resolve){
// Get fpPS4 main output
APP.exec.run({exe: emuPath, useLogWindow: !1, printLog: !1, callback: function(exitCode){
// If exit code is ok
if (exitCode === 0){
// Reset hack list
APP.emumanager.hackList = {};
// Generate list
var outData = APP.exec.outputData.split('\n'),
hList = outData.splice((outData.indexOf(enableHackString) + 1));
// Check if is a valid fpPS4 file
if (outData.indexOf(enableHackString) !== -1){
// Process list
hList.forEach(function(cHack){
// Check if string is empty
if (cHack !== ''){
// Get hack data
var hackName = cHack.slice(0, cHack.indexOf('//')).replace(RegExp(' ', 'gi'), ''),
hackDesc = cHack.slice((cHack.indexOf('//') + 2), cHack.indexOf('\r'));
// Set hack data
APP.emumanager.hackList[hackName] = hackDesc;
// Log data
APP.log.add({data: 'INFO - (Setitngs) Updating hack list database (Loading ' + hackName + ')'});
}
});
} else {
throw new Error('This is not a valid fpPS4 executable!');
}
} else {
// Set default error type
var errorType = 'errorLoadHackList';
// Switch error types
switch (exitCode){
// Missing DLL
case 3221225781:
errorType = 'errorLoadHackListDLL';
break;
}
// Check if is on app is on boot process
if (isBootProcess === !0){
// Push error list
APP.settings.sLoadError.push(errorType);
nextAction = 'bootCheck';
}
}
// Load next action
if (isBootProcess === !0){
res = APP.settings[nextAction](!0);
} else {
// Check if callback exists
if (typeof cb === 'function'){
res = cb(exitCode);
}
}
// End
resolve(res);
}});
});
// Get fpPS4 main output
APP.exec.run({exe: emuPath, useLogWindow: !1, printLog: !1, callback: function(exitCode){
// If exit code is ok
if (exitCode === 0){
// Reset current hack list and generate new one
APP.emumanager.hackList = {};
var outData = APP.exec.outputData.split('\n'),
hList = outData.splice((outData.indexOf(enableHackString) + 1));
// Check if is a valid fpPS4 file
if (outData.indexOf(enableHackString) !== -1){
// Process updated entries
hList.forEach(function(cHack){
// Check if string is empty
if (cHack !== ''){
// Get hack data
var hackName = cHack.slice(0, cHack.indexOf('//')).replace(RegExp(' ', 'gi'), ''),
hackDesc = cHack.slice((cHack.indexOf('//') + 2), cHack.indexOf('\r'));
// Set hack data and add log
APP.emumanager.hackList[hackName] = hackDesc;
APP.log.add({data: `INFO - (Setitngs) Updating hack list database (Loading ${hackName})`});
}
});
} else {
throw new Error('This is not a valid fpPS4 executable!');
}
} else {
// Set default error type and process swicth
var errorType = 'errorLoadHackList';
switch (exitCode){
// Missing DLL
case 3221225781:
errorType = 'errorLoadHackListDLL';
break;
}
// Check if is on app is on boot process
if (isBootProcess === !0){
// Push error list
APP.settings.sLoadError.push(errorType);
nextAction = 'bootCheck';
}
}
// Load next action
if (isBootProcess === !0){
res = APP.settings[nextAction](!0);
} else {
// Check if callback exists
if (typeof cb === 'function'){
res = cb(exitCode);
}
}
// End
resolve(res);
}});
});
}
},