Skip to content

Commit

Permalink
docs: add Windows build instructions (#55)
Browse files Browse the repository at this point in the history
* docs: add Windows build instructions

* fix: resolve cursor_remaining feature compilation error
  • Loading branch information
leopeng1995 authored Feb 4, 2025
1 parent 771a2c2 commit e1646a2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 8 deletions.
59 changes: 59 additions & 0 deletions docs/windows_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Building OpenPAL3 on Windows

### Setting up the build environment

You will need to download and install the following tools:

Required Softwares:

- Visual Studio Build Tools
- With the "Visual C++ Build Tools" workload
- MSVC v143 or newer recommended
- Rust
- Install using rustup
- Switch to nightly: rustup default nightly
- Vulkan SDK
- Download and install from LunarG
- Latest version recommended (tested with 1.4.304.0)
- OpenAL
- Download and install OpenAL 1.1 Core PC SDK
- vcpkg
- Set up vcpkg following the official guide

### Building OpenPAL3

1. Clone the repository:

```bash
git clone https://github.com/dontpanic92/OpenPAL3.git
cd OpenPAL3
```

2. Initialize submodules:

```bash
git submodule update --init
```

3. Install dependencies via vcpkg:

```bash
vcpkg install --triplet x64-windows-static-md
```

4. Build the project:

```bash
$env:RUSTFLAGS="-A explicit_builtin_cfgs_in_flags"
cargo build --release
```

### Notes

- The RUSTFLAGS environment variable is required to prevent compilation errors related to the `--cfg windows` flag
- The build output will be located in target/release/
- Make sure all environment variables are properly set up before building

### Known Issues
- If you encounter a --cfg windows compilation error, ensure you've set the RUSTFLAGS environment variable as shown above
- If cargo can't find MSVC, ensure Visual Studio Build Tools is properly installed and the environment is configured
2 changes: 0 additions & 2 deletions yaobow/fileformats/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(cursor_remaining)]

pub mod c00;
pub mod mv3;
pub mod nif;
Expand Down
8 changes: 4 additions & 4 deletions yaobow/fileformats/src/rwbs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub fn list_chunks(data: &[u8]) -> anyhow::Result<Vec<ChunkHeader>> {
let mut cursor = Cursor::new(data);
let mut chunks = vec![];

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

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

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

while !cursor.is_empty() {
while cursor.position() < cursor.get_ref().len() as u64 {
let chunk = ChunkHeader::read(&mut cursor)?;
match chunk.ty {
ChunkType::ANIM_ANIMATION => anim.push(AnmAction::read(&mut cursor)?),
Expand Down
1 change: 0 additions & 1 deletion yaobow/packfs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(io_error_more)]
#![feature(cursor_remaining)]
#![cfg_attr(target_os = "vita", feature(stdarch_arm_neon_intrinsics))]

pub mod cpk;
Expand Down
2 changes: 1 addition & 1 deletion yaobow/packfs/src/pkg/pkg_archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl PkgEntries {

let mut file_entries = vec![];
let mut entry_cursor = Cursor::new(buf);
while !entry_cursor.is_empty() {
while entry_cursor.position() < entry_cursor.get_ref().len() as u64 {
let name_len = entry_cursor.read_u32_le()?;
let name = String::from_utf8(entry_cursor.read_u8_vec(name_len as usize)?)?;
let start_position = entry_cursor.read_u32_le()?;
Expand Down

0 comments on commit e1646a2

Please sign in to comment.