From 4c92c5e8ec8274628649801c908829014878526a Mon Sep 17 00:00:00 2001 From: Will Greenberg Date: Mon, 11 Nov 2024 21:01:51 -0800 Subject: [PATCH] wip --- rust/src/unity/types/binary.rs | 3 +++ src/AShortHike/Scenes.ts | 2 +- src/Common/Unity/AssetManager.ts | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rust/src/unity/types/binary.rs b/rust/src/unity/types/binary.rs index f74825a30..35cb99e62 100644 --- a/rust/src/unity/types/binary.rs +++ b/rust/src/unity/types/binary.rs @@ -214,7 +214,10 @@ pub struct ChannelInfo { pub stream: u8, pub offset: u8, pub format: VertexFormat, + #[deku(bits = "3")] pub dimension: u8, + #[deku(bits = "1", pad_bits_after = "4")] + pub instance_data: u8, } #[derive(DekuRead, Clone, Debug)] diff --git a/src/AShortHike/Scenes.ts b/src/AShortHike/Scenes.ts index d5d3e0f9d..a84b07152 100644 --- a/src/AShortHike/Scenes.ts +++ b/src/AShortHike/Scenes.ts @@ -291,7 +291,7 @@ const id = 'AShortHike'; const name = 'A Short Hike'; const sceneDescs = [ - new AShortHikeSceneDesc(`level0`, "Main Menu"), + new AShortHikeSceneDesc(`level1`, "Main Menu"), new AShortHikeSceneDesc(`level2`, "The Island"), ]; diff --git a/src/Common/Unity/AssetManager.ts b/src/Common/Unity/AssetManager.ts index d95b8a137..26c8d43f9 100644 --- a/src/Common/Unity/AssetManager.ts +++ b/src/Common/Unity/AssetManager.ts @@ -490,7 +490,11 @@ function vertexFormatToGfxFormatBase(vertexFormat: UnityVertexFormat): GfxFormat function vertexFormatToGfxFormat(vertexFormat: UnityVertexFormat, dimension: number): GfxFormat { const baseFormat = vertexFormatToGfxFormatBase(vertexFormat); - const compFlags = dimension as FormatCompFlags; + let maskedDimension = dimension & 0x0F; + if (![1, 2, 3, 4].includes(maskedDimension)) { + throw new Error(`invalid dimension ${maskedDimension}`); + } + const compFlags = maskedDimension as FormatCompFlags; return setFormatCompFlags(baseFormat, compFlags); }