Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

WIP: main sub

Currently, I'm not always getting a PackfileView back, and when I do
it seems to be corrupted.
  • Loading branch information...
commit fcd101f35c6e5d1593e797fd3d8052ff52d3ba80 1 parent d17a7b4
@Benabik Benabik authored
Showing with 14 additions and 2 deletions.
  1. +11 −2 src/PACT/Packfile/Decompile.winxed
  2. +3 −0  src/disasm.winxed
View
13 src/PACT/Packfile/Decompile.winxed
@@ -61,6 +61,10 @@ class PACT.Packfile.Decompile {
if ( !(packfile instanceof 'Packfile') )
die("Need a PBC filename or Packfile PMC");
self.packfile = packfile;
+ var view = packfile.view();
+ cry(typeof(packfile), ' ', typeof(view), ' ', view);
+ if ( !(view instanceof 'PackfileView') )
+ die('7?!?!?');
:PACT.Packfile ret();
ret.set_uuid(int(packfile['uuid_type']), string(packfile['uuid']));
@@ -117,15 +121,18 @@ class PACT.Packfile.Decompile {
size = constants.pmc_count();
var pmcs = new 'FixedPMCArray'(size);
- var subs = [];
ret.pmcs = pmcs;
+ var subs = [];
+ var main = view.main_sub();
for (i = 0; i < size; ++i) {
var c = var(constants[i]);
if (c instanceof 'Sub') {
// Create a new Packfile.Subroutine that we'll reference
// later.
c = new PACT.Packfile.Subroutine(c);
- push(subs, c); // TODO: Convert to Packfile.Subroutine
+ push(subs, c);
+ if (c.sub === main)
+ ret.main = c;
}
if (c instanceof 'Key')
@@ -144,6 +151,8 @@ class PACT.Packfile.Decompile {
return 1;
});
+ // TODO: load main and tags from Packfile
+
// Load annotations
var annos;
int annos_size;
View
3  src/disasm.winxed
@@ -112,6 +112,9 @@ function main[main](var argv) {
print(')');
}
+ if (vi === packfile.main)
+ print(', main');
+
say();
break;
Please sign in to comment.
Something went wrong with that request. Please try again.