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

Function Reboot

engine/engine/src/engine.cpp:2277–2314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2275 }
2276
2277 static void Reboot(HEngine engine, dmSystemDDF::Reboot* reboot)
2278 {
2279 engine->m_RunResult.Free();
2280 memset(engine->m_RunResult.m_Argv, 0, sizeof(engine->m_RunResult.m_Argv));
2281
2282 int argc = 0;
2283 engine->m_RunResult.m_Argv[argc++] = strdup("dmengine");
2284
2285 // This value should match the count in dmSystemDDF::Reboot
2286 const int ARG_COUNT = 6;
2287 const char* args[ARG_COUNT] =
2288 {
2289 reboot->m_Arg1,
2290 reboot->m_Arg2,
2291 reboot->m_Arg3,
2292 reboot->m_Arg4,
2293 reboot->m_Arg5,
2294 reboot->m_Arg6,
2295 };
2296
2297 for (int i = 0; i < ARG_COUNT; ++i)
2298 {
2299 const char* arg = args[i];
2300 if (arg == 0 || arg[0] == '\0')
2301 {
2302 break;
2303 }
2304
2305 // NOTE: +1 here, see above
2306 engine->m_RunResult.m_Argv[i + 1] = strdup(arg);
2307 argc++;
2308 }
2309
2310 engine->m_RunResult.m_Argc = argc;
2311
2312 engine->m_Alive = false;
2313 engine->m_RunResult.m_Action = dmEngine::RunResult::REBOOT;
2314 }
2315
2316 static void Dispatch(dmMessage::Message* message, void* user_ptr)
2317 {

Callers 1

DispatchFunction · 0.85

Calls 1

FreeMethod · 0.45

Tested by

no test coverage detected