diff --git a/pkg/api/worker.go b/pkg/api/worker.go index b82d19146..b206c5c17 100644 --- a/pkg/api/worker.go +++ b/pkg/api/worker.go @@ -25,8 +25,8 @@ type ( PlayerIndex int `json:"player_index"` } GameInfo struct { - Name string `json:"name"` Base string `json:"base"` + Name string `json:"name"` Path string `json:"path"` System string `json:"system"` Type string `json:"type"` diff --git a/pkg/coordinator/workerapi.go b/pkg/coordinator/workerapi.go index 65b57589b..cc21bec37 100644 --- a/pkg/coordinator/workerapi.go +++ b/pkg/coordinator/workerapi.go @@ -23,7 +23,7 @@ func (w *Worker) StartGame(id com.Uid, app games.AppMeta, req api.GameStartUserR return api.UnwrapChecked[api.StartGameResponse]( w.Send(api.StartGame, api.StartGameRequest[com.Uid]{ StatefulRoom: StateRoom(id, req.RoomId), - Game: api.GameInfo{Name: app.Name, Base: app.Base, Path: app.Path, System: app.System, Type: app.Type}, + Game: api.GameInfo(app), PlayerIndex: req.PlayerIndex, Record: req.Record, RecordUser: req.RecordUser, diff --git a/pkg/games/launcher.go b/pkg/games/launcher.go index af5be8dfc..78bcdae35 100644 --- a/pkg/games/launcher.go +++ b/pkg/games/launcher.go @@ -14,11 +14,11 @@ type Launcher interface { } type AppMeta struct { - Name string - Type string Base string + Name string Path string System string + Type string } type GameLauncher struct { diff --git a/pkg/games/library.go b/pkg/games/library.go index d46b80933..0fde5023f 100644 --- a/pkg/games/library.go +++ b/pkg/games/library.go @@ -56,14 +56,11 @@ type WithEmulatorInfo interface { } type GameMetadata struct { - // the display name of the game - Name string - // the game file extension (e.g. nes, n64) - Type string - Base string - // the game path relative to the library base path - Path string + Base string + Name string // the display name of the game + Path string // the game path relative to the library base path System string + Type string // the game file extension (e.g. nes, n64) } func (g GameMetadata) FullPath(base string) string { diff --git a/pkg/worker/coordinatorhandlers.go b/pkg/worker/coordinatorhandlers.go index 420aaaeff..c530c61a2 100644 --- a/pkg/worker/coordinatorhandlers.go +++ b/pkg/worker/coordinatorhandlers.go @@ -81,9 +81,7 @@ func (c *coordinator) HandleGameStart(rq api.StartGameRequest[com.Uid], w *Worke if room == nil { room = NewRoom( rq.Room.Rid, - games.GameMetadata{ - Name: rq.Game.Name, Base: rq.Game.Base, Type: rq.Game.Type, Path: rq.Game.Path, System: rq.Game.System, - }, + games.GameMetadata(rq.Game), func(room *Room) { w.router.SetRoom(nil) c.CloseRoom(room.id)