|
|
|
@ -25,31 +25,32 @@ package main
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
|
"github.com/jordanorelli/hyperstone/dota"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type datagramType int32
|
|
|
|
|
type packetType int32
|
|
|
|
|
type entityType int32
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
EDemoCommands_DEM_Error datagramType = -1
|
|
|
|
|
EDemoCommands_DEM_Stop datagramType = 0
|
|
|
|
|
EDemoCommands_DEM_FileHeader datagramType = 1
|
|
|
|
|
EDemoCommands_DEM_FileInfo datagramType = 2
|
|
|
|
|
EDemoCommands_DEM_SyncTick datagramType = 3
|
|
|
|
|
EDemoCommands_DEM_SendTables datagramType = 4
|
|
|
|
|
EDemoCommands_DEM_ClassInfo datagramType = 5
|
|
|
|
|
EDemoCommands_DEM_StringTables datagramType = 6
|
|
|
|
|
EDemoCommands_DEM_Packet datagramType = 7
|
|
|
|
|
EDemoCommands_DEM_SignonPacket datagramType = 8
|
|
|
|
|
EDemoCommands_DEM_ConsoleCmd datagramType = 9
|
|
|
|
|
EDemoCommands_DEM_CustomData datagramType = 10
|
|
|
|
|
EDemoCommands_DEM_CustomDataCallbacks datagramType = 11
|
|
|
|
|
EDemoCommands_DEM_UserCmd datagramType = 12
|
|
|
|
|
EDemoCommands_DEM_FullPacket datagramType = 13
|
|
|
|
|
EDemoCommands_DEM_SaveGame datagramType = 14
|
|
|
|
|
EDemoCommands_DEM_SpawnGroups datagramType = 15
|
|
|
|
|
EDemoCommands_DEM_Error packetType = -1
|
|
|
|
|
EDemoCommands_DEM_Stop packetType = 0
|
|
|
|
|
EDemoCommands_DEM_FileHeader packetType = 1
|
|
|
|
|
EDemoCommands_DEM_FileInfo packetType = 2
|
|
|
|
|
EDemoCommands_DEM_SyncTick packetType = 3
|
|
|
|
|
EDemoCommands_DEM_SendTables packetType = 4
|
|
|
|
|
EDemoCommands_DEM_ClassInfo packetType = 5
|
|
|
|
|
EDemoCommands_DEM_StringTables packetType = 6
|
|
|
|
|
EDemoCommands_DEM_Packet packetType = 7
|
|
|
|
|
EDemoCommands_DEM_SignonPacket packetType = 8
|
|
|
|
|
EDemoCommands_DEM_ConsoleCmd packetType = 9
|
|
|
|
|
EDemoCommands_DEM_CustomData packetType = 10
|
|
|
|
|
EDemoCommands_DEM_CustomDataCallbacks packetType = 11
|
|
|
|
|
EDemoCommands_DEM_UserCmd packetType = 12
|
|
|
|
|
EDemoCommands_DEM_FullPacket packetType = 13
|
|
|
|
|
EDemoCommands_DEM_SaveGame packetType = 14
|
|
|
|
|
EDemoCommands_DEM_SpawnGroups packetType = 15
|
|
|
|
|
NET_Messages_net_NOP entityType = 0
|
|
|
|
|
NET_Messages_net_Disconnect entityType = 1
|
|
|
|
|
NET_Messages_net_SplitScreenUser entityType = 3
|
|
|
|
@ -128,7 +129,6 @@ const (
|
|
|
|
|
EBaseUserMessages_UM_CloseCaptionPlaceholder entityType = 142
|
|
|
|
|
EBaseUserMessages_UM_CameraTransition entityType = 143
|
|
|
|
|
EBaseUserMessages_UM_AudioParameter entityType = 144
|
|
|
|
|
EBaseGameEvents_GE_VDebugGameSessionIDEvent entityType = 200
|
|
|
|
|
EBaseGameEvents_GE_PlaceDecalEvent entityType = 201
|
|
|
|
|
EBaseGameEvents_GE_ClearWorldDecalsEvent entityType = 202
|
|
|
|
|
EBaseGameEvents_GE_ClearEntityDecalsEvent entityType = 203
|
|
|
|
@ -235,8 +235,8 @@ const (
|
|
|
|
|
EDotaUserMessages_DOTA_UM_QuestStatus entityType = 559
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (d datagramType) String() string {
|
|
|
|
|
switch d {
|
|
|
|
|
func (t packetType) String() string {
|
|
|
|
|
switch t {
|
|
|
|
|
case EDemoCommands_DEM_Stop:
|
|
|
|
|
return "EDemoCommands_DEM_Stop"
|
|
|
|
|
case EDemoCommands_DEM_FileHeader:
|
|
|
|
@ -270,12 +270,12 @@ func (d datagramType) String() string {
|
|
|
|
|
case EDemoCommands_DEM_SpawnGroups:
|
|
|
|
|
return "EDemoCommands_DEM_SpawnGroups"
|
|
|
|
|
default:
|
|
|
|
|
return "UnknownDatagramType"
|
|
|
|
|
return fmt.Sprintf("UnknownPacketType_%d", t)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e entityType) String() string {
|
|
|
|
|
switch e {
|
|
|
|
|
func (t entityType) String() string {
|
|
|
|
|
switch t {
|
|
|
|
|
case NET_Messages_net_NOP:
|
|
|
|
|
return "NET_Messages_net_NOP"
|
|
|
|
|
case NET_Messages_net_Disconnect:
|
|
|
|
@ -432,8 +432,6 @@ func (e entityType) String() string {
|
|
|
|
|
return "EBaseUserMessages_UM_CameraTransition"
|
|
|
|
|
case EBaseUserMessages_UM_AudioParameter:
|
|
|
|
|
return "EBaseUserMessages_UM_AudioParameter"
|
|
|
|
|
case EBaseGameEvents_GE_VDebugGameSessionIDEvent:
|
|
|
|
|
return "EBaseGameEvents_GE_VDebugGameSessionIDEvent"
|
|
|
|
|
case EBaseGameEvents_GE_PlaceDecalEvent:
|
|
|
|
|
return "EBaseGameEvents_GE_PlaceDecalEvent"
|
|
|
|
|
case EBaseGameEvents_GE_ClearWorldDecalsEvent:
|
|
|
|
@ -643,7 +641,7 @@ func (e entityType) String() string {
|
|
|
|
|
case EDotaUserMessages_DOTA_UM_QuestStatus:
|
|
|
|
|
return "EDotaUserMessages_DOTA_UM_QuestStatus"
|
|
|
|
|
default:
|
|
|
|
|
return "UnknownEntityType"
|
|
|
|
|
return fmt.Sprintf("UnknownEntityType_%d", t)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -665,16 +663,16 @@ func (m messageStatus) Error() string {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type datagramFactory map[datagramType]func() proto.Message
|
|
|
|
|
type packetFactory map[packetType]func() proto.Message
|
|
|
|
|
type entityFactory map[entityType]func() proto.Message
|
|
|
|
|
|
|
|
|
|
type messageFactory struct {
|
|
|
|
|
datagrams datagramFactory
|
|
|
|
|
packets packetFactory
|
|
|
|
|
entities entityFactory
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *messageFactory) BuildDatagram(id datagramType) (proto.Message, error) {
|
|
|
|
|
fn, ok := m.datagrams[id]
|
|
|
|
|
func (m *messageFactory) BuildPacket(id packetType) (proto.Message, error) {
|
|
|
|
|
fn, ok := m.packets[id]
|
|
|
|
|
if !ok {
|
|
|
|
|
return nil, m_Unknown
|
|
|
|
|
}
|
|
|
|
@ -690,7 +688,7 @@ func (m *messageFactory) BuildEntity(id entityType) (proto.Message, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var messages = messageFactory{
|
|
|
|
|
datagramFactory{
|
|
|
|
|
packetFactory{
|
|
|
|
|
EDemoCommands_DEM_Stop: func() proto.Message { return new(dota.CDemoStop) },
|
|
|
|
|
EDemoCommands_DEM_FileHeader: func() proto.Message { return new(dota.CDemoFileHeader) },
|
|
|
|
|
EDemoCommands_DEM_FileInfo: func() proto.Message { return new(dota.CDemoFileInfo) },
|
|
|
|
@ -787,7 +785,6 @@ var messages = messageFactory{
|
|
|
|
|
EBaseUserMessages_UM_CloseCaptionPlaceholder: func() proto.Message { return new(dota.CUserMessageCloseCaptionPlaceholder) },
|
|
|
|
|
EBaseUserMessages_UM_CameraTransition: func() proto.Message { return new(dota.CUserMessageCameraTransition) },
|
|
|
|
|
EBaseUserMessages_UM_AudioParameter: func() proto.Message { return new(dota.CUserMessageAudioParameter) },
|
|
|
|
|
EBaseGameEvents_GE_VDebugGameSessionIDEvent: func() proto.Message { return new(dota.CMsgVDebugGameSessionIDEvent) },
|
|
|
|
|
EBaseGameEvents_GE_PlaceDecalEvent: func() proto.Message { return new(dota.CMsgPlaceDecalEvent) },
|
|
|
|
|
EBaseGameEvents_GE_ClearWorldDecalsEvent: func() proto.Message { return new(dota.CMsgClearWorldDecalsEvent) },
|
|
|
|
|
EBaseGameEvents_GE_ClearEntityDecalsEvent: func() proto.Message { return new(dota.CMsgClearEntityDecalsEvent) },
|
|
|
|
|