mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-04 22:15:33 +02:00
Try and patch up steamshim_child
This commit is contained in:
parent
d2c60cfb2a
commit
807294ac65
3 changed files with 18 additions and 9 deletions
|
@ -197,6 +197,8 @@ RB_METHOD(CUSLResetAllStats) {
|
||||||
void CUSLBindingInit() {
|
void CUSLBindingInit() {
|
||||||
|
|
||||||
STEAMSHIM_requestStats();
|
STEAMSHIM_requestStats();
|
||||||
|
bool ok;
|
||||||
|
STEAMSHIM_GET_OK(SHIMEVENT_STATSRECEIVED, ok);
|
||||||
|
|
||||||
VALUE mSteamLite = rb_define_module("SteamLite");
|
VALUE mSteamLite = rb_define_module("SteamLite");
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN 1
|
#define WIN32_LEAN_AND_MEAN 1
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef HANDLE PipeType;
|
#include <process.h>
|
||||||
#define NULLPIPE NULL
|
#include <io.h>
|
||||||
|
#include <errno.h>
|
||||||
|
typedef int PipeType;
|
||||||
|
#define NULLPIPE 0
|
||||||
typedef unsigned __int8 uint8;
|
typedef unsigned __int8 uint8;
|
||||||
typedef __int32 int32;
|
typedef __int32 int32;
|
||||||
typedef unsigned __int64 uint64;
|
typedef unsigned __int64 uint64;
|
||||||
|
@ -50,21 +53,23 @@ static int pipeReady(PipeType fd)
|
||||||
|
|
||||||
static int writePipe(PipeType fd, const void *buf, const unsigned int _len)
|
static int writePipe(PipeType fd, const void *buf, const unsigned int _len)
|
||||||
{
|
{
|
||||||
const DWORD len = (DWORD) _len;
|
const ssize_t len = (ssize_t) _len;
|
||||||
DWORD bw = 0;
|
ssize_t bw;
|
||||||
return ((WriteFile(fd, buf, len, &bw, NULL) != 0) && (bw == len));
|
while (((bw = _write(fd, buf, len)) == -1) && (errno == EINTR)) { /*spin*/ }
|
||||||
|
return (bw == len);
|
||||||
} /* writePipe */
|
} /* writePipe */
|
||||||
|
|
||||||
static int readPipe(PipeType fd, void *buf, const unsigned int _len)
|
static int readPipe(PipeType fd, void *buf, const unsigned int _len)
|
||||||
{
|
{
|
||||||
const DWORD len = (DWORD) _len;
|
const ssize_t len = (ssize_t) _len;
|
||||||
DWORD br = 0;
|
ssize_t br;
|
||||||
return ReadFile(fd, buf, len, &br, NULL) ? (int) br : -1;
|
while (((br = _read(fd, buf, len)) == -1) && (errno == EINTR)) { /*spin*/ }
|
||||||
|
return (int) br;
|
||||||
} /* readPipe */
|
} /* readPipe */
|
||||||
|
|
||||||
static void closePipe(PipeType fd)
|
static void closePipe(PipeType fd)
|
||||||
{
|
{
|
||||||
CloseHandle(fd);
|
_close(fd);
|
||||||
} /* closePipe */
|
} /* closePipe */
|
||||||
|
|
||||||
static char *getEnvVar(const char *key, char *buf, const size_t buflen)
|
static char *getEnvVar(const char *key, char *buf, const size_t buflen)
|
||||||
|
|
|
@ -441,8 +441,10 @@ SteamBridge::SteamBridge(PipeType _fd)
|
||||||
void SteamBridge::OnUserStatsReceived(UserStatsReceived_t *pCallback) {
|
void SteamBridge::OnUserStatsReceived(UserStatsReceived_t *pCallback) {
|
||||||
if (GAppID != pCallback->m_nGameID)
|
if (GAppID != pCallback->m_nGameID)
|
||||||
return;
|
return;
|
||||||
|
#ifndef _WIN32 //FIXME
|
||||||
if (GUserID != pCallback->m_steamIDUser.ConvertToUint64())
|
if (GUserID != pCallback->m_steamIDUser.ConvertToUint64())
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
writeStatsReceived(fd, pCallback->m_eResult == k_EResultOK);
|
writeStatsReceived(fd, pCallback->m_eResult == k_EResultOK);
|
||||||
} // SteamBridge::OnUserStatsReceived
|
} // SteamBridge::OnUserStatsReceived
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue