File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -148,22 +148,24 @@ pub struct Directory {
148148 pub header : Header ,
149149 pub entries : Vec < Entry > ,
150150 pub offset : usize ,
151+ pub size : usize ,
151152 pub name : String ,
152153}
153154
154155impl Display for Directory {
155156 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
156157 let n = & self . name ;
157158 let o = self . offset ;
159+ let s = self . size ;
158160 let m = self . manifest ;
159- write ! ( f, "{n} @ {o:08x}, {m}" )
161+ write ! ( f, "{n} @ {o:08x}, {s} bytes, { m}" )
160162 }
161163}
162164
163165const HEADER_SIZE : usize = core:: mem:: size_of :: < Header > ( ) ;
164166
165167impl Directory {
166- pub fn new ( data : & [ u8 ] , offset : usize ) -> Result < Self , String > {
168+ pub fn new ( data : & [ u8 ] , offset : usize , size : usize ) -> Result < Self , String > {
167169 let Ok ( manifest) = Manifest :: new ( data) else {
168170 return Err ( "cannot parse Gen 2 directory manifest" . to_string ( ) ) ;
169171 } ;
@@ -198,6 +200,7 @@ impl Directory {
198200 header,
199201 entries,
200202 offset,
203+ size,
201204 name,
202205 } )
203206 }
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ impl ME {
7777 {
7878 gen3dirs. push ( cpd) ;
7979 }
80- } else if let Ok ( dir) = Gen2Directory :: new ( & data[ o..] , o) {
80+ } else if let Ok ( dir) = Gen2Directory :: new ( & data[ o..] , o, s ) {
8181 gen2dirs. push ( dir) ;
8282 } else if debug {
8383 println ! ( "{name} @ {o:08x} has no CPD signature" ) ;
You can’t perform that action at this time.
0 commit comments