Adding modding folder with a hacked build.

This commit is contained in:
ml
2026-09-26 08:53:08 +02:00
parent cdb960dc71
commit c91080aba7
755 changed files with 50424 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
package movie
import (
"github.com/inkyblackness/hacked/ss1/content/audio"
"github.com/inkyblackness/hacked/ss1/content/movie/internal/format"
)
const audioEntrySize = 0x2000
// Audio represents the sound part of a movie.
type Audio struct {
Sound audio.L8
}
func (a Audio) duration() format.Timestamp {
if a.Sound.SampleRate <= 0 {
return format.Timestamp{}
}
return format.TimestampFromSeconds(a.Sound.Duration())
}
func (a Audio) encode() []format.EntryBucket {
buckets := make([]format.EntryBucket, 0, (len(a.Sound.Samples)/audioEntrySize)+1)
addBucket := func(ts format.Timestamp, samples []byte) {
buckets = append(buckets,
format.EntryBucket{
Priority: format.EntryBucketPriorityAudio,
Timestamp: ts,
Entries: []format.Entry{
{
Timestamp: ts,
Data: format.AudioEntryData{
Samples: samples,
},
},
},
})
}
startOffset := 0
for (startOffset + audioEntrySize) <= len(a.Sound.Samples) {
ts := format.TimestampFromSeconds(float32(startOffset) / a.Sound.SampleRate)
endOffset := startOffset + audioEntrySize
addBucket(ts, a.Sound.Samples[startOffset:endOffset])
startOffset = endOffset
}
if startOffset < len(a.Sound.Samples) {
ts := format.TimestampFromSeconds(float32(startOffset) / a.Sound.SampleRate)
addBucket(ts, a.Sound.Samples[startOffset:])
}
return buckets
}