mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Adds adhoc support notes on readme, and option to load server address from config
This commit is contained in:
parent
0bc7dee02c
commit
2c484c9bee
4 changed files with 44 additions and 13 deletions
|
@ -255,6 +255,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
|||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
pspConfig->Get("NickName", &sNickName, "PPSSPP");
|
||||
pspConfig->Get("proAdhocServer", &proAdhocServer, "localhost");
|
||||
pspConfig->Get("Language", &iLanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
||||
pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
|
||||
pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD);
|
||||
|
@ -451,6 +452,7 @@ void Config::Save() {
|
|||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
pspConfig->Set("NickName", sNickName.c_str());
|
||||
pspConfig->Set("proAdhocServer", proAdhocServer.c_str());
|
||||
pspConfig->Set("Language", iLanguage);
|
||||
pspConfig->Set("TimeFormat", iTimeFormat);
|
||||
pspConfig->Set("DateFormat", iDateFormat);
|
||||
|
|
|
@ -184,6 +184,7 @@ public:
|
|||
|
||||
// SystemParam
|
||||
std::string sNickName;
|
||||
std::string proAdhocServer;
|
||||
int iLanguage;
|
||||
int iTimeFormat;
|
||||
int iDateFormat;
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <mutex>
|
||||
|
@ -660,33 +661,39 @@ int __init_network(SceNetAdhocctlAdhocId *adhoc_id){
|
|||
WSADATA data;
|
||||
iResult = WSAStartup(MAKEWORD(2,2),&data);
|
||||
if(iResult != NOERROR){
|
||||
printf("Wsa failed with error %d\n",iResult);
|
||||
ERROR_LOG(SCENET, "Wsa failed");
|
||||
return iResult;
|
||||
}
|
||||
#endif
|
||||
metasocket = INVALID_SOCKET;
|
||||
metasocket = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP);
|
||||
if(metasocket == INVALID_SOCKET){
|
||||
printf("invalid socket");
|
||||
ERROR_LOG(SCENET,"invalid socket");
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
struct sockaddr_in server_addr;
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(27312);
|
||||
server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
iResult = connect(metasocket,(sockaddr *)&server_addr,sizeof(server_addr));
|
||||
server_addr.sin_port = htons(27312); // Maybe read this from config too
|
||||
|
||||
if(iResult == SOCKET_ERROR){
|
||||
printf("Socket error %d", iResult);
|
||||
// Resolve dns
|
||||
addrinfo * resultAddr;
|
||||
iResult = getaddrinfo(g_Config.proAdhocServer.c_str(),0,NULL,&resultAddr);
|
||||
if(iResult != 0){
|
||||
printf("Dns error\n");
|
||||
return iResult;
|
||||
}
|
||||
server_addr.sin_addr.s_addr = ((sockaddr_in *)resultAddr->ai_addr)->sin_addr.s_addr;
|
||||
iResult = connect(metasocket,(sockaddr *)&server_addr,sizeof(server_addr));
|
||||
if(iResult == SOCKET_ERROR){
|
||||
ERROR_LOG(SCENET,"Socket error");
|
||||
return iResult;
|
||||
}
|
||||
|
||||
memset(¶meter,0,sizeof(parameter));
|
||||
strcpy((char *)¶meter.nickname.data, g_Config.sNickName.c_str());
|
||||
parameter.channel = 1; // Fake Channel 1
|
||||
|
||||
// Prepare Login Packet
|
||||
__getLocalMac(¶meter.bssid.mac_addr);
|
||||
|
||||
|
||||
SceNetAdhocctlLoginPacketC2S packet;
|
||||
packet.base.opcode = OPCODE_LOGIN;
|
||||
SceNetEtherAddr addres;
|
||||
|
|
23
README.md
23
README.md
|
@ -1,3 +1,24 @@
|
|||
ADHOC SUPPORT
|
||||
=============
|
||||
This is based on coldbird code: http://code.google.com/p/aemu/ All Credit goes
|
||||
to him!
|
||||
|
||||
Status
|
||||
------
|
||||
Code is a complete mess and it's not fully functional yet, I still need to implement
|
||||
some functions and add a upnp lib(really important for people with routers).
|
||||
|
||||
I did test it with some games(emulator <-> real psp with the server running locally)
|
||||
and it's looking good:
|
||||
* Worms Open Warfare: Ran just fine, I was able to play a whole match without problems
|
||||
* Monster Hunter Freedom Unite: Runs fine too. Gathering Hall and embarking on quests Works
|
||||
* Dissidia Duodecim 012: Doesn't work. It requires some functions that I haven't implemented
|
||||
yet. Also, it uses a port < 1000 and thats reserved for admin apps on linux, running the emu
|
||||
as sudo "solves" it, but it's far from ideal.
|
||||
* Pacman World Rally: Works too.
|
||||
|
||||
Oh, and it probably only compiles on linux for now.
|
||||
|
||||
PPSSPP - a fast and portable PSP emulator
|
||||
=========================================
|
||||
|
||||
|
@ -8,7 +29,7 @@ Originally released under the GPL 2.0 (and later) in November 2012
|
|||
Official website:
|
||||
http://www.ppsspp.org/
|
||||
|
||||
To contribute, see [the development page](http://www.ppsspp.org/development.html).
|
||||
To contribute, see [the development page](http://www.ppspp.org/development.html).
|
||||
|
||||
For the latest source code, see [our github page](https://github.com/hrydgard/ppsspp).
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue