From 2093642ed81e8e002735557c09c65456cd78fd40 Mon Sep 17 00:00:00 2001
From: themitosan
Date: Sat, 24 Feb 2024 15:27:18 -0300
Subject: [PATCH] Project: Update readme and fix more stuff on non-windows os
---
.gitignore | 13 +++++++++----
App/js/design.js | 10 ++++------
App/js/emumanager.js | 10 +++-------
App/js/filemanager.js | 15 +++++++++++++--
App/js/gamelist.js | 20 +++++++++++++-------
App/js/paramSfoParser.js | 6 ++----
App/js/settings.js | 13 ++++---------
App/js/tools.js | 2 +-
App/js/updateEmu.js | 13 +++----------
Launcher.sh | 4 ++--
README.md | 23 +++++++++++++++--------
11 files changed, 69 insertions(+), 60 deletions(-)
mode change 100644 => 100755 Launcher.sh
diff --git a/.gitignore b/.gitignore
index a734c47..257a5d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,11 @@
# Paths
-Games/*
-Nwjs/*
-Emu/*
+Games/
+Nwjs/
+Emu/
+
+# Paths generated by fpPS4
+shader_dump/
+savedata/
# Launcher settings
Settings.json
@@ -17,4 +21,5 @@ Settings.json
*.zip
*.pkg
*.log
-*.dat
\ No newline at end of file
+*.dat
+*.sh
\ No newline at end of file
diff --git a/App/js/design.js b/App/js/design.js
index abd6cbc..d1c57ee 100644
--- a/App/js/design.js
+++ b/App/js/design.js
@@ -695,7 +695,7 @@ temp_DESIGN = {
cDisplayMode = APP.settings.data.gameListMode;
// Grid options
- switch (cDisplayMode) {
+ switch (cDisplayMode){
case 'normal':
document.getElementById('RANGE_settingsGridIconSize').disabled = 'disabled';
@@ -713,13 +713,11 @@ temp_DESIGN = {
}
- // Reset display modes
+ // Reset display modes and update zoom scale
this.gameListDisplayModes.forEach(function(cMode){
- document.getElementById('BTN_displayMode_' + cMode).disabled = '';
+ document.getElementById(`BTN_displayMode_${cMode}`).disabled = '';
});
- document.getElementById('BTN_displayMode_' + cDisplayMode).disabled = 'disabled';
-
- // Update zoom scale
+ document.getElementById(`BTN_displayMode_${cDisplayMode}`).disabled = 'disabled';
document.body.style.zoom = guiZoomScale;
},
diff --git a/App/js/emumanager.js b/App/js/emumanager.js
index dde8eac..a349cc0 100644
--- a/App/js/emumanager.js
+++ b/App/js/emumanager.js
@@ -19,16 +19,12 @@ temp_EMUMANAGER = {
// Run emu
runGame: function(){
- // Get selected game details
+ // Get selected game details and check if user selected a game
const mainGameData = APP.gameList.list[APP.gameList.selectedGame];
-
- // If user selected a game
if (mainGameData !== void 0){
- // Reset Error List
+ // Reset Error List and clear log on emu running (if needed)
APP.emuManager.emuErrorList = [];
-
- // Options: Clear log on emu starts
if (APP.settings.data.clearLogOnEmuLoad === !0 && APP.emuManager.emuRunCounter !== 0){
APP.clearLog(!0);
}
@@ -47,7 +43,7 @@ temp_EMUMANAGER = {
// Get enabled hacks
hList.forEach(function(hackName){
- if (document.getElementById('CHECK_' + hackName).checked === !0){
+ if (document.getElementById(`CHECK_${hackName}`).checked === !0){
emuArgs.push('-h');
emuArgs.push(hackName);
}
diff --git a/App/js/filemanager.js b/App/js/filemanager.js
index 5a09d88..fe893c3 100644
--- a/App/js/filemanager.js
+++ b/App/js/filemanager.js
@@ -92,6 +92,7 @@ temp_FILEMANAGER = {
}
+ // Open save dialog
TMS.triggerClick('APP_FILE_SAVE');
},
@@ -99,8 +100,18 @@ temp_FILEMANAGER = {
// Open game folder
openDir: function(path){
- // Spawn explorer
- APP.childProcess.exec(`start "" "${path}"`);
+ // Switch platform
+ switch (APP.os.platform()){
+
+ case 'win32':
+ APP.childProcess.exec(`start "" "${path}"`);
+ break;
+
+ case 'linux':
+ APP.childProcess.exec(`browse "${path}"`);
+ break;
+
+ }
}
diff --git a/App/js/gamelist.js b/App/js/gamelist.js
index 0debd2e..f9c651c 100644
--- a/App/js/gamelist.js
+++ b/App/js/gamelist.js
@@ -38,7 +38,7 @@ temp_GAMELIST = {
// Write file
try {
- APP.fs.writeFileSync(data.path, JSON.stringify(gameSettings), 'utf8');
+ APP.fs.writeFileSync(data.path, JSON.stringify(gameSettings), 'utf-8');
logMessage = APP.lang.getVariable('createdSettingsFile', [data.name]);
} catch (err) {
console.error(err);
@@ -87,7 +87,7 @@ temp_GAMELIST = {
// Write file
try {
- APP.fs.writeFileSync(fPath, JSON.stringify(tempData), 'utf8');
+ APP.fs.writeFileSync(fPath, JSON.stringify(tempData), 'utf-8');
logMessage = APP.lang.getVariable('updateGameSettings', [APP.gameList.selectedGame]);
} catch (err) {
@@ -156,6 +156,7 @@ temp_GAMELIST = {
if (this.selectedGame !== ''){
+ // Create main vars
var logMessage = '',
cGame = this.selectedGame;
@@ -213,11 +214,13 @@ temp_GAMELIST = {
document.getElementById('INPUT_gameListSearch').value = '';
const gList = APP.fs.readdirSync(APP.settings.data.gamePath);
+ // Check if game list isn't empty
if (gList.length > 0){
// Process game list
gList.forEach(function(gPath){
-
+
+ // Create main vars
var appBg,
appIcon,
addGame = !0,
@@ -307,6 +310,7 @@ temp_GAMELIST = {
// If executable exists, set data
if (addGame === !0){
+ // Create metadata
const metadata = {
bg: appBg,
name: appName,
@@ -351,6 +355,7 @@ temp_GAMELIST = {
// Process search list
search: function(){
+ // Create main search vars
var gameListArray = Object.keys(APP.gameList.list),
searchQuery = document.getElementById('INPUT_gameListSearch').value;
@@ -437,10 +442,10 @@ temp_GAMELIST = {
});
// Check if playgo-chunk.dat exists
- if (APP.fs.existsSync(gPath + '/sce_sys/playgo-chunk.dat') !== !0){
- cGameStatus = 'WARN';
+ if (APP.fs.existsSync(`${gPath}/sce_sys/playgo-chunk.dat`) !== !0){
- // Check if playgo-chunk.dat is inside app folder
+ // Set current game status to warn and check if playgo-chunk.dat is inside app folder
+ cGameStatus = 'WARN';
if (APP.fs.existsSync(`${gPath}/sce_sys/app/playgo-chunk.dat`) === !0){
APP.fs.copyFileSync(`${gPath}/sce_sys/app/playgo-chunk.dat`, `${gPath}/sce_sys/playgo-chunk.dat`);
APP.log(APP.lang.getVariable('checkDumpPlayGoOnApp', [this.list[this.selectedGame].name]));
@@ -465,6 +470,7 @@ temp_GAMELIST = {
// Open selected game location
openGameLocation: function(){
+ // Check if there's game selected
if (this.selectedGame !== ''){
APP.fileManager.openDir(`${APP.settings.data.gamePath}/${this.list[this.selectedGame].folderName}`);
}
@@ -504,7 +510,7 @@ temp_GAMELIST = {
APP.gameList.selectedGame = '';
APP.gameList.load();
APP.design.selectGame(cGame);
- TMS.scrollCenter('GAME_ENTRY_' + cGame);
+ TMS.scrollCenter(`GAME_ENTRY_${cGame}`);
}, 50);
} catch (err) {
diff --git a/App/js/paramSfoParser.js b/App/js/paramSfoParser.js
index 3ec9515..70508c9 100644
--- a/App/js/paramSfoParser.js
+++ b/App/js/paramSfoParser.js
@@ -72,9 +72,8 @@ temp_PARAMSFO_PARSER = {
// Get key table data info
listAttrArray.forEach(function(cAttr){
- // Slice Current Data
+ // Slice current data and set current read mode
const cReadingMode = hexStartLocation.slice(readerLocation, parseInt(readerLocation + 32));
-
readMode[cAttr] = {
keyTableOffset: cReadingMode.slice(0, 4), // Key table offset
@@ -91,7 +90,7 @@ temp_PARAMSFO_PARSER = {
});
/*
- Set Metadata Info
+ Set metadata info
*/
// Set location to data table start create first slice
@@ -104,7 +103,6 @@ temp_PARAMSFO_PARSER = {
// Get hex file starting from current location
var keyData = '',
convertUft8 = !1,
- cSlice = dataTableSlice.slice(pointerLocation),
stopLocation = parseInt(pointerLocation + 8); // Default: int32
/*
diff --git a/App/js/settings.js b/App/js/settings.js
index 6a7a390..51f8cb6 100644
--- a/App/js/settings.js
+++ b/App/js/settings.js
@@ -27,7 +27,6 @@ temp_SETTINGS = {
nwPath: '',
emuPath: '',
gamePath: '',
- emuWinePath: '',
// Run fpPS4 on fullscreen
enableEmuFullscreen: !1,
@@ -106,10 +105,8 @@ temp_SETTINGS = {
try {
- // Read settings file
+ // Read settings file and check for obsolete keys
var loadSettings = JSON.parse(APP.fs.readFileSync(settingsPath, 'utf8'));
-
- // Check for obsolete settings
Object.keys(loadSettings).forEach(function(cSettings){
if (APP.settings.data[cSettings] === void 0){
@@ -155,7 +152,7 @@ temp_SETTINGS = {
this.data.launcherVersion = APP.packageJson.version;
try {
- APP.fs.writeFileSync(`${nwPath}/Settings.json`, JSON.stringify(this.data), 'utf8');
+ APP.fs.writeFileSync(`${nwPath}/Settings.json`, JSON.stringify(this.data), 'utf-8');
} catch (err) {
console.error(APP.lang.getVariable('settingsSaveError', [err]));
}
@@ -175,7 +172,7 @@ temp_SETTINGS = {
if (cLang !== 'english' && APP.fs.existsSync(fileLocation) === !0){
// Get selected lang
- var getLangFile = APP.fs.readFileSync(fileLocation, 'utf8');
+ var getLangFile = APP.fs.readFileSync(fileLocation, 'utf-8');
APP.lang.selected = JSON.parse(getLangFile);
} else {
@@ -199,6 +196,7 @@ temp_SETTINGS = {
// Check paths
checkPaths: function(){
+ // Create main vars
var logMessage = '',
mainPath = this.data.nwPath,
pathList = ['/Emu', '/Games', '/Lang'];
@@ -233,7 +231,6 @@ temp_SETTINGS = {
// Set flag to skip update check on window.onload
APP.emuManager.update.skipLoadingCheck = !0;
-
this.data.latestCommitSha = '';
APP.emuManager.update.check();
@@ -243,8 +240,6 @@ temp_SETTINGS = {
if (this.data.latestCommitSha !== ''){
APP.log(APP.lang.getVariable('settingsLogEmuSha', [APP.settings.data.latestCommitSha.slice(0, 7)]));
}
-
- // Log message
APP.log(logMessage);
},
diff --git a/App/js/tools.js b/App/js/tools.js
index 48ec6c1..05d6a75 100644
--- a/App/js/tools.js
+++ b/App/js/tools.js
@@ -41,7 +41,7 @@ temp_TOOLS = {
var textValue = '';
if (hex !== void 0 && hex !== ''){
- textValue = decodeURIComponent('%' + hex.match(/.{2,2}/g).join('%'));
+ textValue = decodeURIComponent(`%${hex.match(/.{2,2}/g).join('%')}`);
}
return textValue;
diff --git a/App/js/updateEmu.js b/App/js/updateEmu.js
index 41b15e7..3e2021d 100644
--- a/App/js/updateEmu.js
+++ b/App/js/updateEmu.js
@@ -170,7 +170,6 @@ temp_EMU_UPDATE = {
artifactData,
canPrompt = !0,
canUpdate = !1,
- latestCommit = '',
msgMode = 'confirm',
settingsData = APP.settings.data;
@@ -181,10 +180,8 @@ temp_EMU_UPDATE = {
const cRun = options.runs.workflow_runs[i];
if (cRun.status === 'completed' && cRun.conclusion === 'success' && cRun.head_branch === settingsData.fpps4BranchName){
- // Set can update on
+ // Set canUpdate on and run info
canUpdate = !0;
-
- // Set run info
artifactData = {
artifact: cRun.id,
sha: cRun.head_sha
@@ -256,11 +253,9 @@ temp_EMU_UPDATE = {
// If (by some reason) fpPS4 is running - close it!
APP.emuManager.killEmu();
- // Display GUI
+ // Display GUI and start download
APP.design.toggleEmuUpdateGUI('show');
APP.design.updateProgressbarStatus(25, APP.lang.getVariable('updateEmu-1-4', [actionsData.sha.slice(0, 7)]));
-
- // Start download
fetch(`https://nightly.link/red-prig/fpPS4/actions/runs/${actionsData.artifact}/fpPS4.zip`).then(function(resp){
if (resp.ok === !0){
@@ -319,10 +314,8 @@ temp_EMU_UPDATE = {
// Finish process
finish: function(data){
- // Update status
+ // Update status, remove download file and update settings
APP.design.updateProgressbarStatus(75, APP.lang.getVariable('updateEmu-3-4'));
-
- // Remove download file and update settings
APP.fs.unlinkSync(data.path);
APP.settings.data.latestCommitSha = data.actions.sha;
APP.settings.data.emuPath = `${APP.path.parse(data.path).dir}/fpPS4.exe`;
diff --git a/Launcher.sh b/Launcher.sh
old mode 100644
new mode 100755
index 223c7aa..7dd41ef
--- a/Launcher.sh
+++ b/Launcher.sh
@@ -1,3 +1,3 @@
clear
-./Nwjs/nw ../
-exit
+./Nwjs/nw .
+exit
\ No newline at end of file
diff --git a/README.md b/README.md
index ef3db06..eeec65e 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,29 @@
-# fpPS4 Temmie's Launcher
-Created by TheMitoSan _(Previously known as TemmieHeartz)_, This is a simple launcher created for [fpPS4](https://github.com/red-prig/fpPS4/) project.
+
+ ![fpPS4_TL_Logo](App/img/logo.png)
+ fpPS4 Temmie's Launcher
+
+
+Created by TheMitoSan _(Previously known as TemmieHeartz)_, This is a simple launcher created for [fpPS4](https://github.com/red-prig/fpPS4) compatibility layer.
-
+
## How to install
-- Download / Clone this repo
+
+- [Download / Clone this repo](https://github.com/themitosan/fpPS4-Temmie-s-Launcher/archive/refs/heads/main.zip)
- Download [nw.js](https://dl.nwjs.io/v0.70.1/nwjs-sdk-v0.70.1-win-x64.zip) version `0.70.1`
-- Extract all files from nw to the `Nwjs` folder
+- Extract all files from `nw` on `Nwjs` folder
- Run `Launcher.bat`
-### How to setup fpPS4 and launcher
+### How to Setup fpPS4 and launcher
You can setup both launcher and emulator using [this tutorial](https://docs.google.com/document/d/1HHRm9939HL7b8XCBagIyBo1VJIDj7Me4/edit).
## External plugins used on this project
- [memoryjs](https://github.com/rob--/memoryjs) - created by [Rob--](https://github.com/rob--)
- [node-stream-zip](https://github.com/antelle/node-stream-zip) - created by [antelle](https://github.com/antelle)
-- [TMS.js](https://github.com/themitosan/TMS.js) by [TheMitoSan](https://github.com/themitosan/) (Hi!)
+- [TMS.js](https://github.com/themitosan/TMS.js) by [TheMitoSan](https://github.com/themitosan/) *(Hi!)*
-IMPORTANT: This software does not allow you to obtain free PS4 Games / Apps.
+
+ **IMPORTANT**: This software does not allow you to obtain free PS4 Games / Apps.
+
\ No newline at end of file