Skip to content

Commit

Permalink
fix wsl instructions and add DX_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 committed Jan 4, 2025
1 parent 9ae11d1 commit f034f1d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 39 deletions.
17 changes: 11 additions & 6 deletions manual/setup-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ RED="\033[1;31m"
GREEN='\033[1;32m'
RESET='\033[0m'

DX_DIR=~/papermario-dx
DX_DIR="${DX_DIR:-~/papermario-dx}"
COMPLETE=0

# Check for $DX_DIR; if it exists, exit
if [ -d $DX_DIR ]; then
if [ -d "$DX_DIR" ]; then
COMPLETE=1
echo -e "${RED}Paper Mario DX is already installed in $DX_DIR!${RESET}"
echo -e "${RED}$DX_DIR already exists!${RESET}"
echo -e "${RED}If you would like to reinstall, run the following command, then try again:${RESET}"
echo -e "${YELLOW} rm -rf $DX_DIR${RESET}"
exit 1
Expand All @@ -45,13 +45,18 @@ fi

# Ensure we are in Nix trusted-users so we can add caches
if ! nix config show | grep -q -E "^trusted-users = .* ${USER}($| )"; then
# TODO: extend existing trusted-users
echo -e "${PURPLE}Adding $USER to Nix trusted-users...${RESET}"
echo "trusted-users = $USER" | sudo tee -a /etc/nix/nix.conf
echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
fi

# Prompt for baserom
echo -e "${PURPLE}Drag and drop a Paper Mario (US) ROM file below, then press Enter.${RESET}"
read -r -p "> " baserom
# Some terminals wrap the path in quotes, so remove them
baserom="${baserom%\"}"
baserom="${baserom#\"}"
# Convert Windows path to Linux path
if command -v wslpath > /dev/null; then
baserom=$(wslpath -u "$baserom")
fi
Expand All @@ -72,8 +77,8 @@ cp "$baserom" papermario.us.z64
nix-store --add-fixed sha256 papermario.us.z64

# Clone the repository
git clone https://github.com/bates64/papermario-dx.git $DX_DIR --depth 1
cd $DX_DIR
git clone https://github.com/bates64/papermario-dx.git "$DX_DIR" --depth 1
cd "$DX_DIR"

# Prepare devshell
echo -e "${PURPLE}Downloading dependencies and splitting assets from ROM...${RESET}"
Expand Down
66 changes: 33 additions & 33 deletions manual/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,59 @@ You will need:
- A Paper Mario (USA) ROM
- A computer running Windows 11, Windows 10, macOS, or Linux

<details>
<summary>I don't have a ROM! Can I still use DX?</summary>
<p>
You must own a copy of Paper Mario (USA) to use DX. The European and Japanese versions of the game are not currently supported.
</p>
<p>
There are a variety of tools you can use to dump a backup from your own cartridge or Virtual Console copy.
If you do have a clean NTSC-U ROM, but it is in another format, <a href="https://hack64.net/tools/swapper.php">convert it to z64</a>.
</p>
</details>

<details>
<summary>I prefer my editor, like neovim. Do I have to use Visual Studio Code?</summary>
<p>
This guide assumes you are using Visual Studio Code.
If you are using another editor, you will need to be smart enough to adapt the instructions to your editor.
</p>
<p>
To build the game, use <code>nix develop --profile .nix-profile --command ./run</code>.
</p>
</details>

### Step 1. Install WSL (Windows only)

1. Open PowerShell in administrator mode by right-clicking and selecting "Run as administrator".
2. Type `wsl --install` and press Enter.
3. Restart your computer.
4. After restarting, an "Ubuntu" installation window will appear. Follow the instructions to set it up.

### Step 2. Install Visual Studio Code

Download and install Visual Studio Code (VSCode), a code editor that works well with DX:

[Download Visual Studio Code](https://code.visualstudio.com/)

<details>
<summary>I prefer my editor, like neovim. Do I have to use Visual Studio Code?</summary>
<p>
This manual assumes you are using Visual Studio Code, but it is possible to use another editor.
However, you will need to adapt instructions to your editor and be confident using the command line.
</p>
<p>
For Step 4, to run the game, use <code>nix develop --profile .nix-profile --command ./run</code>.
</p>
</details>

### Step 3. Run the setup script

#### Windows
On Windows, open WSL. On macOS, open Terminal.

Open PowerShell. Copy the following command and paste it into PowerShell with Ctrl+Shift+V:
Carefully type the following command and press Enter:

```sh
wsl --exec 'bash <(curl -Ls https://bates64.com/setup-dx.sh)'
bash <(curl -Ls https://bates64.com/setup-dx.sh)
```

#### macOS and Linux

Open a terminal. Copy the following command and paste it into the terminal with Ctrl+Shift+V or Cmd+V:
Then follow the instructions to set up DX.

```sh
bash <(curl -Ls https://bates64.com/setup-dx.sh)
```
<details>
<summary>How do I set up DX in a specific directory?</summary>
<p>
Type <code>DX_DIR=~/my-folder</code>, then run the setup script as above.
</p>
</details>

Then press Enter and follow the instructions.
<details>
<summary>It asked me for a ROM, but I don't have one!</summary>
<p>
You must own a copy of Paper Mario (USA) to use DX. The European and Japanese versions of the game are not currently supported.
</p>
<p>
There are a variety of tools you can use to dump a backup from your own cartridge or Virtual Console copy.
If you do have a clean NTSC-U ROM, but it is in another format, <a href="https://hack64.net/tools/swapper.php">convert it to z64</a>.
</p>
</details>

When the script finishes successfully, it should open DX in VSCode. You can close the terminal now.

Expand All @@ -86,7 +86,7 @@ You're _almost_ ready to start making changes to the game. To do that, you need

You can reopen it by using the 'Recent' menu on the VSCode Welcome screen.

If you can't find it, you can open VSCode from a terminal. Open a terminal and run `code ~/papermario-dx`. Note that you should use a WSL terminal if you're on Windows.
If you can't find it, you can open VSCode from a terminal. Open a terminal and run `code ~/papermario-dx`. Note that you should use WSL if you're on Windows.

### Help!!!!

Expand Down

0 comments on commit f034f1d

Please sign in to comment.