- commit
- d33337a51b89bf59d6eca91ea8f39203a635dab6
- parent
- 003e5cc2d9b7d2191966cf689712526a95b6f624
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-01-30 09:02
refactor: RubyMarshalReader.read_all()
Diffstat
| M | rpg_extract.py | 17 | +++++++++++------ |
1 files changed, 11 insertions, 6 deletions
diff --git a/rpg_extract.py b/rpg_extract.py
@@ -260,6 +260,16 @@ class RubyMarshalReader: 260 260 self.objects[i] = value 261 261 return typ, value 262 262 -1 263 @classmethod -1 264 def read_all(cls, fh): -1 265 objs = [] -1 266 while True: -1 267 r = cls(fh) -1 268 if not r.check_version(): -1 269 break -1 270 objs.append(r.read_obj()) -1 271 return objs -1 272 263 273 264 274 def log(path, i, total): 265 275 progress = i * 100 // total @@ -290,12 +300,7 @@ if __name__ == '__main__': 290 300 path.parent.mkdir(parents=True, exist_ok=True) 291 301 292 302 if path.suffix == '.rvdata2':293 -1 objs = []294 -1 while True:295 -1 r = RubyMarshalReader(fi)296 -1 if not r.check_version():297 -1 break298 -1 objs.append(r.read_obj())-1 303 objs = RubyMarshalReader.read_all(fi) 299 304 300 305 if name == 'Data\\Scripts.rvdata2': 301 306 assert len(objs) == 1