The wasm-support branch contains significant enhancements to the SWFRecomp project, adding WebAssembly build support, improved documentation, better build automation, and enhanced ActionScript variable handling. This document comprehensively lists all differences between the two branches.
Note: This document was updated on 2025-11-02 to reflect the current state of the branches. The wasm-hello-world example files and docs/ directory (GitHub Pages) were moved to SWFRecompDocs and are no longer part of this diff.
Statistics:
- 24 files changed
- 1,848 insertions (+)
- 72 deletions (-)
- 18 commits ahead of master
The wasm-support branch includes 18 commits beyond master:
7dc144c- cleanup documentation and build artifacts9ba9419- variable optimization961031e- updated next steps doc21ee82e- added two more docsf624fb6- Implement StringAdd variable storage with Copy-on-Store00b9801- added STRING_VARIABLE_STORAGE_PLAN.mdecbce76- corrected several details in the documentse285712- added 2 font planning docs2ade8d6- minor document updates03905a5- added AS3_TEST_SWF_GENERATION_GUIDE.md15edc43- added ABC_PARSER_RESEARCH.md and ABC_IMPLEMENTATION_INFO.mdbf32dfe- added ABC_PARSER_GUIDE.mdf51802a- added 2 more planning docs, deprecated most of the old docsabaa0e5- added 3 more planning docs41e103f- added 5 more planning docscf3892a- added AS3_IMPLEMENTATION_PLAN.md8fef768- initial commit for this fork
Complete rewrite of the main README - transformed from a casual/experimental tone to professional project documentation.
Key Changes:
- Project Description: Changed from "This is a stupid idea" to a proper technical description explaining it's a static recompiler for Flash SWF files
- Added Live Demo Link: https://swfrecomp.github.io/SWFRecompDocs/
- Added Comprehensive Sections:
- What is This? (explains static recompilation concept)
- Documentation (links to all guides)
- Quick Start (prerequisites, build instructions, examples)
- Project Structure (directory layout)
- How It Works (detailed workflow diagram)
- Current Features (feature status table)
- Related Projects (links to SWFModernRuntime, N64Recomp)
- Legal Note (Adobe Open Screen Project info)
New Features Documented:
- Improved build system with automated builds
- Better project structure with clean separation
- Enhanced documentation with complete guides
- WebAssembly examples that run in browser
Documentation Improvements:
- Added step-by-step build instructions for both native and WASM
- Added complete example workflow (from SWF to WASM)
- Added visual workflow diagram showing compilation pipeline
- Added feature status table
- Added links to related projects
Tone Change:
- From: Casual, self-deprecating ("This is a stupid idea. Let's do it anyway")
- To: Professional, technical, comprehensive project documentation
Size: README grew from ~100 lines to ~266 lines
Note: The README references live demos at https://swfrecomp.github.io/SWFRecompDocs/ - these demo files are hosted in the SWFRecompDocs repository, not in SWFRecomp.
Major Enhancements to Variable Handling:
Added:
std::map<std::string, size_t> string_to_id- Tracks declared strings to prevent duplicatesgetStringId()method - Retrieves ID for previously declared strings- Deduplication logic in
declareString():auto it = string_to_id.find(str); if (it != string_to_id.end()) { // String already exists - don't create duplicate return; }
Benefits:
- Eliminates duplicate string constants in generated C code
- Reduces memory footprint
- More efficient code generation
Changed GetVariable implementation:
// OLD:
temp_val = getVariable((char*) STACK_TOP_VALUE, STACK_TOP_N);
POP();
PUSH_VAR(temp_val);
// NEW:
actionGetVariable(stack, sp);Changed SetVariable implementation:
// OLD:
temp_val = getVariable((char*) STACK_SECOND_TOP_VALUE, STACK_SECOND_TOP_N);
SET_VAR(temp_val, STACK_TOP_TYPE, STACK_TOP_N, STACK_TOP_VALUE);
POP_2();
// NEW:
actionSetVariable(stack, sp);Benefits:
- Cleaner generated code
- Better encapsulation of variable operations
- Easier to maintain and extend
Changed:
// OLD:
PUSH_STR(str_X, length);
// NEW:
PUSH_STR_ID(str_X, length, string_id);Benefits:
- Runtime can track string IDs for variable storage
- Enables more efficient string variable handling
- Supports Copy-on-Store optimization
Added:
// Generate MAX_STRING_ID constant for runtime initialization
context.out_script_defs << endl << endl
<< "// Maximum string ID for variable array allocation" << endl
<< "#define MAX_STRING_ID " << next_str_i << endl;
context.out_script_decls << endl
<< "#define MAX_STRING_ID " << next_str_i << endl;Benefits:
- Runtime knows how many string variables to allocate
- Enables static array allocation instead of dynamic
- Better performance and memory management
Added:
#include <map> // For string deduplication
// In SWFAction class:
std::map<std::string, size_t> string_to_id; // Track declared strings
size_t getStringId(const char* str); // Get ID for previously declared stringNEW: Complete working example with automated builds
Added files:
tests/trace_swf_4/config.toml(4 lines) - Recompiler configurationtests/trace_swf_4/Makefile(62 lines) - Automated native buildtests/trace_swf_4/build_wasm.sh(71 lines) - Automated WASM buildtests/trace_swf_4/README.md(186 lines) - Complete documentation
Native Runtime:
tests/trace_swf_4/runtime/native/include/recomp.h(105 lines)tests/trace_swf_4/runtime/native/include/stackvalue.h(4 lines)tests/trace_swf_4/runtime/native/main.c(6 lines)tests/trace_swf_4/runtime/native/runtime.c(305 lines)
WASM Runtime:
tests/trace_swf_4/runtime/wasm/main.c(27 lines)tests/trace_swf_4/runtime/wasm/recomp.h(62 lines)tests/trace_swf_4/runtime/wasm/runtime.c(76 lines)tests/trace_swf_4/runtime/wasm/stackvalue.h(4 lines)tests/trace_swf_4/runtime/wasm/index.html(199 lines)
Features:
- Complete build automation (no manual file copying)
- Separate native and WASM runtime implementations
- Comprehensive documentation
- Working live demo
NEW: Test case for dynamic string variable storage
Added files:
tests/dyna_string_vars_swf_4/config.toml(4 lines)tests/dyna_string_vars_swf_4/test_main.c(12 lines)tests/dyna_string_vars_swf_4/runtime/native/include/recomp.h(105 lines)tests/dyna_string_vars_swf_4/runtime/native/include/stackvalue.h(4 lines)tests/dyna_string_vars_swf_4/runtime/native/main.c(6 lines)tests/dyna_string_vars_swf_4/runtime/native/runtime.c(305 lines)
Purpose:
- Tests dynamic string variable storage
- Tests Copy-on-Store optimization
- Validates variable handling improvements
NEW: Documentation for string concatenation tests
Added files:
tests/string_add_to_var_test/README.md(35 lines)
Purpose:
- Documents string concatenation behavior
- Explains variable storage patterns
Added entries:
NewDocs/
docs/specs/
# Temporary files
COMMIT_MESSAGE.txt
# Test executables
test_vars
Purpose:
- Ignore documentation drafts
- Ignore downloaded specifications
- Ignore build artifacts
- Ignore temporary files
trace_swf_4/Makefile Features:
- Clean separation of source and build directories
- Automatic directory creation
- Native compilation with gcc
- Proper dependency tracking
- Clean target for rebuild
trace_swf_4/build_wasm.sh Features:
- Emscripten environment setup
- WASM compilation with emcc
- Automatic file organization
- HTML/JS generation
- Output bundling for deployment
Benefits:
- No manual file copying required
- Reproducible builds
- Clear build process
- Easy deployment to GitHub Pages
-
README.md
- Complete rewrite: casual � professional
- Added: Quick start, documentation, examples, diagrams
- Size: ~100 lines � 266 lines
- +204 lines, -20 lines
-
.gitignore
- Added: NewDocs/, docs/specs/, COMMIT_MESSAGE.txt, test_vars
- +8 lines
-
include/action/action.hpp
- Added: std::map for string deduplication
- Added: getStringId() method
- +7 lines, -1 line
-
src/action/action.cpp
- Added: String deduplication system
- Changed: GetVariable/SetVariable to use action functions
- Changed: PUSH_STR � PUSH_STR_ID with ID tracking
- Added: MAX_STRING_ID constant generation
- +62 lines, -38 lines
trace_swf_4 Test (13 files):
- tests/trace_swf_4/config.toml (4 lines)
- tests/trace_swf_4/Makefile (62 lines)
- tests/trace_swf_4/build_wasm.sh (71 lines)
- tests/trace_swf_4/README.md (186 lines)
- tests/trace_swf_4/runtime/native/include/recomp.h (105 lines)
- tests/trace_swf_4/runtime/native/include/stackvalue.h (4 lines)
- tests/trace_swf_4/runtime/native/main.c (6 lines)
- tests/trace_swf_4/runtime/native/runtime.c (305 lines)
- tests/trace_swf_4/runtime/wasm/main.c (27 lines)
- tests/trace_swf_4/runtime/wasm/recomp.h (62 lines)
- tests/trace_swf_4/runtime/wasm/runtime.c (76 lines)
- tests/trace_swf_4/runtime/wasm/stackvalue.h (4 lines)
- tests/trace_swf_4/runtime/wasm/index.html (199 lines)
dyna_string_vars_swf_4 Test (6 files):
- tests/dyna_string_vars_swf_4/config.toml (4 lines)
- tests/dyna_string_vars_swf_4/test_main.c (12 lines)
- tests/dyna_string_vars_swf_4/runtime/native/include/recomp.h (105 lines)
- tests/dyna_string_vars_swf_4/runtime/native/include/stackvalue.h (4 lines)
- tests/dyna_string_vars_swf_4/runtime/native/main.c (6 lines)
- tests/dyna_string_vars_swf_4/runtime/native/runtime.c (305 lines)
string_add_to_var_test (1 file):
- tests/string_add_to_var_test/README.md (35 lines)
- String Deduplication: Eliminates duplicate string constants
- Cleaner Generated Code: Simplified variable operations
- Better Encapsulation: Action functions instead of inline operations
- Automated Builds: Makefile + build scripts
- No Manual Steps: All file copying automated
- Reproducible: Same results every time
- Multi-Target: Native + WASM from same source
- Professional README: Complete project overview
- Live Demos: Working examples in browser
- Comprehensive Guides: Step-by-step instructions
- Better Structure: Clear organization
- Complete Pipeline: SWF � C � WASM
- Working Examples: trace_swf_4 demo
- Browser Integration: HTML + JavaScript interface
- Deployment Ready: GitHub Pages compatible
- Multiple Test Cases: trace_swf_4, dyna_string_vars_swf_4, string_add_to_var_test
- Dual Runtimes: Native and WASM variants
- Comprehensive Tests: Console output, variable storage, string operations
- Copy-on-Store: Efficient string variable handling
- ID Tracking: Runtime can identify string literals
- Static Allocation: MAX_STRING_ID enables fixed-size arrays
- Memory Efficiency: Reduced allocations and copying
- Backward Compatible: No breaking changes to master functionality
- Additive Only: All changes are additions or improvements
- Optional WASM: Native builds still work exactly as before
- String Deduplication: Reduces code size and memory usage
- Optimized Variables: Copy-on-Store reduces string copying
- Static Allocation: MAX_STRING_ID enables compile-time sizing
- Better Organization: Clear project structure
- Comprehensive Docs: Easy for new contributors
- Automated Testing: Build scripts make testing easier
- Cleaner Code: Better encapsulation and separation
- GitHub Pages: Live demos attract users
- Quick Start: Easy to try out the project
- Examples: Multiple working examples to learn from
- Documentation: Complete guides for all workflows
The wasm-support branch represents a significant maturation of the SWFRecomp project:
- Professional Documentation: Transformed from experimental project to production-ready
- WebAssembly Support: Complete pipeline from SWF to browser-runnable WASM
- Build Automation: No manual steps, reproducible builds
- Code Quality: String deduplication, cleaner variable handling, better encapsulation
- Live Demos: Working examples accessible via GitHub Pages
- Testing Infrastructure: Multiple test cases with dual runtime support
- Developer Experience: Comprehensive guides, clear structure, easy to contribute
Total Changes:
- 24 files changed (4 modified, 20 added)
- 1,848 additions
- 72 deletions
- 18 commits
Key Achievement: Successfully demonstrates SWF → C → WASM pipeline with live demo at https://swfrecomp.github.io/SWFRecompDocs/ (demos hosted in SWFRecompDocs repository)
This branch is ready for merging into master and represents the project's evolution from proof-of-concept to a viable tool for Flash preservation through static recompilation.