mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 01:55:19 -04:00
Fix multiplayer not working at all with old emscripten
This commit is contained in:
parent
6e57334f9a
commit
5d93db81d2
@ -90,7 +90,7 @@ WEB_CC="/home/buildbot/emsdk/emscripten/1.38.31/emcc"
|
|||||||
build_web() {
|
build_web() {
|
||||||
echo "Building web.."
|
echo "Building web.."
|
||||||
rm cc.js
|
rm cc.js
|
||||||
$WEB_CC *.c -O1 -o cc.js -s WASM=0 -s LEGACY_VM_SUPPORT=1 -s ALLOW_MEMORY_GROWTH=1 -s ABORTING_MALLOC=0 --preload-file texpacks/default.zip -w
|
$WEB_CC *.c -O1 -o cc.js --js-library interop_web.js -s WASM=0 -s LEGACY_VM_SUPPORT=1 -s ALLOW_MEMORY_GROWTH=1 -s ABORTING_MALLOC=0 --preload-file texpacks/default.zip -w
|
||||||
# so game loads textures from classicube.net/static/default.zip
|
# so game loads textures from classicube.net/static/default.zip
|
||||||
sed -i 's#cc.data#/static/default.zip#g' cc.js
|
sed -i 's#cc.data#/static/default.zip#g' cc.js
|
||||||
# fix mouse wheel scrolling page not being properly prevented
|
# fix mouse wheel scrolling page not being properly prevented
|
||||||
|
@ -22,10 +22,17 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Unfortunately, errno constants are different in some older emscripten versions */
|
||||||
|
/* (linux errno compared to WASI errno) */
|
||||||
|
/* So just use the same numbers as interop_web.js (otherwise connecting always fail) */
|
||||||
|
#define _EINPROGRESS 26
|
||||||
|
#define _EAGAIN 6 /* same as EWOULDBLOCK */
|
||||||
|
#define _EHOSTUNREACH 23
|
||||||
|
|
||||||
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
||||||
const cc_result ReturnCode_FileNotFound = ENOENT;
|
const cc_result ReturnCode_FileNotFound = ENOENT;
|
||||||
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
const cc_result ReturnCode_SocketInProgess = _EINPROGRESS;
|
||||||
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
const cc_result ReturnCode_SocketWouldBlock = _EAGAIN;
|
||||||
const cc_result ReturnCode_DirectoryExists = EEXIST;
|
const cc_result ReturnCode_DirectoryExists = EEXIST;
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
@ -288,7 +295,7 @@ cc_result Socket_Connect(cc_socket s, const cc_string* ip, int port) {
|
|||||||
res = -interop_SocketConnect(s, addr, port);
|
res = -interop_SocketConnect(s, addr, port);
|
||||||
|
|
||||||
/* error returned when invalid address provided */
|
/* error returned when invalid address provided */
|
||||||
if (res == EHOSTUNREACH) return ERR_INVALID_ARGUMENT;
|
if (res == _EHOSTUNREACH) return ERR_INVALID_ARGUMENT;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +312,7 @@ cc_result Socket_Read(cc_socket s, cc_uint8* data, cc_uint32 count, cc_uint32* m
|
|||||||
data += res; count -= res;
|
data += res; count -= res;
|
||||||
} else {
|
} else {
|
||||||
/* EAGAIN when no data available */
|
/* EAGAIN when no data available */
|
||||||
if (res == -EAGAIN) break;
|
if (res == -_EAGAIN) break;
|
||||||
return -res;
|
return -res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ mergeInto(LibraryManager.library, {
|
|||||||
},
|
},
|
||||||
interop_InitSockets: function() {
|
interop_InitSockets: function() {
|
||||||
window.SOCKETS = {
|
window.SOCKETS = {
|
||||||
EBADF:-8,EISCONN:-30,ENOTCONN:-53,EAGAIN:-6,EWOULDBLOCK:-6,EHOSTUNREACH:-23,EINPROGRESS:-26,EALREADY:-7,ECONNRESET:-15,EINVAL:-28,ECONNREFUSED:-14,
|
EBADF:-8,EISCONN:-30,ENOTCONN:-53,EAGAIN:-6,EHOSTUNREACH:-23,EINPROGRESS:-26,EALREADY:-7,ECONNRESET:-15,EINVAL:-28,ECONNREFUSED:-14,
|
||||||
sockets: [],
|
sockets: [],
|
||||||
|
|
||||||
createSocket:function() {
|
createSocket:function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user