#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_NACL
#include "SDL_main.h"
#include "ppapi_simple/ps_main.h"
#include "ppapi_simple/ps_event.h"
#include "ppapi_simple/ps_interface.h"
#include "nacl_io/nacl_io.h"
#include "sys/mount.h"
extern void NACL_SetScreenResolution(int width, int height, Uint32 format);
int
nacl_main(int argc, char *argv[])
{
int status;
PSEvent* ps_event;
PP_Resource event;
struct PP_Rect rect;
int ready = 0;
const PPB_View *ppb_view = PSInterfaceView();
PSEventSetFilter(PSE_INSTANCE_DIDCHANGEVIEW);
while (!ready) {
while (!ready && (ps_event = PSEventWaitAcquire()) != NULL) {
event = ps_event->as_resource;
switch(ps_event->type) {
case PSE_INSTANCE_DIDCHANGEVIEW:
ppb_view->GetRect(event, &rect);
NACL_SetScreenResolution(rect.size.width, rect.size.height, 0);
ready = 1;
break;
default:
break;
}
PSEventRelease(ps_event);
}
}
nacl_io_init_ppapi(PSGetInstanceId(), PSGetInterface);
umount("/");
mount(
"",
"/",
"httpfs",
0,
"");
SDL_SetMainReady();
status = SDL_main(argc, argv);
return 0;
}
PPAPI_SIMPLE_REGISTER_MAIN(nacl_main);
#endif