const char * XPMPMultiplayerInit( const char * inCSLFolder, const char * inRelatedPath, const char * inTexturePath, const char * inDoc8643, const char * inDefaultPlane, int (* inIntPrefsFunc)(const char *, const char *, int), float (* inFloatPrefsFunc)(const char *, const char *, float)) { gDefaultPlane = inDefaultPlane; gIntPrefsFunc = inIntPrefsFunc; gFloatPrefsFunc = inFloatPrefsFunc; char myPath[1024]; char airPath[1024]; char line[256]; char sysPath[1024]; FILE * fi; bool problem = false; // TODO - FORM GOOD DIAGNOSTIC MESSAGES HERE! // Initialize our OpenGL Utilities OGL_UtilsInit(); if (!CSL_LoadCSL(inCSLFolder, inRelatedPath, inDoc8643)) problem = true; XPMPInitDefaultPlaneRenderer(); if (!CSL_Init(inTexturePath)) problem = true; // Register the plane control calls. XPLMRegisterDrawCallback(XPMPControlPlaneCount, xplm_Phase_Gauges, 0, /* after*/ 0 /* hide planes*/); XPLMRegisterDrawCallback(XPMPControlPlaneCount, xplm_Phase_Gauges, 1, /* before */ (void *) -1 /* show planes*/); // Register the actual drawing func. XPLMRegisterDrawCallback(XPMPRenderMultiplayerPlanes, xplm_Phase_Airplanes, 0, /* after*/ 0 /* refcon */); if (problem) return "There were problems initializing XSquawkBox. Please examine X-Plane's error.out file for detailed information."; else return ""; }
/* * ======== SERVICES_Init ======== * Purpose: * Initializes SERVICES modules. */ bool SERVICES_Init(void) { bool fInit = true; bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM; bool fREG, fSYNC, fCLK, fNTFY; DBC_Require(cRefs >= 0); if (cRefs == 0) { GT_init(); GT_create(&SERVICES_debugMask, "OS"); /* OS for OSal */ GT_0trace(SERVICES_debugMask, GT_ENTER, "SERVICES_Init: entered\n"); /* Perform required initialization of SERVICES modules. */ fMEM = MEM_Init(); fREG = REG_Init(); fCFG = CFG_Init(); fCSL = CSL_Init(); fDBG = DBG_Init(); fDPC = DPC_Init(); fKFILE = KFILE_Init(); fLST = LST_Init(); fSYNC = SYNC_Init(); fCLK = CLK_Init(); fNTFY = NTFY_Init(); fInit = fCFG && fCSL && fDBG && fDPC && fKFILE && fLST && fMEM && fREG && fSYNC && fCLK; if (!fInit) { if (fNTFY) NTFY_Exit(); if (fSYNC) SYNC_Exit(); if (fCLK) CLK_Exit(); if (fREG) REG_Exit(); if (fLST) LST_Exit(); if (fKFILE) KFILE_Exit(); if (fDPC) DPC_Exit(); if (fDBG) DBG_Exit(); if (fCSL) CSL_Exit(); if (fCFG) CFG_Exit(); if (fMEM) MEM_Exit(); } } if (fInit) cRefs++; GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Init: cRefs 0x%x\n", cRefs); DBC_Ensure((fInit && (cRefs > 0)) || (!fInit && (cRefs >= 0))); return fInit; }