Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions native/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ HL_PRIM vbyte *HL_NAME(get_current_game_language)(){
return (vbyte*)SteamApps()->GetCurrentGameLanguage();
}

HL_PRIM vbyte *HL_NAME(get_launch_command_line)(){
if (!CheckInit()) return NULL;
char *pszCommandLine = (char *)hl_gc_alloc_noptr(4096);
int size = SteamApps()->GetLaunchCommandLine(pszCommandLine, 4096);
return (vbyte*)pszCommandLine;
}

HL_PRIM vbyte *HL_NAME(get_launch_query_param)(vbyte *pchKey){
if (!CheckInit()) return NULL;
return (vbyte*)SteamApps()->GetLaunchQueryParam((char*)pchKey);
}

vdynamic *CallbackHandler::EncodeNewUrlLaunchParameters(NewUrlLaunchParameters_t *d) {
return NULL;
}

HL_PRIM bool HL_NAME(is_dlc_installed)( int appid ) {
return SteamApps()->BIsDlcInstalled((AppId_t)appid);
}
Expand Down Expand Up @@ -347,6 +363,8 @@ DEFINE_PRIM(_BOOL, is_steam_in_big_picture_mode, _NO_ARG);
DEFINE_PRIM(_BOOL, is_steam_running_on_steam_deck, _NO_ARG);
DEFINE_PRIM(_BOOL, is_steam_running, _NO_ARG);
DEFINE_PRIM(_BYTES, get_current_game_language, _NO_ARG);
DEFINE_PRIM(_BYTES, get_launch_command_line, _NO_ARG);
DEFINE_PRIM(_BYTES, get_launch_query_param, _BYTES);
DEFINE_PRIM(_BYTES, get_auth_ticket, _REF(_I32) _REF(_I32));
DEFINE_PRIM(_VOID, request_encrypted_app_ticket, _BYTES _I32 _FUN(_VOID, _BYTES _I32));
DEFINE_PRIM(_VOID, cancel_call_result, _CRESULT);
Expand Down
1 change: 1 addition & 0 deletions native/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
EVENT_DECL( PersonaChange, PersonaStateChange_t )
EVENT_DECL( OverlayActivated, GameOverlayActivated_t )
EVENT_DECL( AuthSessionTicketResponse, GetAuthSessionTicketResponse_t )
EVENT_DECL( NewUrlLaunchParameters, NewUrlLaunchParameters_t )

// matchmaking
EVENT_DECL( LobbyData, LobbyDataUpdate_t )
Expand Down
17 changes: 17 additions & 0 deletions steam/Api.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Api
// User-settable Callbacks

public static var onOverlay : Bool -> Void;
public static var onNewUrlLaunchParameters : Void -> Void;

/**
* @param appId_ Your Steam APP ID (the numbers on the end of your store page URL - store.steampowered.com/app/XYZ)
Expand Down Expand Up @@ -92,6 +93,12 @@ class Api
}
});

// NewUrlLaunchParameters_t
registerGlobalEvent(1000 + 14, function(data:{ok:Bool}) {
if ( onNewUrlLaunchParameters != null )
onNewUrlLaunchParameters();
});

// if we get this far, the dlls loaded ok and we need Steam to init.
// otherwise, we're trying to run the Steam version without the Steam client
active = _Init(steamWrap_onEvent, onGlobalEvent);
Expand Down Expand Up @@ -201,6 +208,16 @@ class Api
return l==null ? null : @:privateAccess String.fromUTF8(l);
}

public static function getLaunchCommandLine():String {
var l = _GetLaunchCommandLine();
return l==null ? null : @:privateAccess String.fromUTF8(l);
}

public static function getLaunchQueryParam(query:String):String {
var l = _GetLaunchQueryParam(@:privateAccess query.toUtf8());
return l==null ? null : @:privateAccess String.fromUTF8(l);
}

public static function getCurrentBetaName():String {
var l = _GetCurrentBetaName();
return l == null ? null : @:privateAccess String.fromUTF8(l);
Expand Down