Merge branch 'Unity2019'

This commit is contained in:
Jáchym Toušek
2022-07-27 08:41:56 +02:00
10 changed files with 169 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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

View File

@@ -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
}
}

View File

@@ -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]))

View File

@@ -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,7 +65,6 @@ 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")
@@ -77,11 +75,14 @@ fn main() {
.expect("failed to execute UnityTextModifier.py");
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);