Skip to content

Commit

Permalink
improve install instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPicklePinosaur committed Sep 11, 2024
1 parent f6af6ff commit 1e4cfaa
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 17 deletions.
86 changes: 78 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,94 @@ PICO-8 powered games launcher for the [PeX Console](https://pex-labs.com/)

## Getting started

**PicoLauncher** requires an installed version of PICO-8 (if you don't have it, you can buy it [here](https://www.lexaloffle.com/pico-8.php?#getpico8)). You can either use a pre-compiled version from the latest [release]() or build this project from source.
**PicoLauncher** requires an installed version of PICO-8 (if you don't have it, you can buy it [here](https://www.lexaloffle.com/pico-8.php?#getpico8)). You can either use a pre-compiled version from the [latest release](https://github.com/pex-labs/picolauncher/releases/latest) or build this project from source.

### Pre-compiled
### Linux

Download the pre-compiled release for your platform and unzip it. You will then find executables for all supported platforms. The `drive/` directory will be where the PICO-8 data files will be stored. For now, you can only run **PicoLauncher** from the same directory as the executables.
<details>
<summary>click to expand</summary>
<div>
Download the latest pre-compiled binary titled `picolauncher-linux-x86_64.zip`. The unzip and navigate to the directory
```sh
unzip picolauncher-linux-x86_64.zip
cd picolauncher-linux-x86_64/
```

On windows, if your PICO-8 binary doesn't reside at the default location of `C:\Program Files (x86)\PICO-8\pico8.exe`, you need to set the environment variable `PICO8_BINARY` before launching.
Next, ensure that `pico8` is included in your path. In your `.bashrc` or equivalent, add the line
```sh
set PICO8_BINARY=<path to pico8>
picolauncher.exe
export PATH="$PATH:<path to pico8 directory>"
```
For example
```sh
export PATH="$PATH:~/Downloads/pico-8/"
```

On linux, if PICO-8 is not in your PATH, you need to set the environment variable as well.
You can now run **PicoLauncher**:
```sh
PICO8_BINARY=<path to pico8>
./picolauncher
```

It is also possible to explicitly pass a binary to use to launch pico8 by setting the `PICO8_BINARY` environment variable:
```sh
PICO8_BINARY=<path to pico8 binary> ./picolauncher
```
For example
```sh
PICO8_BINARY=~/Downloads/pico-8/pico8 ./picolauncher
```
</div>
</details>

### Raspberry Pi

<details>
<summary>click to expand</summary>
<div>
First double check if you are running 64-bit or 32-bit Raspberry Pi OS.
```sh
uname -m
```
If the output of the above command is `aarch64`, you are 64-bit, and if the output is `armv7` or something similar, you are 32-bit.

In the case that you are 64-bit, you should download the latest pre-compiled binary titled `picolauncher-linux-aarch64.zip`. Otherwise, download `picolauncher-linux-armv7.zip`. Similar to the above instructions, unzip and enter the directory
```sh
unzip picolauncher-linux-aarch64.zip
cd picolauncher-linux-aarch64/
```

Once again, add the pico8 directory to your PATH environment variables in your `.bashrc` or equivalent:
```sh
export PATH="$PATH:<path to pico8 directory>"
```

When launching **PicoLauncher** and supplying the binary explicitly, if you are on 64-bit Raspberry Pi, ensure that you are using the `pico8_64` binary.
</div>
</details>


### Windows

<details>
<summary>click to expand</summary>
<div>
Download the `picolauncher-windows.zip` zip file from the latest releases and unzip it. If your pico8 binary doesn't reside at the default location of `C:\Program Files (x86)\PICO-8\pico8.exe`, you need to set the environment variable `PICO8_BINARY` before launching.
```sh
set PICO8_BINARY=<path to pico8>
picolauncher.exe
```

You can also do this graphically. First search up 'Environment Variables' in your start menu.
<img src="media/windows_install/step1.png" width=50%">
Then in the 'System Properties' page, click the button titled 'Environment Variables...'
<img src="media/windows_install/step2.png" width=50%">
Locate the variable titled 'Path' and click the 'Edit' button.
<img src="media/windows_install/step3.png" width=50%">
Add a new path and set the value to the directory where you have installed pico8. If you used the windows installer for pico8, this should be set to `C:\Program Files (x86)\PICO-8\pico8.exe`
<img src="media/windows_install/step4.png" width=50%">

</div>
</details>

### Build from source

To build from source, you need to have a [rust toolchain](https://www.rust-lang.org/tools/install) installed. To build **PicoLauncher** for all platforms, there is a provided build script at `dev/scripts/build-linux-x86_64.sh`, `dev/scripts/build-windows.sh`, etc. The built files are present in the `build/build-<platform>` directory, as well as zipped up in `build-<platform>.zip`. This is the same build that is distributed in the pre-compiled release.
Expand Down
Binary file added media/windows_install/step1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/windows_install/step2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/windows_install/step3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/windows_install/step4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/hal/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ pub fn open_in_pipe() -> anyhow::Result<File> {
}
}

// search start menu for pico8.exe
pub fn locate_pico8_binary() {
// TODO traverse start menu directory, find pico8.exe
// TODO resolve .lnk file to get actual location of pico8 binary
}

/*
pub fn open_out_pipe() -> anyhow::Result<File> {
let mut file = OpenOptions::new()
Expand Down
13 changes: 4 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ mod consts;
mod hal;
mod p8util;

use std::process::Stdio;
use std::thread; // TODO maybe switch to async
use std::{
collections::HashMap,
fs::{read_dir, read_to_string, File, OpenOptions},
io::{BufRead, BufReader, Read, Write},
path::{Path, PathBuf},
process::{Child, Command},
process::{Child, Command, Stdio},
ptr,
time::Duration,
};
use log::{debug, error, warn, info};

use anyhow::anyhow;
use consts::*;
use hal::*;
use log::{debug, error, info, warn};
use notify::event::CreateKind;
use notify_debouncer_full::{new_debouncer, notify::*, DebounceEventResult};
use p8util::*;
Expand Down Expand Up @@ -76,7 +75,7 @@ fn screenshot_watcher() {

info!("screenshot watcher registered");

loop {}
loop {} // TODO this might consume a lot of cpu?
}

/// Attempts to spawn pico8 binary by trying multiple potential binary names depending on the
Expand Down Expand Up @@ -106,11 +105,8 @@ pub fn launch_pico8_binary(bin_names: Vec<String>) -> anyhow::Result<Child> {
}

fn main() {

// set up logger
env_logger::builder()
.format_timestamp(None)
.init();
env_logger::builder().format_timestamp(None).init();

// set up screenshot watcher process
let screenshot_handle = thread::spawn(|| {
Expand Down Expand Up @@ -264,7 +260,6 @@ fn main() {
},
"sys" => {
// Get system information like operating system, etc

},
_ => {
warn!("unhandled command");
Expand Down

0 comments on commit 1e4cfaa

Please sign in to comment.