diff --git a/assets/files-2019.4/SGCaret000000_0_Sprite.dat b/assets/files-2019.4/SGCaret000000_0_Sprite.dat new file mode 100644 index 0000000..fdc9533 Binary files /dev/null and b/assets/files-2019.4/SGCaret000000_0_Sprite.dat differ diff --git a/assets/files-2019.4/SGCaret000000_1_Sprite.dat b/assets/files-2019.4/SGCaret000000_1_Sprite.dat new file mode 100644 index 0000000..d54ecd2 Binary files /dev/null and b/assets/files-2019.4/SGCaret000000_1_Sprite.dat differ diff --git a/assets/files-2019.4/SGCaret000000_2_Sprite.dat b/assets/files-2019.4/SGCaret000000_2_Sprite.dat new file mode 100644 index 0000000..f33cbcb Binary files /dev/null and b/assets/files-2019.4/SGCaret000000_2_Sprite.dat differ diff --git a/assets/files-2019.4/SGCaret000100_0_Sprite.dat b/assets/files-2019.4/SGCaret000100_0_Sprite.dat new file mode 100644 index 0000000..0a34121 Binary files /dev/null and b/assets/files-2019.4/SGCaret000100_0_Sprite.dat differ diff --git a/assets/files-2019.4/SGCaret000100_1_Sprite.dat b/assets/files-2019.4/SGCaret000100_1_Sprite.dat new file mode 100644 index 0000000..dceb617 Binary files /dev/null and b/assets/files-2019.4/SGCaret000100_1_Sprite.dat differ diff --git a/assets/files-2019.4/SGCaret000100_2_Sprite.dat b/assets/files-2019.4/SGCaret000100_2_Sprite.dat new file mode 100644 index 0000000..5e79954 Binary files /dev/null and b/assets/files-2019.4/SGCaret000100_2_Sprite.dat differ diff --git a/compileall.sh b/compileall.sh index b6ec2fe..3ffaa58 100644 --- a/compileall.sh +++ b/compileall.sh @@ -22,4 +22,5 @@ cargo run matsuribayashi 5.6.7f1 win && \ cargo run matsuribayashi 5.6.7f1 unix && \ cargo run matsuribayashi 2017.2.5 unix && \ cargo run matsuribayashi 2017.2.5 win && \ -cargo run rei 2019.4.3 win +cargo run rei 2019.4.3 win && \ +cargo run rei 2019.4.3 unix diff --git a/scripts/BinaryTemplates/Unity2019.4Sprite.tcl b/scripts/BinaryTemplates/Unity2019.4Sprite.tcl new file mode 100644 index 0000000..d8aec62 --- /dev/null +++ b/scripts/BinaryTemplates/Unity2019.4Sprite.tcl @@ -0,0 +1,147 @@ +little_endian +proc align {size alignment} { + set extra [expr $size % $alignment] + set newExtra [expr $extra > 0 ? $alignment : 0] + return [expr $size - $extra + $newExtra] +} + +proc alignPos {alignment} { + goto [align [pos] $alignment] +} + +proc pptr {name} { + section $name { + int32 "m_FileID" + int64 "m_PathID" + } +} + +proc rectf {name} { + section $name { + float "x" + float "y" + float "width" + float "height" + } +} + +proc vector2f {name} { + section $name { + float "x" + float "y" + } +} + +proc vector3f {name} { + section $name { + float "x" + float "y" + float "z" + } +} + +proc vector4f {name} { + section $name { + float "x" + float "y" + float "z" + float "w" + } +} + +set nameLen [uint32 "Name Length"] +str [align $nameLen 4] "utf8" "Name" +rectf "m_Rect" +vector2f "m_Offset" +vector4f "m_Border" +float "m_PixelsToUnits" +vector2f "m_Pivot" +uint32 "m_Extrude" +uint8 "m_IsPolygon" +alignPos 4 +section "m_RenderDataKey" { + uuid "first" + int64 "second" +} +uint32 "m_AtlasTags.size" +pptr "m_SpriteAtlas" +section "m_RD" { + pptr "texture" + pptr "alphaTexture" + section "secondaryTextures" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + # TODO: What are these? + } + } + section "m_SubMeshes" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + section "Submesh" { + uint32 "firstByte" + uint32 "indexCount" + int32 "topology" + uint32 "baseVertex" + uint32 "firstVertex" + uint32 "vertexCount" + section "localAABB" { + vector3f "m_Center" + vector3f "m_Extent" + } + } + } + } + section "m_IndexBuffer" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + uint8 "data" + } + } + section "m_VertexData" { + uint32 "m_VertexCount" + section "m_Channels" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + section "ChannelInfo" { + uint8 "stream" + uint8 "offset" + uint8 "format" + uint8 "dimension" + } + } + } + set dlen [uint32 "dataSize"] + bytes $dlen "data" + } + section "m_Bindpose" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + # TODO: What are these + } + } + rectf "textureRect" + vector2f "textureRectOffset" + vector2f "atlasRectOffset" + uint32 "settingsRaw" + vector4f "uvTransform" + float "downscaleMultiplier" +} + +section "m_PhysicsShape" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + section "Entry" { + set blen [int32 "size"] + for {set j 0} {$j < $blen} {incr j} { + vector2f "data" + } + } + } +} + +section "m_Bones" { + set alen [int32 "size"] + for {set i 0} {$i < $alen} {incr i} { + # TODO: What are these + } +} \ No newline at end of file diff --git a/scripts/EMIPGenerator.py b/scripts/EMIPGenerator.py index c6c9798..6ebad72 100644 --- a/scripts/EMIPGenerator.py +++ b/scripts/EMIPGenerator.py @@ -32,12 +32,17 @@ class AssetEdit: output = len(self.name).to_bytes(4, byteorder="little") output += self.name.encode("utf-8") output += b"\0" * ((4 - len(self.name)) % 4) + if unityVersion[0] == 2019: + output += (4).to_bytes(4, byteorder="little") # m_ForcedFallbackFormat + output += (0).to_bytes(4, byteorder="little") # m_DownscaleFallback output += image.width.to_bytes(4, byteorder="little") output += image.height.to_bytes(4, byteorder="little") output += len(imageData).to_bytes(4, byteorder="little") output += (4).to_bytes(4, byteorder="little") # m_TextureFormat output += (1).to_bytes(4, byteorder="little") # m_MipCount output += b"\0\x01\0\0" # Flags + if unityVersion[0] == 2019: + output += (0).to_bytes(4, byteorder="little") # m_StreamingMipmapsPriority output += (1).to_bytes(4, byteorder="little") # m_ImageCount output += (2).to_bytes(4, byteorder="little") # m_TextureDimension output += (2).to_bytes(4, byteorder="little") # m_FilterMode @@ -45,7 +50,7 @@ class AssetEdit: output += (0).to_bytes(4, byteorder="little") # m_MipBias if unityVersion[0] == 5: output += (1).to_bytes(4, byteorder="little") # m_WrapMode - elif unityVersion[0] == 2017: + elif unityVersion[0] == 2017 or unityVersion[0] == 2019: output += (1).to_bytes(4, byteorder="little") * 3 # m_wrap{U,V,W} else: sys.stderr.write("Warning: Unrecognized Unity version: " + str(unityVersion[0])) diff --git a/src/main.rs b/src/main.rs index 18b668e..3d5d28b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,6 @@ fn main() { } let arc_number = chapters.get(&chapter[..]).unwrap().clone(); - let arc_type = if arc_number <= 4 { "question_arcs" } else { "answer_arcs" }; let assets = format!("assets/vanilla/{}/{}-{}/sharedassets0.assets", &chapter, &system, &unity); let directory_assets = "output/assets"; let directory_data = format!("output/HigurashiEp{:02}_Data", arc_number); @@ -66,22 +65,24 @@ fn main() { assert_eq!(unity, &version.trim()); // 1. texts - if arc_number.clone() < 9 { - let status = Command::new("python") - .env("PYTHONIOENCODING", "utf-8") - .arg("scripts/UnityTextModifier.py") - .arg(&assets) - .arg("assets/text-edits.json") - .arg(&directory_assets) - .status() - .expect("failed to execute UnityTextModifier.py"); + let status = Command::new("python") + .env("PYTHONIOENCODING", "utf-8") + .arg("scripts/UnityTextModifier.py") + .arg(&assets) + .arg("assets/text-edits.json") + .arg(&directory_assets) + .status() + .expect("failed to execute UnityTextModifier.py"); - assert!(status.success()); - } + assert!(status.success()); // 2. images copy_images("assets/images/shared", &directory_assets); - copy_images(format!("assets/images/{}", &arc_type).as_ref(), &directory_assets); + if arc_number <= 4 { + copy_images("assets/images/question_arcs", &directory_assets); + } else if arc_number <= 8 { + copy_images("assets/images/answer_arcs", &directory_assets); + }; copy_images(format!("assets/images/specific/{}", &chapter).as_ref(), &directory_assets); let version_specific_path = format!("assets/images/version-specific/{}-{}", &chapter, &unity); copy_images(version_specific_path.as_ref(), &directory_assets);