From 74fd88688c0e68b84199d590517950ea3757e525 Mon Sep 17 00:00:00 2001 From: Dragoon Dorise Date: Thu, 31 Oct 2024 18:04:33 +0100 Subject: [PATCH] fixes + emudecky --- src/renderer/components | 2 +- src/renderer/pages/MigrationPage.jsx | 44 +++++++++++++++++++++++++-- src/renderer/pages/RomStoragePage.jsx | 6 ++-- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/renderer/components b/src/renderer/components index d8e8ef8..e9af133 160000 --- a/src/renderer/components +++ b/src/renderer/components @@ -1 +1 @@ -Subproject commit d8e8ef869ae1eacf3d13b9c34bae40615f5f0210 +Subproject commit e9af1331ba6441140a5b3fda6c735e9944eac081 diff --git a/src/renderer/pages/MigrationPage.jsx b/src/renderer/pages/MigrationPage.jsx index 9108a28..3d73da2 100644 --- a/src/renderer/pages/MigrationPage.jsx +++ b/src/renderer/pages/MigrationPage.jsx @@ -13,7 +13,7 @@ function MigrationPage() { const { t, i18n } = useTranslation(); const ipcChannel = window.electron.ipcRenderer; const { state, setState } = useContext(GlobalContext); - const { storage, storagePath } = state; + const { storage, storagePath, system } = state; const [statePage, setStatePage] = useState({ disabledNext: storage === null, disabledBack: false, @@ -25,6 +25,7 @@ function MigrationPage() { storagePathDestination: undefined, modal: undefined, dom: undefined, + hddrives: [], }); const { disabledNext, @@ -37,6 +38,7 @@ function MigrationPage() { storageDestination, modal, dom, + hddrives, } = statePage; const storageSet = (storageName) => { @@ -129,9 +131,44 @@ function MigrationPage() { }); }; + const getHDdrives = () => { + ipcChannel.sendMessage('emudeck', ['getLocations|||getLocations']); + + ipcChannel.once('getLocations', (message) => { + const hdrives = message.stdout; + + const hdrivesCleanup = hdrives.replace(/(\r\n|\r|\n)/g, ''); + const jsonDrives = JSON.parse(hdrivesCleanup); + + setStatePage({ + ...statePage, + modal: false, + hddrives: jsonDrives, + }); + console.log({ statePage }); + }); + }; + // Do we have a valid SD Card? useEffect(() => { - checkSDValid(); + if (navigator.onLine === false) { + navigate('/error'); + return; + } + + if (system !== 'win32') { + checkSDValid(); + } else if (system === 'win32') { + const modalData = { + active: true, + header: Collecting Drives Names, + body:

This will take a few seconds. Please wait...

, + css: 'emumodal--xs', + }; + setStatePage({ ...statePage, modal: modalData }); + // We get the drives + getHDdrives(); + } }, []); // We make sure we get the new SD Card name on State when we populate it if the user selected the SD Card in the previous installation @@ -205,6 +242,9 @@ function MigrationPage() { onClick={storageSet} onClickStart={startMigration} storage={storage} + showSDCard={system !== 'win32'} + showInternal={system !== 'win32'} + hddrives={system === 'win32' ? hddrives : false} storageDestination={storageDestination} storagePath={storagePath} storagePathDestination={storagePathDestination} diff --git a/src/renderer/pages/RomStoragePage.jsx b/src/renderer/pages/RomStoragePage.jsx index 6688a75..c851d6e 100644 --- a/src/renderer/pages/RomStoragePage.jsx +++ b/src/renderer/pages/RomStoragePage.jsx @@ -79,9 +79,9 @@ function RomStoragePage() { ipcChannel.sendMessage('emudeck', ['customLocation|||customLocation']); ipcChannel.once('customLocation', (message) => { - const stdout = message.stdout.replace('\n', ''); + let stdout = message.stdout.replace('\n', ''); - const storagePath = stdout; + const storagePath = stdout.replaceAll('\\', '/'); setStatePage({ ...statePage, @@ -499,7 +499,7 @@ function RomStoragePage() { sdCardValid={sdCardValid} showSDCard={system !== 'win32'} showInternal={system !== 'win32'} - showCustom={!!(system !== 'win32' && system !== 'darwin')} + showCustom={true} hddrives={system === 'win32' ? hddrives : false} reloadSDcard={checkSDValid} sdCardName={sdCardName}