2 * Acess GUI (AxWin) Version 2
3 * By John Hodge (thePowersGang)
7 #include <axwin/messages.h>
9 #define STATICBUF_SIZE 64
12 typedef void tMessages_Handle_Callback(int, size_t,void*);
15 void Messages_PollIPC();
16 void Messages_RespondIPC(int ID, size_t Length, void *Data);
17 void Messages_Handle(tAxWin_Message *Msg, tMessages_Handle_Callback *Respond, int ID);
22 void Messages_PollIPC()
26 char staticBuf[STATICBUF_SIZE];
30 while( (len = SysGetMessage(&tid, NULL)) == 0 )
33 // Allocate the space for it
34 if( len <= STATICBUF_SIZE )
35 msg = (void*)staticBuf;
41 "ERROR - Unable to allocate message buffer, ignoring message from %i\n",
43 SysGetMessage(NULL, GETMSG_IGNORE);
49 SysGetMessage(NULL, msg);
51 Messages_Handle(msg, Messages_RespondIPC, tid);
54 void Messages_RespondIPC(int ID, size_t Length, void *Data)
56 SysSendMessage(ID, Length, Data);
59 void Messages_Handle(tAxWin_Message *Msg, tMessages_Handle_Callback *Respond, int ID)
65 Msg->ID = MSG_SRSP_VERSION;
69 *(uint16_t*)&Msg->Data[2] = -1;
70 Messages_RespondIPC(ID, sizeof(Msg->ID), Msg);
74 fprintf(stderr, "WARNING: Unknown message %i from %i (%p)\n", Msg->ID, ID, Respond);
75 _SysDebug("WARNING: Unknown message %i from %i (%p)\n", Msg->ID, ID, Respond);