- JGE updates : main accepts argv/argc. Compilation variables for MP3 and Network support
- Minor fix in Wagic (potentially fixes crashes when using activated abilities several times in onr turn. Couldn't reproduce the issue)
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-07-11 10:56:12 +00:00
parent 672e53d58c
commit fd8645d1a4
12 changed files with 112 additions and 13 deletions

View File

@@ -1,3 +1,5 @@
#ifdef NETWORK_SUPPORT
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
@@ -14,6 +16,7 @@
#include <arpa/inet.h>
#include <sys/select.h>
#include <errno.h>
#endif
#include "../include/JGE.h"
@@ -25,8 +28,10 @@ JSocket * JSocket::mInstance = NULL;
int JSocket::connected = 0;
void JSocket::init(){
#ifdef NETWORK_SUPPORT
sceUtilityLoadNetModule(1);
sceUtilityLoadNetModule(3);
#endif
}
JSocket::JSocket(){
@@ -34,15 +39,18 @@ JSocket::JSocket(){
}
JSocket::~JSocket(){
#ifdef NETWORK_SUPPORT
pspSdkInetTerm();
sceNetApctlDisconnect();
sceNetApctlTerm();
#endif
}
int JSocket::make_socket(uint16_t port)
{
int sock;
int sock = -1;
#ifdef NETWORK_SUPPORT
int ret;
struct sockaddr_in name;
@@ -60,12 +68,13 @@ int JSocket::make_socket(uint16_t port)
{
return -1;
}
#endif
return sock;
}
void JSocket::readWrite(int val){
#ifdef NETWORK_SUPPORT
char data[1024];
int readbytes;
readbytes = read(val, data, sizeof(data));
@@ -93,10 +102,12 @@ void JSocket::readWrite(int val){
tosend_data.pop();
}
if (size) write(val,data,size);
#endif
}
/* Start a client */
int JSocket::start_client(const char *szIpAddr){
#ifdef NETWORK_SUPPORT
int sock;
sockaddr_in addrListen;
int error;
@@ -126,12 +137,14 @@ int JSocket::start_client(const char *szIpAddr){
while(1){
readWrite(sock);
}
#endif
return 0;
}
/* Start a server */
int JSocket::start_server(const char *szIpAddr)
{
#ifdef NETWORK_SUPPORT
int ret;
int sock;
int _new = -1;
@@ -206,6 +219,7 @@ int JSocket::start_server(const char *szIpAddr)
}
close(sock);
#endif
return 0;
}