- JGE bug fixes (network)
- increased the size of kernel ram. 2048 might bee too much though, let's see if we can go with 1024
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-29 04:44:38 +00:00
parent 3f21dad546
commit b275b6f758
5 changed files with 268 additions and 239 deletions

View File

@@ -1,10 +1,7 @@
#ifndef _JNETWORK_H_
#define _JNETWORK_H_
#ifdef WIN32
#elif defined (LINUX)
#else
#endif
#include "JGE.h"
#include <string>
@@ -14,7 +11,9 @@ class JNetwork{
private:
static JNetwork * mInstance;
static int connected_to_ap;
public:
static string error;
JNetwork();
static JNetwork * GetInstance();
static void EndInstance();
@@ -28,7 +27,6 @@ public:
#elif defined (LINUX)
static void* net_thread(void* param);
#else
static int net_thread(SceSize args, void *argp);
static int connect_to_apctl(int config);
#endif
@@ -44,4 +42,10 @@ private:
};
#if defined (WIN32)
#elif defined (LINUX)
#else
static int net_thread(SceSize args, void *argp);
#endif
#endif

View File

@@ -4,6 +4,7 @@
*/
#if defined (WIN32) || defined (LINUX)
#else
#include <pspkernel.h>
@@ -12,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <psputility.h>
#include <pspnet.h>
#include <pspnet_inet.h>
#include <pspnet_apctl.h>
@@ -22,11 +24,13 @@
#include <errno.h>
#endif
#include "../include/JNetwork.h"
#include "../include/JSocket.h"
JNetwork* JNetwork::mInstance = NULL;
string JNetwork::serverIP = "";
string JNetwork::error = "";
JNetwork * JNetwork::GetInstance(){
if (!mInstance) mInstance = new JNetwork();
@@ -157,9 +161,17 @@ int net_thread(SceSize args, void *argp)
int JNetwork::connect(string serverIP){
int err;
char buffer[4096];
if(netthread) return 0;
sceUtilityLoadNetModule(1);
sceUtilityLoadNetModule(3);
if((err = pspSdkInetInit())){
printf("JGE Error, could not initialise the network %08X\n", err);
sprintf(buffer, "JGE Error, could not initialise the network %08X", err);
printf(buffer); printf("\n");
error = buffer;
return err;
}
@@ -187,28 +199,37 @@ int JNetwork::connect_to_apctl(int config)
{
int err;
int stateLast = -1;
char buffer[4096];
/* Connect using the first profile */
err = sceNetApctlConnect(config);
if (err != 0)
{
printf("JGE: sceNetApctlConnect returns %08X\n", err);
sprintf(buffer, "JGE: sceNetApctlConnect returns %08X", err);
printf(buffer);printf("\n");
error = buffer;
return 0;
}
printf("JGE: Connecting...\n");
sprintf(buffer,"JGE: Connecting...");
printf(buffer);printf("\n");
error = buffer;
while (1)
{
int state;
err = sceNetApctlGetState(&state);
if (err != 0)
{
printf("JGE: sceNetApctlGetState returns $%x\n", err);
sprintf(buffer,"JGE: sceNetApctlGetState returns $%x", err);
printf(buffer);printf("\n");
error = buffer;
break;
}
if (state > stateLast)
{
printf(" connection state %d of 4\n", state);
sprintf(buffer, " connection state %d of 4", state);
printf(buffer);printf("\n");
error = buffer;
stateLast = state;
}
if (state == 4){

View File

@@ -22,6 +22,8 @@ JSocket * JSocket::mInstance = NULL;
#define SERVER_PORT 20666
int JSocket::connected = 0;
void JSocket::init(){
sceUtilityLoadNetModule(1);
sceUtilityLoadNetModule(3);
@@ -119,6 +121,8 @@ int JSocket::start_client(const char *szIpAddr){
return err;
}
connected = 1;
while(1){
readWrite(sock);
}

View File

@@ -29,7 +29,7 @@
#ifdef DEVHOOK
PSP_MODULE_INFO(JGEApp_Title, 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(-256);
PSP_HEAP_SIZE_KB(-2048);
#else