MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / InitIOSystems

Function InitIOSystems

Descent3/init.cpp:1399–1555  ·  view source on GitHub ↗

I/O systems initialization */

Source from the content-addressed store, hash-verified

1397 I/O systems initialization
1398*/
1399void InitIOSystems(bool editor) {
1400 ddio_init_info io_info;
1401
1402 // Set the base directory
1403 int dirarg = FindArg("-setdir");
1404 int exedirarg = FindArg("-useexedir");
1405 if (dirarg) {
1406 strncpy(Base_directory, GameArgs[dirarg + 1], sizeof(Base_directory) - 1);
1407 Base_directory[sizeof(Base_directory) - 1] = '\0';
1408 } else if (exedirarg) {
1409 char exec_path[_MAX_PATH];
1410 memset(exec_path, 0, sizeof(exec_path));
1411 // Populate exec_path with the executable path
1412 if (!ddio_GetBinaryPath(exec_path, sizeof(exec_path))) {
1413 Error("Failed to get executable path\n");
1414 } else {
1415 std::filesystem::path executablePath(exec_path);
1416 std::string baseDirectoryString = executablePath.parent_path().string();
1417 strncpy(Base_directory, baseDirectoryString.c_str(), sizeof(Base_directory) - 1);
1418 Base_directory[sizeof(Base_directory) - 1] = '\0';
1419 mprintf(0, "Using working directory of %s\n", Base_directory);
1420 }
1421 } else {
1422 ddio_GetWorkingDir(Base_directory, sizeof(Base_directory));
1423 }
1424
1425 ddio_SetWorkingDir(Base_directory);
1426
1427 Descent->set_defer_handler(D3DeferHandler);
1428
1429#ifndef RELEASE
1430 if (!editor && !FindArg("-windowed")) {
1431 if (Dedicated_server) {
1432 ddio_MouseMode(MOUSE_STANDARD_MODE);
1433 } else {
1434 ddio_MouseMode(MOUSE_EXCLUSIVE_MODE);
1435 }
1436 }
1437#else
1438 ddio_MouseMode(MOUSE_EXCLUSIVE_MODE);
1439#endif
1440
1441 // do io init stuff
1442 io_info.obj = Descent;
1443 io_info.joy_emulation = (bool)((FindArg("-alternatejoy") == 0) && (FindArg("-directinput") == 0));
1444 io_info.key_emulation = true; //(bool)(FindArg("-slowkey")!=0); WIN95: DirectInput is flaky for some keys.
1445 INIT_MESSAGE(("Initializing DDIO systems."));
1446 if (!ddio_Init(&io_info)) {
1447 Error("I/O initialization failed.");
1448 }
1449
1450 rtp_Init();
1451 RTP_ENABLEFLAGS(RTI_FRAMETIME | RTI_RENDERFRAMETIME | RTI_MULTIFRAMETIME | RTI_MUSICFRAMETIME |
1452 RTI_AMBSOUNDFRAMETIME);
1453 RTP_ENABLEFLAGS(RTI_WEATHERFRAMETIME | RTI_PLAYERFRAMETIME | RTI_DOORFRAMETIME | RTI_LEVELGOALTIME |
1454 RTI_MATCENFRAMETIME);
1455 RTP_ENABLEFLAGS(RTI_OBJFRAMETIME | RTI_AIFRAMETIME | RTI_PROCESSKEYTIME);
1456

Callers 1

InitD3Systems1Function · 0.85

Calls 15

ddio_GetBinaryPathFunction · 0.85
ErrorFunction · 0.85
ddio_MouseModeFunction · 0.85
ddio_InitFunction · 0.85
rtp_InitFunction · 0.85
LoadGameSettingsFunction · 0.85
SetupTempDirectoryFunction · 0.85
DeleteTempFilesFunction · 0.85
mng_InitTableFilesFunction · 0.85
cf_OpenLibraryFunction · 0.85
cfexistFunction · 0.85
DebugGraph_InitializeFunction · 0.85

Tested by

no test coverage detected