Skip to content

Commit

Permalink
SteamOS UI + API
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Dec 2, 2023
1 parent c8b51ce commit cd0ba80
Show file tree
Hide file tree
Showing 50 changed files with 164 additions and 593 deletions.
37 changes: 17 additions & 20 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ const os = require('os');
const fs = require('fs');
const lsbRelease = require('lsb-release');

const homeUser = os.homedir();
let allPath;
if (os.platform().includes('win32')) {
allPath = `${homeUser}/AppData/Roaming/EmuDeck/backend/functions/all.ps1`;
} else {
allPath = `${homeUser}/.config/EmuDeck/backend/functions/all.sh`;
}

let shellType: any;
export default class AppUpdater {
constructor() {
Expand Down Expand Up @@ -334,13 +342,6 @@ ipcMain.on('bash-nolog', async (event, command) => {
ipcMain.on('emudeck', async (event, command) => {
let backChannel: any;
let bashCommand: any;
let allPath;
const homeUser = os.homedir();
if (os.platform().includes('win32')) {
allPath = `${homeUser}/AppData/Roaming/EmuDeck/backend/functions/all.ps1`;
} else {
allPath = `${homeUser}/.config/EmuDeck/backend/functions/all.sh`;
}

if (command[0].includes('|||')) {
const tempCommand = command[0].split('|||');
Expand Down Expand Up @@ -625,19 +626,15 @@ ipcMain.on('clone', async (event, branch) => {
ipcMain.on('pull', async (event, branch) => {
const branchGIT = branch;
const backChannel = 'pull';
let bashCommand = `cd ~/.config/EmuDeck/backend && touch ~/emudeck/logs/git.log && script ~/emudeck/logs/git.log -c 'git reset --hard && git clean -fd && git checkout ${branchGIT} && git pull' && . ~/.config/EmuDeck/backend/functions/all.sh && appImageInit`;

if (os.platform().includes('darwin')) {
bashCommand = `cd ~/.config/EmuDeck/backend && git reset --hard && git clean -fd && git checkout ${branchGIT} && git pull && . ~/.config/EmuDeck/backend/functions/all.sh && appImageInit`;
}
if (os.platform().includes('win32')) {
bashCommand = `cd %userprofile% && cd AppData && cd Roaming && cd EmuDeck && cd backend && powershell -ExecutionPolicy Bypass -command "& { Start-Transcript "$env:USERPROFILE/EmuDeck/logs/git.log"; git reset --hard ; git clean -fd ; git checkout ${branchGIT} ; git pull --allow-unrelated-histories -X theirs;cd $env:USERPROFILE ; cd AppData ; cd Roaming ; cd EmuDeck ; cd backend ; cd functions ; . ./all.ps1 ; appImageInit; Stop-Transcript; "}`;
}

return exec(`${bashCommand}`, shellType, (error, stdout, stderr) => {
logCommand(bashCommand, error, stdout, stderr);
event.reply(backChannel, stdout);
});
const bashCommand = `API_pull ${branchGIT}`;
return exec(
`. ${allPath}; ${bashCommand}`,
shellType,
(error, stdout, stderr) => {
logCommand(bashCommand, error, stdout, stderr);
event.reply(backChannel, stdout);
}
);
});

ipcMain.on('branch', async (event) => {
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/AspectRatio3DPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@ function AspectRatio3DPage() {
});
};

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Configure Aspect Ratio for Classic 3D Games" />
<AspectRatio3D data={data} onClick={arSet} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/AspectRatioDolphinPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@ function AspectRatioDolphinPage() {
});
};

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Configure Aspect Ratio for GameCube games" />
<AspectRatioDolphin data={data} onClick={arSet} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/AspectRatioSNESPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@ function AspectRatioSNESPage() {
});
};

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Configure Aspect Ratio for Classic Nintendo" />
<AspectRatioSNES data={data} onClick={arSet} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/AspectRatioSegaPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,11 @@ function AspectRatioSegaPage() {
});
};

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Configure Aspect Ratio for Classic Sega Systems" />
<AspectRatioSega
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/AutoSavePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,11 @@ function AutoSavePage() {
});
};

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Configure Auto Save" />
<AutoSave data={data} onClick={autoSaveSet} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CHDToolPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,11 @@ function CHDToolPage() {
]);
};

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="EmuDeck Compression Tool" />
<CHDTool onClick={runCHD} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/ChangeLogPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,11 @@ function ChangeLogPage() {
});
}, []);

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Latest changes" />
<ChangeLog disabledNext={disabledNext} disabledBack={disabledBack}>
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CheckBiosPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,11 @@ function CheckBiosPage() {
checkBios('checkDSBios');
}, []);

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Bios files checker" />
<CheckBios
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CheckDependenciesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,11 @@ function CheckDependenciesPage() {
}
}, [statusGIT, status7Zip]);

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper aside={false}>
{statusGIT === undefined ||
(statusSteam === undefined && (
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CheckUpdatePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,11 @@ function CheckUpdatePage() {
}
}, [downloadComplete]);

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper css="wrapper__full" aside={false}>
<Kamek />
<Header title="EmuDeck is loading..." />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CloudSyncConfigPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,11 @@ function CloudSyncPageConfig() {
return 'copy-games';
};

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >


<Wrapper>
<PatreonLogin>
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CloudSyncPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,11 @@ function CloudSyncPage() {
: `cloud-sync-config/${type}`;
};

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Cloud Saves" />
<CloudSync
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ function ConfirmationPage() {
}
}, [state]);

//GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
<Header title="Here is what EmuDeck will do" />
<Confirmation data={data} />
Expand Down
15 changes: 3 additions & 12 deletions src/renderer/pages/CopyGamesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,11 @@ function CopyGamesPage() {
});
};

// GamePad
const domElementsRef = useRef(null);
const domElementsCur = domElementsRef.current;
let domElements;
useEffect(() => {
if (domElementsCur && dom === undefined) {
domElements = domElementsCur.querySelectorAll('button');
setStatePage({ ...statePage, dom: domElements });
}
}, [statePage]);


return (
<div style={{ height: '100vh' }} ref={domElementsRef}>
{dom !== undefined && <GamePad elements={dom} />}
<div style={{ height: '100vh' }} >

<Wrapper>
{statusCopyGames !== true && system !== 'win32' && (
<Header title="Use a USB Drive to transfer your games" />
Expand Down
Loading

0 comments on commit cd0ba80

Please sign in to comment.