steamworks

package module
v0.0.0-...-3c9223e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-steamworks

A Steamworks SDK binding for Go

[!WARNING] 32bit OSes are not supported.

Steamworks SDK version

1.65

How to use

On Windows, copy one of these files on the working directory:

  • steam_api64.dll (For 64bit. Copy redistribution_bin\win64\steam_api64.dll in the SDK)
package steamapi

import (
	"fmt"
	"os"

	"github.com/hajimehoshi/go-steamworks"
	"golang.org/x/text/language"
)

const appID = 480 // Rewrite this

func init() {
	if steamworks.RestartAppIfNecessary(appID) {
		os.Exit(1)
	}
	if err := steamworks.Init(); err != nil {
		panic(fmt.Sprintf("steamworks.Init failed: %v", err))
	}
}

func SystemLang() language.Tag {
	switch steamworks.SteamApps().GetCurrentGameLanguage() {
	case "english":
		return language.English
	case "japanese":
		return language.Japanese
	}
	return language.Und
}

License

All the source code files are licensed under Apache License 2.0.

These binary files are copied from Steamworks SDK's redistribution_bin directory. You must follow Valve Corporation Steamworks SDK Access Agreement for these files:

  • libsteam_api.dylib (copied from redistribution_bin/osx/libsteam_api.dylib)
  • libsteam_api64.so (copied from redistribution_bin/linux64/libsteam_api.so)

Resources

Documentation

Index

Constants

View Source
const ESteamInputType_GenericXInput = ESteamInputType_GenericGamepad

Deprecated: Use ESteamInputType_GenericGamepad.

View Source
const GetTicketForWebApiResponseCallbackID = 168

GetTicketForWebApiResponseCallbackID is the k_iCallback of GetTicketForWebApiResponse_t (k_iSteamUserCallbacks + 68, isteamuser.h).

Variables

This section is empty.

Functions

func Init

func Init() error

func ManualDispatch_FreeLastCallback

func ManualDispatch_FreeLastCallback(pipe HSteamPipe)

func ManualDispatch_GetNextCallback

func ManualDispatch_GetNextCallback(pipe HSteamPipe, msg *CallbackMsg) bool

func ManualDispatch_Init

func ManualDispatch_Init()

ManualDispatch_Init informs the API that the application uses manual event dispatch. It must be called after Init and before the other ManualDispatch functions. Manual dispatch replaces RunCallbacks and must not be mixed with the normal callback dispatch (RunCallbacks, or the C++ CCallback/CCallResult mechanisms).

func ManualDispatch_RunFrame

func ManualDispatch_RunFrame(pipe HSteamPipe)

func RestartAppIfNecessary

func RestartAppIfNecessary(appID uint32) bool

func RunCallbacks

func RunCallbacks()

Types

type AppId_t

type AppId_t uint32

type CSteamID

type CSteamID uint64

type CallbackMsg

type CallbackMsg struct {
	SteamUser  HSteamUser
	CallbackID int32
	Param      unsafe.Pointer
	ParamSize  int32
	// contains filtered or unexported fields
}

CallbackMsg mirrors the native CallbackMsg_t returned by ManualDispatch_GetNextCallback. Param points to the callback payload and is only valid until ManualDispatch_FreeLastCallback is called.

type EFloatingGamepadTextInputMode

type EFloatingGamepadTextInputMode int32
const (
	EFloatingGamepadTextInputMode_ModeSingleLine    EFloatingGamepadTextInputMode = 0
	EFloatingGamepadTextInputMode_ModeMultipleLines EFloatingGamepadTextInputMode = 1
	EFloatingGamepadTextInputMode_ModeEmail         EFloatingGamepadTextInputMode = 2
	EFloatingGamepadTextInputMode_ModeNumeric       EFloatingGamepadTextInputMode = 3
)

type EResult

type EResult int32
const (
	EResultNone                  EResult = 0
	EResultOK                    EResult = 1
	EResultFail                  EResult = 2
	EResultNoConnection          EResult = 3
	EResultInvalidPassword       EResult = 5
	EResultInvalidProtocolVer    EResult = 7
	EResultInvalidParam          EResult = 8
	EResultBusy                  EResult = 10
	EResultInvalidState          EResult = 11
	EResultTimeout               EResult = 16
	EResultNotLoggedOn           EResult = 21
	EResultPending               EResult = 22
	EResultInsufficientPrivilege EResult = 24
)

type ESteamAPIInitResult

type ESteamAPIInitResult int32
const (
	ESteamAPIInitResult_OK              ESteamAPIInitResult = 0
	ESteamAPIInitResult_FailedGeneric   ESteamAPIInitResult = 1
	ESteamAPIInitResult_NoSteamClient   ESteamAPIInitResult = 2
	ESteamAPIInitResult_VersionMismatch ESteamAPIInitResult = 3
)

type ESteamHardwareDefaultConfig

type ESteamHardwareDefaultConfig int32
const (
	ESteamHardwareDefaultConfig_None         ESteamHardwareDefaultConfig = 0
	ESteamHardwareDefaultConfig_Low          ESteamHardwareDefaultConfig = 1
	ESteamHardwareDefaultConfig_Medium       ESteamHardwareDefaultConfig = 2
	ESteamHardwareDefaultConfig_High         ESteamHardwareDefaultConfig = 3
	ESteamHardwareDefaultConfig_Max          ESteamHardwareDefaultConfig = 4
	ESteamHardwareDefaultConfig_SteamDeck    ESteamHardwareDefaultConfig = 5
	ESteamHardwareDefaultConfig_SteamMachine ESteamHardwareDefaultConfig = 6
	ESteamHardwareDefaultConfig_SteamFrame   ESteamHardwareDefaultConfig = 7
)

type ESteamHardwareType

type ESteamHardwareType int32
const (
	ESteamHardwareType_None         ESteamHardwareType = 0
	ESteamHardwareType_SteamDeck    ESteamHardwareType = 1
	ESteamHardwareType_SteamMachine ESteamHardwareType = 2
	ESteamHardwareType_SteamFrame   ESteamHardwareType = 3
)

type ESteamInputType

type ESteamInputType int32
const (
	ESteamInputType_Unknown                  ESteamInputType = 0
	ESteamInputType_SteamController          ESteamInputType = 1
	ESteamInputType_XBox360Controller        ESteamInputType = 2
	ESteamInputType_XBoxOneController        ESteamInputType = 3
	ESteamInputType_GenericGamepad           ESteamInputType = 4
	ESteamInputType_PS4Controller            ESteamInputType = 5
	ESteamInputType_AppleMFiController       ESteamInputType = 6 // Unused
	ESteamInputType_AndroidController        ESteamInputType = 7 // Unused
	ESteamInputType_SwitchJoyConPair         ESteamInputType = 8 // Unused
	ESteamInputType_SwitchJoyConSingle       ESteamInputType = 9 // Unused
	ESteamInputType_SwitchProController      ESteamInputType = 10
	ESteamInputType_MobileTouch              ESteamInputType = 11
	ESteamInputType_PS3Controller            ESteamInputType = 12
	ESteamInputType_PS5Controller            ESteamInputType = 13
	ESteamInputType_SteamDeckController      ESteamInputType = 14
	ESteamInputType_SteamOSHandheld          ESteamInputType = 15
	ESteamInputType_Switch2ProController     ESteamInputType = 16
	ESteamInputType_SteamController2026      ESteamInputType = 17
	ESteamInputType_SteamFrameControllerPair ESteamInputType = 18
	ESteamInputType_Count                    ESteamInputType = 19
	ESteamInputType_MaximumPossibleValue     ESteamInputType = 255
)

type GetTicketForWebApiResponse

type GetTicketForWebApiResponse struct {
	Handle    HAuthTicket
	Result    EResult
	TicketLen int32
	Ticket    [2560]byte
	// contains filtered or unexported fields
}

type HAuthTicket

type HAuthTicket uint32
const HAuthTicketInvalid HAuthTicket = 0

type HSteamPipe

type HSteamPipe int32

func GetHSteamPipe

func GetHSteamPipe() HSteamPipe

type HSteamUser

type HSteamUser int32

type ISteamApps

type ISteamApps interface {
	BGetDLCDataByIndex(iDLC int) (appID AppId_t, available bool, pchName string, success bool)
	BIsDlcInstalled(appID AppId_t) bool
	GetAppInstallDir(appID AppId_t) string
	GetCurrentGameLanguage() string
	GetDLCCount() int32
}

func SteamApps

func SteamApps() ISteamApps

type ISteamFriends

type ISteamFriends interface {
	GetPersonaName() string
	SetRichPresence(string, string) bool
}

func SteamFriends

func SteamFriends() ISteamFriends

type ISteamInput

type ISteamInput interface {
	GetConnectedControllers() []InputHandle_t
	GetInputTypeForHandle(inputHandle InputHandle_t) ESteamInputType
	Init(bExplicitlyCallRunFrame bool) bool
	RunFrame()
}

func SteamInput

func SteamInput() ISteamInput

type ISteamRemoteStorage

type ISteamRemoteStorage interface {
	FileWrite(file string, data []byte) bool
	FileRead(file string, data []byte) int32
	FileDelete(file string) bool
	GetFileSize(file string) int32
}

func SteamRemoteStorage

func SteamRemoteStorage() ISteamRemoteStorage

type ISteamUser

type ISteamUser interface {
	GetSteamID() CSteamID
	GetAuthTicketForWebApi(identity string) HAuthTicket
	CancelAuthTicket(ticket HAuthTicket)
}

func SteamUser

func SteamUser() ISteamUser

type ISteamUserStats

type ISteamUserStats interface {
	GetAchievement(name string) (achieved, success bool)
	SetAchievement(name string) bool
	ClearAchievement(name string) bool
	StoreStats() bool
}

func SteamUserStats

func SteamUserStats() ISteamUserStats

type ISteamUtils

type ISteamUtils interface {
	IsOverlayEnabled() bool
	IsRunningOnSteamHardware() ESteamHardwareType
	GetSteamHardwareDefaultConfig() ESteamHardwareDefaultConfig
	IsRunningUnderProton() bool
	// Deprecated: Use IsRunningOnSteamHardware.
	IsSteamRunningOnSteamDeck() bool
	ShowFloatingGamepadTextInput(keyboardMode EFloatingGamepadTextInputMode, textFieldXPosition, textFieldYPosition, textFieldWidth, textFieldHeight int32) bool
}

func SteamUtils

func SteamUtils() ISteamUtils

type InputHandle_t

type InputHandle_t uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址