diff --git a/release/app/package.json b/release/app/package.json index 56aa282..9b6fb72 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "EmuDeck", - "version": "2.2.0", + "version": "2.2.1", "description": "Play all your RetroGames", "license": "MIT", "author": { diff --git a/src/renderer/components b/src/renderer/components index 52c39ea..74ee186 160000 --- a/src/renderer/components +++ b/src/renderer/components @@ -1 +1 @@ -Subproject commit 52c39ea160fbc2e7236c717da39ac38a78ba4499 +Subproject commit 74ee1863682c0147321e7535a7ee7d8367e8e846 diff --git a/src/renderer/pages/EmulatorsDetailPage.jsx b/src/renderer/pages/EmulatorsDetailPage.jsx index 5314e17..176f396 100644 --- a/src/renderer/pages/EmulatorsDetailPage.jsx +++ b/src/renderer/pages/EmulatorsDetailPage.jsx @@ -62,6 +62,7 @@ function EmulatorsDetailPage() { newDesiredVersions: null, modal: null, dom: undefined, + lastSelected: null, }); const { disabledNext, @@ -70,9 +71,19 @@ function EmulatorsDetailPage() { modal, updates, newDesiredVersions, - dom, + lastSelected, } = statePage; + // TODO: Use only one state for bioses, doing it this way is quick but madness + const [ps1Bios, setps1Bios] = useState(null); + const [ps2Bios, setps2Bios] = useState(null); + const [switchBios, setSwitchBios] = useState(null); + const [segaCDBios, setSegaCDBios] = useState(null); + const [saturnBios, setSaturnBios] = useState(null); + const [dreamcastBios, setDreamcastBios] = useState(null); + const [DSBios, setDSBios] = useState(null); + const ipcChannel = window.electron.ipcRenderer; + const yuzuEAsetToken = (data) => { console.log({ data }); let yuzuEAtokenValue; @@ -216,10 +227,6 @@ function EmulatorsDetailPage() { }); }; - // const yuzuEAInstall = () => { - // - // }; - const diff = (obj1, obj2) => { // Make sure an object to compare is provided if (!obj2 || Object.prototype.toString.call(obj2) !== '[object Object]') { @@ -331,15 +338,6 @@ function EmulatorsDetailPage() { return diffs; }; - // TODO: Use only one state for bioses, doing it this way is quick but madness - const [ps1Bios, setps1Bios] = useState(null); - const [ps2Bios, setps2Bios] = useState(null); - const [switchBios, setSwitchBios] = useState(null); - const [segaCDBios, setSegaCDBios] = useState(null); - const [saturnBios, setSaturnBios] = useState(null); - const [dreamcastBios, setDreamcastBios] = useState(null); - const [DSBios, setDSBios] = useState(null); - const ipcChannel = window.electron.ipcRenderer; const checkBios = (biosCommand) => { ipcChannel.sendMessage('emudeck', [`${biosCommand}|||${biosCommand}`]); ipcChannel.once(`${biosCommand}`, (status) => { @@ -656,145 +654,6 @@ function EmulatorsDetailPage() { }); }; - const saveParsers = () => { - const modalData = { - active: true, - header: Updating Parsers!, - body:

Please wait a few seconds...

, - footer: , - css: 'emumodal--xs', - }; - - setStatePage({ - ...statePage, - modal: modalData, - }); - }; - - const setAlternativeEmulator = (system, emuName, emuName2, disable) => { - if (emuName === 'ra' || emuName === 'ares') { - setState({ - ...state, - emulatorAlternative: { - ...emulatorAlternative, - [system]: emuName, - }, - installEmus: { - ...installEmus, - [emuName2]: { ...installEmus[emuName2], status: false }, - }, - }); - } else if (emuName2 === 'multiemulator' || emuName2 === 'both') { - setState({ - ...state, - emulatorAlternative: { - ...emulatorAlternative, - [system]: emuName, - }, - }); - } else { - setStatePage({ ...statePage, lastSelected: emuName }); - - setState({ - ...state, - emulatorAlternative: { - ...emulatorAlternative, - [system]: emuName, - }, - installEmus: { - ...installEmus, - [emuName2]: { ...installEmus[emuName2], status: false }, - }, - }); - } - saveParsers(); - }; - - useEffect(() => { - const ogStateAlternativeValues = emulatorAlternative; - const json = JSON.stringify(ogStateAlternativeValues); - localStorage.setItem('ogStateAlternative', json); - }, []); - - useEffect(() => { - const ogStateAlternative = JSON.parse( - localStorage.getItem('ogStateAlternative') - ); - - function sameObjects(obj1, obj2) { - const keys1 = Object.keys(obj1); - const keys2 = Object.keys(obj2); - - if (keys1.length !== keys2.length) { - return false; - } - - for (const key of keys1) { - if (obj1[key] !== obj2[key]) { - return false; - } - } - - return true; - } - - const sameObject = sameObjects(ogStateAlternative, emulatorAlternative); - - if (sameObject) { - return; - } - - if (system === 'win32') { - ipcChannel.sendMessage('emudeck', [ - `parsersUpdatePrev|||setSetting emuGBA ${state.emulatorAlternative.gba}; setSetting emuMAME ${state.emulatorAlternative.mame}; setSetting emuMULTI ${state.emulatorAlternative.multiemulator}; setSetting emuN64 ${state.emulatorAlternative.n64}; setSetting emuNDS ${state.emulatorAlternative.nds}; setSetting emuPSP ${state.emulatorAlternative.psp}; setSetting emuPSX ${state.emulatorAlternative.psx}; setSetting emuSCUMMVM ${state.emulatorAlternative.scummvm}; setSetting doInstallPPSSPP ${state.installEmus.ppsspp.status};setSetting doInstallmelonDS ${state.installEmus.melonds.status};setSetting doInstallDuck ${state.installEmus.duckstation.status};;setSetting doInstallFlycast ${state.installEmus.dreamcast.status}`, - ]); - } else { - ipcChannel.sendMessage('emudeck', [ - `parsersUpdatePrev|||$(. ~/.config/EmuDeck/backend/functions/all.sh && setSetting emuGBA ${state.emulatorAlternative.gba} >/dev/null && setSetting emuMAME ${state.emulatorAlternative.mame} >/dev/null && setSetting emuMULTI ${state.emulatorAlternative.multiemulator} >/dev/null && setSetting emuN64 ${state.emulatorAlternative.n64} >/dev/null && setSetting emuNDS ${state.emulatorAlternative.nds} >/dev/null && setSetting emuPSP ${state.emulatorAlternative.psp} >/dev/null && setSetting emuPSX ${state.emulatorAlternative.psx} >/dev/null && setSetting emuSCUMMVM ${state.emulatorAlternative.scummvm} && setSetting doInstallPPSSPP ${state.installEmus.ppsspp.status} >/dev/null && setSetting doInstallMAME ${state.installEmus.mame.status} >/dev/null && setSetting doInstallmelonDS ${state.installEmus.melonds.status} >/dev/null && setSetting doInstallDuck ${state.installEmus.duckstation.status} >/dev/null && setSetting doInstallFlycast ${state.installEmus.flycast.status} >/dev/null && setSetting doInstallMAME ${state.installEmus.mame} >/dev/null && setSetting doInstallRMG ${state.installEmus.rmg.status} >/dev/null && setSetting doInstallScummVM ${state.installEmus.scummvm.status} >/dev/null && setSetting doInstallScummVM ${state.installEmus.scummvm.status}} >/dev/null) >/dev/null`, - ]); - } - - ipcChannel.once(`parsersUpdatePrev`, () => { - ipcChannel.sendMessage('emudeck', [`parsersUpdate|||SRM_init`]); - }); - - ipcChannel.once(`parsersUpdate`, (message) => { - const status = message.stdout; - status.replace('\n', ''); - console.log({ message }); - let modalData; - if (status.includes('true')) { - modalData = { - active: true, - header: Success!, - body:

All Parsers have been configured.

, - footer: ( - navigate('/welcome')} - > - Close - - ), - css: 'emumodal--xs', - }; - } else if (system !== 'win32') { - modalData = { - active: true, - header: Failed, - body:

There was an issue trying to configure your parsers

, - css: 'emumodal--xs', - }; - console.log({ modalData }); - } - setStatePage({ - ...statePage, - modal: modalData, - }); - }); - }, [emulatorAlternative]); - const installEmu = (emulator, code) => { const modalData = { active: true, @@ -865,437 +724,17 @@ function EmulatorsDetailPage() { emulator === 'rmg' || emulator === 'flycast' ) { - let emuOption1; - let emuOption2; - let emuID1; - let emuID2; - let system; - let multiemulatorName; - let multiemulatorID; - let modalData; - // //RA || ARES + mGBA - if ( - (emulator === 'mgba' && installEmus.ra.status) || - (emulator === 'mgba' && installEmus.ares.status) - ) { - if (emulatorAlternative.gba !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'mGBA'; - emuOption2 = multiemulatorName; - emuID2 = 'mgba'; - emuID1 = multiemulatorID; - system = 'gba'; - modalData = { - active: true, - body: ( - <> -

- Which emulator do you want to use for GameBoy Advance. -

-
- RetroArch (recommended) has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
-
- mGBA has this pro: -
-
    -
  1. GBA Link for Multiplayer, Pokemon Trading, etc.
  2. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - // //RA || ARES + rmg - if ( - (emulator === 'rmg' && installEmus.ra.status) || - (emulator === 'rmg' && installEmus.ares.status) - ) { - // alert(emuModified); - if (emulatorAlternative.n64 !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'rmg'; - emuOption2 = multiemulatorName; - emuID2 = 'rmg'; - emuID1 = multiemulatorID; - system = 'n64'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch (recommended) has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
-
- RMG has this pro: -
-
    -
  1. Better Performance
  2. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - if ( - (emulator === 'duckstation' && installEmus.ra.status) || - (emulator === 'duckstation' && installEmus.ares.status) - ) { - if (emulatorAlternative.psx !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'DuckStation'; - emuOption2 = multiemulatorName; - emuID2 = 'duckstation'; - emuID1 = multiemulatorID; - system = 'psx'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch has these prosss: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
-
- DuckStation (recommended) has this pro: -
-
    -
  1. Better Performance
  2. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - if ( - (emulator === 'flycast' && installEmus.ra.status) || - (emulator === 'flycast' && installEmus.ares.status) - ) { - if (emulatorAlternative.dreamcast !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'Flycast'; - emuOption2 = multiemulatorName; - emuID2 = 'flycast'; - emuID1 = multiemulatorID; - system = 'dreamcast'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch has these prosss: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
-
- Flycast (recommended) has this pro: -
-
    -
  1. Better Performance
  2. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - if ( - (emulator === 'melonds' && installEmus.ra.status) || - (emulator === 'melonds' && installEmus.ares.status) - ) { - if (emulatorAlternative.nds !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'melonDS'; - emuOption2 = multiemulatorName; - emuID2 = 'melonds'; - emuID1 = multiemulatorID; - system = 'nds'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
-
- melonDS (recommended) has this pros: -
-
    -
  1. Better performance and scaling
  2. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - if ( - (emulator === 'ppsspp' && installEmus.ra.status) || - (emulator === 'ppsspp' && installEmus.ares.status) - ) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'PPSSPP'; - emuOption2 = multiemulatorName; - emuID2 = 'ppsspp'; - emuID1 = multiemulatorID; - system = 'psp'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
-
- PPSSPP (recommended) has this pro: -
-
    -
  1. Better performance
  2. -
  3. Better compatibility
  4. -
-

- We will only add the parser according to your selection so - you don't end up with duplicates in your library. -

- - ), - }; - console.log({ modalData }); - const myTimeout = setTimeout(launchModal, 500); - } - - if ( - (emulator === 'mame' && installEmus.ra.status) || - (emulator === 'mame' && installEmus.ares.status) - ) { - if (emulatorAlternative.mame !== 'both') { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'RetroArch'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - multiemulatorName = 'ares'; - } - - emuOption1 = 'MAME'; - emuOption2 = multiemulatorName; - emuID2 = 'mame'; - emuID1 = multiemulatorID; - system = 'mame'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch (recommended) has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
  7. 3 different cores: 2003 plus, 2010 and current
  8. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - - if ( - (emulator === 'scummvm' && installEmus.ra.status) || - (emulator === 'scummvm' && installEmus.ares.status) - ) { - if (emulatorAlternative.scummvm !== 'both') { - multiemulatorID = 'multiemulator'; - if (installEmus.ares.status) { - multiemulatorID = 'multiemulator'; - } - - emuOption1 = 'ScummVM'; - emuOption2 = multiemulatorName; - emuID2 = 'scummvm'; - emuID1 = multiemulatorID; - system = 'scummvm'; - modalData = { - active: true, - body: ( - <> -

Which emulator do you want to use

-
- RetroArch has these pros: -
-
    -
  1. RetroAchievements
  2. -
  3. Bezels & Shaders
  4. -
  5. Auto Save States
  6. -
  7. Better Keymapping and Controller support
  8. -
-
- ScummVM (recommended) has these pros: -
-
    -
  1. Not an emulation but runs natively
  2. -
  3. Takes less resources
  4. -
  5. Has better compatibility
  6. -
  7. More flexible configuration
  8. -
-

- We will only add the parser according to your selection - so you don't end up with duplicates in your library. -

- - ), - }; - const myTimeout = setTimeout(launchModal, 500); - } - } - console.log({ modalData }); - function launchModal() { - modalData = { - ...modalData, - header: ( - RetroArch or Standalone Emulator? - ), - css: 'emumodal--sm', - footer: ( - <> - - setAlternativeEmulator(system, emuID2, emuID1, false) - } - disabled={false} - > - {emuOption1} - - - setAlternativeEmulator(system, emuID1, emuID2, true) - } - disabled={false} - > - {emuOption2} - - - setAlternativeEmulator(system, 'both', 'both') - } - > - Both - - - ), - }; - setStatePage({ ...statePage, modal: modalData }); - } + const modalData = { + active: true, + header: Parser update needed, + body: ( +

+ If you want to use this new Standalone emulator in Steam you + need to go to Steam Rom Manager and pick the proper parser. +

+ ), + css: 'emumodal--xs', + }; } } else { const modalData = { @@ -1606,13 +1045,23 @@ function EmulatorsDetailPage() { }); }; + const selectEmu = (e) => { + const emu = e.target.value; + if (emu != '-1') { + setStatePage({ + ...statePage, + emulatorSelected: emu, + }); + } + }; + useEffect(() => { // We save it on localstorage const json = JSON.stringify(state); localStorage.setItem('settings_emudeck', json); }, [state]); - useEffect(() => { + // Check for bios switch (emulator) { case 'ra': checkBios('checkPS1BIOS'); @@ -1636,18 +1085,8 @@ function EmulatorsDetailPage() { break; default: } - }, []); - const selectEmu = (e) => { - const emu = e.target.value; - if (emu != '-1') { - setStatePage({ - ...statePage, - emulatorSelected: emu, - }); - } - }; - useEffect(() => { + // Check for updates ipcChannel.sendMessage('check-versions'); ipcChannel.once('check-versions', (repoVersions) => { // No versioning found, what to do? @@ -1663,7 +1102,10 @@ function EmulatorsDetailPage() { }); }); - // eslint-disable-next-line react-hooks/exhaustive-deps + // save OG Alternatives + const ogStateAlternativeValues = emulatorAlternative; + const json = JSON.stringify(ogStateAlternativeValues); + localStorage.setItem('ogStateAlternative', json); }, []); useEffect(() => { @@ -1680,6 +1122,91 @@ function EmulatorsDetailPage() { } }, [modal]); + useEffect(() => { + if (lastSelected !== null) { + saveParsers(); + } + }, [lastSelected]); + + useEffect(() => { + const ogStateAlternative = JSON.parse( + localStorage.getItem('ogStateAlternative') + ); + + function sameObjects(obj1, obj2) { + const keys1 = Object.keys(obj1); + const keys2 = Object.keys(obj2); + + if (keys1.length !== keys2.length) { + return false; + } + + for (const key of keys1) { + if (obj1[key] !== obj2[key]) { + return false; + } + } + + return true; + } + + const sameObject = sameObjects(ogStateAlternative, emulatorAlternative); + + if (sameObject) { + return; + } + + if (system === 'win32') { + ipcChannel.sendMessage('emudeck', [ + `parsersUpdatePrev|||setSetting emuGBA ${state.emulatorAlternative.gba}; setSetting emuMAME ${state.emulatorAlternative.mame}; setSetting emuMULTI ${state.emulatorAlternative.multiemulator}; setSetting emuN64 ${state.emulatorAlternative.n64}; setSetting emuNDS ${state.emulatorAlternative.nds}; setSetting emuPSP ${state.emulatorAlternative.psp}; setSetting emuPSX ${state.emulatorAlternative.psx}; setSetting emuSCUMMVM ${state.emulatorAlternative.scummvm}; setSetting doInstallPPSSPP ${state.installEmus.ppsspp.status};setSetting doInstallmelonDS ${state.installEmus.melonds.status};setSetting doInstallDuck ${state.installEmus.duckstation.status};;setSetting doInstallFlycast ${state.installEmus.dreamcast.status}`, + ]); + } else { + ipcChannel.sendMessage('emudeck', [ + `parsersUpdatePrev|||$(. ~/.config/EmuDeck/backend/functions/all.sh && setSetting emuGBA ${state.emulatorAlternative.gba} >/dev/null && setSetting emuMAME ${state.emulatorAlternative.mame} >/dev/null && setSetting emuMULTI ${state.emulatorAlternative.multiemulator} >/dev/null && setSetting emuN64 ${state.emulatorAlternative.n64} >/dev/null && setSetting emuNDS ${state.emulatorAlternative.nds} >/dev/null && setSetting emuPSP ${state.emulatorAlternative.psp} >/dev/null && setSetting emuPSX ${state.emulatorAlternative.psx} >/dev/null && setSetting emuSCUMMVM ${state.emulatorAlternative.scummvm} && setSetting doInstallPPSSPP ${state.installEmus.ppsspp.status} >/dev/null && setSetting doInstallMAME ${state.installEmus.mame.status} >/dev/null && setSetting doInstallmelonDS ${state.installEmus.melonds.status} >/dev/null && setSetting doInstallDuck ${state.installEmus.duckstation.status} >/dev/null && setSetting doInstallFlycast ${state.installEmus.flycast.status} >/dev/null && setSetting doInstallMAME ${state.installEmus.mame} >/dev/null && setSetting doInstallRMG ${state.installEmus.rmg.status} >/dev/null && setSetting doInstallScummVM ${state.installEmus.scummvm.status} >/dev/null && setSetting doInstallScummVM ${state.installEmus.scummvm.status}} >/dev/null) >/dev/null`, + ]); + } + + ipcChannel.once(`parsersUpdatePrev`, () => { + ipcChannel.sendMessage('emudeck', [`parsersUpdate|||SRM_init`]); + }); + + ipcChannel.once(`parsersUpdate`, (message) => { + const status = message.stdout; + status.replace('\n', ''); + console.log({ message }); + let modalData; + if (status.includes('true')) { + modalData = { + active: true, + header: Success!, + body:

All Parsers have been configured.

, + footer: ( + navigate('/welcome')} + > + Close + + ), + css: 'emumodal--xs', + }; + } else if (system !== 'win32') { + modalData = { + active: true, + header: Failed, + body:

There was an issue trying to configure your parsers

, + css: 'emumodal--xs', + }; + console.log({ modalData }); + } + setStatePage({ + ...statePage, + modal: modalData, + }); + }); + }, [emulatorAlternative]); + return (
diff --git a/src/renderer/pages/FrontendSelectorPage.jsx b/src/renderer/pages/FrontendSelectorPage.jsx index 172e4c7..dee70a0 100644 --- a/src/renderer/pages/FrontendSelectorPage.jsx +++ b/src/renderer/pages/FrontendSelectorPage.jsx @@ -210,8 +210,6 @@ function FrontendSelectorPage() { } }, [installFrontends]); - - const nextPage = () => { if (installFrontends.pegasus.status && installFrontends.esde.status) { return 'esde-theme'; @@ -222,6 +220,9 @@ function FrontendSelectorPage() { if (installFrontends.pegasus.status) { return 'pegasus-theme'; } + if (installFrontends.steam.status) { + return 'confirmation'; + } // if (system !== 'SteamOS') { // return 'emulator-resolution'; @@ -233,8 +234,7 @@ function FrontendSelectorPage() { }; return ( -
- +