Skip to content

Commit

Permalink
Merge branch 'dev' into subdir_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PikminGuts92 committed Jan 21, 2024
2 parents b7c0248 + 7b3e4c2 commit e24e8e6
Show file tree
Hide file tree
Showing 35 changed files with 174 additions and 147 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
osname: "linux-x64"
- os: windows-latest
osname: "win-x64"
- os: windows-latest
osname: "win-x86"
toolchain: "stable-i686-pc-windows-msvc"
env:
BIN_PATH: ./target/release
steps:
Expand All @@ -33,18 +30,13 @@ jobs:
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ matrix.osname }}-cargo-audit-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain || 'stable' }}
override: true
- name: Install audit dependencies
shell: bash
run: |
Expand Down
83 changes: 17 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ jobs:
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-check-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
- name: Cargo check
shell: bash
run: |
cargo check --all-features
test:
name: Test
Expand All @@ -39,54 +35,17 @@ jobs:
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-test-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test

clippy:
name: Clippy
if: ${{ false }} # Always skip job (for now)
runs-on: ubuntu-latest
steps:
- name: Install linux dependencies
- name: Cargo test
shell: bash
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-clippy-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
cargo test --all-features
build:
name: Build (${{ matrix.osname }})
Expand All @@ -101,9 +60,6 @@ jobs:
osname: "linux-x64"
- os: windows-latest
osname: "win-x64"
- os: windows-latest
osname: "win-x86"
toolchain: "stable-i686-pc-windows-msvc"
env:
ZIP_NAME: ${{ github.event.repository.name }}-ci-${{ github.sha }}-${{ matrix.osname }}
BIN_PATH: ./target/release
Expand All @@ -116,22 +72,17 @@ jobs:
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ matrix.osname }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain || 'stable' }}
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --bins
- name: Cargo build
shell: bash
run: |
cargo build --release --bins
- name: Create output directory and copy licenses
shell: bash
run: |
Expand All @@ -144,7 +95,7 @@ jobs:
for exe in $(find $BIN_PATH -maxdepth 1 -type f ${{ matrix.os == 'macos-latest' && '-perm +0111' || '-executable' }} -print); do
cp -f $exe $OUTPUT_PATH/$(basename $exe)
done
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.OUTPUT_PATH }}/*
14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,23 @@ authors = ["PikminGuts92"]
edition = "2021"

[workspace.dependencies]
clap = { version = "4.4.11", features = ["derive"] }
clap = { version = "4.4.18", features = ["derive"] }
gltf = { version = "=1.3.0", default-features = false, features = [ "import", "names", "utils" ] }
gltf-json = { version = "=1.3.0", features = [ "names" ] }
grim = { path = "core/grim" }
itertools = "0.12.0"
lazy_static = "1.4.0"
log = "0.4.20"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
simplelog = "0.12.1"
thiserror = "1.0.52"
thiserror = "1.0.56"

[workspace.lints.rust]
dead_code = "allow"
deprecated = "allow"
unused_assignments = "allow"
unused_imports = "allow"

[profile.dev.package."*"]
opt-level = 3
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Grim (Working Title) [![CI](https://github.com/PikminGuts92/grim/workflows/CI/badge.svg)](https://github.com/PikminGuts92/grim/actions?query=workflow%3ACI)
This project is intended to be a re-write of [Mackiloha](https://github.com/PikminGuts92/Mackiloha).

**UNDER CONSTRUCTION**

**DO NOT USE**
This project is intended to be an evolution of [Mackiloha](https://github.com/PikminGuts92/Mackiloha). Overall design is still being worked on. Command line interface and Python API should be considered unstable. The latest CI build can be found [here](https://github.com/PikminGuts92/grim/actions/workflows/ci.yml).

# Build
Install **rustup** and **cargo** from [here](https://www.rust-lang.org/tools/install). Specific python module build instructions are in [scripts](scripts/).

Run: `cargo build --release`
5 changes: 4 additions & 1 deletion apps/cli/audio_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ grim = { workspace = true, features = [ "audio" ] }
thiserror = { workspace = true }

[features]
encode = [ "grim/audio_experimental" ]
encode = [ "grim/audio_experimental" ]

[lints]
workspace = true
4 changes: 2 additions & 2 deletions apps/cli/audio_tool/src/apps/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub struct EncoderApp {

impl SubApp for EncoderApp {
fn process(&mut self) -> Result<(), Box<dyn Error>> {
let input_path = Path::new(&self.input_path);
let output_path = Path::new(&self.output_path);
let _input_path = Path::new(&self.input_path);
let _output_path = Path::new(&self.output_path);

todo!()
//Ok(())
Expand Down
2 changes: 0 additions & 2 deletions apps/cli/audio_tool/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(unused_imports)]

mod apps;
use apps::AudioTool;

Expand Down
6 changes: 5 additions & 1 deletion apps/cli/mesh_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ grim = { workspace = true, features = [ "model" ] }
thiserror = { workspace = true }

[features]
experimental = []
default = [ "experimental" ]
experimental = []

[lints]
workspace = true
2 changes: 0 additions & 2 deletions apps/cli/mesh_tool/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(unused_imports)]

mod apps;
use apps::MeshTool;

Expand Down
3 changes: 3 additions & 0 deletions apps/cli/p9_scene_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ thiserror = { workspace = true }
[dev-dependencies]
criterion = "0.5.1"
rstest = "0.18.2"

[lints]
workspace = true
3 changes: 0 additions & 3 deletions apps/cli/p9_scene_tool/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![allow(dead_code)]
#![allow(unused_imports)]

mod apps;
mod formatter;
mod helpers;
Expand Down
3 changes: 3 additions & 0 deletions apps/cli/scene_tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ edition.workspace = true
clap = { workspace = true }
grim = { workspace = true, features = [ "midi" ] }
thiserror = { workspace = true }

[lints]
workspace = true
3 changes: 0 additions & 3 deletions apps/cli/scene_tool/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![allow(dead_code)]
#![allow(unused_imports)]

mod apps;
use apps::SceneTool;

Expand Down
12 changes: 7 additions & 5 deletions core/grim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ authors.workspace = true
edition.workspace = true

[dependencies]
base64 = "0.21.5"
base64 = "0.21.7"
bitstream-io = { version = "2.2.0", optional = true }
ffmpeg-next = { version = "6.1.0", optional = true }
flate2 = "1.0.28"
fon = { version = "0.6.0", optional = true }
gltf = { workspace = true, optional = true }
Expand All @@ -16,15 +15,15 @@ grim_gltf = { path = "../grim_gltf", optional = true }
grim_macros = { path = "../grim_macros" }
grim_traits = { path = "../grim_traits" }
half = { version = "2.3.1", default-features = false }
image = { version = "0.24.7", default-features = false, features = [ "dxt", "png" ] }
image = { version = "0.24.8", default-features = false, features = [ "dxt", "png" ] }
itertools = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
midly = { version = "0.5.3", optional = true }
nalgebra = { version = "0.32.3", optional = true }
nom = "7.1.3"
# pyo3 = { version = "0.17.3", optional = true, features = [ "extension-module" ] }
pyo3 = { git = "https://github.com/PyO3/pyo3", branch = "cfg-feature-pyo3", optional = true, features = [ "extension-module" ] }
pyo3 = { git = "https://github.com/PyO3/pyo3", branch = "cfg-feature-pyo3", optional = true, features = [ "experimental-inspect", "extension-module" ] }
rayon = "1.8.0"
regex = { version = "1.10.2", default-features = false, features = [ "std" ] }
serde = { optional = true, workspace = true }
Expand All @@ -37,7 +36,7 @@ rstest = "0.18.2"

[features]
audio = [ "bitstream-io", "fon", "wav" ]
audio_experimental = [ "ffmpeg-next" ]
audio_experimental = []
midi = [ "midly" ]
model = [ "gltf", "gltf-json", "grim_gltf", "nalgebra", "serde" ]
python = [ "pyo3" ]
Expand All @@ -49,3 +48,6 @@ harness = false
[lib]
bench = false
crate-type = [ "lib", "cdylib" ]

[lints]
workspace = true
29 changes: 29 additions & 0 deletions core/grim/grim.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class ArkOffsetEntry:
id: int
path: str
offset: int
part: int
size: int
inflated_size: int

class Ark:
version: int
encryption: int | None
entries: list[ArkOffsetEntry]

@staticmethod
def from_file_path(path: str) -> Ark: ...

class Bitmap:
bpp: int
encoding: int
mip_maps: int
width: int
height: int
bpl: int
raw_data: list[int]

@staticmethod
def from_file_path(path: str) -> Bitmap: ...

def save_to_file(path: str) -> None: ...
2 changes: 1 addition & 1 deletion core/grim/src/audio/xma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn read_frame_length<R: Read, E: Endianness>(reader: &mut BitReader<R, E>) -
}

#[cfg(feature = "audio_experimental")]
pub fn decode_xma_packets(packets: &[u8], sample_count: i32) -> Result<Vec<i16>> {
pub fn decode_xma_packets(packets: &[u8], _sample_count: i32) -> Result<Vec<i16>> {
let mut reader = BitReader::endian(Cursor::new(packets), BigEndian);

let packet = PacketInfo::from_reader(&mut reader)?;
Expand Down
2 changes: 1 addition & 1 deletion core/grim/src/dta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl DataArray {
stream.write_all(&v.data)?;
},
//DataArray::Func(_) => 0x03,
DataArray::Object(o) => {
DataArray::Object(_o) => {
todo!("Support object dta serialization")
},
DataArray::Symbol(s) => {
Expand Down
4 changes: 2 additions & 2 deletions core/grim/src/dta/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'a> DTAParser<'a> {
}

fn parse_array(&mut self) -> Vec<(DataArray, usize)> {
let mut data = Vec::new();
let data = Vec::new();

self.consume_whitespace();
// TODO: Consume comments
Expand Down Expand Up @@ -346,7 +346,7 @@ fn parse_variable<'a>(text: &'a [u8]) -> IResult<&'a [u8], DataArray> {
fn parse_kdata_unhandled<'a>(text: &'a [u8]) -> IResult<&'a [u8], DataArray> {
map(
all_consuming(tag("kDataUnhandled")),
|data: &'a [u8]| DataArray::KDataUnhandled
|_data: &'a [u8]| DataArray::KDataUnhandled
)(text)
}

Expand Down
Loading

0 comments on commit e24e8e6

Please sign in to comment.