Skip to content

Commit

Permalink
ima start focusing on school now
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRTTV committed Sep 16, 2023
1 parent 1bce49c commit c51cf1e
Show file tree
Hide file tree
Showing 23 changed files with 2,932 additions and 2,035 deletions.
91 changes: 88 additions & 3 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nbtworkbench"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
description = "A modern NBT Editor written in rust. Optimized beyond belief"
license-file = "LICENSE"
Expand Down Expand Up @@ -29,7 +29,6 @@ codegen-units = 1

[profile.flame]
inherits = "release"
lto = "fat"
strip = false
debug = true

Expand All @@ -55,3 +54,5 @@ hashbrown = { version = "0.14.0", features = ["raw"] }
notify = "6.0.1"
uuid = { version = "1.4.1", features = ["v4"] }
compact_str = "0.7.1"
wgsl-inline = "0.1.3" # minify no work for some reason
static_assertions = "1.1.0"
2 changes: 1 addition & 1 deletion src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub const TOOLTIP_Z: u8 = 240;
pub fn icon() -> Vec<u8> {
#[cfg(debug_assertions)]
let start = unsafe { core::arch::x86_64::_rdtsc() };
let original = match (SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_micros() & 7) as u8 {
let original = match (SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).expect("time cant go backwards").as_micros() & 7) as u8 {
// its a good random only because its used once
0 => OTHERSIDE_MUSIC_DISC_ICON,
1 => PIGSTEP_MUSIC_DISC_ICON,
Expand Down
18 changes: 8 additions & 10 deletions src/elements/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ macro_rules! array {
let vec = alloc(Layout::array::<NbtElement>(len).unwrap_unchecked()).cast::<NbtElement>();
for idx in 0..len {
let mut element = NbtElement {
data: ManuallyDrop::new(NbtElementData {
$element_field: core::mem::transmute(<$t>::from_be_bytes(
decoder.data.add(idx * core::mem::size_of::<$t>()).cast::<[u8; core::mem::size_of::<$t>()]>().read(),
)),
}),
$element_field: core::mem::transmute(<$t>::from_be_bytes(
decoder.data.add(idx * core::mem::size_of::<$t>()).cast::<[u8; core::mem::size_of::<$t>()]>().read(),
)),
};
element.id.id = $id;
vec.add(idx).write(element);
Expand Down Expand Up @@ -100,7 +98,7 @@ macro_rules! array {
impl $name {
#[inline(always)]
fn transmute(element: &NbtElement) -> $t {
unsafe { element.data.deref().$element_field.deref().value }
unsafe { element.deref().$element_field.deref().value }
}

#[inline]
Expand Down Expand Up @@ -239,10 +237,10 @@ macro_rules! array {
}

let ghost_tail_mod = if let Some((id, x, y, _)) = ctx.ghost && ctx.pos() + (0, 16 - *remaining_scroll * 16 - 8) == (x, y) && id == $id {
false
} else {
true
};
false
} else {
true
};

builder.draw_texture(ctx.pos() - (16, 0), CONNECTION_UV, (16, (!(idx == self.len() - 1 && ghost_tail_mod)) as usize * 7 + 9));
if !tail {
Expand Down
Loading

0 comments on commit c51cf1e

Please sign in to comment.