Skip to content

Commit e1646a2

Browse files
authored
docs: add Windows build instructions (#55)
* docs: add Windows build instructions * fix: resolve cursor_remaining feature compilation error
1 parent 771a2c2 commit e1646a2

File tree

5 files changed

+64
-8
lines changed

5 files changed

+64
-8
lines changed

docs/windows_build.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Building OpenPAL3 on Windows
2+
3+
### Setting up the build environment
4+
5+
You will need to download and install the following tools:
6+
7+
Required Softwares:
8+
9+
- Visual Studio Build Tools
10+
- With the "Visual C++ Build Tools" workload
11+
- MSVC v143 or newer recommended
12+
- Rust
13+
- Install using rustup
14+
- Switch to nightly: rustup default nightly
15+
- Vulkan SDK
16+
- Download and install from LunarG
17+
- Latest version recommended (tested with 1.4.304.0)
18+
- OpenAL
19+
- Download and install OpenAL 1.1 Core PC SDK
20+
- vcpkg
21+
- Set up vcpkg following the official guide
22+
23+
### Building OpenPAL3
24+
25+
1. Clone the repository:
26+
27+
```bash
28+
git clone https://github.com/dontpanic92/OpenPAL3.git
29+
cd OpenPAL3
30+
```
31+
32+
2. Initialize submodules:
33+
34+
```bash
35+
git submodule update --init
36+
```
37+
38+
3. Install dependencies via vcpkg:
39+
40+
```bash
41+
vcpkg install --triplet x64-windows-static-md
42+
```
43+
44+
4. Build the project:
45+
46+
```bash
47+
$env:RUSTFLAGS="-A explicit_builtin_cfgs_in_flags"
48+
cargo build --release
49+
```
50+
51+
### Notes
52+
53+
- The RUSTFLAGS environment variable is required to prevent compilation errors related to the `--cfg windows` flag
54+
- The build output will be located in target/release/
55+
- Make sure all environment variables are properly set up before building
56+
57+
### Known Issues
58+
- If you encounter a --cfg windows compilation error, ensure you've set the RUSTFLAGS environment variable as shown above
59+
- If cargo can't find MSVC, ensure Visual Studio Build Tools is properly installed and the environment is configured

yaobow/fileformats/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(cursor_remaining)]
2-
31
pub mod c00;
42
pub mod mv3;
53
pub mod nif;

yaobow/fileformats/src/rwbs/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub fn list_chunks(data: &[u8]) -> anyhow::Result<Vec<ChunkHeader>> {
287287
let mut cursor = Cursor::new(data);
288288
let mut chunks = vec![];
289289

290-
while !cursor.is_empty() {
290+
while cursor.position() < cursor.get_ref().len() as u64 {
291291
let chunk = ChunkHeader::read(&mut cursor)?;
292292
cursor.set_position(cursor.position() + chunk.length as u64);
293293
chunks.push(chunk);
@@ -300,7 +300,7 @@ pub fn read_dff(data: &[u8]) -> anyhow::Result<Vec<Clump>> {
300300
let mut cursor = Cursor::new(data);
301301
let mut chunks = vec![];
302302

303-
while !cursor.is_empty() {
303+
while cursor.position() < cursor.get_ref().len() as u64 {
304304
let chunk = ChunkHeader::read(&mut cursor)?;
305305
match chunk.ty {
306306
ChunkType::CLUMP => chunks.push(Clump::read(&mut cursor)?),
@@ -315,7 +315,7 @@ pub fn read_bsp(data: &[u8]) -> anyhow::Result<Vec<World>> {
315315
let mut cursor = Cursor::new(data);
316316
let mut world = vec![];
317317

318-
while !cursor.is_empty() {
318+
while cursor.position() < cursor.get_ref().len() as u64 {
319319
let chunk = ChunkHeader::read(&mut cursor)?;
320320
match chunk.ty {
321321
ChunkType::WORLD => world.push(World::read(&mut cursor)?),
@@ -330,7 +330,7 @@ pub fn read_anm(data: &[u8]) -> anyhow::Result<Vec<AnmAction>> {
330330
let mut cursor = Cursor::new(data);
331331
let mut anim = vec![];
332332

333-
while !cursor.is_empty() {
333+
while cursor.position() < cursor.get_ref().len() as u64 {
334334
let chunk = ChunkHeader::read(&mut cursor)?;
335335
match chunk.ty {
336336
ChunkType::ANIM_ANIMATION => anim.push(AnmAction::read(&mut cursor)?),

yaobow/packfs/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(io_error_more)]
2-
#![feature(cursor_remaining)]
32
#![cfg_attr(target_os = "vita", feature(stdarch_arm_neon_intrinsics))]
43

54
pub mod cpk;

yaobow/packfs/src/pkg/pkg_archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl PkgEntries {
244244

245245
let mut file_entries = vec![];
246246
let mut entry_cursor = Cursor::new(buf);
247-
while !entry_cursor.is_empty() {
247+
while entry_cursor.position() < entry_cursor.get_ref().len() as u64 {
248248
let name_len = entry_cursor.read_u32_le()?;
249249
let name = String::from_utf8(entry_cursor.read_u8_vec(name_len as usize)?)?;
250250
let start_position = entry_cursor.read_u32_le()?;

0 commit comments

Comments
 (0)