MCPcopy Create free account
hub / github.com/defold/defold / LoadBootstrapContent

Function LoadBootstrapContent

engine/engine/src/engine.cpp:2445–2496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2443 }
2444
2445 bool LoadBootstrapContent(HEngine engine, dmConfigFile::HConfig config)
2446 {
2447 dmResource::Result fact_error;
2448#if !defined(DM_RELEASE)
2449 const char* system_font_map = "/builtins/fonts/debug/always_on_top.fontc";
2450 fact_error = dmResource::Get(engine->m_Factory, system_font_map, (void**) &engine->m_SystemFont);
2451 if (fact_error != dmResource::RESULT_OK)
2452 {
2453 dmLogFatal("Could not load system font map '%s'.", system_font_map);
2454 return false;
2455 }
2456 dmRender::SetSystemFontMap(engine->m_RenderContext, ResFontGetHandle(engine->m_SystemFont));
2457#endif
2458 // The system font is currently the only resource we need from the connection app
2459 // After this point, the rest of the resources should be loaded the ordinary way
2460 if (!engine->m_ConnectionAppMode)
2461 {
2462 int unload = dmConfigFile::GetInt(engine->m_Config, "dmengine.unload_builtins", 1);
2463 if (unload)
2464 {
2465 dmResource::ReleaseBuiltinsArchive(engine->m_Factory);
2466 }
2467 }
2468
2469 const char* gamepads = dmConfigFile::GetString(config, "input.gamepads", 0);
2470 if (gamepads)
2471 {
2472 dmInputDDF::GamepadMaps* gamepad_maps_ddf;
2473 fact_error = dmResource::Get(engine->m_Factory, gamepads, (void**)&gamepad_maps_ddf);
2474 if (fact_error != dmResource::RESULT_OK)
2475 return false;
2476 dmInput::RegisterGamepads(engine->m_InputContext, gamepad_maps_ddf);
2477 dmResource::Release(engine->m_Factory, gamepad_maps_ddf);
2478 }
2479
2480 const char* game_input_binding = dmConfigFile::GetString(config, "input.game_binding", "/input/game.input_bindingc");
2481 fact_error = dmResource::Get(engine->m_Factory, game_input_binding, (void**)&engine->m_GameInputBinding);
2482 if (fact_error != dmResource::RESULT_OK)
2483 return false;
2484
2485 const char* render_path = dmConfigFile::GetString(config, "bootstrap.render", "/builtins/render/default.renderc");
2486 fact_error = dmResource::Get(engine->m_Factory, render_path, (void**)&engine->m_RenderScriptPrototype);
2487 if (fact_error != dmResource::RESULT_OK)
2488 return false;
2489
2490 const char* display_profiles_path = dmConfigFile::GetString(config, "display.display_profiles", "/builtins/render/default.display_profilesc");
2491 fact_error = dmResource::Get(engine->m_Factory, display_profiles_path, (void**)&engine->m_DisplayProfiles);
2492 if (fact_error != dmResource::RESULT_OK)
2493 return false;
2494
2495 return true;
2496 }
2497
2498 void UnloadBootstrapContent(HEngine engine)
2499 {

Callers 1

engine.cppFile · 0.85

Calls 8

SetSystemFontMapFunction · 0.85
ResFontGetHandleFunction · 0.85
ReleaseBuiltinsArchiveFunction · 0.85
RegisterGamepadsFunction · 0.85
GetFunction · 0.50
GetIntFunction · 0.50
GetStringFunction · 0.50
ReleaseFunction · 0.50

Tested by

no test coverage detected