1
0
mirror of synced 2024-11-14 18:07:36 +01:00
Commit Graph

283 Commits

Author SHA1 Message Date
Jennifer Taylor
7eb41a45e7 Implement support for adding a background image on top of the background color but below the animation. 2021-05-23 23:37:05 +00:00
Jennifer Taylor
cc5cdde995 Fix frame number display in verbose output. 2021-05-23 20:37:42 +00:00
Jennifer Taylor
56498f6154 Implement masking support. 2021-05-23 20:37:18 +00:00
Jennifer Taylor
9df33fcec3 Support simple frame control bytecode. 2021-05-23 20:33:05 +00:00
Jennifer Taylor
14c8ac9347 Implement the first bits of bytecode processing, including the ability to go to an animation frame. 2021-05-23 20:32:21 +00:00
Jennifer Taylor
0a6635d993 Add comment about additive blending alpha 'hack'. 2021-05-23 20:31:39 +00:00
Jennifer Taylor
2aa37c2e40 Fix additive blending on semi-transparent backgrounds. 2021-05-22 23:24:51 +00:00
Jennifer Taylor
2d69d1dc99 Support parent sprite blend parameter inheritance. 2021-05-22 21:56:28 +00:00
Jennifer Taylor
e3e6354295 Blend 1 is the same as blend 0, according to Bishi. 2021-05-22 21:54:53 +00:00
Jennifer Taylor
a5c93569e9 Add a couple more warnings for areas where we don't (yet) support animation features. 2021-05-22 21:54:22 +00:00
Jennifer Taylor
274bd297f2 Change compositing to take from the center of the pixel in preparation of upcoming anti-aliasing attempt. 2021-05-22 21:53:09 +00:00
Jennifer Taylor
212ff2be4e Improved disassembled output when setting register values. 2021-05-22 21:52:40 +00:00
Jennifer Taylor
8923c93a66 Implement embedded clip blend colors. 2021-05-22 21:52:17 +00:00
Jennifer Taylor
0edb5dc2b1 Rework additive color a bit for type clarity and add warnings where we don't support it. 2021-05-22 01:31:42 +00:00
Jennifer Taylor
3bdc0d3887 Add more specific warning for missing bytecode. 2021-05-22 01:31:17 +00:00
Jennifer Taylor
8ee8e5c519 Make some debugging adjustments. 2021-05-22 01:30:58 +00:00
Jennifer Taylor
f33c73572b Preserve placed object order when rendering. 2021-05-22 01:30:28 +00:00
Jennifer Taylor
03381ee8ca Fix double-applying base transform to the root clip. 2021-05-21 21:32:19 +00:00
Jennifer Taylor
70f06b2b33 Fix translation matrix application on embedded clips, fixes placement of lots of complex animations. 2021-05-21 21:32:02 +00:00
Jennifer Taylor
2c678e60f8 Implement scale by width and height for final animation. 2021-05-21 21:31:39 +00:00
Jennifer Taylor
35c53c3b6c Implement forced aspect ratio for renderer. 2021-05-21 21:31:13 +00:00
Jennifer Taylor
3922535555 Implement non-textured rectangle shapes. 2021-05-21 16:58:39 +00:00
Jennifer Taylor
4290b86c34 Implement basic import system to avoid crashing with not-found registered objects. 2021-05-21 16:58:01 +00:00
Jennifer Taylor
0d648f1371 Implement a multi-threaded C++ renderer for a decent speed boost. 2021-05-20 03:51:43 +00:00
Jennifer Taylor
f47a4782da Another attempted fix for CLANG on OSX. 2021-05-19 20:16:51 +00:00
Jennifer Taylor
48e9c59513 Initial implementation of C++ affine renderer for massive speed boost. 2021-05-19 16:25:13 +00:00
Jennifer Taylor
b02c4292be Fix non-alpha blended modes now that I have an example file. 2021-05-19 02:00:05 +00:00
Jennifer Taylor
d59fec65f7 More descriptive frame count when printing verbose information. 2021-05-17 04:04:38 +00:00
Jennifer Taylor
1da2ac8397 Ignore PLACE_CAMERA tags in renderer for the time being. 2021-05-17 03:55:41 +00:00
Jennifer Taylor
f2be6d2bb8 Initial RE of new tags and flags seen in some IIDX versions. 2021-05-17 03:48:05 +00:00
Jennifer Taylor
ace6bd54c4 Fix partial-alpha blending equation, should fix dark sprites on semi-transparent backgrounds. 2021-05-16 22:19:38 +00:00
Jennifer Taylor
40968ab039 Remove ability to render exported tags as it was broken and elongated the render time of some animations. 2021-05-16 22:19:07 +00:00
Jennifer Taylor
ec20ab4cf1 Slightly better verbose debugging for DO_ACTION tag so I can start to figure out what it's used for in animations. 2021-05-16 22:18:44 +00:00
Jennifer Taylor
337440cb14 Handle decompiling bytecode which does not use function call results properly. 2021-05-16 22:18:23 +00:00
Jennifer Taylor
21ba1db898 Add support for rendering only certain depth planes for debugging. 2021-05-16 19:40:06 +00:00
Jennifer Taylor
89af7c100a Better multi-threaded Ctrl+C handling. 2021-05-16 19:39:44 +00:00
Jennifer Taylor
604b987f90 Better logging for rendering cycle. 2021-05-16 19:39:25 +00:00
Jennifer Taylor
428ee8a063 Implement alternate transform matrix specification to fix some animations not having scaling/rotation applied to various sprites. 2021-05-16 19:39:07 +00:00
Jennifer Taylor
3db9cc9a58 Shave off another 33% of rendering time by better pcklable data in multithreaded case. 2021-05-16 15:15:06 +00:00
Jennifer Taylor
fdf7e70bfd Speed up rendering using multi-processing. The bottleneck is now the queue and we need a C++ implementation. 2021-05-16 00:20:43 +00:00
Jennifer Taylor
85606fece9 Move affine transform function out into blend for slight cPython boost and also preparation for threading. 2021-05-16 00:20:23 +00:00
Jennifer Taylor
187783696b Use cPython to speed up some rendering by about 10%. 2021-05-16 00:19:50 +00:00
Jennifer Taylor
f74dd8c136 Speed up animation rendering a bit by caching some calculated properties from PIL. 2021-05-16 00:18:59 +00:00
Jennifer Taylor
afb5eaa6fb Add todo to fix decompiling some Pop'n animation bytecodes. 2021-05-15 04:23:04 +00:00
Jennifer Taylor
f7861c0819 Support update tags allowing the underlying object to be swapped out, fixes some IIDX animations. 2021-05-15 04:22:43 +00:00
Jennifer Taylor
a58e1165bf Fix incorrectly handling placed sprites if there was a change previously in the frame. 2021-05-15 04:22:17 +00:00
Jennifer Taylor
7ead384215 Add more documentation to blend modes, implement multiply blend mode. 2021-05-15 04:21:52 +00:00
Jennifer Taylor
26c2a99a6e Tie up loose ends by adding TODOs and documentation for a few remaining bits in decompiler. 2021-05-11 17:01:35 +00:00
Jennifer Taylor
b184ae3169 Rename references to labels as they do the same thing as SWF labels in the original format. 2021-05-10 22:26:46 +00:00
Jennifer Taylor
17aaeb81fe Rewrite AFP rendering engine core which seems to fix several Pop'n animations. 2021-05-10 22:26:26 +00:00
Jennifer Taylor
d9550122de Allow dumping decompiled bytecode to file for both raw afp/bsi pairs and TXP2 containers. 2021-05-10 00:12:54 +00:00
Jennifer Taylor
ee3e272787 Properly plumb verbosity flags to all of decompiler pieces, clean up some code. 2021-05-10 00:12:28 +00:00
Jennifer Taylor
08601dfcfe Initial parsing of AFP buttons, which is good enough to parse all of DDR PS3's files and decompile them. 2021-05-09 19:19:19 +00:00
Jennifer Taylor
aace5c7c13 Enable selective coverage printing to help narrow down missing sections in individual tags. 2021-05-09 19:19:02 +00:00
Jennifer Taylor
da1dba8f2b Implement GET_TIME opcode used by some DDR PS3 files. 2021-05-09 19:18:48 +00:00
Jennifer Taylor
95dc046043 Do a really half-assed job handling morph shapes. 2021-05-09 19:18:33 +00:00
Jennifer Taylor
1e6ab47c4a Better constants for a few more floating point values. 2021-05-07 05:16:00 +00:00
Jennifer Taylor
cbe084f137 Update some debug prints based on better understanding of one more tag section. 2021-05-06 19:38:13 +00:00
Jennifer Taylor
2252390706 Implement one more opcode needed for some Bishi levels. 2021-05-06 19:37:55 +00:00
Jennifer Taylor
459803d244 Only check IFS file size if we extracted it out of our own IFS. 2021-05-06 19:37:32 +00:00
Jennifer Taylor
9ce8b79b10 Implement define text tag, fill in some better understanding of the font tag from define text understanding. 2021-05-06 19:37:05 +00:00
Jennifer Taylor
5d26149298 Check in fix for non-compressed files. 2021-05-06 19:36:43 +00:00
Jennifer Taylor
74e3160588 Implement super support for IFS extraction. 2021-05-06 19:36:24 +00:00
Jennifer Taylor
b81d2aeaae Fix one last case where we can get surprise gotos. 2021-05-05 19:32:08 +00:00
Jennifer Taylor
203fdd3a10 Fix tricky case where we have nowhere to jump to after a While loop inside an if. 2021-05-05 19:31:45 +00:00
Jennifer Taylor
481c5a50ce Implement one more opcode that I've seen in Bishi levels. 2021-05-05 00:57:31 +00:00
Jennifer Taylor
9544287b13 Deal with empty if statements (usually compiled-out debug switches). 2021-05-05 00:56:59 +00:00
Jennifer Taylor
25278d76c5 Fix stack walking bug with respect to pre-converted if statements. 2021-05-05 00:56:33 +00:00
Jennifer Taylor
eba79ed3bc Add heuristic for parsing a troublesome flag in SWF object create tags. 2021-05-05 00:55:34 +00:00
Jennifer Taylor
f75b9f038e Implement a few more opcodes to get a few more Bishi files decompiling. 2021-05-05 00:55:02 +00:00
Jennifer Taylor
636e1876bc Add while loop detection and conversion. 2021-05-05 00:54:34 +00:00
Jennifer Taylor
2f79a6401d Fix massive bug which dropped function calls without returns from the finished output. 2021-05-05 00:53:58 +00:00
Jennifer Taylor
f09fd79a45 Add for loop detection and conversion. 2021-05-05 00:53:38 +00:00
Jennifer Taylor
e17f7c2bdb Add some tests for for/while loops in anticipation of optimizing output. 2021-05-05 00:53:02 +00:00
Jennifer Taylor
83f4f43e9e Implement a few more opcodes, fix stack ordering with multiple entries after reconciliation. 2021-05-04 02:32:32 +00:00
Jennifer Taylor
eddb8dc208 Several more code output optimizations done. 2021-05-04 02:32:04 +00:00
Jennifer Taylor
44b3628a85 Fix logic error in merging stacks when if statements didn't have a true and false body. 2021-05-04 02:31:07 +00:00
Jennifer Taylor
4790385022 Fix a logic error in if statement unwrapping, remove duplicated code in favor of a better true/false detection algorithm. 2021-05-04 02:30:37 +00:00
Jennifer Taylor
108d7c228d Handle having bytecode with no actual entries. 2021-05-04 02:29:53 +00:00
Jennifer Taylor
54b4c88d65 It seems that some bytecode leaves extra stuff on the stack sometimes, I think this is fine? 2021-05-04 02:29:27 +00:00
Jennifer Taylor
70c7448aa0 Fix nasty bug where sometimes we would have gotos without corresponding labels. 2021-05-02 03:50:48 +00:00
Jennifer Taylor
336ef6fc3d Check in some beta code for a new style of if detection that does not work yet. 2021-05-02 03:50:19 +00:00
Jennifer Taylor
7493db034f Add in basic throw, test code generation of mostly the same code as we tested the code graph with. 2021-05-02 03:49:35 +00:00
Jennifer Taylor
829597a871 Address the fact that I never handled END actions (they end processing as they are encountered). 2021-05-02 03:48:38 +00:00
Jennifer Taylor
261c3d7fbd Start a unit test framework for decompilation, in the hopes of eventually tracking down a logic bug in if extraction. 2021-05-02 03:48:07 +00:00
Jennifer Taylor
820a86845d Fix shallowest successor find when multiple nodes lead to the same location, fix if swap optimization and add BITAND and NOT_BITAND if support. 2021-04-26 03:24:47 +00:00
Jennifer Taylor
8cf219cb25 Avoid duplicating labels outside of and inside of do-while statements. Avoid going to or generating negative labels (artificially inserted nodes). 2021-04-26 03:24:24 +00:00
Jennifer Taylor
b7523b5521 Fix if processing by getting rid of negation early optimization. There was a path that
was negating but not being checked when doing the final render, leaving some if statements
inverted. Moved the optimization to a final pass for more generalized correctness.
2021-04-26 02:50:19 +00:00
Jennifer Taylor
2d4f6cadfb Much more complicated stack walking algorithm that chains the stack through chunks and also calculates when temporary variables are needed. 2021-04-26 01:28:48 +00:00
Jennifer Taylor
4d0bfe5637 Fix an edge case in if detection where we reused IDs incorrectly by stopping the reuse of IDs. Also, convert returns much earlier in the stack. 2021-04-26 01:27:51 +00:00
Jennifer Taylor
28ce17b996 Apparently some BishiBashi levels use an even older AP2 version. 2021-04-26 01:27:10 +00:00
Jennifer Taylor
06bd9d1245 Fix logic error where we lost if statement jump points because __gather_chunks was too-aggressively dropping end pointers. 2021-04-26 01:26:50 +00:00
Jennifer Taylor
6f78668e9a Fix up exceptions and add more invariant checks to loop generation code. 2021-04-26 01:25:32 +00:00
Jennifer Taylor
5761474bec Enforce another invariant for dominator calculation that would have caught another hard-to-find bug. 2021-04-26 01:24:25 +00:00
Jennifer Taylor
a09ad70de5 Improve a lot of exception message, enforce several more invariants in
graph generation that would have caught previous bugs, fix possible
issue with loop/dominator code if the entry code chunk was the beginning
of a loop.
2021-04-26 01:23:54 +00:00
Jennifer Taylor
44f5e5cdcc Fix control flow graph splitting function to handle functions that jump to the end offset as a way of exiting early. 2021-04-26 01:23:08 +00:00
Jennifer Taylor
6323ef9adf Implment several more opcodes in actual decompilation step. 2021-04-26 01:22:39 +00:00
Jennifer Taylor
6052deed3c Refactor code generation step to allow for nested function definitions, actually hook those up. 2021-04-26 01:22:14 +00:00
Jennifer Taylor
3a9b3a7b3c Pass indentation context into expression rendering for upcoming function definition support. 2021-04-26 01:21:42 +00:00
Jennifer Taylor
351e7060b8 Allow subclasses of verbose manager to check verbose state directly. 2021-04-26 01:21:03 +00:00
Jennifer Taylor
51e27c0cff Enhance goto eliminiation to remove all unneeded gotos. 2021-04-24 19:37:14 +00:00
Jennifer Taylor
964d6f082c Clean up types on If statement, stop using strings to pass information. 2021-04-24 19:36:58 +00:00
Jennifer Taylor
534ab20f98 Add dead code eliminiation so dominators doesn't fail. Fix a tricky jump case with if statements. 2021-04-24 18:13:07 +00:00
Jennifer Taylor
de84379ad0 Implement a lot more opcodes for expressions, fix an if conditional, improve while display. 2021-04-24 18:11:20 +00:00
Jennifer Taylor
cc27d2418e Fix register display on assignment, add a few optimizing passes to clean up code. 2021-04-24 18:10:27 +00:00
Jennifer Taylor
f1aea996c4 Handle if-goto pattern that I previously neglected. 2021-04-24 18:09:44 +00:00
Jennifer Taylor
6221d0273b Overhauled statement eval system so we always get back a list of statements. 2021-04-24 18:08:04 +00:00
Jennifer Taylor
b0778e1110 Convert expression rendering to an explicit function so we can retain __repr__ for debugging. 2021-04-24 18:07:01 +00:00
Jennifer Taylor
f2761b90b0 Restructure a lot of types to fit an expression/statement model and making a lot of stuff make more sense. 2021-04-24 18:05:58 +00:00
Jennifer Taylor
19c6de1fcc Actually decompile basic bytecode. There's much left to do, but some basics work! 2021-04-24 18:05:03 +00:00
Jennifer Taylor
aebc277b62 Add a graph walker at the very end to verify that we've handled all control paths correctly, fix an edge case in If detection. 2021-04-24 18:03:24 +00:00
Jennifer Taylor
6aa04b0c1b Implement recursive if detection. 2021-04-24 18:02:26 +00:00
Jennifer Taylor
6e34d2647e Implement loop break/continue/goto processing. 2021-04-24 18:01:25 +00:00
Jennifer Taylor
738fce36c9 Lots more implementation done on decompiler, including better control flow and loop detection. 2021-04-24 18:00:13 +00:00
Jennifer Taylor
b77ccdd5b9 Beginning of an AFP ByteCode decompiler, starting with a massive code reorg and a control flow graph analyzer. 2021-04-24 17:59:36 +00:00
Jennifer Taylor
011b84aceb Actually parse bytecode into an intermediate representation. 2021-04-21 03:58:53 +00:00
Jennifer Taylor
f209bcbe54 Exit early if we're done rendering the main animation, allow background color override. 2021-04-21 01:06:48 +00:00
Jennifer Taylor
47525837cd Allow partial renders by hitting ctrl-c. 2021-04-21 00:01:35 +00:00
Jennifer Taylor
cc25c3c8dc Don't draw shapes/sprites with zero scaling factor. 2021-04-20 23:33:43 +00:00
Jennifer Taylor
05a85abce8 Convert some more exceptions to warnings for best-effort renderings. 2021-04-20 23:19:14 +00:00
Jennifer Taylor
4c7ac0f744 Rework engine so multiple of the same sprite can be placed down by place item tags. 2021-04-20 21:41:28 +00:00
Jennifer Taylor
81c4496269 Implement what I think are the correct blending modes. Fixes some older Pop'n animations. 2021-04-20 21:41:09 +00:00
Jennifer Taylor
5a499a0f2c Fix rotation origin so some bishi bashi levels will render. 2021-04-17 23:33:04 +00:00
Jennifer Taylor
d1cf978e12 Change rendering output style, allow series of png files to be rendered. 2021-04-17 23:32:47 +00:00
Jennifer Taylor
8cd85f26e9 Separate blend and color arguments for ease of experimenting. 2021-04-17 23:32:30 +00:00
Jennifer Taylor
ebc86019ae Implement color blending, add fast path back to rendering shapes. 2021-04-17 23:32:10 +00:00
Jennifer Taylor
e1c6ad429c Implement proper affine transformations instead of just translation. 2021-04-17 23:31:36 +00:00
Jennifer Taylor
c6e19d0dfa Overhaul clip playback engine to allow clips to start when they're placed, not when they're created. 2021-04-17 23:31:08 +00:00
Jennifer Taylor
830f32814e Clean up the code some in preparation for trying to get affine transformations working. 2021-04-17 23:30:46 +00:00
Jennifer Taylor
700e63a001 Convert some more exceptions to warnings to allow attempts to render some BishiBashi content. 2021-04-16 21:28:53 +00:00
Jennifer Taylor
de5dfd2421 Hook up TXP2 container to renderer, provide a "list" option to list out possible rendering paths in a container. 2021-04-16 21:08:41 +00:00
Jennifer Taylor
d4faa9f7d8 Fix path issues for a few miscelaneous tools on Windows. 2021-04-16 03:51:16 +00:00
Jennifer Taylor
42f57e10d7 Include origin point in updated tags. 2021-04-15 23:24:46 +00:00
Jennifer Taylor
3ad60064f9 Convert some exceptions to warnings so files can be partially rendered. 2021-04-15 23:20:27 +00:00
Jennifer Taylor
d835c46320 Support nested animations as well as update object requests. 2021-04-15 23:19:56 +00:00
Jennifer Taylor
3f5760343a Always filter out unnecessary exported tags, even when rendering the default animation. 2021-04-15 23:18:54 +00:00
Jennifer Taylor
1683c8ecdd Initial stab at an AFP animation renderer. It can render some basic animations from Pop'n Music! 2021-04-15 23:18:33 +00:00
Jennifer Taylor
3941b7e602 Fix a few more typos in object placement, values make a lot more sense now. 2021-04-15 23:17:45 +00:00
Jennifer Taylor
61603b0e63 Codify my guess as to what's going on with the mysterious point. 2021-04-15 23:17:15 +00:00
Jennifer Taylor
544baae387 Fix a few small bugs with place object handling. 2021-04-15 23:16:45 +00:00
Jennifer Taylor
db36298f22 Slightly better IFS extraction and shape documentation, given my understanding of the relationship between the two. 2021-04-15 23:16:03 +00:00
Jennifer Taylor
520181785d Vastly improved IFS extraction which names afp/bsi/geo files correctly. 2021-04-14 01:08:13 +00:00
Jennifer Taylor
d486cfa54e Finish handling push types and a few miscelaneous constants. 2021-04-14 01:07:33 +00:00
Jennifer Taylor
142ee31d56 Finish initial RE on bytecode, every opcode is now accounted for. 2021-04-14 01:07:01 +00:00
Jennifer Taylor
79b31c7fa2 Hook up parsed objects to all of SWF except for the bytecode mess. 2021-04-12 03:10:31 +00:00
Jennifer Taylor
8d686dcdb7 Assert on unknown data inside GE2D structures, so we don't miss something important. 2021-04-12 03:10:14 +00:00
Jennifer Taylor
9f6b9eb7d6 Begin parsing AFP data into useful structures. 2021-04-12 03:09:57 +00:00
Jennifer Taylor
522f8eaa29 Refactor verbose debugging to its own class, clean up classes that used it. 2021-04-11 20:45:17 +00:00
Jennifer Taylor
897e779b20 Refactor coverage stuff out to its own utility class, clean up code that used it. 2021-04-11 20:44:55 +00:00
Jennifer Taylor
30a51f48e6 Massive juggling of core AFP/AP2 implementation into its own files. 2021-04-11 20:44:31 +00:00