JsPspEmu: Streaming PSP Games, Embedding and CORS

May 08 2014

One of the strengths of this emulator is that it is able to stream large games, including zip files, isos, csos, eboots, etc.

So it is possible for example to stream the psp homebrew reminiscence, a port of flashback, Doom, abuse or kaiten patisser.

You can test them here (some could be broken in master release):http://jspspemu.com/#http://games.jspspemu.com/Doom.zip (3MB)http://jspspemu.com/#http://games.jspspemu.com/reminiscence.zip (95MB)http://jspspemu.com/#http://games.jspspemu.com/abuse.zip (19MB)http://jspspemu.com/#http://games.jspspemu.com/UraKaitenPatissierPSP.zip (13MB)

It won’t download the whole file, but will read relatively small chunks (usually 128KB) (and perform buffering) when required. So the game will start immediately, won’t require large local storages and the bandwidth used will be limited.

This will allow homebrew developers to allow people to play their games online. Or even embedding it in an iframe.

In order to be able to do this, you need to use CORS (Cross-origin resource sharing)

To allow this to work, you should expose several headers: “If-Modified-Since,Range,Content-Range,Content-Length” and methods “GET, HEAD, OPTIONS”.

An example of nginx configuration would be:

add_header 'Access-Control-Allow-Origin' "*";  
add_header 'Access-Control-Allow-Credentials' 'true';  
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, OPTIONS';  
add_header 'Access-Control-Max-Age' 1728000;  
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since,Range,Content-Range,Content-Length';  
add_header 'Access-Control-Expose-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since,Range,Content-Range,Content-Length';  
You can read more about CORS here: [http://enable-cors.org/](http://enable-cors.org/)