Documentation
¶
Index ¶
- type EmulatorInterface
- type Manager
- func (m *Manager) ClearProgressDirty()
- func (m *Manager) ComputeGameHash(romData []byte) string
- func (m *Manager) Destroy()
- func (m *Manager) DoFrame()
- func (m *Manager) EnsureLibrariesLoaded(callback func(success bool))
- func (m *Manager) GetBadgeImage(achievementID uint32) *ebiten.Image
- func (m *Manager) GetBadgeImageAsync(achievementID uint32, callback func(*ebiten.Image))
- func (m *Manager) GetCachedAchievements() []*rcheevos.Achievement
- func (m *Manager) GetCachedGameTitle() string
- func (m *Manager) GetGame() *rcheevos.Game
- func (m *Manager) GetUsername() string
- func (m *Manager) Idle()
- func (m *Manager) IsEnabled() bool
- func (m *Manager) IsGameLoaded() bool
- func (m *Manager) IsLoggedIn() bool
- func (m *Manager) IsProgressDirty() bool
- func (m *Manager) IsSpectatorMode() bool
- func (m *Manager) LoadGame(romData []byte, filePath string, md5Hash string) error
- func (m *Manager) Login(username, password string, ...)
- func (m *Manager) LoginWithToken(username, token string, callback func(success bool, result int, err error))
- func (m *Manager) Logout()
- func (m *Manager) LookupGameProgress(md5Hash string) (found bool, progress *rcheevos.UserProgressEntry)
- func (m *Manager) RefreshUserProgress(callback func(success bool))
- func (m *Manager) SetEmulator(emu EmulatorInterface)
- func (m *Manager) SetOnUnlockCallback(fn func(achievementID uint32))
- func (m *Manager) SetScreenshotFunc(fn ScreenshotFunc)
- func (m *Manager) UnloadGame()
- type Notification
- type ScreenshotFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmulatorInterface ¶
EmulatorInterface defines the interface for emulator memory access. This matches the coreif.MemoryInspector interface, decoupling the achievement manager from the concrete emulator type. The core adapter handles mapping flat addresses to internal memory regions.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps the rcheevos client for RetroAchievements integration
func NewManager ¶
func NewManager(notification Notification, config *storage.Config, appName, appVersion string, consoleID uint32) *Manager
NewManager creates a new achievement manager
func (*Manager) ClearProgressDirty ¶
func (m *Manager) ClearProgressDirty()
ClearProgressDirty clears the dirty flag after the detail screen refreshes.
func (*Manager) ComputeGameHash ¶
ComputeGameHash generates the MD5 hash for ROM data in rcheevos format. Use this as a fallback when the MD5 is not in the RDB.
func (*Manager) DoFrame ¶
func (m *Manager) DoFrame()
DoFrame processes achievements for the current frame
func (*Manager) EnsureLibrariesLoaded ¶
EnsureLibrariesLoaded fetches the hash library and user progress for SMS if not already cached. Call this when logged in to pre-fetch data for the detail screen.
func (*Manager) GetBadgeImage ¶
GetBadgeImage returns a cached badge image for an achievement. Always returns the colored (unlocked) version - caller applies grayscale if needed. Returns nil if the badge is not yet cached.
func (*Manager) GetBadgeImageAsync ¶
GetBadgeImageAsync fetches a badge image asynchronously. Always fetches the colored (unlocked) version - caller applies grayscale if needed. The callback is called when the image is ready (may be nil on error).
func (*Manager) GetCachedAchievements ¶
func (m *Manager) GetCachedAchievements() []*rcheevos.Achievement
GetCachedAchievements returns the cached achievement list for the current game. Returns nil if no game is loaded. The slice is safe to read; do not modify.
func (*Manager) GetCachedGameTitle ¶
GetCachedGameTitle returns the cached game title.
func (*Manager) GetGame ¶
GetGame returns information about the currently loaded game. Returns nil if no game is loaded.
func (*Manager) GetUsername ¶
GetUsername returns the logged in username
func (*Manager) IsGameLoaded ¶
IsGameLoaded returns whether a game is currently loaded for achievements
func (*Manager) IsLoggedIn ¶
IsLoggedIn returns whether a user is currently logged in
func (*Manager) IsProgressDirty ¶
IsProgressDirty returns true if achievements were unlocked since the last check. Used by the detail screen to know when to refresh cached progress data.
func (*Manager) IsSpectatorMode ¶
IsSpectatorMode returns whether spectator mode is enabled in config
func (*Manager) LoadGame ¶
LoadGame identifies and loads a game for achievement tracking. If md5Hash is provided and non-empty, it will be used directly (fast path). Otherwise, the hash will be computed from romData (fallback).
func (*Manager) Login ¶
func (m *Manager) Login(username, password string, callback func(success bool, token string, err error))
Login authenticates with RetroAchievements using username and password
func (*Manager) LoginWithToken ¶
func (m *Manager) LoginWithToken(username, token string, callback func(success bool, result int, err error))
LoginWithToken authenticates with RetroAchievements using a stored token. The result code is passed through so callers can distinguish credential errors (e.g. ExpiredToken) from network errors (e.g. NoResponse).
func (*Manager) Logout ¶
func (m *Manager) Logout()
Logout logs out the current user and clears all caches
func (*Manager) LookupGameProgress ¶
func (m *Manager) LookupGameProgress(md5Hash string) (found bool, progress *rcheevos.UserProgressEntry)
LookupGameProgress returns user progress for a game by MD5 hash. Returns (false, nil) if the game is not in the RetroAchievements database. Returns (true, nil) if the game exists but user has no progress. Returns (true, progress) if the game exists and user has progress.
func (*Manager) RefreshUserProgress ¶
RefreshUserProgress re-fetches user progress data from the server. Call this after achievements are unlocked to update cached progress.
func (*Manager) SetEmulator ¶
func (m *Manager) SetEmulator(emu EmulatorInterface)
SetEmulator sets the emulator for memory access
func (*Manager) SetOnUnlockCallback ¶
SetOnUnlockCallback sets a callback that's called when an achievement is unlocked. The callback receives the achievement ID. Used by the overlay to update its display.
func (*Manager) SetScreenshotFunc ¶
func (m *Manager) SetScreenshotFunc(fn ScreenshotFunc)
SetScreenshotFunc sets the callback for taking screenshots on achievement unlock
type Notification ¶
type Notification interface {
ShowDefault(message string)
ShowAchievementWithBadge(title, description string, badge *ebiten.Image)
SetBadge(badge *ebiten.Image) // Update badge after async fetch
PlaySound(soundData []byte) // Play sound through notification audio stream
}
Notification interface for showing achievement popups
type ScreenshotFunc ¶
type ScreenshotFunc func()
ScreenshotFunc is called when an achievement triggers to capture a screenshot