Skip to content

Commit 323544f

Browse files
more docs + build
1 parent efbccbd commit 323544f

File tree

10 files changed

+112
-48
lines changed

10 files changed

+112
-48
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
<!--pex philosophy: _"everything is a cart"_-->
3+
4+
WIP
5+
6+

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ nix = { version = "0.29", features = ["fs", "process", "signal"] }
3333
winapi = { version = "0.3", features = ["namedpipeapi", "handleapi", "winbase"] }
3434

3535
[[bin]]
36-
name = "pexos"
36+
name = "picolauncher"
3737
path = "src/main.rs"
3838

3939
[[bin]]

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,27 @@ PICO-8 powered games launcher for the [PeX Console](https://pex-labs.com/)
3535

3636
## Getting started
3737

38-
### Requirements
38+
**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.
3939

40-
**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)).
40+
### Pre-compiled
4141

42-
You can either build this project from source or use a pre-compiled version for your platform.
42+
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.
4343

44+
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.
45+
```sh
46+
set PICO8_BINARY=<path to pico8>
47+
./picolauncher.exe
48+
```
4449

50+
On linux, if PICO-8 is not in your PATH, you need to set the environment variable as well.
51+
```sh
52+
PICO8_BINARY=<path to pico8>
53+
./picolauncher
54+
```
4555

46-
<!--pex philosophy: _"everything is a cart"_-->
56+
### Build from source
57+
58+
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.sh` and `dev/scripts/build_windows.sh`. The built files are present in the `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.
4759

4860
## Contributing
4961

@@ -52,13 +64,13 @@ Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more details! Don't hesitate t
5264
## Credits
5365

5466
Pre-bundled games
55-
- [birds with guns]()
56-
- [bun bun samurai]()
57-
- [celeste]()
58-
- [cherrybomb]()
59-
- [mot's grand prix]()
60-
- [oblivion eve]()
61-
- [pico night punkin']()
62-
- [poom]()
63-
- [swordfish]()
67+
- [birds with guns](https://www.lexaloffle.com/bbs/?tid=45334)
68+
- [bun bun samurai](https://www.lexaloffle.com/bbs/?tid=54707)
69+
- [celeste](https://www.lexaloffle.com/bbs/?tid=2145)
70+
- [cherrybomb](https://www.lexaloffle.com/bbs/?tid=48986)
71+
- [mot's grand prix](https://www.lexaloffle.com/bbs/?pid=97606)
72+
- [oblivion eve](https://www.lexaloffle.com/bbs/?pid=142641)
73+
- [pico night punkin'](https://www.lexaloffle.com/bbs/?tid=42715)
74+
- [poom](https://www.lexaloffle.com/bbs/?pid=101541)
75+
- [swordfish](https://www.lexaloffle.com/bbs/?tid=31141)
6476

dev/scripts/build.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

dev/scripts/build_linux.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# create file structure
6+
rm -rf build_linux
7+
mkdir -p build_linux/
8+
mkdir -p build_linux/drive/
9+
mkdir -p build_linux/drive/screenshots/
10+
mkdir -p build_linux/drive/carts/
11+
mkdir -p build_linux/drive/carts/screenshots/
12+
13+
# build executables
14+
cargo build --release --target x86_64-unknown-linux-gnu
15+
16+
# install files
17+
cp -r drive/carts/{games,labels,metadata,music} build_linux/drive/carts
18+
cp -r drive/carts/{*.p8,*.lua} build_linux/drive/carts/
19+
cp drive/config_template.txt build_linux/drive/config.txt
20+
21+
cp target/x86_64-unknown-linux-gnu/release/picolauncher build_linux/picolauncher
22+
cp target/x86_64-unknown-linux-gnu/release/p8util build_linux/p8util
23+
24+
zip -r build_linux.zip build_linux/

dev/scripts/build_windows.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# create file structure
6+
rm -rf build_windows
7+
mkdir -p build_windows/
8+
mkdir -p build_windows/drive/
9+
mkdir -p build_windows/drive/screenshots/
10+
mkdir -p build_windows/drive/carts/
11+
mkdir -p build_windows/drive/carts/screenshots/
12+
13+
# build executables
14+
cargo build --release --target x86_64-pc-windows-gnu
15+
16+
# install files
17+
cp -r drive/carts/{games,labels,metadata,music} build_windows/drive/carts
18+
cp -r drive/carts/{*.p8,*.lua} build_windows/drive/carts/
19+
cp drive/config_template.txt build_windows/drive/config.txt
20+
21+
cp target/x86_64-pc-windows-gnu/release/picolauncher.exe build_windows/picolauncher.exe
22+
cp target/x86_64-pc-windows-gnu/release/p8util.exe build_windows/p8util.exe
23+
24+
zip -r build_windows.zip build_windows/

drive/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ foreground_sleep_ms 2 // number of milliseconds to sleep each frame. Try 10 to c
3030

3131
background_sleep_ms 10 // number of milliseconds to sleep each frame when running in the background
3232

33-
sessions 3 // number of times program has been run
33+
sessions 4 // number of times program has been run
3434

3535
// (scancode) hold this key down and left-click to simulate right-click
3636
rmb_key 0 // 0 for none 226 for LALT

src/hal/linux.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::{fs::{File, OpenOptions}, path::{Path, PathBuf}};
1+
use std::{
2+
fs::{File, OpenOptions},
3+
path::{Path, PathBuf},
4+
};
25

36
pub const IN_PIPE: &'static str = "in_pipe";
47
pub const OUT_PIPE: &'static str = "out_pipe";
@@ -33,4 +36,3 @@ pub fn open_out_pipe() -> anyhow::Result<File> {
3336

3437
Ok(out_pipe)
3538
}
36-

src/hal/windows.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
use std::{
2+
fs::{File, OpenOptions},
3+
os::windows::{io::RawHandle, prelude::*},
4+
path::{Path, PathBuf},
5+
ptr,
6+
};
17

2-
use std::os::windows::{io::RawHandle, prelude::*};
3-
use std::ptr;
4-
use std::fs::{File};
5-
use std::path::{PathBuf, Path};
68
use anyhow::anyhow;
7-
89
use winapi::um::{
910
fileapi::{CreateFileW, OPEN_EXISTING},
1011
handleapi::INVALID_HANDLE_VALUE,
@@ -102,3 +103,22 @@ pub fn open_in_pipe() -> anyhow::Result<File> {
102103
}
103104
}
104105

106+
/*
107+
pub fn open_out_pipe() -> anyhow::Result<File> {
108+
let mut file = OpenOptions::new()
109+
.write(true)
110+
.truncate(true)
111+
.open("out_pipe")?;
112+
113+
Ok(file)
114+
}
115+
116+
pub fn open_in_pipe() -> anyhow::Result<File> {
117+
let mut file = OpenOptions::new()
118+
.read(true)
119+
.truncate(true)
120+
.open("in_pipe")?;
121+
122+
Ok(file)
123+
}
124+
*/

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
mod consts;
2-
mod p8util;
32
mod hal;
3+
mod p8util;
44

55
use std::thread; // TODO maybe switch to async
66
use std::{
@@ -15,11 +15,11 @@ use std::{
1515

1616
use anyhow::anyhow;
1717
use consts::*;
18+
use hal::*;
1819
use notify::event::CreateKind;
1920
use notify_debouncer_full::{new_debouncer, notify::*, DebounceEventResult};
2021
use p8util::*;
2122
use serde_json::Map;
22-
use hal::*;
2323

2424
fn parse_metadata(path: &Path) -> anyhow::Result<String> {
2525
let content = read_to_string(path)?;

0 commit comments

Comments
 (0)