This commit is contained in:
jl777
2019-03-26 05:02:16 -11:00
parent 4aed5b5b98
commit 0642013b11
2 changed files with 12 additions and 4 deletions

View File

@@ -1070,7 +1070,7 @@ gamesevent games_readevent(struct games_state *rs)
//_quit(); //_quit();
return(27); return(27);
} }
if ( rs != 0 && rs->guiflag != 0 ) /*if ( rs != 0 && rs->guiflag != 0 )
{ {
if ( rs->num < sizeof(rs->buffered) ) if ( rs->num < sizeof(rs->buffered) )
{ {
@@ -1082,7 +1082,7 @@ gamesevent games_readevent(struct games_state *rs)
//sleep(3); //sleep(3);
} }
} else fprintf(stderr,"buffer filled without flushed\n"); } else fprintf(stderr,"buffer filled without flushed\n");
} }*/
} else fprintf(stderr,"readchar rs.%p non-gui error?\n",rs); } else fprintf(stderr,"readchar rs.%p non-gui error?\n",rs);
return(ch); return(ch);
} }

View File

@@ -640,13 +640,21 @@ void init_colors(void)
*/ */
#include "dapps/dappstd.c" #include "dapps/dappstd.c"
int32_t issue_games_events(struct games_state *rs,char *gametxidstr,uint32_t eventid,int16_t c) int32_t issue_games_events(struct games_state *rs,char *gametxidstr,uint32_t eventid,gamesevent c)
{ {
static FILE *fp; static FILE *fp;
char params[512],*retstr; cJSON *retjson,*resobj; int32_t retval = -1; char params[512],*retstr; cJSON *retjson,*resobj; int32_t retval = -1;
if ( fp == 0 ) if ( fp == 0 )
fp = fopen("events.log","wb"); fp = fopen("events.log","wb");
sprintf(params,"[\"events\",\"17\",\"[%%22%04x%%22,%%22%s%%22,%u]\"]",c&0xffff,gametxidstr,eventid); rs->buffered[rs->num++] = c;
if ( sizeof(c) == 1 )
sprintf(params,"[\"events\",\"17\",\"[%%22%02x%%22,%%22%s%%22,%u]\"]",c&0xff,gametxidstr,eventid);
else if ( sizeof(c) == 2 )
sprintf(params,"[\"events\",\"17\",\"[%%22%04x%%22,%%22%s%%22,%u]\"]",c&0xffff,gametxidstr,eventid);
else if ( sizeof(c) == 4 )
sprintf(params,"[\"events\",\"17\",\"[%%22%08x%%22,%%22%s%%22,%u]\"]",c&0xffffffff,gametxidstr,eventid);
else if ( sizeof(c) == 8 )
sprintf(params,"[\"events\",\"17\",\"[%%22%016llx%%22,%%22%s%%22,%u]\"]",(long long)c,gametxidstr,eventid);
if ( (retstr= komodo_issuemethod(USERPASS,(char *)"cclib",params,GAMES_PORT)) != 0 ) if ( (retstr= komodo_issuemethod(USERPASS,(char *)"cclib",params,GAMES_PORT)) != 0 )
{ {
if ( (retjson= cJSON_Parse(retstr)) != 0 ) if ( (retjson= cJSON_Parse(retstr)) != 0 )