mirror of
https://github.com/jwetzell/psn-go.git
synced 2026-08-17 21:24:17 +00:00
21 lines
418 B
Go
21 lines
418 B
Go
package decoders
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"errors"
|
|
"log/slog"
|
|
)
|
|
|
|
func DecodePacketChunk(bytes []byte) (interface{}, error) {
|
|
switch id := binary.LittleEndian.Uint16(bytes[0:2]); id {
|
|
case 0x6756:
|
|
return DecodeInfoPacketChunk(bytes), nil
|
|
case 0x6755:
|
|
return DecodeDataPacketChunk(bytes), nil
|
|
default:
|
|
slog.Error("unhandled packet id", "id", id)
|
|
return Chunk{}, errors.New("unhandled packet id")
|
|
}
|
|
|
|
}
|