MCPcopy Create free account
hub / github.com/Inori/GPCS4 / initializeModules

Method initializeModules

GPCS4/Loader/ModuleLoader.cpp:330–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328
329
330bool ModuleLoader::initializeModules()
331{
332 auto &mods = m_modSystem.getAllNativeModules();
333 bool retVal = true;
334
335 auto tlsManager = TLSManager::GetInstance();
336 uint32_t tlsIndex = TLS_MODULE_ID_MAIN;
337 // intialize TLS
338 for (auto const &mod : mods)
339 {
340 void *pTls = nullptr;
341 uint32_t initSize = 0;
342 uint32_t totalSize = 0;
343 uint32_t align = 0;
344 retVal = mod.getTLSInfo(&pTls, &initSize, &totalSize, &align);
345 if (!retVal || pTls == nullptr)
346 {
347 LOG_DEBUG("no TLS info for module:%s", mod.fileName.c_str());
348 continue;
349 }
350
351 TLSBlock block;
352 block.address = pTls;
353 block.initSize = initSize;
354 block.totalSize = totalSize;
355 block.align = align;
356 block.index = tlsIndex;
357 block.isDynamic = false;
358 block.offset = 0;
359 tlsManager->registerTLSBlock(block);
360
361 ++tlsIndex;
362 }
363
364 // skip eboot.bin
365 for (size_t i = 1; i < mods.size(); i++)
366 {
367 if (m_moduleInitBlackList.find(mods[i].fileName) != m_moduleInitBlackList.end())
368 {
369 // skip black list modules
370 continue;
371 }
372
373 int ret = mods[i].initialize();
374 if (ret != 0)
375 {
376 LOG_ERR("unable to initialize module %s. ret=%d",
377 mods[i].fileName.c_str(), ret);
378 retVal = false;
379 break;
380 }
381 }
382
383 return retVal;
384}
385
386

Callers

nothing calls this directly

Calls 7

getTLSInfoMethod · 0.80
registerTLSBlockMethod · 0.80
c_strMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected