diff --git a/README.md b/README.md index 8d65f5c..92660a2 100644 --- a/README.md +++ b/README.md @@ -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. +
+click to expand +
+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= -picolauncher.exe +export PATH="$PATH:" +``` +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= ./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= ./picolauncher +``` +For example +```sh +PICO8_BINARY=~/Downloads/pico-8/pico8 ./picolauncher +``` +
+
+ +### Raspberry Pi + +
+click to expand +
+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:" +``` + +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. +
+
+ + +### Windows + +
+click to expand +
+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= +picolauncher.exe +``` + +You can also do this graphically. First search up 'Environment Variables' in your start menu. + +Then in the 'System Properties' page, click the button titled 'Environment Variables...' + +Locate the variable titled 'Path' and click the 'Edit' button. + +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` + + +
+
+ ### 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-` directory, as well as zipped up in `build-.zip`. This is the same build that is distributed in the pre-compiled release. diff --git a/media/windows_install/step1.png b/media/windows_install/step1.png new file mode 100644 index 0000000..5aced92 Binary files /dev/null and b/media/windows_install/step1.png differ diff --git a/media/windows_install/step2.png b/media/windows_install/step2.png new file mode 100644 index 0000000..adc664a Binary files /dev/null and b/media/windows_install/step2.png differ diff --git a/media/windows_install/step3.png b/media/windows_install/step3.png new file mode 100644 index 0000000..513d164 Binary files /dev/null and b/media/windows_install/step3.png differ diff --git a/media/windows_install/step4.png b/media/windows_install/step4.png new file mode 100644 index 0000000..3c19b6c Binary files /dev/null and b/media/windows_install/step4.png differ diff --git a/src/hal/windows.rs b/src/hal/windows.rs index 0043e65..809906a 100644 --- a/src/hal/windows.rs +++ b/src/hal/windows.rs @@ -103,6 +103,12 @@ pub fn open_in_pipe() -> anyhow::Result { } } +// 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 { let mut file = OpenOptions::new() diff --git a/src/main.rs b/src/main.rs index 00e3863..fc0f8f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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::*; @@ -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 @@ -106,11 +105,8 @@ pub fn launch_pico8_binary(bin_names: Vec) -> anyhow::Result { } 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(|| { @@ -264,7 +260,6 @@ fn main() { }, "sys" => { // Get system information like operating system, etc - }, _ => { warn!("unhandled command");