Partial solution to the interop problem
This commit is contained in:
15
src/SDK.h
15
src/SDK.h
@@ -38,9 +38,8 @@ extern "C" {
|
|||||||
#define INTERCEPT_ENABLED 111
|
#define INTERCEPT_ENABLED 111
|
||||||
#define INTERCEPT_DISABLED 222
|
#define INTERCEPT_DISABLED 222
|
||||||
|
|
||||||
void zt_init_rpc(const char *nwid);
|
void zt_init_rpc(char *nwid);
|
||||||
const char *get_netpath();
|
const char *get_netpath();
|
||||||
void zt_init_rpc(const char *nwid);
|
|
||||||
bool check_intercept_enabled_for_thread();
|
bool check_intercept_enabled_for_thread();
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
@@ -73,20 +72,8 @@ ssize_t zt_recvmsg(RECVMSG_SIG);
|
|||||||
|
|
||||||
|
|
||||||
#if defined(__UNITY_3D__)
|
#if defined(__UNITY_3D__)
|
||||||
|
|
||||||
struct UnityArrayInput
|
|
||||||
{
|
|
||||||
void *array;
|
|
||||||
int len;
|
|
||||||
};
|
|
||||||
|
|
||||||
ssize_t zt_recv(int fd, void *buf, int len);
|
ssize_t zt_recv(int fd, void *buf, int len);
|
||||||
|
|
||||||
ssize_t zt_send(int fd, void *buf, int len);
|
ssize_t zt_send(int fd, void *buf, int len);
|
||||||
|
|
||||||
|
|
||||||
//ssize_t zt_send(int fd, struct UnityArrayInput *buf, int len);
|
|
||||||
//ssize_t zt_recv(int fd, struct UnityArrayInput *buf, int len);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ extern "C" {
|
|||||||
// Starts a service at the specified path
|
// Starts a service at the specified path
|
||||||
void unity_start_service(char * path, int len) {
|
void unity_start_service(char * path, int len) {
|
||||||
Debug(path);
|
Debug(path);
|
||||||
|
zt_init_rpc(path);
|
||||||
init_service(INTERCEPT_DISABLED, path);
|
init_service(INTERCEPT_DISABLED, path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -89,26 +90,11 @@ extern "C" {
|
|||||||
zt1Service->join(nwid);
|
zt1Service->join(nwid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void leave_network(const char *nwid)
|
void leave_network(const char *nwid) { zt1Service->leave(nwid); }
|
||||||
{
|
void zt_join_network(char * nwid) { join_network(nwid); }
|
||||||
zt1Service->leave(nwid);
|
void zt_leave_network(char * nwid) { leave_network(nwid); }
|
||||||
}
|
bool zt_is_running() { return zt1Service->isRunning(); }
|
||||||
|
void zt_terminate() { zt1Service->terminate(); }
|
||||||
void zt_join_network(char * nwid) {
|
|
||||||
//Debug(nwid.c_str());
|
|
||||||
join_network(nwid);
|
|
||||||
}
|
|
||||||
void zt_leave_network(char * nwid) {
|
|
||||||
//Debug(nwid.c_str());
|
|
||||||
leave_network(nwid);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool zt_is_running() {
|
|
||||||
return zt1Service->isRunning();
|
|
||||||
}
|
|
||||||
void zt_terminate() {
|
|
||||||
zt1Service->terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(__ANDROID__)
|
#if !defined(__ANDROID__)
|
||||||
/*
|
/*
|
||||||
@@ -133,9 +119,6 @@ extern "C" {
|
|||||||
intercept_thread_id = (int*)malloc(sizeof(int));
|
intercept_thread_id = (int*)malloc(sizeof(int));
|
||||||
*intercept_thread_id = mode;
|
*intercept_thread_id = mode;
|
||||||
pthread_setspecific(thr_id_key, intercept_thread_id);
|
pthread_setspecific(thr_id_key, intercept_thread_id);
|
||||||
//#if !defined(__UNITY_3D__)
|
|
||||||
// check_intercept_enabled_for_thread();
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -92,17 +92,20 @@ const char *get_netpath() {
|
|||||||
// ---------------------------------- zt_init_rpc -------------------------------
|
// ---------------------------------- zt_init_rpc -------------------------------
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
void zt_init_rpc(const char *nwid)
|
void zt_init_rpc(char *nwid)
|
||||||
{
|
{
|
||||||
#if defined(__UNITY_3D__)
|
#if defined(__UNITY_3D__)
|
||||||
char *nw = "565799d8f6e1c11a";
|
//char *nw = "565799d8f6e1c11a";
|
||||||
char *path = "/Users/Joseph/utest2/nc_";
|
//char *path = "/Users/Joseph/utest2/nc_";
|
||||||
char *fullpath = malloc(strlen(path)+strlen(nw)+1);
|
//char *fullpath = malloc(strlen(path)+strlen(nw)+1);
|
||||||
if(fullpath) {
|
//if(fullpath) {
|
||||||
strcpy(fullpath, path);
|
// strcpy(fullpath, path);
|
||||||
strcat(fullpath, nw);
|
// strcat(fullpath, nw);
|
||||||
api_netpath = fullpath;
|
// api_netpath = fullpath;
|
||||||
}
|
//}
|
||||||
|
//api_netpath = nwid;
|
||||||
|
api_netpath = "/Users/Joseph/utest2/nc_565799d8f6e1c11a";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__IOS__)
|
#if defined(__IOS__)
|
||||||
|
|||||||
Reference in New Issue
Block a user