Skip to content

Commit 34ba117

Browse files
committed
Merge branch 'Unity2019'
2 parents ec15bfe + 1fe34a3 commit 34ba117

10 files changed

+169
-15
lines changed
512 Bytes
Binary file not shown.
520 Bytes
Binary file not shown.
528 Bytes
Binary file not shown.
476 Bytes
Binary file not shown.
476 Bytes
Binary file not shown.
476 Bytes
Binary file not shown.

compileall.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ cargo run matsuribayashi 5.6.7f1 win && \
2222
cargo run matsuribayashi 5.6.7f1 unix && \
2323
cargo run matsuribayashi 2017.2.5 unix && \
2424
cargo run matsuribayashi 2017.2.5 win && \
25-
cargo run rei 2019.4.3 win
25+
cargo run rei 2019.4.3 win && \
26+
cargo run rei 2019.4.3 unix
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
little_endian
2+
proc align {size alignment} {
3+
set extra [expr $size % $alignment]
4+
set newExtra [expr $extra > 0 ? $alignment : 0]
5+
return [expr $size - $extra + $newExtra]
6+
}
7+
8+
proc alignPos {alignment} {
9+
goto [align [pos] $alignment]
10+
}
11+
12+
proc pptr {name} {
13+
section $name {
14+
int32 "m_FileID"
15+
int64 "m_PathID"
16+
}
17+
}
18+
19+
proc rectf {name} {
20+
section $name {
21+
float "x"
22+
float "y"
23+
float "width"
24+
float "height"
25+
}
26+
}
27+
28+
proc vector2f {name} {
29+
section $name {
30+
float "x"
31+
float "y"
32+
}
33+
}
34+
35+
proc vector3f {name} {
36+
section $name {
37+
float "x"
38+
float "y"
39+
float "z"
40+
}
41+
}
42+
43+
proc vector4f {name} {
44+
section $name {
45+
float "x"
46+
float "y"
47+
float "z"
48+
float "w"
49+
}
50+
}
51+
52+
set nameLen [uint32 "Name Length"]
53+
str [align $nameLen 4] "utf8" "Name"
54+
rectf "m_Rect"
55+
vector2f "m_Offset"
56+
vector4f "m_Border"
57+
float "m_PixelsToUnits"
58+
vector2f "m_Pivot"
59+
uint32 "m_Extrude"
60+
uint8 "m_IsPolygon"
61+
alignPos 4
62+
section "m_RenderDataKey" {
63+
uuid "first"
64+
int64 "second"
65+
}
66+
uint32 "m_AtlasTags.size"
67+
pptr "m_SpriteAtlas"
68+
section "m_RD" {
69+
pptr "texture"
70+
pptr "alphaTexture"
71+
section "secondaryTextures" {
72+
set alen [int32 "size"]
73+
for {set i 0} {$i < $alen} {incr i} {
74+
# TODO: What are these?
75+
}
76+
}
77+
section "m_SubMeshes" {
78+
set alen [int32 "size"]
79+
for {set i 0} {$i < $alen} {incr i} {
80+
section "Submesh" {
81+
uint32 "firstByte"
82+
uint32 "indexCount"
83+
int32 "topology"
84+
uint32 "baseVertex"
85+
uint32 "firstVertex"
86+
uint32 "vertexCount"
87+
section "localAABB" {
88+
vector3f "m_Center"
89+
vector3f "m_Extent"
90+
}
91+
}
92+
}
93+
}
94+
section "m_IndexBuffer" {
95+
set alen [int32 "size"]
96+
for {set i 0} {$i < $alen} {incr i} {
97+
uint8 "data"
98+
}
99+
}
100+
section "m_VertexData" {
101+
uint32 "m_VertexCount"
102+
section "m_Channels" {
103+
set alen [int32 "size"]
104+
for {set i 0} {$i < $alen} {incr i} {
105+
section "ChannelInfo" {
106+
uint8 "stream"
107+
uint8 "offset"
108+
uint8 "format"
109+
uint8 "dimension"
110+
}
111+
}
112+
}
113+
set dlen [uint32 "dataSize"]
114+
bytes $dlen "data"
115+
}
116+
section "m_Bindpose" {
117+
set alen [int32 "size"]
118+
for {set i 0} {$i < $alen} {incr i} {
119+
# TODO: What are these
120+
}
121+
}
122+
rectf "textureRect"
123+
vector2f "textureRectOffset"
124+
vector2f "atlasRectOffset"
125+
uint32 "settingsRaw"
126+
vector4f "uvTransform"
127+
float "downscaleMultiplier"
128+
}
129+
130+
section "m_PhysicsShape" {
131+
set alen [int32 "size"]
132+
for {set i 0} {$i < $alen} {incr i} {
133+
section "Entry" {
134+
set blen [int32 "size"]
135+
for {set j 0} {$j < $blen} {incr j} {
136+
vector2f "data"
137+
}
138+
}
139+
}
140+
}
141+
142+
section "m_Bones" {
143+
set alen [int32 "size"]
144+
for {set i 0} {$i < $alen} {incr i} {
145+
# TODO: What are these
146+
}
147+
}

scripts/EMIPGenerator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,25 @@ def pngToTexture2D(self, pngData, unityVersion):
3232
output = len(self.name).to_bytes(4, byteorder="little")
3333
output += self.name.encode("utf-8")
3434
output += b"\0" * ((4 - len(self.name)) % 4)
35+
if unityVersion[0] == 2019:
36+
output += (4).to_bytes(4, byteorder="little") # m_ForcedFallbackFormat
37+
output += (0).to_bytes(4, byteorder="little") # m_DownscaleFallback
3538
output += image.width.to_bytes(4, byteorder="little")
3639
output += image.height.to_bytes(4, byteorder="little")
3740
output += len(imageData).to_bytes(4, byteorder="little")
3841
output += (4).to_bytes(4, byteorder="little") # m_TextureFormat
3942
output += (1).to_bytes(4, byteorder="little") # m_MipCount
4043
output += b"\0\x01\0\0" # Flags
44+
if unityVersion[0] == 2019:
45+
output += (0).to_bytes(4, byteorder="little") # m_StreamingMipmapsPriority
4146
output += (1).to_bytes(4, byteorder="little") # m_ImageCount
4247
output += (2).to_bytes(4, byteorder="little") # m_TextureDimension
4348
output += (2).to_bytes(4, byteorder="little") # m_FilterMode
4449
output += (2).to_bytes(4, byteorder="little") # m_Aniso
4550
output += (0).to_bytes(4, byteorder="little") # m_MipBias
4651
if unityVersion[0] == 5:
4752
output += (1).to_bytes(4, byteorder="little") # m_WrapMode
48-
elif unityVersion[0] == 2017:
53+
elif unityVersion[0] == 2017 or unityVersion[0] == 2019:
4954
output += (1).to_bytes(4, byteorder="little") * 3 # m_wrap{U,V,W}
5055
else:
5156
sys.stderr.write("Warning: Unrecognized Unity version: " + str(unityVersion[0]))

src/main.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ fn main() {
3131
}
3232

3333
let arc_number = chapters.get(&chapter[..]).unwrap().clone();
34-
let arc_type = if arc_number <= 4 { "question_arcs" } else { "answer_arcs" };
3534
let assets = format!("assets/vanilla/{}/{}-{}/sharedassets0.assets", &chapter, &system, &unity);
3635
let directory_assets = "output/assets";
3736
let directory_data = format!("output/HigurashiEp{:02}_Data", arc_number);
@@ -66,22 +65,24 @@ fn main() {
6665
assert_eq!(unity, &version.trim());
6766

6867
// 1. texts
69-
if arc_number.clone() < 9 {
70-
let status = Command::new("python")
71-
.env("PYTHONIOENCODING", "utf-8")
72-
.arg("scripts/UnityTextModifier.py")
73-
.arg(&assets)
74-
.arg("assets/text-edits.json")
75-
.arg(&directory_assets)
76-
.status()
77-
.expect("failed to execute UnityTextModifier.py");
68+
let status = Command::new("python")
69+
.env("PYTHONIOENCODING", "utf-8")
70+
.arg("scripts/UnityTextModifier.py")
71+
.arg(&assets)
72+
.arg("assets/text-edits.json")
73+
.arg(&directory_assets)
74+
.status()
75+
.expect("failed to execute UnityTextModifier.py");
7876

79-
assert!(status.success());
80-
}
77+
assert!(status.success());
8178

8279
// 2. images
8380
copy_images("assets/images/shared", &directory_assets);
84-
copy_images(format!("assets/images/{}", &arc_type).as_ref(), &directory_assets);
81+
if arc_number <= 4 {
82+
copy_images("assets/images/question_arcs", &directory_assets);
83+
} else if arc_number <= 8 {
84+
copy_images("assets/images/answer_arcs", &directory_assets);
85+
};
8586
copy_images(format!("assets/images/specific/{}", &chapter).as_ref(), &directory_assets);
8687
let version_specific_path = format!("assets/images/version-specific/{}-{}", &chapter, &unity);
8788
copy_images(version_specific_path.as_ref(), &directory_assets);

0 commit comments

Comments
 (0)