// Initialize the module, staring a worker thread to load the shared object. virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { nacl_io_init_ppapi( pp_instance(), pp::Module::Get()->get_browser_interface()); // printf( "Constructor thread id '%p'\n", pthread_self()); // printf( "createFS thread id '%p'\n", pthread_self()); umount("/"); int res = mount("", "/", "memfs", 0, ""); // int res = mount("", "/web", "httpfs", 0, ""); if (res) { // std::cout << "unable to mount httpfs file system!" << std::endl; bCreatedFS_ = true; return false; } // std::cout << "mount res: " << res << std::endl; if (pthread_create( &message_thread_, NULL, &LASzipInstance::HandleMessageThread, this)) { PostError("Init", "Unable to initialize thread!", "null"); return false; } InitializeMessageQueue(); return true; }
explicit MoonlightInstance(PP_Instance instance) : pp::Instance(instance), pp::MouseLock(this), m_IsPainting(false), m_OpusDecoder(NULL), m_CallbackFactory(this), m_MouseLocked(false), m_KeyModifiers(0), m_WaitingForAllModifiersUp(false) { // This function MUST be used otherwise sockets don't work (nacl_io_init() doesn't work!) nacl_io_init_ppapi(pp_instance(), pp::Module::Get()->get_browser_interface()); m_GamepadApi = static_cast<const PPB_Gamepad*>(pp::Module::Get()->GetBrowserInterface(PPB_GAMEPAD_INTERFACE)); }
/* set up the viewport and run the game as usual */ void run(){ Util::ReferenceCount<Storage::System> system(new Nacl::NetworkSystem(the_instance, core)); Storage::setInstance(system); SDL_NACL_SetInstance(pp_instance(), 640, 480); int ok = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); Global::debug(0) << "SDL Init: " << ok << std::endl; Util::Thread::Id thread; Util::Thread::createThread(&thread, NULL, (Util::Thread::ThreadFunction) launch, NULL); Global::debug(0) << "Running thread " << thread << std::endl; }
virtual bool Init(uint32_t argc, const char* arg_n[], const char* argv[]) { // Create file system to hold the binaries that will be loaded into the // emulator nacl_io_init_ppapi(pp_instance(), pp::Module::Get()->get_browser_interface()); umount("/"); mount("", "/", "memfs", 0, ""); mount("bin", "/bin", "httpfs", 0, ""); // Init the main emulator objects cpu = new CPU(this); // Create thread to load boot images if (pthread_create(&tid, NULL, LoadResourcesAndStart, this)) { fprintf(stderr, "ERROR: OREmulatorInstance.Init() failed to create pthread"); return false; } return true; }
explicit MoonlightInstance(PP_Instance instance) : pp::Instance(instance), pp::MouseLock(this), m_IsPainting(false), m_RequestIdrFrame(false), m_OpusDecoder(NULL), m_CallbackFactory(this), m_MouseLocked(false), m_KeyModifiers(0), m_WaitingForAllModifiersUp(false), m_AccumulatedTicks(0), openHttpThread(this) { // This function MUST be used otherwise sockets don't work (nacl_io_init() doesn't work!) nacl_io_init_ppapi(pp_instance(), pp::Module::Get()->get_browser_interface()); LiInitializeStreamConfiguration(&m_StreamConfig); pp::TextInputController(this).SetTextInputType(PP_TEXTINPUT_TYPE_NONE); m_GamepadApi = static_cast<const PPB_Gamepad*>(pp::Module::Get()->GetBrowserInterface(PPB_GAMEPAD_INTERFACE)); openHttpThread.Start(); }