1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// Ported from UnityPy 1.25.2 (MIT): UnityPy/export/SpriteHelper.py's get_image and get_image_from_sprite (which Sprites read and render, the sheet and alpha texture each takes, in that order), and export/Texture2DConverter.py's parse_image_data for a side of 0. See THIRD_PARTY_LICENSES.
//! The `sprites` output kind (`outputs.sprites`, `docs/BATCH_SPEC.md` 1.5;
//! `docs/plans/extract.md` E17): one PNG per Sprite of the input's own
//! `SerializedFile`s (section 3), rendered by `unityrs_texture::sprite` from
//! a sheet that may be in a dependency (`docs/plans/batch.md` 2.6).
//!
//! - **The plan** ([`plan`], 4.4, in plan order between the textures kind
//! and the atlases): each Sprite's name (step 1, `duplicate_name` among
//! Sprites), the skips that need no pixels (step 2: the Sprite's checked
//! read as UnityPy constructs it, then E17's fields ([`object`]), its
//! render data ([`atlas`]), then its texture's dereference, object read
//! and, for a sheet with no side of 0, section 3's answers 2 and 3, and
//! then its alpha texture's), then its key from the `sprites` template
//! (step 3), from the attempt's one key table.
//! - **Sprite groups** (4.4): the planned Sprites grouped by their sheet,
//! the texture's file ([`files`]: the row chain it was opened from) and
//! path id, and the alpha texture's or none ([`SheetId`]), in the order
//! of each group's first Sprite (a counting sort, linear and counted),
//! whose pointers to its sheet the group keeps ([`GroupSheet`]).
//! - **The export** ([`export`]), first in 4.4's export order: each group's
//! sheet dereferenced from its record and decoded once (section 3's
//! answers 4 to 10, 12 and 13; a side of 0 is UnityPy's 0 x 0 `RGBA`
//! image; a failure every Sprite's of the group), its alpha texture with
//! it and merged in (`sprite::Sheet`), then each Sprite rendered, in plan
//! order, and its PNG made (E19) with its visible hash (E20).
//!
//! The textures a Sprite renders from are found by dereferencing, so every
//! such read is an Environment call checked as 2.6 step 7 says, its target's
//! top-level bundle held while it is used and dropped when the read ends:
//! the plan keeps no handle into another bundle (a group keeps its first
//! Sprite's own file and pointers, an atlas's index keeps render data, not
//! the atlas). Every buffer is charged to `M_X` before it is allocated,
//! every core call is under the refusal probe on its own, and each pixel
//! buffer is counted as export work (`docs/plans/batch.md` 2.6 step 10): a
//! decoded sheet's and a merged sheet's before they are made, a rendered
//! image's once the render returns it, after answer 11 and before its PNG
//! (the canvases inside the render are charged to `M_X` and its loops
//! counted as decode work, E59).
use Arc;
use ObjectRef;
use PPtr;
use ;
use ;
use ;
use MemberPath;
use ;
use read;
use Seam;
use Map;
use ;
/// `Sprite`'s class id.
pub const SPRITE: i32 = 213;
/// `SpriteAtlas`'s class id.
pub const SPRITE_ATLAS: i32 = 687_078_895;
/// A texture's identity in 4.4's sprite groups: its file's number in the
/// attempt ([`files::Files`]) and its path id.
pub
/// A sprite group's sheet: the texture's identity, and its alpha
/// texture's or none.
pub type GroupKey = ;
/// Where a group's export finds its sheet (recorded at the plan, from the
/// group's first Sprite): the Sprite's own file; the `m_SpriteAtlas`
/// pointer of it, where its render data is that atlas's (the textures'
/// pointers are then the atlas's file's); and the texture's and alpha
/// texture's pointers.
pub
/// A planned Sprite: its object, what it renders from, its group and its
/// key.
pub
/// The sprites kind's plan: the planned Sprites in plan order, and their
/// groups' sheets in the order of each one's first Sprite.
pub
/// A Sprite's render data, resolved (E17): its rectangle and settings
/// with its `m_PixelsToUnits`; the render data; the file its pointers are
/// read from; the `m_SpriteAtlas` pointer, where the render data is that
/// atlas's; and the atlas's top-level bundle, held while the caller uses
/// them (2.6 step 7).
pub
/// A `PPtr`'s ids followed from `from` (`PPtr.deref`), with the core
/// pointer they are: an `m_FileID` outside an `int` names no external,
/// `bad_pointer` (the core's `FileIdPastEnd`); an `m_PathID` outside an
/// `i64` (a `UInt64` past `2^63`) names no object of any file, so its file
/// is found as any id's is (its failure the pointer's) and then none is
/// there, `bad_pointer` (UnityPy's `KeyError`, the core's `MissingObject`;
/// B3's review round 3, S3a).