libsdl-org / SDL_net

A simple, cross-platform wrapper over TCP/IP sockets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDL_net 1.2.9 port to the pspsdk?

superfury opened this issue · comments

I've managed to get SDL_net 1.2.9 (as it calls itself on the SDL_net branch for 1.2) ported onto the PSP using the simple "make -f Makefile.psp install" command.

I've already managed to compile it (under Windows) under the Minimalist PSPSDK (SDK+devpak 0.10.0) from https://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.10.0/

The repository with the commit required for compiling it can be found here:
https://github.com/superfury/SDL_net/tree/SDL-1.2

I've already tried it with just that one commit I've done to it and it compiles correctly. Then I tried adjusting my own program (UniPCemu) to support it and without base modification it already compiled (although I still needed to add code to (dis)connect to/from an access point on the PSP-specific code in my app (since that's app-specific (interface etc.)).

Should this be merged back into the SDL 1.2 branch here? Or should it first still need to be tested somehow on an actual PSP(so far just ran it on the JPCSP PSP emulator instead of my physical PSP for easy verification if it didn't crash).
There were some warnings in the compiler about srandom() and random() being undefined (couldn't find it in the PSPSDK header files though), but it compiled without issues? Linking in the library also succeeded without issues, all the way to the actual application being properly produced.

Edit: Just put the commit I made into a pull request:
#64

OK. I've done some more testing on the SDL_net port (that's now merged into the SDL_net 1.2 branch).

It seems that when I try to use SDL_net functions (in particular only a few functions other than init and Quit are actually called by default (init on startup, after loading the PSP PSP_NET_MODULE_COMMON and PSP_NET_MODULE_INET modules) (unless instructed to do other things like connecting by software or the user or getting connected to the server TCP port from another device while the TCP server side is running).
Those two functions that are called by the main loop of the app (polling for incoming connections) are:
SDLNet_ResolveHost
SDLNet_AllocSocketSet
SDLNet_TCP_Open
SDLNet_FreeSocketSet
SDLNet_TCP_AddSocket
SDLNet_TCP_Close
SDLNet_CheckSockets (to check for incoming connections on the TCP port).

Note that this only happens when it's listening and having the server started (and listening for incoming connections on said port, which seems to behave normally).

Edit: Another test ran and confirmed that calling one of those above functions seems to be the cause?
Edit: Then ran another test and it terminates the app without issues? Huh?
Edit: OK. It's running correctly. The issue wasn't with SDL_net. My app was calling a log file initialization function in the cleanup function for the network functionality (cleans up the SDL_net by calling SDLNet_Quit function, then after that proceeds to disconnect any lingering WiFi connections (and stopping the WiFi thread from my own app), followed by unloading the PSP net modules. It now runs without any visible issues. :D

OK. Both SDL2_net and SDL_net now support this. Closing this issue.

Thanks!