About Store Forum Documentation Contact



Post Reply 
[solved]Steam callbacks, issue with macro
Author Message
RedcrowProd Offline
Member

Post: #1
[solved]Steam callbacks, issue with macro
Hey,

i seem to have an issue with the STEAM_CALLBACK macro provided by the steamwork SDK
here is the code:

Code:
class GroupGUI : GuiObjs
{
   STEAM_CALLBACK(GroupGUI, OnPersonaStateChange, PersonaStateChange_t);

void OnPersonaStateChange(PersonaStateChange_t *pCallback)
   {
      
   }

void Create(){ //do creation there and stuff
}
}
GroupGUI GUI_Group;

When the .h is generated thru EE code editor VS sees it as ";TEAM_CALLBACK" instead of "STEAM_CALLBACK" and throw an error.
https://gyazo.com/c3cecdef25515d8c51f9ec3ad9b5cab5

Using VS only i can get it working ,but i want to stick to EE editor. ( casual scripting ;D )

What is the proper way to code this ? or any way around this that someone knows ?
and is there a way to avoid function to create header file automatically ?

here is the code from Steam:

Code:
// Declares a callback member function plus a helper member variable which
// registers the callback on object creation and unregisters on destruction.
// The optional fourth 'var' param exists only for backwards-compatibility
// and can be ignored.
#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \
    _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )


//-----------------------------------------------------------------------------
// The following macros are implementation details, not intended for public use
//-----------------------------------------------------------------------------
#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param )
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... )        _STEAM_CALLBACK_##SELECTED
#define _STEAM_CALLBACK_SELECT( X, Y )                        _STEAM_CALLBACK_HELPER X Y
#define _STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \
    struct CCallbackInternal_ ## func : private CCallbackImpl< sizeof( param ) > { \
        CCallbackInternal_ ## func () { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
        CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \
        CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \
        private: virtual void Run( void *pvParam ) { _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \
            thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
            pOuter->func( reinterpret_cast<param*>( pvParam ) ); \
        } \
    } m_steamcallback_ ## func ; void func( param *pParam )
#define _STEAM_CALLBACK_4( _, thisclass, func, param, var ) \
CCallback< thisclass, param > var; void func( param *pParam )

Thanks
(This post was last modified: 12-17-2018 07:01 AM by RedcrowProd.)
12-13-2018 08:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Steam callbacks, issue with macro
Hi smile

Could you tell me what kind of functionality would you like to integrate?

There's already Steam.callback for in-app purchases.

What else are you interested in?

Perhaps this could be just integrated into the engine.
12-15-2018 05:17 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Steam callbacks, issue with macro
If it's just a few, I could integrate this into the engine.

If it's more, you could add this in the source edition over here:
https://github.com/Esenthel/EsenthelEngi...am.cpp#L45
(that's the best way)

You could also try making a regular *.h file, and inside it declare your callbacks, and include that *.h file through application properties settings.
12-15-2018 05:35 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #4
RE: Steam callbacks, issue with macro
sadly i dont have source :(

I would be interested in the PersonaStateChange_t callbacks and some of the lobby functions. ( planning on doing a group system that includes friends and lobbies from Steamwork )

i am trying the .h file way,i didnt think about it pfft. i managed to declare my callbacks, ill do some test and come back smile
(This post was last modified: 12-16-2018 05:58 AM by RedcrowProd.)
12-16-2018 01:23 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #5
RE: Steam callbacks, issue with macro
my bad, i got it working perfectly grin using the .h version like pointed out by Esenthel grin
(This post was last modified: 12-16-2018 05:54 AM by RedcrowProd.)
12-16-2018 05:31 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Steam callbacks, issue with macro
Wow, that's great news, anyway I've just updated Esenthel Source on GitHub, with some new built-in Steam functionality.
12-16-2018 09:20 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #7
RE: Steam callbacks, issue with macro
that was fast ^^ ill take a look when it comes out in binary grin
12-16-2018 09:40 AM
Find all posts by this user Quote this message in a reply
Post Reply