Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wasm and watch the whole project burn #4

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ license = "MIT OR Apache-2.0"
keywords = ["TES3", "Morrowind"]
categories = ["Game development"]

[lib]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be unnecessary. Can't remember adding it, must've done so in the other repo

crate-type = ["cdylib", "rlib"]

[workspace]
members = ["libs/*"]

[dependencies]
esp = { path = "libs/esp", optional = true }
nif = { path = "libs/nif", optional = true }
wasm-bindgen = "0.2.92"

[dev-dependencies]
rayon = "^1.5"
Expand All @@ -25,3 +29,4 @@ walkdir = "^2.3"
[features]
default = ["esp", "nif"]
nightly = ["esp/nightly", "nif/nightly"]
wasm = ["esp/wasm"]
4 changes: 3 additions & 1 deletion libs/esp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ esp_macros = { path = "../esp_macros" }
hashbrown = { version = "^0.12", features = ["rayon"] }
rayon = "^1.5"
smart-default = "^0.6"
wasm-bindgen = { version = "0.2", optional = true }

[features]
default = []
default = ["wasm"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temp

nightly = ["bytes_io/nightly", "hashbrown/nightly"]
wasm = ["wasm-bindgen"]
4 changes: 4 additions & 0 deletions libs/esp/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ pub use startscript::*;
pub use static_::*;
pub use string::*;
pub use weapon::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[rustfmt::skip]
#[derive(TES3Object, Clone, Debug, PartialEq)]
pub enum TES3Object {
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/activator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Activator {
pub flags: ObjectFlags,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/aidata.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct AiData {
pub hello: i16,
Expand Down
10 changes: 10 additions & 0 deletions libs/esp/src/types/aipackage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Clone, Debug, PartialEq, SmartDefault)]
pub enum AiPackage {
#[default]
Expand All @@ -11,12 +15,14 @@ pub enum AiPackage {
Activate(AiActivatePackage),
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct AiTravelPackage {
pub location: [f32; 3],
pub reset: u8,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct AiWanderPackage {
pub distance: u16,
Expand All @@ -33,6 +39,7 @@ pub struct AiWanderPackage {
pub reset: i8,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct AiEscortPackage {
pub location: [f32; 3],
Expand All @@ -42,6 +49,7 @@ pub struct AiEscortPackage {
pub cell: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct AiFollowPackage {
pub location: [f32; 3],
Expand All @@ -51,12 +59,14 @@ pub struct AiFollowPackage {
pub cell: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct AiActivatePackage {
pub target: FixedString<32>,
pub reset: u8,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct TravelDestination {
pub translation: [f32; 3],
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/alchemy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Alchemy {
pub flags: ObjectFlags,
Expand All @@ -13,6 +17,7 @@ pub struct Alchemy {
pub effects: Option<Vec<Effect>>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct AlchemyData {
pub weight: f32,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/apparatus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Apparatus {
pub flags: ObjectFlags,
Expand All @@ -12,6 +16,7 @@ pub struct Apparatus {
pub script: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct ApparatusData {
pub kind: ApparatusType,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/armor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Armor {
pub flags: ObjectFlags,
Expand All @@ -14,6 +18,7 @@ pub struct Armor {
pub biped_objects: Option<Vec<BipedObject>>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct ArmorData {
pub kind: ArmorType,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/bipedobject.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct BipedObject {
pub kind: BipedObjectType,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/birthsign.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Birthsign {
pub flags: ObjectFlags,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/bodypart.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Bodypart {
pub flags: ObjectFlags,
Expand All @@ -10,6 +14,7 @@ pub struct Bodypart {
pub mesh: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct BodypartData {
pub part: BodypartId,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/book.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Book {
pub flags: ObjectFlags,
Expand All @@ -14,6 +18,7 @@ pub struct Book {
pub text: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct BookData {
pub weight: f32,
Expand Down
6 changes: 6 additions & 0 deletions libs/esp/src/types/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ use std::cmp::Reverse;

// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Cell {
pub flags: ObjectFlags,
Expand All @@ -16,12 +20,14 @@ pub struct Cell {
pub references: HashMap<(u32, u32), Reference>, // no option, to prevent auto merge
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct CellData {
pub flags: u32,
pub grid: (i32, i32),
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct AtmosphereData {
pub ambient_color: [u8; 4],
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/class.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Class {
pub flags: ObjectFlags,
Expand All @@ -10,6 +14,7 @@ pub struct Class {
pub description: Option<String>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct ClassData {
pub attribute1: AttributeId,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/clothing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Clothing {
pub flags: ObjectFlags,
Expand All @@ -14,6 +18,7 @@ pub struct Clothing {
pub biped_objects: Option<Vec<BipedObject>>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, PartialEq)]
pub struct ClothingData {
pub kind: ClothingType,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/container.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Container {
pub flags: ObjectFlags,
Expand Down
2 changes: 2 additions & 0 deletions libs/esp/src/types/creature.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// internal imports
use crate::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, PartialEq)]
pub struct Creature {
pub flags: ObjectFlags,
Expand All @@ -19,6 +20,7 @@ pub struct Creature {
pub travel_destinations: Option<Vec<TravelDestination>>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct CreatureData {
pub kind: u32,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/dialogue.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Dialogue {
pub flags: ObjectFlags,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/door.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Door {
pub flags: ObjectFlags,
Expand Down
4 changes: 4 additions & 0 deletions libs/esp/src/types/effect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct Effect {
pub magic_effect: EffectId2,
Expand Down
5 changes: 5 additions & 0 deletions libs/esp/src/types/enchanting.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// internal imports
use crate::prelude::*;
// wasm
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, Clone, Debug, Default, Eq, PartialEq)]
pub struct Enchanting {
pub flags: ObjectFlags,
Expand All @@ -9,6 +13,7 @@ pub struct Enchanting {
pub effects: Option<Vec<Effect>>,
}

#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[derive(Meta, LoadSave, Clone, Debug, Default, Eq, PartialEq)]
pub struct EnchantingData {
pub kind: EnchantType,
Expand Down
Loading