void Component::deleteAllResources() { ConfigurationManagerLocker locker(m_confManager); // This is not the most efficient algorithm, but for a limited number of different // resource names it should be quick enough. Here we also remove owner-resource // maps that become empty QMap<QString, QMap<Component*, ResourceHandler*> >::iterator it = resources().begin(); while (it != resources().end()) { QMap<Component*, ResourceHandler*>::iterator ownerResourceIt = it.value().find(this); if (ownerResourceIt != it.value().end()) { // This will not call resourceChanged of self if this function is // called by the destructor because when we get here the child classes // have already been destroyed and their vtable removed delete ownerResourceIt.value(); it.value().erase(ownerResourceIt); } if (it.value().isEmpty()) { it = resources().erase(it); } else { ++it; } } }
int main(int argc, char *argv[]) { std::ostream& stream = std::cout; const char *parm = (argc > 1 ? argv[1] : 0); stream << "welcome to goat attack "; stream << GameVersion; stream << "...\n" << std::endl; init_hpet(); start_net(); try { Configuration config(UserDirectory, ConfigFilename); #ifdef DEDICATED_SERVER SubsystemNull subsystem(stream, "Goat Attack"); #else SubsystemSDL subsystem(stream, "Goat Attack", config.get_bool("shading_pipeline")); #endif #ifdef __APPLE__ CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); char path[PATH_MAX]; if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { throw Exception("Cannot get bundle path"); } CFRelease(resourcesURL); std::string data_directory(path); Resources resources(subsystem, data_directory); #else # ifdef DEDICATED_SERVER const char *data_directory = STRINGIZE_VALUE_OF(DATA_DIRECTORY); # else const char *data_directory = (parm ? parm : STRINGIZE_VALUE_OF(DATA_DIRECTORY)); # endif Resources resources(subsystem, data_directory); #endif Game game(resources, subsystem, config); game.run(parm ? parm : ""); } catch (const ResourcesMissingException& e) { stream << std::endl << "ERROR: "; #ifdef DEDICATED_SERVER stream << e.what() << std::endl; #else stream << e.what() << std::endl; stream << "Ensure that you can add a data folder as parameter." << std::endl; stream << "Example: " << argv[0] << " path/to/your/data/folder" << std::endl; #endif } catch (const Exception& e) { stream << std::endl << "ERROR: "; stream << e.what() << std::endl; } stop_net(); stream << "\nbye bye... :)" << std::endl; return 0; }
Resource::Resource(const std::string& group): _overrideGroup(nullptr) { _group = resources().find(group); CORRADE_ASSERT(_group != resources().end(), "Utility::Resource: group" << '\'' + group + '\'' << "was not found", ); if(!_group->second.overrideGroup.empty()) { Debug() << "Utility::Resource: group" << '\'' + group + '\'' << "overriden with" << '\'' + _group->second.overrideGroup + '\''; _overrideGroup = new OverrideData(_group->second.overrideGroup); if(_overrideGroup->conf.value("group") != _group->first) Warning() << "Utility::Resource: overriden with different group, found" << '\'' + _overrideGroup->conf.value("group") + '\'' << "but expected" << '\'' + group + '\''; } }
void DeskbarView::_InitBitmaps() { for (int i = 0; i < kStatusCount; i++) fBitmaps[i] = NULL; image_info info; if (our_image(&info) != B_OK) return; BFile file(info.name, B_READ_ONLY); if (file.InitCheck() != B_OK) return; BResources resources(&file); if (resources.InitCheck() != B_OK) return; for (int i = 0; i < kStatusCount; i++) { const void* data = NULL; size_t size; data = resources.LoadResource(B_VECTOR_ICON_TYPE, kIconNoMail + i, &size); if (data != NULL) { BBitmap* icon = new BBitmap(Bounds(), B_RGBA32); if (icon->InitCheck() == B_OK && BIconUtils::GetVectorIcon((const uint8 *)data, size, icon) == B_OK) { fBitmaps[i] = icon; } else delete icon; } } }
void ProtocolSettings::_Init() { // Find protocol add-on BPath dllPath(fAddOn->Path()); BFile file(dllPath.Path(), B_READ_ONLY); if (file.InitCheck() < B_OK) { fStatus = file.InitCheck(); return; } BResources resources(&file); if (resources.InitCheck() != B_OK) { fStatus = resources.InitCheck(); return; } size_t size; const void* data = resources.LoadResource(B_MESSAGE_TYPE, kProtocolSettingsTemplate, &size); if (!data) { fStatus = B_BAD_VALUE; return; } // Load protocol's settings template fTemplate->Unflatten((const char*)data); }
status_t BIconButton::SetIcon(int32 resourceID) { app_info info; status_t status = be_app->GetAppInfo(&info); if (status != B_OK) return status; BResources resources(&info.ref); status = resources.InitCheck(); if (status != B_OK) return status; size_t size; const void* data = resources.LoadResource(B_VECTOR_ICON_TYPE, resourceID, &size); if (data != NULL) { BBitmap bitmap(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_RGBA32); status = bitmap.InitCheck(); if (status != B_OK) return status; status = BIconUtils::GetVectorIcon(reinterpret_cast<const uint8*>(data), size, &bitmap); if (status != B_OK) return status; return SetIcon(&bitmap); } // const void* data = resources.LoadResource(B_BITMAP_TYPE, resourceID, &size); return B_ERROR; }
void XRandRScreens::update() { auto fallback = [this]() { m_geometries << QRect(); setCount(1); }; m_geometries.clear(); T resources(rootWindow()); if (resources.isNull()) { fallback(); return; } xcb_randr_crtc_t *crtcs = resources.crtcs(); QVector<Xcb::RandR::CrtcInfo> infos(resources->num_crtcs); for (int i = 0; i < resources->num_crtcs; ++i) { infos[i] = Xcb::RandR::CrtcInfo(crtcs[i], resources->config_timestamp); } for (int i = 0; i < resources->num_crtcs; ++i) { Xcb::RandR::CrtcInfo info(infos.at(i)); const QRect geo = info.rect(); if (geo.isValid()) { m_geometries << geo; } } if (m_geometries.isEmpty()) { fallback(); return; } setCount(m_geometries.count()); }
static void init_everything(void) { log_init("rtpengine"); log_format(rtpe_config.log_format); recording_fs_init(rtpe_config.spooldir, rtpe_config.rec_method, rtpe_config.rec_format); rtpe_ssl_init(); #if !GLIB_CHECK_VERSION(2,32,0) g_thread_init(NULL); #endif #if !(GLIB_CHECK_VERSION(2,36,0)) g_type_init(); #endif signals(); resources(); sdp_init(); dtls_init(); ice_init(); crypto_init_main(); interfaces_init(&rtpe_config.interfaces); iptables_init(); control_ng_init(); if (call_interfaces_init()) abort(); statistics_init(); codeclib_init(0); media_player_init(); }
void Java_cc_openframeworks_OFAndroid_setAppDataDir( JNIEnv* env, jobject thiz, jstring data_dir, jstring app_name ) { jboolean iscopy; const char *mfile = env->GetStringUTFChars(data_dir, &iscopy); __android_log_print(ANDROID_LOG_INFO,"OF",("Setting app dir name to: " + string(mfile)).c_str()); ofSetDataPathRoot(string(mfile)+"/"); string appname = env->GetStringUTFChars(app_name, &iscopy); __android_log_print(ANDROID_LOG_INFO,"OF",("app name: " + appname).c_str()); if(appname!=""){ string resources_name = ofToLower(appname + "resources.zip"); __android_log_print(ANDROID_LOG_INFO,"OF",("uncompressing " + resources_name).c_str()); ofFile resources(resources_name); __android_log_print(ANDROID_LOG_INFO,"OF",("uncompressing " + resources.getAbsolutePath()).c_str()); if(resources.exists()){ unzFile zip = unzOpen(resources.getAbsolutePath().c_str()); char current_dir[1000]; getcwd(current_dir,1000); chdir(ofToDataPath("",true).c_str()); do_extract(zip,0,1,NULL); chdir(current_dir); resources.remove(); } } }
void compile(const char* path, CompileOptions& opts) { Buffer buf = opts.read(path); TempAllocator4096 ta; JsonObject object(ta); sjson::parse(buf, object); JsonArray texture(ta); JsonArray script(ta); JsonArray sound(ta); JsonArray mesh(ta); JsonArray unit(ta); JsonArray sprite(ta); JsonArray material(ta); JsonArray font(ta); JsonArray level(ta); JsonArray phyconf(ta); JsonArray shader(ta); JsonArray sprite_animation(ta); if (json_object::has(object, "texture")) sjson::parse_array(object["texture"], texture); if (json_object::has(object, "lua")) sjson::parse_array(object["lua"], script); if (json_object::has(object, "sound")) sjson::parse_array(object["sound"], sound); if (json_object::has(object, "mesh")) sjson::parse_array(object["mesh"], mesh); if (json_object::has(object, "unit")) sjson::parse_array(object["unit"], unit); if (json_object::has(object, "sprite")) sjson::parse_array(object["sprite"], sprite); if (json_object::has(object, "material")) sjson::parse_array(object["material"], material); if (json_object::has(object, "font")) sjson::parse_array(object["font"], font); if (json_object::has(object, "level")) sjson::parse_array(object["level"], level); if (json_object::has(object, "physics_config")) sjson::parse_array(object["physics_config"], phyconf); if (json_object::has(object, "shader")) sjson::parse_array(object["shader"], shader); if (json_object::has(object, "sprite_animation")) sjson::parse_array(object["sprite_animation"], sprite_animation); Array<PackageResource::Resource> resources(default_allocator()); compile_resources("texture", texture, resources, opts); compile_resources("lua", script, resources, opts); compile_resources("sound", sound, resources, opts); compile_resources("mesh", mesh, resources, opts); compile_resources("unit", unit, resources, opts); compile_resources("sprite", sprite, resources, opts); compile_resources("material", material, resources, opts); compile_resources("font", font, resources, opts); compile_resources("level", level, resources, opts); compile_resources("physics_config", phyconf, resources, opts); compile_resources("shader", shader, resources, opts); compile_resources("sprite_animation", sprite_animation, resources, opts); // Write opts.write(RESOURCE_VERSION_PACKAGE); opts.write(array::size(resources)); for (u32 i = 0; i < array::size(resources); ++i) { opts.write(resources[i].type); opts.write(resources[i].name); } }
int uavcannode_start(int argc, char *argv[]) { resources("Before board_app_initialize"); board_app_initialize(NULL); resources("After board_app_initialize"); // CAN bitrate int32_t bitrate = 0; // Node ID int32_t node_id = 0; // Did the bootloader auto baud and get a node ID Allocated bootloader_app_shared_t shared; int valid = bootloader_app_shared_read(&shared, BootLoader); if (valid == 0) { bitrate = shared.bus_speed; node_id = shared.node_id; // Invalidate to prevent deja vu bootloader_app_shared_invalidate(); } else { // Node ID (void)param_get(param_find("CANNODE_NODE_ID"), &node_id); (void)param_get(param_find("CANNODE_BITRATE"), &bitrate); } if (node_id < 0 || node_id > uavcan::NodeID::Max || !uavcan::NodeID(node_id).isUnicast()) { warnx("Invalid Node ID %i", node_id); ::exit(1); } // Start warnx("Node ID %u, bitrate %u", node_id, bitrate); int rv = UavcanNode::start(node_id, bitrate); resources("After UavcanNode::start"); ::sleep(1); return rv; }
int main() { GameResources resources("Ludum Dare 33: You Are The Virus"); ng::StateStack states; states.add<GameState>("Game", resources); states.start("Game"); return 0; }
std::unique_ptr<WebNotificationResources> NotificationResourcesLoader::getResources() const { std::unique_ptr<WebNotificationResources> resources( new WebNotificationResources()); resources->image = m_image; resources->icon = m_icon; resources->badge = m_badge; resources->actionIcons = m_actionIcons; return resources; }
std::vector<std::string> Resource::list() const { CORRADE_INTERNAL_ASSERT(_group != resources().end()); std::vector<std::string> result; result.reserve(_group->second.resources.size()); for(const auto& filename: _group->second.resources) result.push_back(filename.first); return result; }
ResourceHandler* Component::getResourceHandlerForOurResource(QString name) { ResourceHandler* h = getResourceHandlerWithOwner(name, this); if (h == nullptr) { // Adding an non-existant resource (in an exception-safe way) std::unique_ptr<ResourceHandler> hp(new ResourceHandler(name, this)); resources()[name][this] = hp.get(); h = hp.release(); } return h; }
TermInfosReaderThreadResourcesPtr TermInfosReader::getThreadResources() { TermInfosReaderThreadResourcesPtr resources(threadResources.get()); if (!resources) { resources = newLucene<TermInfosReaderThreadResources>(); resources->termEnum = terms(); // Cache does not have to be thread-safe, it is only used by one thread at the same time resources->termInfoCache = newInstance<TermInfoCache>(DEFAULT_CACHE_SIZE); threadResources.set(resources); } return resources; }
void KasBar::addTestItems() { KasItem *i = new KasItem( this ); insert( 0, i ); i->setText( "Animated" ); i->setIcon( KGlobal::iconLoader()->loadIcon( "icons", KIconLoader::NoGroup, KIconLoader::SizeMedium ) ); i->setAnimation( resources()->startupAnimation() ); QTimer *aniTimer = new QTimer( i ); connect( aniTimer, SIGNAL( timeout() ), i, SLOT( advanceAnimation() ) ); aniTimer->start( 100 ); i->setShowAnimation( true ); updateLayout(); }
static void add_subdict( const SkTDArray<SkPDFObject*>& resourceList, SkPDFResourceDict::SkPDFResourceType type, SkPDFDict* dst) { if (0 == resourceList.count()) { return; } SkAutoTUnref<SkPDFDict> resources(new SkPDFDict); for (int i = 0; i < resourceList.count(); i++) { resources->insertObjRef(SkPDFResourceDict::getResourceName(type, i), SkRef(resourceList[i])); } dst->insertObject(get_resource_type_name(type), resources.detach()); }
void NetworkStatusView::_UpdateBitmaps() { for (int i = 0; i < kStatusCount; i++) { delete fTrayIcons[i]; delete fNotifyIcons[i]; fTrayIcons[i] = NULL; fNotifyIcons[i] = NULL; } image_info info; if (our_image(info) != B_OK) return; BFile file(info.name, B_READ_ONLY); if (file.InitCheck() < B_OK) return; BResources resources(&file); #ifdef HAIKU_TARGET_PLATFORM_HAIKU if (resources.InitCheck() < B_OK) return; #endif for (int i = 0; i < kStatusCount; i++) { const void* data = NULL; size_t size; data = resources.LoadResource(B_VECTOR_ICON_TYPE, kNetworkStatusNoDevice + i, &size); if (data != NULL) { // Scale main tray icon BBitmap* trayIcon = new BBitmap(Bounds(), B_RGBA32); if (trayIcon->InitCheck() == B_OK && BIconUtils::GetVectorIcon((const uint8 *)data, size, trayIcon) == B_OK) { fTrayIcons[i] = trayIcon; } else delete trayIcon; // Scale notification icon BBitmap* notifyIcon = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32); if (notifyIcon->InitCheck() == B_OK && BIconUtils::GetVectorIcon((const uint8 *)data, size, notifyIcon) == B_OK) { fNotifyIcons[i] = notifyIcon; } else delete notifyIcon; } } }
void Component::deleteResource(QString name) { ConfigurationManagerLocker locker(m_confManager); ResourceHandler* h = getResourceHandlerWithOwner(name, this); if (h == nullptr) { throw ResourceNotDeclaredException(name.toLatin1().data()); } delete h; if (Q_UNLIKELY(resources()[name].remove(this) != 1)) { qFatal("Internal error, not one single resource with the given name for one owner"); } }
bool is_resource(BFile& file) { BResources resources(&file); if (resources.InitCheck() != B_OK) return false; BNodeInfo nodeInfo(&file); char type[B_MIME_TYPE_LENGTH]; if (nodeInfo.GetType(type) != B_OK || strcasecmp(type, B_RESOURCE_MIME_TYPE)) return false; return true; }
status_t VBoxGuestDeskbarView::_Init(BMessage *archive) { BString toolTipText; toolTipText << VBOX_PRODUCT << " Guest Additions "; toolTipText << VBOX_VERSION_MAJOR << "." << VBOX_VERSION_MINOR << "." << VBOX_VERSION_BUILD; toolTipText << "r" << VBOX_SVN_REV; SetToolTip(toolTipText.String()); image_info info; if (our_image(info) != B_OK) return B_ERROR; BFile file(info.name, B_READ_ONLY); if (file.InitCheck() < B_OK) return B_ERROR; BResources resources(&file); if (resources.InitCheck() < B_OK) return B_ERROR; const void *data = NULL; size_t size; //data = resources.LoadResource(B_VECTOR_ICON_TYPE, // kNetworkStatusNoDevice + i, &size); data = resources.LoadResource('data', 400, &size); if (data != NULL) { BMemoryIO mem(data, size); fIcon = BTranslationUtils::GetBitmap(&mem); } int rc = RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); if (RT_SUCCESS(rc)) { rc = VbglR3Init(); if (RT_SUCCESS(rc)) { fClipboardService = new VBoxClipboardService(); fDisplayService = new VBoxDisplayService(); } else LogRel(("VBoxGuestDeskbarView::_init VbglR3Init failed. rc=%d\n", rc)); } else LogRel(("VBoxGuestDeskbarView::_init RTR3InitDll failed. rc=%d\n", rc)); return RTErrConvertToErrno(rc); }
TEST_F_TEMP_DISABLED_ON_WINDOWS( ResourceOffersTest, ResourceOfferWithMultipleSlaves) { Try<Owned<cluster::Master>> master = StartMaster(); ASSERT_SOME(master); Owned<MasterDetector> detector = master.get()->createDetector(); vector<Owned<cluster::Slave>> slaves; // Start 10 slaves. for (int i = 0; i < 10; i++) { slave::Flags flags = CreateSlaveFlags(); flags.launcher = "posix"; flags.resources = Option<std::string>("cpus:2;mem:1024"); Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags); ASSERT_SOME(slave); slaves.push_back(slave.get()); } MockScheduler sched; MesosSchedulerDriver driver( &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL); EXPECT_CALL(sched, registered(&driver, _, _)); Future<vector<Offer>> offers; EXPECT_CALL(sched, resourceOffers(&driver, _)) .WillOnce(FutureArg<1>(&offers)) .WillRepeatedly(Return()); // All 10 slaves might not be in first offer. driver.start(); AWAIT_READY(offers); ASSERT_FALSE(offers->empty()); EXPECT_GE(10u, offers->size()); Resources resources(offers.get()[0].resources()); EXPECT_EQ(2, resources.get<Value::Scalar>("cpus")->value()); EXPECT_EQ(1024, resources.get<Value::Scalar>("mem")->value()); driver.stop(); driver.join(); }
Containers::ArrayView<const char> Resource::getRaw(const std::string& filename) const { CORRADE_INTERNAL_ASSERT(_group != resources().end()); /* The group is overriden with live data */ if(_overrideGroup) { /* The file is already loaded */ auto it = _overrideGroup->data.find(filename); if(it != _overrideGroup->data.end()) return it->second; /* Load the file and save it for later use. Linear search is not an issue, as this shouldn't be used in production code anyway. */ std::vector<const ConfigurationGroup*> files = _overrideGroup->conf.groups("file"); for(auto file: files) { const std::string name = file->hasValue("alias") ? file->value("alias") : file->value("filename"); if(name != filename) continue; /* Load the file */ bool success; Containers::Array<char> data; std::tie(success, data) = fileContents(Directory::join(Directory::path(_group->second.overrideGroup), file->value("filename"))); if(!success) { Error() << "Utility::Resource::get(): cannot open file" << file->value("filename") << "from overriden group"; break; } /* Save the file for later use and return */ #ifndef CORRADE_GCC47_COMPATIBILITY it = _overrideGroup->data.emplace(filename, std::move(data)).first; #else it = _overrideGroup->data.insert(std::make_pair(filename, std::move(data))).first; #endif return it->second; } /* The file was not found, fallback to compiled-in ones */ Warning() << "Utility::Resource::get(): file" << '\'' + filename + '\'' << "was not found in overriden group, fallback to compiled-in resources"; } const auto it = _group->second.resources.find(filename); CORRADE_ASSERT(it != _group->second.resources.end(), "Utility::Resource::get(): file" << '\'' + filename + '\'' << "was not found in group" << '\'' + _group->first + '\'', nullptr); return it->second; }
static void init_everything() { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); srandom(ts.tv_sec ^ ts.tv_nsec); SSL_library_init(); SSL_load_error_strings(); #if !GLIB_CHECK_VERSION(2,32,0) g_thread_init(NULL); #endif if (!_log_stderr) openlog("rtpengine", LOG_PID | LOG_NDELAY, _log_facility); signals(); resources(); sdp_init(); dtls_init(); }
void Component::removeAllNotifiedResources() { ConfigurationManagerLocker locker(m_confManager); // If in configuration phase, we remove the recorded notification if it exists if (inConfigurationPhase()) { removeAllOurRequestOfResourceChangeNotification(); return; } #warning THIS IS VERY INEFFICIENT, CHANGE IF POSSIBLE for (QMap<QString, QMap<Component*, ResourceHandler*> >::iterator it = resources().begin(); it != resources().end(); ++it) { for (QMap<Component*, ResourceHandler*>::iterator rit = it.value().begin(); rit != it.value().end(); ++rit) { rit.value()->removeNotifee(this); } } }
TEST_F(ResourceOffersTest, ResourceOfferWithMultipleSlaves) { Try<PID<Master>> master = StartMaster(); ASSERT_SOME(master); // Start 10 slaves. for (int i = 0; i < 10; i++) { slave::Flags flags = CreateSlaveFlags(); flags.resources = Option<std::string>("cpus:2;mem:1024"); Try<PID<Slave>> slave = StartSlave(flags); ASSERT_SOME(slave); } MockScheduler sched; MesosSchedulerDriver driver( &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL); EXPECT_CALL(sched, registered(&driver, _, _)) .Times(1); Future<vector<Offer>> offers; EXPECT_CALL(sched, resourceOffers(&driver, _)) .WillOnce(FutureArg<1>(&offers)) .WillRepeatedly(Return()); // All 10 slaves might not be in first offer. driver.start(); AWAIT_READY(offers); EXPECT_NE(0u, offers.get().size()); EXPECT_GE(10u, offers.get().size()); Resources resources(offers.get()[0].resources()); EXPECT_EQ(2, resources.get<Value::Scalar>("cpus").get().value()); EXPECT_EQ(1024, resources.get<Value::Scalar>("mem").get().value()); driver.stop(); driver.join(); Shutdown(); }
/** * Creates a ExtGState with the SMask set to the luminosityShader in * luminosity mode. The shader pattern extends to the bbox. */ SkPDFGraphicState* SkPDFAlphaFunctionShader::CreateSMaskGraphicState() { SkRect bbox; bbox.set(fState.get()->fBBox); SkAutoTUnref<SkPDFObject> luminosityShader( SkPDFShader::GetPDFShaderByState( fState->CreateAlphaToLuminosityState())); SkAutoTUnref<SkStream> alphaStream(create_pattern_fill_content(-1, bbox)); SkAutoTUnref<SkPDFResourceDict> resources(get_gradient_resource_dict(luminosityShader, NULL)); SkAutoTUnref<SkPDFFormXObject> alphaMask( new SkPDFFormXObject(alphaStream.get(), bbox, resources.get())); return SkPDFGraphicState::GetSMaskGraphicState( alphaMask.get(), false, SkPDFGraphicState::kLuminosity_SMaskMode); }
IOReturn IOPlatformExpert::callPlatformFunction(const OSSymbol *functionName, bool waitForFunction, void *param1, void *param2, void *param3, void *param4) { IOService *service, *_resources; if (waitForFunction) { _resources = waitForService(resourceMatching(functionName)); } else { _resources = resources(); } if (_resources == 0) return kIOReturnUnsupported; service = OSDynamicCast(IOService, _resources->getProperty(functionName)); if (service == 0) return kIOReturnUnsupported; return service->callPlatformFunction(functionName, waitForFunction, param1, param2, param3, param4); }
StarObject* DX11Engine::createVideoRendererResources(IUnknown* pDeviceIn, const Filesystem* pFilesystem) const { std::unique_ptr<ID3D11DeviceContext, COMDeleter> pDC; ID3D11Device* pDevice = static_cast<ID3D11Device*>(pDeviceIn); pDevice->GetImmediateContext(ref(pDC)); std::unique_ptr<DX11VideoRendererResources> resources( new DX11VideoRendererResources(pDevice, pDC.get())); if (!resources) return nullptr; try { resources->create(*pFilesystem); } catch (...) { return nullptr; } return resources.release(); }