Force playback on swf2ass, fixed DefineFont tag

This commit is contained in:
DataHoarder 2023-12-03 04:57:13 +01:00
parent a6e9a3917f
commit 9fd8438a4b
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
4 changed files with 13 additions and 4 deletions

2
go.mod
View file

@ -3,7 +3,7 @@ module git.gammaspectra.live/WeebDataHoarder/swf2ass-go
go 1.21
require (
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231202012532-b95c08f9aa18
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231203035451-0793f5bb9aab
github.com/ctessum/polyclip-go v1.1.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa

4
go.sum
View file

@ -1,5 +1,5 @@
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231202012532-b95c08f9aa18 h1:ZckbT8bgOJYaQB7J3M0draw10VVY6Z2+OZcNqSJF7j8=
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231202012532-b95c08f9aa18/go.mod h1:3f06zEUylBik8U1er/ueDZ9IM8jiWS5dRZLsrl66ddo=
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231203035451-0793f5bb9aab h1:pevmVCbdnGyzxK171c0rIIP3VVkbMbND/3cHGzaE0ns=
git.gammaspectra.live/WeebDataHoarder/swf-go v0.0.0-20231203035451-0793f5bb9aab/go.mod h1:3f06zEUylBik8U1er/ueDZ9IM8jiWS5dRZLsrl66ddo=
github.com/ctessum/polyclip-go v1.1.0 h1:TGMfwMynNykXwCZCxI+CHdjo/ZE9JThup/gmrgigGEE=
github.com/ctessum/polyclip-go v1.1.0/go.mod h1:e/Lh1JOGyynZwLr0M4tZGIyx07wXw9T+pu6hFut+kFQ=
github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82 h1:EvokxLQsaaQjcWVWSV38221VAK7qc2zhaO17bKys/18=

View file

@ -145,6 +145,12 @@ func main() {
break
}
lastFrame = frame
//Force playback
if !processor.Playing {
processor.Playing = true
}
if !processor.Playing || processor.Loops > 0 {
break
}

View file

@ -228,6 +228,8 @@ func (p *SWFTreeProcessor) process(actions ActionList) (tag swftag.Tag, newActio
if p.Loops > 0 {
break
}
offsetTable := slices.Clone(node.OffsetTable)
offsetTable = slices.Insert(offsetTable, 0, node.NumGlyphsEntries)
p.Objects.Add(FontDefinitionFromSWF(
node.FontId,
nil,
@ -237,7 +239,7 @@ func (p *SWFTreeProcessor) process(actions ActionList) (tag swftag.Tag, newActio
false,
nil,
node.ShapeTable,
node.OffsetTable,
offsetTable,
[]uint8{},
node.Scale(),
))
@ -630,6 +632,7 @@ func (p *SWFTreeProcessor) NextFrame(loop bool) *ViewFrame {
p.LastFrame = frame
//TODO: this might need to be elsewhere?
//TODO: handle this for sprites
for _, action := range actions {
switch action := action.(type) {
case *StopAction: