Fix: register D2R resolution profiles with engine, fix null API responses
This commit is contained in:
parent
67f8ec1fe8
commit
4ebed5e3ab
3 changed files with 20 additions and 2 deletions
|
|
@ -333,7 +333,7 @@ func (s *Server) handleLootRules(w http.ResponseWriter, r *http.Request) {
|
|||
func (s *Server) handleRoutines(w http.ResponseWriter, r *http.Request) {
|
||||
routines := s.engine.GamePlugin().Routines()
|
||||
|
||||
var response []map[string]interface{}
|
||||
response := make([]map[string]interface{}, 0)
|
||||
for _, routine := range routines {
|
||||
response = append(response, map[string]interface{}{
|
||||
"name": routine.Name(),
|
||||
|
|
@ -475,7 +475,7 @@ func (s *Server) getRegions() []RegionInfo {
|
|||
profile, err := registry.Get(gameID, width, height)
|
||||
if err != nil {
|
||||
log.Printf("Failed to get resolution profile: %v", err)
|
||||
return nil
|
||||
return make([]RegionInfo, 0)
|
||||
}
|
||||
|
||||
var regions []RegionInfo
|
||||
|
|
|
|||
|
|
@ -61,6 +61,18 @@ func NewEngine(captureSource capture.Source, gamePlugin plugin.Plugin, devMode b
|
|||
startTime: time.Now(),
|
||||
}
|
||||
|
||||
// Register game-specific resolution profiles with the engine's registry.
|
||||
// Plugins that support resolution profiles implement this optional interface.
|
||||
type profileRegistrar interface {
|
||||
RegisterResolutionProfiles(*resolution.Registry) error
|
||||
}
|
||||
if registrar, ok := gamePlugin.(profileRegistrar); ok {
|
||||
if err := registrar.RegisterResolutionProfiles(engine.resolutionRegistry); err != nil {
|
||||
return nil, fmt.Errorf("failed to register resolution profiles: %w", err)
|
||||
}
|
||||
log.Printf("Registered resolution profiles for %s", gamePlugin.Info().ID)
|
||||
}
|
||||
|
||||
// Create engine services for the plugin
|
||||
engine.services = &engineServices{engine: engine}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue