diff --git a/native/friends.cpp b/native/friends.cpp index f4ad92d..6e2f73a 100644 --- a/native/friends.cpp +++ b/native/friends.cpp @@ -60,6 +60,14 @@ HL_PRIM void HL_NAME(activate_overlay_store)( int appid, int flag ) { SteamFriends()->ActivateGameOverlayToStore((AppId_t)appid,(EOverlayToStoreFlag)flag); } +HL_PRIM bool HL_NAME(set_rich_presence)( vbyte *pchKey, vbyte *pchValue ) { + return SteamFriends()->SetRichPresence((char*)pchKey, (char*)pchValue); +} + +HL_PRIM void HL_NAME(clear_rich_presence)() { + SteamFriends()->ClearRichPresence(); +} + DEFINE_PRIM(_BYTES, get_user_name, _UID); DEFINE_PRIM(_BYTES, get_user_avatar, _UID _I32 _REF(_I32) _REF(_I32)); DEFINE_PRIM(_BOOL, request_user_information, _UID _BOOL); @@ -67,4 +75,5 @@ DEFINE_PRIM(_ARR, get_friends, _I32); DEFINE_PRIM(_BOOL, has_friend, _UID _I32); DEFINE_PRIM(_VOID, activate_overlay_user, _BYTES _UID); DEFINE_PRIM(_VOID, activate_overlay_store, _I32 _I32); - +DEFINE_PRIM(_BOOL, set_rich_presence, _BYTES _BYTES); +DEFINE_PRIM(_VOID, clear_rich_presence, _NO_ARG); diff --git a/steam/Friends.hx b/steam/Friends.hx index 75b1262..c9e037a 100644 --- a/steam/Friends.hx +++ b/steam/Friends.hx @@ -92,11 +92,22 @@ class Friends { public static function activateOverlay( overlay : OverlayKind, ?uid : UID ) { activate_overlay_user( overlay == None ? null : @:privateAccess overlay.toString().toUtf8(), uid); } - + public static function activateOverlayStore( appId : Int, flags : OverlayToStoreFlag ) : Void {} + /** + Key `steam_display` requires localized token as value, see https://partner.steamgames.com/doc/api/ISteamFriends#richpresencelocalization + Set `value` to empty or null to remove the key. + **/ + public static function setRichPresence( key : String, value : Null ) : Bool { + return @:privateAccess set_rich_presence(key.toUtf8(), value == null ? null : value.toUtf8()); + } + + public static function clearRichPresence() : Void {} + static function get_friends( flags : FriendFlags ) : hl.NativeArray { return null; } static function has_friend( uid : UID, flags : FriendFlags ) : Bool { return false; } static function activate_overlay_user( overlay : hl.Bytes, uid : UID ) : Void {} + static function set_rich_presence( pchKey : hl.Bytes, pchValue : hl.Bytes ) : Bool { return false; } -} \ No newline at end of file +}