Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/driver install button #221

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/renderer/containers/Settings/DriverOptions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/** @jsx jsx */
import { css, jsx } from "@emotion/react";
import Button from "@material-ui/core/Button";
import { isLinux, isMac } from "common/constants";
import React from "react";

import { DevGuard } from "@/components/DevGuard";

import { SettingItem } from "./SettingItem";

export const DriverOptions: React.FC = () => {
return (
<div>
<DevGuard show={!isMac && !isLinux}>
<SettingItem
name="Install GC Adapter Drivers"
description="Automatically install drivers for the GameCube controller adapter. This only needs to be done once."
>
<div
css={css`
display: flex;
& > button {
margin-right: 10px;
}
`}
>
<Button variant="contained" color="primary" /* onClick={} */ disabled={false}>
Install drivers
</Button>
<Button variant="outlined" color="primary" /* onClick={} */ disabled={false}>
Manual install
</Button>
</div>
</SettingItem>
</DevGuard>
<DevGuard show={isMac}>
<SettingItem
name="Install GC Adapter Drivers"
description="Automatic installation not available for Mac devices. Open the link below for manual instructions."
>
<Button variant="contained" color="primary" /* onClick={} */ disabled={false}>
Open Instructions
</Button>
</SettingItem>
</DevGuard>
<DevGuard show={isLinux}>
<SettingItem
name="Install GC Adapter Drivers"
description="Automatic installation not available for linux devices. You can execute the command below in a terminal to install drivers."
>
<code>
{
'sudo rm -f /etc/udev/rules.d/51-gcadapter.rules && sudo touch /etc/udev/rules.d/51-gcadapter.rules && echo \'SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666"\' | sudo tee /etc/udev/rules.d/51-gcadapter.rules > /dev/null && sudo udevadm control --reload-rules'
}
</code>
</SettingItem>
</DevGuard>
</div>
);
};
6 changes: 6 additions & 0 deletions src/renderer/containers/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DolphinLaunchType } from "@dolphin/types";
import React from "react";

import { DolphinSettings } from "./DolphinSettings";
import { DriverOptions } from "./DriverOptions";
import { HelpPage } from "./HelpPage";
import { MeleeOptions } from "./MeleeOptions";
import { ReplayOptions } from "./ReplayOptions";
Expand Down Expand Up @@ -36,6 +37,11 @@ export const settings: SettingSection[] = [
path: "playback-dolphin-settings",
component: <DolphinSettings dolphinType={DolphinLaunchType.PLAYBACK} />,
},
{
name: "Drivers",
path: "driver-options",
component: <DriverOptions />,
},
],
},
{
Expand Down