forums.PPSSPP.org
Online Support (PRO Online) - Printable Version

+- forums.PPSSPP.org (https://forums.ppsspp.org)
+-- Forum: PPSSPP - Playstation Portable Simulator Suitable for Playing Portably (/forumdisplay.php?fid=1)
+--- Forum: General Discussion and Announcements (/forumdisplay.php?fid=2)
+--- Thread: Online Support (PRO Online) (/showthread.php?tid=3595)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36


RE: Online Support (PRO Online) - Kyhel - 11-22-2013 05:46 PM

Hi guys, well if what you say Ritori is true, maybe it's time i share here what i've found searching the web and github Big Grin
I hope i won't be forgetting anything since i've modified multiple times the source code to get something to work.

Before going any further, it's important to notice it's not an easy guide to follow, there might be some mistakes. The point is more to show you we didn't give up on this, and that the tools to play MHFU and MH3rd HD locally with your friends or family are here.

Important : With all this modifications, i've been able to play, with a local server running on my mac :
- PSP with PPSSPP on my mac
- PPSSPP on my mac with PPSSPP on my pc(Windows 7 Pro) (yeah now it works)
Not tested yet (will be soon) :
- PPSSPP windows with PPSSPP windows
- PSP with PPSSPP windows
To be tested :
- PPSSPP Linux with PSP
- PPSSPP Linux with Mac OSX or Windows

EDIT : I'm not sure i mentioned it, but i did only try this with MHFU, and now i've just tried it with MH3rd HD (you can find a thread on this in the forum), and it seems to work well too Smile

After all modifications, this is totally functionnal for what i've tested : Gathering hall, doing quest (at least the basic gathering quest, i've not tried to slain any monster, but it shoudl't be any different) without any lag (however the psp (if you use one) needs to get into the gathering hall first, otherwise it crashes, and sometimes it crashes even if nobody was in the gathering hall before, but whatever, i can't fix the psp stuff, even if i knew how to do it).

Although igorcalabria says what he's done works on linux, i couldn't test if my minor changes still work, but there is no reason it wouldn't.

I won't detail the way to build things, there are many tutorials on this forum for that, i'll detail the changes i've made to the code.
(See http://forums.ppsspp.org/showthread.php?tid=5231 for windows, for mac (and linux i guess) just use cmake and make commands)


0) NOT TESTED : For those who really want the latest PPSSPP build, take the source code of the latest that builds on http://buildbot.orphis.net/ppsspp/, then apply the changes from the step 1 to the last one) download into this build


1) First thing to do : get the adhoc-support branch from igorcalabria's repo : https://github.com/igorcalabria/ppsspp/tree/adhoc-support

2) Then if you're on windows : look at the changes made on the adhoc-spport-windows branch of his repository and apply them to what you've just downloaded from the adhoc-support branch.

3) Credits goes to LunaMoo from this issue : https://github.com/hrydgard/ppsspp/issues/4490 , on windows, you may have to change 1 or 2 includes : #include <thread> into #include <thread.h> and #include <mutex> into #include <base/mutex.h> or even better #include "native/base/mutex.h" (which already chanegd if you've taken the adhoc-supoprt branch)

4) Then if you're on OSX and have skipped step 0) (which i did if i remember well) you may need to add this in the includes of Common/FileUtil.cpp
Code:
#if !defined(IOS)
#include <mach-o/dyld.h>
#endif // !defined(IOS)
#endif // __APPLE__

5) If you want to play with 2 emulators together you'll have to change the mac adress which is for the moment hardcoded in 2 places :
- in Core/HLE/proAdhoc.cpp
Code:
void getLocalMac(SceNetEtherAddr * addr){
  uint8_t mac[] = {1, 2, 3, 4, 5, 6};
  memcpy(addr,mac,ETHER_ADDR_LEN);
}
- in Core/HLE/sceNet.cpp
Code:
u32 sceWlanGetEtherAddr(u32 addrAddr) {
    // TODO: Read from config
    static const u8 fakeEtherAddr[6] = { 1, 2, 3, 4, 5, 6 };
    DEBUG_LOG(SCENET, "sceWlanGetEtherAddr(%08x)", addrAddr);
    for (int i = 0; i < 6; i++)
        Memory::Write_U8(fakeEtherAddr[i], addrAddr + i);

    return 0;
}

You have to put the same on both places for one build, but if you plane to use 2 emulators, change it on the second one, to another value (01:02:03:04:05:06 is default use 01:02:03:04:05:05 instead for example).

6) Credits goes to me Big Grin
In Core/Dialog/PSPNetconfDialog.cpp change this :
Code:
return sceNetAdhocctlCreate(request.NetconfData->groupName)
into this :
Code:
if(sceNetAdhocctlCreate(request.NetconfData->groupName) == 0)
{
status = SCE_UTILITY_STATUS_FINISHED;
return 0;
}
return -1;
in the int PSPNetconfDialog::Update(int animSpeed) method.
It prevents the emulator from freezing when you try to save after going online (which is great, since there is no point in doing quests if you can't save afterwards Confused)

NEW STEP FOR WINDOWS ONLY

7) Open the Core/HLE/sceNetAdhoc.cpp file.
Go to the sceNetAdhocPtpConnect Function and change : (Use ctrl+f)
Code:
int errorcode = errno;
with
Code:
int errorcode = WSAGetLastError();

Code:
errorcode == EISCONN
with
Code:
errorcode == WSAEISCONN

Code:
errorcode == EINPROGRESS
with
Code:
errorcode == WSAEWOULDBLOCK

Go to the sceNetAdhocPtpSend AND sceNetAdhocPtpRecv functions and change on both :
Code:
int error = errno;
with
Code:
int error = WSAGetLastError();

and

Code:
error == EAGAIN
with
Code:
error == WSAEWOULDBLOCK

Now if i didn't forget anything and didn't make any typo you should have the same code as i have, and the same builds too (keep in mind i have applied different changes to windows (most of them actually) and osx versions, i might have forgot some things, so don't hesitate to give feedback).

Let's talk about the server. Since i'm in a engineering school i can't configure the router, that we all (students) share, so uPnP is forbidden, and i don't even know how to put my computer in the DMZ, which is not a good idea anyway, but if you're interested, feel free to look at the proOnline Client tutorials around the web for the psp.

Let's go set the server :

Step 1 can be skipped if you go to see my post here : http://forums.ppsspp.org/showthread.php?tid=3595&pid=59021#pid59021

1) Download the code from http://code.google.com/p/aemu/, and use make command on linux/osx inside the ppsspp_addhocctl_server folder to build the server, then launch it, there is nothing to do here (at least with the way my network is configured). Though, you can look at the code in the other folders, it's the code of the psp plugin, which is what igorcalabria is porting into PPSSPP.

2) Replace the coldbird.uk.to adress in the server.txt file from your psp proOnline plugin with the local ip adress of the computer on wich you are running the server you just built.

3) Do the same for every other computer you plan to play with (set the proAdhocServer address (or create the line under the [SystemParam] section) in the memstick/PSP/SYSTEM/ppsspp.ini file, the memstick folder should be at the same place you built PPSSPP, but you'll need to launch it once for it to be created).

4) OPTIONNAL : If you want to play with an emulator on the same computer where the server is runnin, i can't garantee the wait to configure your adresses since i used a particular network configuration, but try using the same as the others emulators, it should work since it did for me Smile

Now you should be able to play in the conditions i've described above.

Of course credits goes to igorcalabria, ColdBird, LunaMoo, Ritori (which highlighted me when i was lost trying to build on windows, which i never did before, i'm a mac user), hrydgard, and all the PPSSP contributors for this awesome emulator. I hope i'm not forgetting anybody, my head is just so full of questions right now.

This is it for the tutorial folks.

I know igorcalabria and ColdBird have stuff to do, that's why i post this here (and i'll certainly update this on igorcalabria's repo when i find out how to do it, and what real version of the code to put), hoping guys like you and me find a way to improve this AWESOME stuff !

Hope you'll enjoy what you can get from this, sorry for my english, i'm not a native speaker, and keep hope, we'll in a near future be able to play with the world on proOnline.

Here a some links you may be interested in reading, looking at etc. Most of them are in this post, but here they are.

https://github.com/igorcalabria/ppsspp
https://github.com/hrydgard/ppsspp
https://github.com/hrydgard/ppsspp/issues/4490
http://forums.ppsspp.org/showthread.php?tid=5231
http://code.google.com/p/aemu/
http://pro.coldbird.uk.to/status/
http://www.gamergen.com/tutoriels/utiliser-configurer-correctement-pro-online-52370-2

Edit : Since I'm both working on a mac and windows version, some changes from the adhoc-support-windows onto your adhoc-support (linux/osx) version (i'm thinking about changin in to unint_32 etc.) maybe have to be reversed if you're using osx/linux, i don't have the patience to test everything here, but i think i've listed all the modifications that need to be made, just revert back if some changes make it worst ^^ And feel free to say if you have changes to add Smile

EDIT 2 (Saturday 23, Nov) : I found what caused the windows version not to connect properly, i've edited my post with recent changes. Check step 7.
Since it works now fully with MHFU (from what i've tested, i'll maybe try to come up with an unified version of all of this with improvements and stuff, and pull a request on igorcalabria's github repo, but like him, i'm a bit lazy, so at the moment i'll just play MHFU with my friends ^^ Enjoy

EDIT 3 [WINDOWS/MAC/LINUX LOCAL SERVER]: I've found how to make the local server run on window, check this post http://forums.ppsspp.org/showthread.php?tid=3595&pid=59021#pid59021

EDIT 4 : Since i don't want to remove all stuff that has become only useful for a few people, i'm making a new post with condensed instructions, and builds when i'll find a way to upload them since they weight around 10Mo


RE: Online Support (PRO Online) - Ritori - 11-22-2013 06:24 PM

There some progress Smile nice discover Kyhel!! hope mac user can look into this stuff ^-^
for me i'm windows user so i need to wait more progress to be made ^-^


RE: Online Support (PRO Online) - Kyhel - 11-22-2013 06:27 PM

Well as a windows user you can still get into the gathering hall and drink beers with your friends xD (Localy) And yeah i hope someone will be able to look at this, but mostly a windows programmer since with all the test i've made it's the Ptp protocol that doesn't work on windows, while everything works fine on mac Smile And since i dont understand a little thing how this network works, i can't help a lot Confused


RE: Online Support (PRO Online) - Archimedes - 11-22-2013 06:31 PM

YES YES YES! (After reading post) No no no...


RE: Online Support (PRO Online) - Ritori - 11-22-2013 06:38 PM

(11-22-2013 06:31 PM)Archimedes Wrote:  YES YES YES! (After reading post) No no no...

A bit more be patient lol xD at least i can drink beer with my brother on mhfu xD


RE: Online Support (PRO Online) - Kyhel - 11-22-2013 06:42 PM

I'm really sorry windows sux, but i had to put in a post, so at least mac and linux users can play localy, and it takes back in the scene this thread so maybe a network programmer will see it and give it an hand Smile


RE: Online Support (PRO Online) - Archimedes - 11-22-2013 06:49 PM

Don't get me wrong guys. I, and all the other people on this thread and even forum for that matter, really appreciate your work on this emulator. Yes it kinda sucks windows compatibility isn't finished yet, but what you said earlier means it's pretty close, and that's GREAT! I don't mind waiting a few more days after waiting for so long.

Thank you for all your efforts! And a huge thanks to everyone who worked on this thing for that matter!

P.S. I never thought I would see the day where the MAC user would have an advantage over the Windows user.


RE: Online Support (PRO Online) - Kyhel - 11-22-2013 07:08 PM

I know you are all waiting for this, and I think me first, but i had to "mettre la main a la pâte" like we say in france, to try to make things better, and i'm trying all my best so that we'll all soon be able to slain the fatalis together with this awesome emulator (i really mean it, it's so fast, and playing with an xbox controller on MHFU makes you gain a second D-Pad, priceless, and the graphics.. and the speed hack, not to have to wait loadings and stuff Big Grin)


RE: Online Support (PRO Online) - Archimedes - 11-22-2013 07:13 PM

(11-22-2013 07:08 PM)Kyhel Wrote:  I know you are all waiting for this, and I think me first, but i had to "mettre la main a la pâte" like we say in france, to try to make things better, and i'm trying all my best so that we'll all soon be able to slain the fatalis together with this awesome emulator (i really mean it, it's so fast, and playing with an xbox controller on MHFU makes you gain a second D-Pad, priceless, and the graphics.. and the speed hack, not to have to wait loadings and stuff Big Grin)

Stop it! I'm drooling....


RE: Online Support (PRO Online) - vnctdj - 11-23-2013 02:58 PM

Nice work Kyhel, I knew that French people are the best ! Wink
LOL, just kidding Smile


RE: Online Support (PRO Online) - Kyhel - 11-23-2013 06:43 PM

Aha yeah we are the best Tongue

I just found what caused the problem of the windows version not being able to connect \o/

I just finish gathering the information, and will post the added modifications to make in my previous post editing it.

IMPORTANT : I only tested that it works with my pc and my mac, locally, i'll test it with 2 pc when i can, but feel free to test it and tell me if it works Big Grin


RE: Online Support (PRO Online) - captainobvious - 11-23-2013 06:58 PM

That's amazing news. Kyhel, could it be possible for you to post your version of a working windows binary?

Personally I've compiled _a_ windows version, but have no idea of knowing whether it works or not since I can't for the life of me get aemu to compile since I don't have a linux / mac Confused


RE: Online Support (PRO Online) - Ritori - 11-23-2013 07:01 PM

(11-23-2013 06:43 PM)Kyhel Wrote:  Aha yeah we are the best Tongue

I just found what caused the problem of the windows version not being able to connect \o/

I just finish gathering the information, and will post the added modifications to make in my previous post editing it.

IMPORTANT : I only tested that it works with my pc and my mac, locally, i'll test it with 2 pc when i can, but feel free to test it and tell me if it works Big Grin

ohh thank you very much i will try it now Big Grin


RE: Online Support (PRO Online) - Archimedes - 11-23-2013 07:12 PM

Can some one post a link to a already built version of the emulator?


RE: Online Support (PRO Online) - Kyhel - 11-23-2013 07:17 PM

@captainobvious : I'm sorry you can't yet play it on the proOnline prometheus server, i quote igorcalabria :

Oh, and you can't really play with players outside your network, because the upnp stuff is still missing. Maybe you could see which ports are being used by the game and forward them manually on your router.

Since i don't know how uPnP works, and since i can't modify my router to test changes, since it's not mine but our school's, i can't help you. We can hope igorcalabria implements it as soon as possible so we can all play this, but for the moment you can just play locally, i'm really sorry for that.