From 5a9b7eefc0649fc5af80e36f504ed5580ec2c859 Mon Sep 17 00:00:00 2001 From: "Xawotihs@gmail.com" Date: Sun, 3 Feb 2013 21:41:31 +0000 Subject: [PATCH] Fixed PSP compilation by stubbing the socket implementation. Somebody with a PSP, please replace this code with a real implementation. --- JGE/include/JSocket.h | 9 ++++++--- JGE/src/JNetwork.cpp | 6 +----- JGE/src/JSocket.cpp | 37 ++++++++++++++++++++++++++---------- JGE/src/pc/JSocket.cpp | 5 ----- projects/mtg/src/GameApp.cpp | 2 +- 5 files changed, 35 insertions(+), 24 deletions(-) diff --git a/JGE/include/JSocket.h b/JGE/include/JSocket.h index ecc81eed9..ab8bb2934 100644 --- a/JGE/include/JSocket.h +++ b/JGE/include/JSocket.h @@ -5,6 +5,8 @@ #include "Threading.h" using namespace std; +#define SERVER_PORT 5001 + class JSocket{ public: typedef enum { @@ -19,10 +21,11 @@ public: } SOCKET_STATE; - // Server creation - JSocket(string ipAddr); // Client creation + JSocket(string ipAddr); + // Server creation JSocket(); + ~JSocket(); JSocket* Accept(); @@ -41,7 +44,7 @@ private: // socket handle #ifdef WIN32 SOCKET mfd; -#elif LINUX +#elif LINUX || PSP int mfd; #endif }; diff --git a/JGE/src/JNetwork.cpp b/JGE/src/JNetwork.cpp index b8a5ca7fb..ade067a5b 100644 --- a/JGE/src/JNetwork.cpp +++ b/JGE/src/JNetwork.cpp @@ -188,11 +188,7 @@ void JNetwork::ThreadProc(void* param) pThis->toSend.str(""); } } -#ifdef LINUX boost::this_thread::sleep(boost::posix_time::milliseconds(1)); -#elif WIN32 -// boost::this_thread::sleep(boost::posix_time::microseconds(10)); -#endif } DebugTrace("Quitting Thread"); @@ -209,7 +205,7 @@ int JNetwork::connect(const string& ip) #else -int JNetwork::connect(string serverIP){ +int JNetwork::connect(const string& serverIP){ #ifdef NETWORK_SUPPORT int err; char buffer[4096]; diff --git a/JGE/src/JSocket.cpp b/JGE/src/JSocket.cpp index 5cf1ead03..9d1e1dbdc 100644 --- a/JGE/src/JSocket.cpp +++ b/JGE/src/JSocket.cpp @@ -1,4 +1,3 @@ -#if 0 // need a complete rewrite to comply to the new interface #ifdef NETWORK_SUPPORT @@ -21,23 +20,21 @@ #endif #include "../include/JGE.h" - #include "../include/JSocket.h" -JSocket * JSocket::mInstance = NULL; -#define SERVER_PORT 20666 - -int JSocket::connected = 0; - -void JSocket::init(){ +JSocket::JSocket(){ #ifdef NETWORK_SUPPORT sceUtilityLoadNetModule(1); sceUtilityLoadNetModule(3); #endif } -JSocket::JSocket(){ - init(); +JSocket::JSocket(string ipAddr) +{ +} + +JSocket::JSocket(int fd) +{ } JSocket::~JSocket(){ @@ -48,7 +45,27 @@ JSocket::~JSocket(){ #endif } +void JSocket::Disconnect() +{ +} +JSocket* JSocket::Accept() +{ + return 0; +} + +int JSocket::Read(char* buff, int size) +{ + return 0; +} + +int JSocket::Write(char* buff, int size) +{ + return 0; +} + + +#if 0 int JSocket::make_socket(uint16_t port) { int sock = -1; diff --git a/JGE/src/pc/JSocket.cpp b/JGE/src/pc/JSocket.cpp index eccc5f616..49eb7165a 100644 --- a/JGE/src/pc/JSocket.cpp +++ b/JGE/src/pc/JSocket.cpp @@ -16,11 +16,6 @@ #include "../../include/JSocket.h" #include "../../include/DebugRoutines.h" -//JSocket * JSocket::mInstance = NULL; - -//#define SERVER_PORT 20666 -#define SERVER_PORT 5001 -unsigned char ADRESSE_IP_SERVEUR [4] = {127,0,0,1}; JSocket::JSocket(string ipAddr) diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index 53a2406b0..60213786d 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -51,8 +51,8 @@ GameState::GameState(GameApp* parent, string id) : GameApp::GameApp() : JApp() #ifdef NETWORK_SUPPORT - ,mpNetwork(NULL) , mServerAddress("") + , mpNetwork(NULL) #endif //NETWORK_SUPPORT { #ifdef DEBUG