From 8aa6bf8d5885506d8b066959a4c56f3bb8776d9d Mon Sep 17 00:00:00 2001 From: shru Date: Sat, 5 Dec 2020 00:12:52 -0500 Subject: [PATCH] Added friends.setRichPresence() --- CONTRIBUTING.md | 2 +- src/friends.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 39930d8..2fea495 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ Install luajit (`brew install luajit`). Run `make osx`. ### Windows 32 and 64 -We'll use [chocolatey](https://chocolatey.org). Install VS and mingw (`choco install visualstudio20127community visualstudio2017-workload-nativecrossplat mingw`). Then run `mingw32-make windows32` for Windows 32 and `mingw32-make windows64` for Windows 64. +We'll use [chocolatey](https://chocolatey.org). Install VS and mingw (`choco install visualstudio2017community visualstudio2017-workload-nativecrossplat mingw`). Then run `mingw32-make windows32` for Windows 32 and `mingw32-make windows64` for Windows 64. ## Resources - [Steam API Reference](https://partner.steamgames.com/doc/api) diff --git a/src/friends.cpp b/src/friends.cpp index 43d12dd..1c0ab51 100644 --- a/src/friends.cpp +++ b/src/friends.cpp @@ -62,13 +62,23 @@ EXTERN int luasteam_getFriendPersonaName(lua_State *L) { return 1; } +// bool SetRichPresence( const char *pchKey, const char *pchValue ); +EXTERN int luasteam_setRichPresence(lua_State *L) { + const char *key = luaL_checkstring(L, 1); + const char *value = luaL_checkstring(L, 2); + bool success = SteamFriends()->SetRichPresence(key, value); + lua_pushboolean(L, success); + return 1; +} + namespace luasteam { void add_friends(lua_State *L) { - lua_createtable(L, 0, 3); + lua_createtable(L, 0, 4); add_func(L, "activateGameOverlay", luasteam_activateGameOverlay); add_func(L, "activateGameOverlayToWebPage", luasteam_activateGameOverlayToWebPage); add_func(L, "getFriendPersonaName", luasteam_getFriendPersonaName); + add_func(L, "setRichPresence", luasteam_setRichPresence); lua_pushvalue(L, -1); friends_ref = luaL_ref(L, LUA_REGISTRYINDEX); lua_setfield(L, -2, "friends");