Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Contributing to `rzfile`

Thanks for your interest in contributing to `rzfile`!
Below you'll find the basic guidelines to help you get started.

---

## Requirements

* **Rust stable** (check with `rustc --version`)
* Use `cargo fmt`, `cargo clippy`, and `cargo test` before submitting any PRs
* Optional: `cargo nextest` and code coverage tools like `cargo tarpaulin`

---

## Running Tests

```bash
cargo test
```

To get code coverage:

```bash
cargo install cargo-tarpaulin
cargo tarpaulin --out Html
```

---

## Project Structure

* `src/lib.rs`: Crate root
* `src/file.rs`: File parsing and index handling
* `src/name.rs`: Encoding/decoding logic for filenames
* `src/error.rs`: Error types and descriptions
* `tests/`: Additional integration tests

---

## Code Style

Use:

```bash
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
```

No warnings or `unwrap()`s in final PRs unless justified.

---

## Pull Request Checklist

Before opening a PR:

* All tests pass (`cargo test`)
* Code is formatted (`cargo fmt`)
* No Clippy warnings (`cargo clippy`)
* No unnecessary `unwrap()`, `expect()`, or panics
* Added or updated tests if functionality changed
* Relevant documentation updated (including `README.md` or inline rustdoc)

---

## Commit Guidelines

Follow conventional commits:

* `feat: Add ...`
* `fix: Correct ...`
* `test: Add test for ...`
* `chore: Maintenance ...`
* `docs: Update README / comments`

---

## Feedback & Issues

Found a bug or have a feature idea?

* Use [GitHub Issues](https://github.com/NGemity/rzfile/issues)
* Try to reproduce bugs with a minimal test case

---

## License

By contributing, you agree that your code will be licensed under the same license as the rest of the project: MIT.

---

Thanks again,
The `rzfile` Maintainers
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Pull Request

## Description

Please explain what this PR does and why it's needed.
Link any related issues (e.g., `Closes #42`).

## Changes

- [ ] Feature added
- [ ] Bug fix
- [ ] Refactoring
- [ ] Docs update
- [ ] Other (explain below)

## Checklist

- [ ] Code is formatted with `cargo fmt`
- [ ] No Clippy warnings (`cargo clippy`)
- [ ] Tests pass (`cargo test`)
- [ ] Added or updated relevant tests
- [ ] Documentation updated (if applicable)
- [ ] Ready for review

---

> If you're contributing for the first time: welcome!
> Check the `CONTRIBUTING.md` for development guidelines.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: actions/setup-rust@v1
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly

- name: Cache cargo registry
uses: actions/cache@v4
with:
rust-version: stable
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Install tarpaulin
run: cargo install cargo-tarpaulin
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release Crate

on:
push:
tags:
- 'v*.*.*'

jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Check build
run: cargo build --release

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish --locked
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rzfile"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
authors = ["Marcel Exner <[email protected]>"]
description = "Library to handle RZ game data parsing and name decoding"
Expand Down
58 changes: 55 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,59 @@
</p>

<h2 align="center">rzfile<br>Rust Library for client file handling</h2>


# rzfile

### Intro
This library is part of the ROSE framework.
Mainly this is used for working with the client resources, e.g. `data.000`
[![CI](https://github.com/NGemity/rzfile/actions/workflows/ci.yml/badge.svg)](https://github.com/NGemity/rzfile/actions/workflows/ci.yml)
[![codecov](https://codecov.io/github/NGemity/rzfile/graph/badge.svg?token=FPK427O7U9)](https://codecov.io/github/NGemity/rzfile)
[![crates.io](https://img.shields.io/crates/v/rzfile.svg)](https://crates.io/crates/rzfile)
[![docs.rs](https://docs.rs/rzfile/badge.svg)](https://docs.rs/rzfile)

`rzfile` is a lightweight Rust library designed for parsing and handling binary file structures used in proprietary MMO game clients. It's part of the [`NGemity`](https://github.com/NGemity) project and supports tools such as the [RZEmulator](https://github.com/NGemity/RZEmulator).

## Features

* Parser for `data.00x` index files
* File name encryption and decryption based on game-specific logic
* Customizable encryption and reference tables
* Precise error handling via `RZError` (compatible with `thiserror`)
* Fully tested with high code coverage
* Minimal dependencies (only `thiserror` optionally)

## Example

```rust
use rzfile::file::parse_index;
use rzfile::name::{encode_file_name, decode_file_name};

let mut buffer = std::fs::read("data.000").unwrap();
let entries = parse_index(&mut buffer, None).unwrap();

let encoded = encode_file_name("test.dds", None, None).unwrap();
let decoded = decode_file_name(&encoded, None, None, true).unwrap();

assert_eq!(decoded, "test.dds");
```

## Installation

```bash
cargo add rzfile
```

Or manually via `Cargo.toml`:

```toml
[dependencies]
rzfile = "0.1"
```

## Documentation

* [docs.rs/rzfile](https://docs.rs/rzfile)
* [crates.io/crates/rzfile](https://crates.io/crates/rzfile)

## License

MIT © [NGemity](https://github.com/NGemity)