Documentation
¶
Index ¶
- Constants
- func ConsoleName(consoleID uint32) string
- func ErrorString(result int) string
- func HashFromBuffer(consoleID uint32, data []byte) string
- func HashFromFile(consoleID uint32, path string) string
- func LoadGameStateName(state int) string
- type Achievement
- type AchievementBucket
- type AchievementList
- type AllUserProgress
- type AsyncHandle
- type ChangeMediaCallback
- type Client
- func (c *Client) AbortAsync(handle *AsyncHandle)
- func (c *Client) CanPause() (allowed bool, framesRemaining uint32)
- func (c *Client) ChangeMedia(hash string, callback ChangeMediaCallback)
- func (c *Client) CreateAchievementList(category, grouping int) *AchievementList
- func (c *Client) CreateLeaderboardList(grouping int) *LeaderboardList
- func (c *Client) CreateSubsetList() *SubsetList
- func (c *Client) DeserializeProgress(data []byte) int
- func (c *Client) Destroy()
- func (c *Client) DoFrame()
- func (c *Client) EnableLogging(level int, logFunc LogFunc)
- func (c *Client) FetchAllUserProgress(consoleID uint32, callback FetchAllUserProgressCallback)
- func (c *Client) FetchGameTitles(gameIDs []uint32, callback FetchGameTitlesCallback)
- func (c *Client) FetchHashLibrary(consoleID uint32, callback FetchHashLibraryCallback)
- func (c *Client) FetchLeaderboardEntries(leaderboardID uint32, firstEntry, count uint32, ...)
- func (c *Client) FetchLeaderboardEntriesAroundUser(leaderboardID uint32, count uint32, callback LeaderboardEntriesCallback)
- func (c *Client) GetAchievement(id uint32) *Achievement
- func (c *Client) GetAchievementImageURL(achievement *Achievement, state int) string
- func (c *Client) GetEncoreModeEnabled() bool
- func (c *Client) GetGame() *Game
- func (c *Client) GetGameImageURL() string
- func (c *Client) GetHardcoreEnabled() bool
- func (c *Client) GetLeaderboard(id uint32) *Leaderboard
- func (c *Client) GetLoadGameState() int
- func (c *Client) GetRichPresenceMessage() string
- func (c *Client) GetSpectatorModeEnabled() bool
- func (c *Client) GetSubsetInfo(subsetID uint32) *Subset
- func (c *Client) GetUnofficialEnabled() bool
- func (c *Client) GetUser() *User
- func (c *Client) GetUserAgentClause() string
- func (c *Client) GetUserGameSummary() *UserGameSummary
- func (c *Client) GetUserImageURL() string
- func (c *Client) GetUserSubsetSummary(subsetID uint32) *UserGameSummary
- func (c *Client) GetUserdata() unsafe.Pointer
- func (c *Client) HasAchievements() bool
- func (c *Client) HasLeaderboards() bool
- func (c *Client) HasRichPresence() bool
- func (c *Client) IdentifyAndChangeMedia(filePath string, data []byte, callback ChangeMediaCallback)
- func (c *Client) IdentifyAndLoadGame(consoleID uint32, filePath string, data []byte, callback LoadGameCallbackFunc)
- func (c *Client) Idle()
- func (c *Client) IsGameLoaded() bool
- func (c *Client) IsProcessingRequired() bool
- func (c *Client) LoadGame(hash string, callback LoadGameCallbackFunc)
- func (c *Client) LoginWithPassword(username, password string, callback LoginCallbackFunc)
- func (c *Client) LoginWithToken(username, token string, callback LoginCallbackFunc)
- func (c *Client) Logout()
- func (c *Client) ProgressSize() int
- func (c *Client) Reset()
- func (c *Client) SerializeProgress() ([]byte, int)
- func (c *Client) SetAllowBackgroundMemoryReads(allowed bool)
- func (c *Client) SetEncoreModeEnabled(enabled bool)
- func (c *Client) SetEventHandler(handler EventFunc)
- func (c *Client) SetGetTimeMillisecsFunction(fn GetTimeMillisecsFunc)
- func (c *Client) SetHardcoreEnabled(enabled bool)
- func (c *Client) SetHost(hostname string)
- func (c *Client) SetReadMemoryFunction(fn ReadMemoryFunc)
- func (c *Client) SetSpectatorModeEnabled(enabled bool)
- func (c *Client) SetUnofficialEnabled(enabled bool)
- func (c *Client) SetUserdata(userdata unsafe.Pointer)
- func (c *Client) UnloadGame()
- type Event
- type EventFunc
- type EventSubset
- type FetchAllUserProgressCallback
- type FetchGameTitlesCallback
- type FetchHashLibraryCallback
- type Game
- type GameTitleEntry
- type GameTitleList
- type GetTimeMillisecsFunc
- type HashIterator
- type HashLibrary
- type HashLibraryEntry
- type Leaderboard
- type LeaderboardBucket
- type LeaderboardEntriesCallback
- type LeaderboardEntry
- type LeaderboardEntryList
- type LeaderboardList
- type LeaderboardScoreboard
- type LeaderboardScoreboardEntry
- type LeaderboardTracker
- type LoadGameCallbackFunc
- type LogFunc
- type LoginCallbackFunc
- type ReadMemoryFunc
- type ServerCallFunc
- type ServerError
- type ServerRequest
- type Subset
- type SubsetList
- type User
- type UserGameSummary
- type UserProgressEntry
Constants ¶
const ( AchievementListGroupingLockState = C.RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_LOCK_STATE AchievementListGroupingProgress = C.RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_PROGRESS )
Achievement list grouping options
const ( AchievementCategoryNone = C.RC_CLIENT_ACHIEVEMENT_CATEGORY_NONE AchievementCategoryCore = C.RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE AchievementCategoryUnofficial = C.RC_CLIENT_ACHIEVEMENT_CATEGORY_UNOFFICIAL AchievementCategoryCoreAndUnofficial = C.RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE_AND_UNOFFICIAL )
Achievement categories
const ( AchievementBucketUnknown = C.RC_CLIENT_ACHIEVEMENT_BUCKET_UNKNOWN AchievementBucketLocked = C.RC_CLIENT_ACHIEVEMENT_BUCKET_LOCKED AchievementBucketUnlocked = C.RC_CLIENT_ACHIEVEMENT_BUCKET_UNLOCKED AchievementBucketUnsupported = C.RC_CLIENT_ACHIEVEMENT_BUCKET_UNSUPPORTED AchievementBucketUnofficial = C.RC_CLIENT_ACHIEVEMENT_BUCKET_UNOFFICIAL AchievementBucketRecentlyUnlocked = C.RC_CLIENT_ACHIEVEMENT_BUCKET_RECENTLY_UNLOCKED AchievementBucketActiveChallenge = C.RC_CLIENT_ACHIEVEMENT_BUCKET_ACTIVE_CHALLENGE AchievementBucketAlmostThere = C.RC_CLIENT_ACHIEVEMENT_BUCKET_ALMOST_THERE AchievementBucketUnsynced = C.RC_CLIENT_ACHIEVEMENT_BUCKET_UNSYNCED )
Achievement bucket types
const ( AchievementTypeStandard = C.RC_CLIENT_ACHIEVEMENT_TYPE_STANDARD AchievementTypeMissable = C.RC_CLIENT_ACHIEVEMENT_TYPE_MISSABLE AchievementTypeProgression = C.RC_CLIENT_ACHIEVEMENT_TYPE_PROGRESSION AchievementTypeWin = C.RC_CLIENT_ACHIEVEMENT_TYPE_WIN )
Achievement types
const ( AchievementUnlockedNone = C.RC_CLIENT_ACHIEVEMENT_UNLOCKED_NONE AchievementUnlockedSoftcore = C.RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE AchievementUnlockedHardcore = C.RC_CLIENT_ACHIEVEMENT_UNLOCKED_HARDCORE AchievementUnlockedBoth = C.RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH )
Achievement unlock states
const ( OK = C.RC_OK InvalidFuncOperand = C.RC_INVALID_FUNC_OPERAND InvalidMemoryOperand = C.RC_INVALID_MEMORY_OPERAND InvalidConstOperand = C.RC_INVALID_CONST_OPERAND InvalidFPOperand = C.RC_INVALID_FP_OPERAND InvalidConditionType = C.RC_INVALID_CONDITION_TYPE InvalidOperator = C.RC_INVALID_OPERATOR InvalidRequiredHits = C.RC_INVALID_REQUIRED_HITS DuplicatedStart = C.RC_DUPLICATED_START DuplicatedCancel = C.RC_DUPLICATED_CANCEL DuplicatedSubmit = C.RC_DUPLICATED_SUBMIT DuplicatedValue = C.RC_DUPLICATED_VALUE DuplicatedProgress = C.RC_DUPLICATED_PROGRESS MissingStart = C.RC_MISSING_START MissingCancel = C.RC_MISSING_CANCEL MissingSubmit = C.RC_MISSING_SUBMIT MissingValue = C.RC_MISSING_VALUE InvalidLboardField = C.RC_INVALID_LBOARD_FIELD MissingDisplayString = C.RC_MISSING_DISPLAY_STRING OutOfMemory = C.RC_OUT_OF_MEMORY InvalidValueFlag = C.RC_INVALID_VALUE_FLAG MissingValueMeasured = C.RC_MISSING_VALUE_MEASURED MultipleMeasured = C.RC_MULTIPLE_MEASURED InvalidMeasuredTarget = C.RC_INVALID_MEASURED_TARGET InvalidComparison = C.RC_INVALID_COMPARISON InvalidState = C.RC_INVALID_STATE InvalidJSON = C.RC_INVALID_JSON APIFailure = C.RC_API_FAILURE LoginRequired = C.RC_LOGIN_REQUIRED NoGameLoaded = C.RC_NO_GAME_LOADED HardcoreDisabled = C.RC_HARDCORE_DISABLED Aborted = C.RC_ABORTED NoResponse = C.RC_NO_RESPONSE AccessDenied = C.RC_ACCESS_DENIED InvalidCredentials = C.RC_INVALID_CREDENTIALS ExpiredToken = C.RC_EXPIRED_TOKEN InsufficientBuffer = C.RC_INSUFFICIENT_BUFFER InvalidVariableName = C.RC_INVALID_VARIABLE_NAME UnknownVariableName = C.RC_UNKNOWN_VARIABLE_NAME NotFound = C.RC_NOT_FOUND )
Result codes
const ( LeaderboardStateInactive = C.RC_CLIENT_LEADERBOARD_STATE_INACTIVE LeaderboardStateActive = C.RC_CLIENT_LEADERBOARD_STATE_ACTIVE LeaderboardStateTracking = C.RC_CLIENT_LEADERBOARD_STATE_TRACKING LeaderboardStateDisabled = C.RC_CLIENT_LEADERBOARD_STATE_DISABLED )
Leaderboard states
const ( LeaderboardFormatTime = C.RC_CLIENT_LEADERBOARD_FORMAT_TIME LeaderboardFormatScore = C.RC_CLIENT_LEADERBOARD_FORMAT_SCORE LeaderboardFormatValue = C.RC_CLIENT_LEADERBOARD_FORMAT_VALUE )
Leaderboard formats
const ( LeaderboardListGroupingNone = C.RC_CLIENT_LEADERBOARD_LIST_GROUPING_NONE LeaderboardListGroupingTracking = C.RC_CLIENT_LEADERBOARD_LIST_GROUPING_TRACKING )
Leaderboard list grouping options
const ( LeaderboardBucketUnknown = C.RC_CLIENT_LEADERBOARD_BUCKET_UNKNOWN LeaderboardBucketInactive = C.RC_CLIENT_LEADERBOARD_BUCKET_INACTIVE LeaderboardBucketActive = C.RC_CLIENT_LEADERBOARD_BUCKET_ACTIVE LeaderboardBucketUnsupported = C.RC_CLIENT_LEADERBOARD_BUCKET_UNSUPPORTED LeaderboardBucketAll = C.RC_CLIENT_LEADERBOARD_BUCKET_ALL )
Leaderboard bucket types
const ( LoadGameStateNone = C.RC_CLIENT_LOAD_GAME_STATE_NONE LoadGameStateAwaitLogin = C.RC_CLIENT_LOAD_GAME_STATE_AWAIT_LOGIN LoadGameStateIdentifying = C.RC_CLIENT_LOAD_GAME_STATE_IDENTIFYING_GAME LoadGameStateFetchingData = C.RC_CLIENT_LOAD_GAME_STATE_FETCHING_GAME_DATA LoadGameStateStartingSession = C.RC_CLIENT_LOAD_GAME_STATE_STARTING_SESSION LoadGameStateDone = C.RC_CLIENT_LOAD_GAME_STATE_DONE LoadGameStateAborted = C.RC_CLIENT_LOAD_GAME_STATE_ABORTED )
Load game state constants
const ( ConsoleUnknown = C.RC_CONSOLE_UNKNOWN ConsoleMegaDrive = C.RC_CONSOLE_MEGA_DRIVE ConsoleNintendo64 = C.RC_CONSOLE_NINTENDO_64 ConsoleSNES = C.RC_CONSOLE_SUPER_NINTENDO ConsoleGameBoy = C.RC_CONSOLE_GAMEBOY ConsoleGBA = C.RC_CONSOLE_GAMEBOY_ADVANCE ConsoleGBC = C.RC_CONSOLE_GAMEBOY_COLOR ConsoleNES = C.RC_CONSOLE_NINTENDO ConsolePCEngine = C.RC_CONSOLE_PC_ENGINE ConsoleSegaCD = C.RC_CONSOLE_SEGA_CD ConsoleSega32X = C.RC_CONSOLE_SEGA_32X ConsoleMasterSystem = C.RC_CONSOLE_MASTER_SYSTEM ConsolePlayStation = C.RC_CONSOLE_PLAYSTATION ConsoleGameGear = C.RC_CONSOLE_GAME_GEAR ConsoleSG1000 = C.RC_CONSOLE_SG1000 )
Console IDs
const ( LogLevelNone = C.RC_CLIENT_LOG_LEVEL_NONE LogLevelError = C.RC_CLIENT_LOG_LEVEL_ERROR LogLevelWarn = C.RC_CLIENT_LOG_LEVEL_WARN LogLevelInfo = C.RC_CLIENT_LOG_LEVEL_INFO LogLevelVerbose = C.RC_CLIENT_LOG_LEVEL_VERBOSE )
Log levels
const ( EventAchievementTriggered = C.RC_CLIENT_EVENT_ACHIEVEMENT_TRIGGERED EventLeaderboardStarted = C.RC_CLIENT_EVENT_LEADERBOARD_STARTED EventLeaderboardFailed = C.RC_CLIENT_EVENT_LEADERBOARD_FAILED EventLeaderboardSubmitted = C.RC_CLIENT_EVENT_LEADERBOARD_SUBMITTED EventAchievementChallengeIndicatorShow = C.RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_SHOW EventAchievementChallengeIndicatorHide = C.RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_HIDE EventAchievementProgressIndicatorShow = C.RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_SHOW EventAchievementProgressIndicatorHide = C.RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_HIDE EventAchievementProgressIndicatorUpdate = C.RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_UPDATE EventLeaderboardTrackerShow = C.RC_CLIENT_EVENT_LEADERBOARD_TRACKER_SHOW EventLeaderboardTrackerHide = C.RC_CLIENT_EVENT_LEADERBOARD_TRACKER_HIDE EventLeaderboardTrackerUpdate = C.RC_CLIENT_EVENT_LEADERBOARD_TRACKER_UPDATE EventReset = C.RC_CLIENT_EVENT_RESET EventGameCompleted = C.RC_CLIENT_EVENT_GAME_COMPLETED EventServerError = C.RC_CLIENT_EVENT_SERVER_ERROR EventDisconnected = C.RC_CLIENT_EVENT_DISCONNECTED EventReconnected = C.RC_CLIENT_EVENT_RECONNECTED )
Event types
const ( AchievementStateInactive = C.RC_CLIENT_ACHIEVEMENT_STATE_INACTIVE AchievementStateActive = C.RC_CLIENT_ACHIEVEMENT_STATE_ACTIVE AchievementStateUnlocked = C.RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED AchievementStateDisabled = C.RC_CLIENT_ACHIEVEMENT_STATE_DISABLED )
Achievement states
Variables ¶
This section is empty.
Functions ¶
func ConsoleName ¶
ConsoleName returns the name for a console ID
func ErrorString ¶
ErrorString returns the error message for a result code
func HashFromBuffer ¶
HashFromBuffer generates a hash from ROM data for a specific console
func HashFromFile ¶
HashFromFile generates a hash from a ROM file for a specific console
func LoadGameStateName ¶
LoadGameStateName returns a human-readable name for a load game state
Types ¶
type Achievement ¶
type Achievement struct {
ID uint32
Title string
Description string
BadgeName string
Points uint32
State uint8
Category uint8
Bucket uint8
Unlocked uint8
Type uint8
MeasuredProgress string
MeasuredPercent float32
Rarity float32
RarityHardcore float32
UnlockTime int64
}
Achievement represents achievement information
type AchievementBucket ¶
type AchievementBucket struct {
Achievements []*Achievement
Label string
SubsetID uint32
BucketType uint8
}
AchievementBucket represents a group of achievements
type AchievementList ¶
type AchievementList struct {
Buckets []*AchievementBucket
// contains filtered or unexported fields
}
AchievementList represents a list of achievement buckets
func (*AchievementList) Destroy ¶
func (l *AchievementList) Destroy()
Destroy releases resources associated with the achievement list.
func (*AchievementList) GetAllAchievements ¶
func (l *AchievementList) GetAllAchievements() []*Achievement
GetAllAchievements returns a flat slice of all achievements across all buckets.
type AllUserProgress ¶
type AllUserProgress struct {
Entries []*UserProgressEntry
// contains filtered or unexported fields
}
AllUserProgress represents a user's progress across all games for a console
func (*AllUserProgress) Destroy ¶
func (l *AllUserProgress) Destroy()
Destroy releases resources associated with the user progress list.
type AsyncHandle ¶
type AsyncHandle struct {
// contains filtered or unexported fields
}
AsyncHandle represents an async operation that can be aborted
type ChangeMediaCallback ¶
ChangeMediaCallback is called when media change completes
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the rc_client
func NewClient ¶
func NewClient(readMemory ReadMemoryFunc, serverCall ServerCallFunc) *Client
NewClient creates a new rcheevos client
func (*Client) AbortAsync ¶
func (c *Client) AbortAsync(handle *AsyncHandle)
AbortAsync marks an async process as aborted. The associated callback will not be called. Pass the async handle returned by login/load game functions.
func (*Client) CanPause ¶
CanPause determines if a sufficient number of frames have been processed since the last call to CanPause. This is used for hardcore anti-cheat to prevent pausing mid-leaderboard attempt.
Returns true if pausing is allowed, false if not. If false, framesRemaining indicates how many more frames must be processed before pausing is allowed (can be converted to seconds for display).
Only call this when the user is actually trying to pause.
func (*Client) ChangeMedia ¶
func (c *Client) ChangeMedia(hash string, callback ChangeMediaCallback)
ChangeMedia changes the active disc in a multi-disc game using a known hash. This allows achievements to span multiple discs.
func (*Client) CreateAchievementList ¶
func (c *Client) CreateAchievementList(category, grouping int) *AchievementList
CreateAchievementList creates a list of achievements matching the specified category and grouping. Category should be one of AchievementCategoryCore, AchievementCategoryUnofficial, or AchievementCategoryCoreAndUnofficial. Grouping should be AchievementListGroupingLockState or AchievementListGroupingProgress. The returned list must be destroyed by calling Destroy() when no longer needed.
func (*Client) CreateLeaderboardList ¶
func (c *Client) CreateLeaderboardList(grouping int) *LeaderboardList
CreateLeaderboardList creates a list of leaderboards matching the specified grouping. Grouping should be LeaderboardListGroupingNone or LeaderboardListGroupingTracking. The returned list must be destroyed by calling Destroy() when no longer needed.
func (*Client) CreateSubsetList ¶
func (c *Client) CreateSubsetList() *SubsetList
CreateSubsetList creates a list of all subsets for the currently loaded game. The returned list must be destroyed by calling Destroy() when no longer needed.
func (*Client) DeserializeProgress ¶
DeserializeProgress restores the runtime state from a buffer. This should be called when loading a savestate to restore achievement progress. Returns OK on success, or an error code on failure.
func (*Client) Destroy ¶
func (c *Client) Destroy()
Destroy releases resources associated with the client
func (*Client) DoFrame ¶
func (c *Client) DoFrame()
DoFrame processes achievements for the current frame
func (*Client) EnableLogging ¶
EnableLogging enables logging at the specified level
func (*Client) FetchAllUserProgress ¶
func (c *Client) FetchAllUserProgress(consoleID uint32, callback FetchAllUserProgressCallback)
FetchAllUserProgress fetches the user's progress for all games on a console. This is useful for displaying a game browser with completion percentages. The callback receives an allocated list that must be destroyed by calling Destroy().
func (*Client) FetchGameTitles ¶
func (c *Client) FetchGameTitles(gameIDs []uint32, callback FetchGameTitlesCallback)
FetchGameTitles fetches titles and badges for the specified game IDs. This is useful for displaying a library with game names/icons. The callback receives an allocated list that must be destroyed by calling Destroy().
func (*Client) FetchHashLibrary ¶
func (c *Client) FetchHashLibrary(consoleID uint32, callback FetchHashLibraryCallback)
FetchHashLibrary fetches all known hashes for a console. This can be used to build a game database or identify ROMs offline. The callback receives an allocated library that must be destroyed by calling Destroy().
func (*Client) FetchLeaderboardEntries ¶
func (c *Client) FetchLeaderboardEntries(leaderboardID uint32, firstEntry, count uint32, callback LeaderboardEntriesCallback)
FetchLeaderboardEntries fetches leaderboard entries from the server. firstEntry is 1-based (1 = first entry). count is the number of entries to fetch. The callback receives an allocated list that must be destroyed by calling Destroy().
func (*Client) FetchLeaderboardEntriesAroundUser ¶
func (c *Client) FetchLeaderboardEntriesAroundUser(leaderboardID uint32, count uint32, callback LeaderboardEntriesCallback)
FetchLeaderboardEntriesAroundUser fetches leaderboard entries surrounding the current user. count is the total number of entries to fetch (user will be approximately in the middle). The callback receives an allocated list that must be destroyed by calling Destroy().
func (*Client) GetAchievement ¶
func (c *Client) GetAchievement(id uint32) *Achievement
GetAchievement returns achievement info by ID
func (*Client) GetAchievementImageURL ¶
func (c *Client) GetAchievementImageURL(achievement *Achievement, state int) string
GetAchievementImageURL returns the URL for an achievement's badge image. Pass AchievementStateUnlocked for the unlocked badge, or AchievementStateLocked for the locked/grayscale badge.
func (*Client) GetEncoreModeEnabled ¶
GetEncoreModeEnabled returns whether encore mode is enabled.
func (*Client) GetGameImageURL ¶
GetGameImageURL returns the URL for the game's badge/box art image.
func (*Client) GetHardcoreEnabled ¶
GetHardcoreEnabled returns whether hardcore mode is enabled
func (*Client) GetLeaderboard ¶
func (c *Client) GetLeaderboard(id uint32) *Leaderboard
GetLeaderboard returns leaderboard info by ID
func (*Client) GetLoadGameState ¶
GetLoadGameState returns the current progress of the asynchronous load game process.
func (*Client) GetRichPresenceMessage ¶
GetRichPresenceMessage returns the current rich presence message
func (*Client) GetSpectatorModeEnabled ¶
GetSpectatorModeEnabled returns whether spectator mode is enabled.
func (*Client) GetSubsetInfo ¶
GetSubsetInfo returns information about a specific subset.
func (*Client) GetUnofficialEnabled ¶
GetUnofficialEnabled returns whether unofficial achievements are enabled.
func (*Client) GetUserAgentClause ¶
GetUserAgentClause returns a string that can be added to the User-Agent header to identify the rcheevos version being used.
func (*Client) GetUserGameSummary ¶
func (c *Client) GetUserGameSummary() *UserGameSummary
GetUserGameSummary returns a summary of the user's progress in the current game. This is used for displaying "You have unlocked X of Y achievements" messages.
func (*Client) GetUserImageURL ¶
GetUserImageURL returns the URL for the current user's avatar.
func (*Client) GetUserSubsetSummary ¶
func (c *Client) GetUserSubsetSummary(subsetID uint32) *UserGameSummary
GetUserSubsetSummary returns a summary of the user's progress in a specific subset.
func (*Client) GetUserdata ¶
GetUserdata returns the client-specific data attached to the runtime.
func (*Client) HasAchievements ¶
HasAchievements returns whether the game has achievements
func (*Client) HasLeaderboards ¶
HasLeaderboards returns whether the game has leaderboards
func (*Client) HasRichPresence ¶
HasRichPresence returns whether the game supports rich presence
func (*Client) IdentifyAndChangeMedia ¶
func (c *Client) IdentifyAndChangeMedia(filePath string, data []byte, callback ChangeMediaCallback)
IdentifyAndChangeMedia identifies and changes the active disc in a multi-disc game. Either filePath or data should be provided (not both).
func (*Client) IdentifyAndLoadGame ¶
func (c *Client) IdentifyAndLoadGame(consoleID uint32, filePath string, data []byte, callback LoadGameCallbackFunc)
IdentifyAndLoadGame identifies a game by ROM data and loads it
func (*Client) IsGameLoaded ¶
IsGameLoaded returns whether a game is currently loaded
func (*Client) IsProcessingRequired ¶
IsProcessingRequired returns whether there are any active achievements, leaderboards, or rich presence that need processing. Can be used to skip DoFrame calls when nothing needs to be evaluated.
func (*Client) LoadGame ¶
func (c *Client) LoadGame(hash string, callback LoadGameCallbackFunc)
LoadGame starts loading a game by hash
func (*Client) LoginWithPassword ¶
func (c *Client) LoginWithPassword(username, password string, callback LoginCallbackFunc)
LoginWithPassword starts a login with username and password
func (*Client) LoginWithToken ¶
func (c *Client) LoginWithToken(username, token string, callback LoginCallbackFunc)
LoginWithToken starts a login with username and token
func (*Client) ProgressSize ¶
ProgressSize returns the number of bytes needed to serialize the runtime state. Use this to allocate a buffer for SerializeProgress.
func (*Client) SerializeProgress ¶
SerializeProgress serializes the runtime state into a buffer. This should be called when creating a savestate to preserve achievement progress. Returns the serialized data, or nil and an error code on failure.
func (*Client) SetAllowBackgroundMemoryReads ¶
SetAllowBackgroundMemoryReads specifies whether rcheevos is allowed to read memory outside of DoFrame/Idle calls. This is used for async processing.
func (*Client) SetEncoreModeEnabled ¶
SetEncoreModeEnabled enables or disables encore mode. When enabled, achievements can be re-triggered even if already unlocked. Must be set before loading a game.
func (*Client) SetEventHandler ¶
SetEventHandler sets the event callback
func (*Client) SetGetTimeMillisecsFunction ¶
func (c *Client) SetGetTimeMillisecsFunction(fn GetTimeMillisecsFunc)
SetGetTimeMillisecsFunction sets a custom function to get the current time in milliseconds. This is used for accurate leaderboard timing. If not set, the default system time is used.
func (*Client) SetHardcoreEnabled ¶
SetHardcoreEnabled enables or disables hardcore mode
func (*Client) SetHost ¶
SetHost sets the server hostname to use. Pass empty string to use the default RetroAchievements server.
func (*Client) SetReadMemoryFunction ¶
func (c *Client) SetReadMemoryFunction(fn ReadMemoryFunc)
SetReadMemoryFunction changes the memory read callback. This allows changing the memory source after the client is created.
func (*Client) SetSpectatorModeEnabled ¶
SetSpectatorModeEnabled enables or disables spectator mode. In spectator mode, events fire locally but nothing is submitted to the server. Can be toggled while a game is loaded.
func (*Client) SetUnofficialEnabled ¶
SetUnofficialEnabled enables or disables loading of unofficial achievements. Unofficial achievements are community-created and not part of the official set. Must be set before loading a game.
func (*Client) SetUserdata ¶
SetUserdata attaches client-specific data to the runtime. This can be retrieved later with GetUserdata.
type Event ¶
type Event struct {
Type uint32
Achievement *Achievement
Leaderboard *Leaderboard
LeaderboardTracker *LeaderboardTracker
LeaderboardScoreboard *LeaderboardScoreboard
ServerError *ServerError
Subset *EventSubset
}
Event represents an achievement event
type EventFunc ¶
type EventFunc func(event *Event)
EventFunc is called when achievement events occur
type EventSubset ¶
EventSubset represents subset info in an event
type FetchAllUserProgressCallback ¶
type FetchAllUserProgressCallback func(result int, errorMessage string, progress *AllUserProgress)
FetchAllUserProgressCallback is called when the user progress fetch completes
type FetchGameTitlesCallback ¶
type FetchGameTitlesCallback func(result int, errorMessage string, titles *GameTitleList)
FetchGameTitlesCallback is called when the game titles fetch completes
type FetchHashLibraryCallback ¶
type FetchHashLibraryCallback func(result int, errorMessage string, library *HashLibrary)
FetchHashLibraryCallback is called when the hash library fetch completes
type GameTitleEntry ¶
GameTitleEntry represents a game's title and badge information
type GameTitleList ¶
type GameTitleList struct {
Entries []*GameTitleEntry
// contains filtered or unexported fields
}
GameTitleList represents a collection of game titles
func (*GameTitleList) Destroy ¶
func (l *GameTitleList) Destroy()
Destroy releases resources associated with the game title list.
type GetTimeMillisecsFunc ¶
type GetTimeMillisecsFunc func() uint64
GetTimeMillisecsFunc returns the current time in milliseconds. Used for accurate leaderboard timing.
type HashIterator ¶
type HashIterator struct {
// contains filtered or unexported fields
}
HashIterator is used to generate hashes for ROM identification
func NewHashIterator ¶
func NewHashIterator(path string) *HashIterator
NewHashIterator creates a new hash iterator for a file path
func NewHashIteratorFromBuffer ¶
func NewHashIteratorFromBuffer(path string, data []byte) *HashIterator
NewHashIteratorFromBuffer creates a new hash iterator from memory
func (*HashIterator) Destroy ¶
func (h *HashIterator) Destroy()
Destroy releases resources associated with the iterator
func (*HashIterator) GenerateHash ¶
func (h *HashIterator) GenerateHash(consoleID uint32) string
GenerateHash generates a hash for the specified console from the iterator
func (*HashIterator) Next ¶
func (h *HashIterator) Next() string
Next generates the next hash. Returns empty string if no more hashes.
type HashLibrary ¶
type HashLibrary struct {
Entries []*HashLibraryEntry
// contains filtered or unexported fields
}
HashLibrary represents a collection of hash-to-game mappings for a console
func (*HashLibrary) Destroy ¶
func (l *HashLibrary) Destroy()
Destroy releases resources associated with the hash library.
type HashLibraryEntry ¶
HashLibraryEntry represents a mapping from hash to game ID
type Leaderboard ¶
type Leaderboard struct {
ID uint32
Title string
Description string
TrackerValue string
State uint8
Format uint8
LowerIsBetter bool
}
Leaderboard represents leaderboard information
type LeaderboardBucket ¶
type LeaderboardBucket struct {
Leaderboards []*Leaderboard
Label string
SubsetID uint32
BucketType uint8
}
LeaderboardBucket represents a group of leaderboards
type LeaderboardEntriesCallback ¶
type LeaderboardEntriesCallback func(result int, errorMessage string, entries *LeaderboardEntryList)
LeaderboardEntriesCallback is called when leaderboard entries are fetched
type LeaderboardEntry ¶
type LeaderboardEntry struct {
User string
Display string
Submitted time.Time
Rank uint32
Index uint32
}
LeaderboardEntry represents a single entry in a leaderboard
func (*LeaderboardEntry) GetUserImageURL ¶
func (e *LeaderboardEntry) GetUserImageURL() string
GetUserImageURL returns the URL for a leaderboard entry user's avatar.
type LeaderboardEntryList ¶
type LeaderboardEntryList struct {
Entries []*LeaderboardEntry
TotalEntries uint32
UserIndex int32 // -1 if user not in list
// contains filtered or unexported fields
}
LeaderboardEntryList represents a list of leaderboard entries
func (*LeaderboardEntryList) Destroy ¶
func (l *LeaderboardEntryList) Destroy()
Destroy releases resources associated with the leaderboard entry list.
type LeaderboardList ¶
type LeaderboardList struct {
Buckets []*LeaderboardBucket
// contains filtered or unexported fields
}
LeaderboardList represents a list of leaderboard buckets
func (*LeaderboardList) Destroy ¶
func (l *LeaderboardList) Destroy()
Destroy releases resources associated with the leaderboard list.
func (*LeaderboardList) GetAllLeaderboards ¶
func (l *LeaderboardList) GetAllLeaderboards() []*Leaderboard
GetAllLeaderboards returns a flat slice of all leaderboards across all buckets.
type LeaderboardScoreboard ¶
type LeaderboardScoreboard struct {
LeaderboardID uint32
SubmittedScore string
BestScore string
NewRank uint32
NumEntries uint32
TopEntries []*LeaderboardScoreboardEntry
}
LeaderboardScoreboard represents scoreboard data after a leaderboard submission
type LeaderboardScoreboardEntry ¶
LeaderboardScoreboardEntry represents a single entry in the scoreboard
type LeaderboardTracker ¶
LeaderboardTracker represents a leaderboard tracker display
type LoadGameCallbackFunc ¶
LoadGameCallbackFunc is called when game loading completes
type LoginCallbackFunc ¶
LoginCallbackFunc is called when login completes
type ReadMemoryFunc ¶
ReadMemoryFunc is called by rcheevos to read emulator memory
type ServerCallFunc ¶
type ServerCallFunc func(request *ServerRequest)
ServerCallFunc is called by rcheevos to make HTTP requests to the RetroAchievements API
type ServerError ¶
ServerError represents an API error
type ServerRequest ¶
type ServerRequest struct {
URL string
PostData string
ContentType string
// contains filtered or unexported fields
}
ServerRequest represents an HTTP request to the RetroAchievements API
func (*ServerRequest) Respond ¶
func (r *ServerRequest) Respond(body []byte, httpStatus int)
Respond sends the server response back to rcheevos
type Subset ¶
type Subset struct {
ID uint32
Title string
BadgeName string
NumAchievements uint32
NumLeaderboards uint32
}
Subset represents a game subset (e.g., "Base Game", "Bonus", "Challenge Mode")
type SubsetList ¶
type SubsetList struct {
Subsets []*Subset
// contains filtered or unexported fields
}
SubsetList represents a list of subsets for the current game
func (*SubsetList) Destroy ¶
func (l *SubsetList) Destroy()
Destroy releases resources associated with the subset list.
type User ¶
type User struct {
DisplayName string
Username string
Token string
Score uint32
ScoreSoftcore uint32
}
User represents user information
type UserGameSummary ¶
type UserGameSummary struct {
NumCoreAchievements uint32
NumUnofficialAchievements uint32
NumUnlockedAchievements uint32
NumUnsupportedAchievements uint32
PointsCore uint32
PointsUnlocked uint32
}
UserGameSummary contains summary information about the user's progress in the current game.