void DNSServiceQueryRecordReplyCallback ( DNSServiceRef DNSServiceRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl, void *context ) { (void)DNSServiceRef; (void)flags; (void)errorCode; (void)rrtype; (void)rrclass; (void)ttl; (void)context; assert( rdlen == 4 ); const byte *ip = (const byte *)rdata; char interfaceName[IF_NAMESIZE]; if_indextoname( interfaceIndex, interfaceName ); printf( "DNSServiceQueryRecordReplyCallback: %s, interface[%i] = %s, [%i] = %i.%i.%i.%i\n", fullname, interfaceIndex, interfaceName, rdlen, ip[0], ip[1], ip[2], ip[3] ); ReportNetworkInterfaces(); memset( &resolvedServerAddress, 0, sizeof( resolvedServerAddress ) ); struct sockaddr_in *sin = (struct sockaddr_in *)&resolvedServerAddress; sin->sin_len = sizeof( resolvedServerAddress ); sin->sin_family = AF_INET; sin->sin_port = htons( DOOM_PORT ); memcpy( &sin->sin_addr, ip, 4 ); gotServerAddress = true; }
void iphoneStartup() { int start = SysIphoneMilliseconds(); // print networking information ReportNetworkInterfaces(); // microseconds will be plenty random for playerID and localGameID playerID = localGameID = SysIphoneMicroseconds(); InitImmediateModeGL(); // init OpenAL before pak file, so the pak file can // make all the al static buffers Sound_Init(); // get our new-style pak file char pakFile[1024]; sprintf( pakFile, "%s/base/base.iPack", SysIphoneGetAppDir() ); PK_Init( pakFile ); // register console commands Cmd_AddCommand( "listcvars", Cvar_List_f ); Cmd_AddCommand( "resetcvars", Cvar_Reset_f ); Cmd_AddCommand( "resetmaps", ResetMaps_f ); Cmd_AddCommand( "listcmds", Cmd_ListCommands_f ); Cmd_AddCommand( "give", Give_f ); Cmd_AddCommand( "god", God_f ); Cmd_AddCommand( "mail", EmailConsole ); //gsh, mails the console to id // register console variables Cvar_Get( "version", va( "%3.1f %s %s", DOOM_IPHONE_VERSION, __DATE__, __TIME__ ), 0 ); skill = Cvar_Get( "skill", "1", CVAR_ARCHIVE ); episode = Cvar_Get( "episode", "0", CVAR_ARCHIVE ); controlScheme = Cvar_Get( "controlScheme", "0", CVAR_ARCHIVE ); stickTurn = Cvar_Get( "stickTurn", "128", CVAR_ARCHIVE ); stickMove = Cvar_Get( "stickMove", "128", CVAR_ARCHIVE ); stickDeadBand = Cvar_Get( "stickDeadBand", "0.2", CVAR_ARCHIVE ); rotorTurn = Cvar_Get( "rotorTurn", "50000", CVAR_ARCHIVE ); tiltTurn = Cvar_Get( "tiltTurn", "0", CVAR_ARCHIVE ); tiltMove = Cvar_Get( "tiltMove", "0", CVAR_ARCHIVE ); tiltDeadBand = Cvar_Get( "tiltDeadBand", "0.08", CVAR_ARCHIVE ); tiltAverages = Cvar_Get( "tiltAverages", "3", CVAR_ARCHIVE ); centerSticks = Cvar_Get( "centerSticks", "1", CVAR_ARCHIVE ); rampTurn = Cvar_Get( "rampTurn", "1", CVAR_ARCHIVE ); music = Cvar_Get( "music", "1", CVAR_ARCHIVE ); cropSprites = Cvar_Get( "cropSprites", "1", 0 ); revLand = Cvar_Get( "revLand", "0", CVAR_ARCHIVE ); mapScale = Cvar_Get( "mapScale", "10", CVAR_ARCHIVE ); drawControls = Cvar_Get( "drawControls", "1", CVAR_ARCHIVE ); autoUse = Cvar_Get( "autoUse", "1", CVAR_ARCHIVE ); statusBar = Cvar_Get( "statusBar", "1", CVAR_ARCHIVE ); touchClick = Cvar_Get( "touchClick", "0.15", CVAR_ARCHIVE ); messages = Cvar_Get( "messages", "1", CVAR_ARCHIVE ); mapSelectY = Cvar_Get( "mapSelectY", "0", CVAR_ARCHIVE ); miniNet = Cvar_Get( "miniNet", "1", CVAR_ARCHIVE ); // multiplayer setup timeLimit = Cvar_Get( "timeLimit", "0", CVAR_ARCHIVE ); fragLimit = Cvar_Get( "fragLimit", "5", CVAR_ARCHIVE ); mpDeathmatch = Cvar_Get( "mpDeathmatch", "0", CVAR_ARCHIVE ); mpDataset = Cvar_Get( "mpDataset", "0", CVAR_ARCHIVE ); mpEpisode = Cvar_Get( "mpEpisode", "1", CVAR_ARCHIVE ); mpSkill = Cvar_Get( "mpSkill", "1", CVAR_ARCHIVE ); mpMap = Cvar_Get( "mpMap", "1", CVAR_ARCHIVE ); // debug tools showTilt = Cvar_Get( "showTilt", "-1", 0 ); showTime = Cvar_Get( "showTime", "0", 0 ); showNet = Cvar_Get( "showNet", "0", 0 ); showSound = Cvar_Get( "showSound", "0", 0 ); noBlend = Cvar_Get( "noBlend", "0", 0 ); // disable the damae blends for screenshots glfinish = Cvar_Get( "glfinish", "0", 0 ); throttle = Cvar_Get( "throttle", "1", 0 ); // network packet throttle enable netBuffer = Cvar_Get( "netBuffer", "4", 0 ); // max tics to buffer ahead // load the archived cvars Cmd_ExecuteFile( va( "%s/config.cfg", SysIphoneGetDocDir() ) ); // make sure volume changes and incoming calls draw the right orientation SysIPhoneSetUIKitOrientation( revLand->value ); // start the intro music if it wasn't disabled with the music cvar iphonePlayMusic( "intro" ); // iphonePlayMusic( "e1m1" ); // these should get overwritten by the config loading memset( &playState, 0, sizeof( playState ) ); playState.map.skill = 1; playState.map.episode = 1; playState.map.map = 1; HudSetForScheme( 0 ); // load the binary config file FILE *f = fopen( va( "%s/binaryConfig.bin", SysIphoneGetDocDir() ), "rb" ); if ( f ) { int version; version = 0; fread( &version, 1, sizeof( version ), f ); if ( version != VERSION_BCONFIG ) { Com_Printf( "Binary config file bad version.\n" ); } else { fread( &playState, 1, sizeof( playState ), f ); fread( &huds, 1, sizeof( huds ), f ); version = 0; fread( &version, 1, sizeof( version ), f ); if ( version != VERSION_BCONFIG ) { Com_Error( "Binary config file bad trailing version.\n" ); } } fclose( f ); } Com_Printf( "startup time: %i msec\n", SysIphoneMilliseconds() - start ); start = SysIphoneMilliseconds(); // the texnums might have been different in the savegame HudSetTexnums(); #ifdef USE_ID_FONT arialFontTexture = PK_FindTexture( "iphone/arialImageLAL.tga" ); #else arialFontTexture = PK_FindTexture( "iphone/droidImageLAL.tga" ); #endif Com_Printf( "preloadBeforePlay(): %i msec\n", SysIphoneMilliseconds() - start ); Com_Printf( "---------- D_DoomMain ----------\n" ); D_DoomMainSetup(); // put savegames here strcpy( basesavegame, SysIphoneGetDocDir() ); // prBoom seems to draw the static pic screens without setting up 2D, causing // a bad first frame iphoneSet2D(); menuState = IPM_MAIN; #if 0 // jump right to the save spot for debugging ResumeGame(); #endif }