Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swf: SWF parsing returns slices of input, use Windows-1252 string encoding in SWFv5 #2636

Merged
merged 9 commits into from
Jan 20, 2021

Conversation

Herschel
Copy link
Member

@Herschel Herschel commented Jan 19, 2021

Start some much needed spring cleaning of swf:

TODO (probably future PRs):

  • Add option for specifying encoding for SWFv5 files. (Currently defaults to WINDOWS-1252).
  • Change the avm2 reader to return slices.
  • Clean up the SWF testing and make it use a macro similar to the core Ruffle regressions tests.
  • Use bitflags or for some of the dense bitflags in various swf structs. (Many of the structs have long lists of bools).
  • Reintroduce parsing SWF header without decompressing the entire SWF. (I would like to return an "extended header" including FileAttributes info.)
  • Reintroduce the convenience API of read_swf reading a sequence of owned tags.
  • Change the parsing functions to free functions instead of having Reader struct. Ruffle core can use these free functions directly. Reader etc. could be reintroduced as part of the above convenience API in swf.
  • Change AvmString representation to work similar to SwfString.

@Herschel Herschel changed the title swf: SWF parsing returns slices of input, allow for different string encoding in SWFv8 swf: SWF parsing returns slices of input, use Windows-1252 string encoding in SWFv5 Jan 19, 2021
@Toad06
Copy link
Member

Toad06 commented Jan 19, 2021

Tested the PR on the web backend and it works perfectly, very impressed how much stuff this PR fixes. 👍

Just a little thing, it seems like every file always logs this warning:
SWF length doesn't match header, may be corrupt

A last thing, but possibly unrelated, this (not legit) file cannot be parsed because of unknown tags 903 and 1002 (I've never seen those values in any other files I've tested).

@Herschel
Copy link
Member Author

Herschel commented Jan 20, 2021

Just a little thing, it seems like every file always logs this warning:
SWF length doesn't match header, may be corrupt

Fixed!

A last thing, but possibly unrelated, this (not legit) file cannot be parsed because of unknown tags 903 and 1002 (I've never seen those values in any other files I've tested).

Looks like the file is contains these bogus tags for whatever reason. (Ffdec shows the same tag #s).

@Herschel Herschel force-pushed the swf-cleanup branch 2 times, most recently from a065218 to d20ff15 Compare January 20, 2021 22:16
SwfStr is now an unsized slice analogous to `str` or `bstr`.
The desired encoding must be supplied when converting to String.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Miami Shark - Start Game button doesn't do anything
2 participants