add support for initial state configuration in print_replay tool

This commit is contained in:
adman
2026-05-10 20:35:58 +02:00
parent 05e8da2ff4
commit 021b8ddc1a
+11
View File
@@ -24,6 +24,7 @@ var (
FileFlag = cmd.String("file", "", "The tmcpr file to print")
ProtocolVersion = cmd.Int("protocol", -1, "The protocol version")
CreateTestsPath = cmd.String("create-tests", "", "")
StateFlag = cmd.String("state", "login", "Initial state: login, config, play")
)
//go:embed failed_packet.go.tmpl
@@ -115,6 +116,16 @@ func Run(args []string) (err error) {
if *FileFlag == "" {
return fmt.Errorf("no file specified")
}
switch *StateFlag {
case "login":
state = proto_base.Login
case "config":
state = proto_base.Configuration
case "play":
state = proto_base.Play
default:
return fmt.Errorf("unknown state: %s", *StateFlag)
}
f, err := os.Open(*FileFlag)
if err != nil {
return