int FM_Digital_Init() { ConsolePrintf("%s ", Msg_Get(MSG_Sound_Init_YM2413_Digital)); opll = OPLL_new(Z80_DEFAULT_CPU_CLOCK, Sound.SampleRate); if (opll == NULL) { ConsolePrintf("%s\n", Msg_Get(MSG_Failed)); return (MEKA_ERR_FAIL); } // FIXME-NEWSOUND: FM init /* FM_Digital_saChannel = stream_init ("YM-2413 #0", g_sasound.audio_sample_rate, 16, 0, FM_Digital_Update); if (FM_Digital_saChannel == -1) { ConsolePrintf ("%s\n", Msg_Get(MSG_Failed)); return (MEKA_ERR_FAIL); // FIXME: Error in channel creation } stream_set_volume (FM_Digital_saChannel, VOLUME_MAX); */ OPLL_reset(opll); ConsolePrintf("%s\n", Msg_Get(MSG_Ok)); return (MEKA_ERR_OK); }
/*---------------------------------------------------------------------------* * Routine: App_StartupLimitedAP *---------------------------------------------------------------------------* * Description: * Put the unit into a limited AP mode using the configuration in the * default LimitedAP settings. * Inputs: * void * Outputs: * void *---------------------------------------------------------------------------*/ void App_StartupLimitedAP(char *mySSID) { ATLIBGS_MSG_ID_E r; DisplayLCD(LCD_LINE3, "Limited AP:"); DisplayLCD(LCD_LINE4, (uint8_t const *)mySSID); #ifdef ATLIBGS_DEBUG_ENABLE ConsolePrintf("Starting Limited AP: %s\n", ATLIBGS_LIMITED_AP_SSID); #endif /* Try to disassociate if not already associated */ AtLibGs_DisAssoc(); while (1) { DisplayLCD(LCD_LINE6, " Setting up"); r =AtLibGs_EnableRadio(1); // enable radio if (r != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE6, "Bad Mode!"); MSTimerDelay(2000); continue; } r = AtLibGs_Mode(ATLIBGS_STATIONMODE_LIMITED_AP); if (r != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE6, "Bad Mode!"); MSTimerDelay(2000); continue; } r = AtLibGs_IPSet(ATLIBGS_LIMITED_AP_IP, ATLIBGS_LIMITED_AP_MASK, ATLIBGS_LIMITED_AP_GATEWAY); if (r != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE6, "Bad IP!"); MSTimerDelay(2000); continue; } r = AtLibGs_EnableDHCPServer(); if (r != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE6, "Bad DHCPSrv!"); AtLibGs_DisableDHCPServer(); MSTimerDelay(2000); continue; } r = AtLibGs_Assoc(mySSID /*ATLIBGS_LIMITED_AP_SSID*/, 0, ATLIBGS_LIMITED_AP_CHANNEL); if (r != ATLIBGS_MSG_ID_OK) { DisplayLCD(LCD_LINE6, "AP Failed!"); MSTimerDelay(2000); continue; } break; } DisplayLCD(LCD_LINE6, ""); #ifdef ATLIBGS_DEBUG_ENABLE ConsolePrintf("Limited AP Started\n"); #endif }
///--------------------------------------------------------------------------------- /// ///--------------------------------------------------------------------------------- void Profiler::PrintDataToConsole() { for (std::map< std::string, ProfileData >::const_iterator categoryIter = s_profileDataMap.begin(); categoryIter != s_profileDataMap.end(); ++categoryIter) { const std::string& categoryName = categoryIter->first; const ProfileData& data = categoryIter->second; ConsolePrintf( "%s total: %lld ms, %lld us \n", categoryName.c_str(), data.m_totalTime_us / 1000LL, data.m_totalTime_us ); ConsolePrintf( "%s average: %lld ms, %lld us \n", categoryName.c_str(), data.m_averageTime_us / 1000LL, data.m_averageTime_us ); } }
bool XAudio2SourceVoice::Init() { if (!XAudio2CheckedCall(XAudio2Device::XAudio2->CreateSourceVoice(&m_Source, (WAVEFORMATEX*)m_wfx, 0, 2.0f, &m_Callback))) { ConsolePrintf(TEXT("Failed to create XAudio2 source voice.")); return false; } UINT32 NumEffects = 0; // Create the reverb effect IUnknown* ReverbXAPO = nullptr; bool bReverbEnabled = (m_EffectFlags & ILLUSYNTH_FX_REVERB) ? true : false; if (!XAudio2CheckedCall(CreateFX(__uuidof(FXReverb), &ReverbXAPO))) { ConsolePrintf(TEXT("XAudio2: Failed to create reverb XAPO.")); return false; } // Create the EQ effect IUnknown* EQ_XAPO = nullptr; bool bEQEnabled = (m_EffectFlags & ILLUSYNTH_FX_EQ) ? true : false; if (!XAudio2CheckedCall(CreateFX(__uuidof(FXEQ), &EQ_XAPO))) { ConsolePrintf(TEXT("XAudio2: Failed to create EQ XAPO.")); return false; } // NOTE: The order of these effects must match the order in the // header file XAUDIO2_EFFECT_DESCRIPTOR EffectDescriptors[] = { { ReverbXAPO, bReverbEnabled, 1 }, { EQ_XAPO, bEQEnabled, 1 } }; XAUDIO2_EFFECT_CHAIN EffectChain; EffectChain.EffectCount = sizeof(EffectDescriptors) / sizeof(XAUDIO2_EFFECT_DESCRIPTOR); EffectChain.pEffectDescriptors = EffectDescriptors; if (!XAudio2CheckedCall(m_Source->SetEffectChain(&EffectChain))) { ConsolePrintf(TEXT("XAudio2: Failed to set effect chain on source voice.")); return false; } m_bInitialized = true; ReverbXAPO->Release(); EQ_XAPO->Release(); return true; }
void readSensor(APP_STATE_E state){ char temp_char[2]; uint16_t temp; float ftemp; float gTemp_F; char LCDString[30]; uint16_t gAmbientLight; extern int16_t gAccData[3]; extern int16_t *Accelerometer_Get(void); ConsolePrintf("Reading sensor %d: ",state); switch(state) { case UPDATE_TEMPERATURE: // Temperature sensor reading temp = Temperature_Get(); #if 0 // Get the temperature and show it on the LCD temp_char[0] = (int16_t)temp / 16; temp_char[1] = (int16_t)((temp & 0x000F) * 10) / 16; #endif temp_char[1] = (temp & 0xFF00)>>8; temp_char[0] = temp & 0xFF; ftemp = *(uint16_t *)temp_char; gTemp_F = ((ftemp/5)*9)/128 + 22; // Display the contents of lcd_buffer onto the debug LCD //sprintf((char *)LCDString, "TEMP: %d.%d C", temp_char[0], temp_char[1]); sprintf((char *)LCDString, "TEMP: %.1fF", gTemp_F); ConsolePrintf("%s\r\n",LCDString); DisplayLCD(LCD_LINE6, (const uint8_t *)LCDString); state = UPDATE_LIGHT; break; case UPDATE_LIGHT: // Light sensor reading gAmbientLight = LightSensor_Get(); // Display the contents of lcd_buffer onto the debug LCD sprintf((char *)LCDString, "Light: %d ", gAmbientLight); ConsolePrintf("%s\r\n",LCDString); DisplayLCD(LCD_LINE7, (const uint8_t *)LCDString); state = UPDATE_ACCELEROMETER; break; case UPDATE_ACCELEROMETER: // 3-axis accelerometer reading Accelerometer_Get(); sprintf((char *)LCDString, "x%2d y%2d z%2d", gAccData[0], gAccData[1], gAccData[2]); ConsolePrintf("%s\r\n",LCDString); DisplayLCD(LCD_LINE8, (const uint8_t *)LCDString); state = UPDATE_TEMPERATURE; break; } }
/***************************************************************************** * * GPRS_SocketOpen * * Open a connection with a remote host. Telit specific. * *****************************************************************************/ int32_t AtModem_SocketOpen(char * ip, uint8_t port, uint8_t * cid) { static unsigned char socketFailures = 0; //TODO: review hard coded IP addresses -> perhaps swap for replaceable //ip via "ip" API call /* 30 is big enough for any IP */ char location[30]; uint8_t len; len = sprintf(location, "atdt\"%s\",%hhu\r", ip, port); AtModem_Write(location,len); int32_t result = AtModem_response_check(25000, "CONNECT", "\r\n"); if (result == AT_REPLY_OK) { socketFailures = 0; ConsolePrintf("Socket Open\r\n"); DisplayLCD(LCD_LINE7, "SOCKET: OPEN"); *cid = 1; // we only have one connection } else { if (result == AT_REPLY_ERROR) { ConsolePrintf("Socket Error\r\n"); DisplayLCD(LCD_LINE7, "SOCKET: ERR"); AtModem_SocketClose(0); } else { ConsolePrintf("Socket No Response\r\n"); DisplayLCD(LCD_LINE7, "SOCKET: DOWN"); } result = -1; if (socketFailures++ > 5) { if( AtModem_Init() == -1) { // restart mcu WDTIMK = 1U; /* disable INTWDTI interrupt, stop kicking watchdog */ while(1); } socketFailures = 0; } } return result; }
///===================================================== /// ///===================================================== SignpostMemoryManager::~SignpostMemoryManager() { #ifndef NDEBUG m_criticalSection.Enter(); delete m_allocationTracking; m_allocationTracking = nullptr; m_criticalSection.Exit(); #endif PrintStats(); if (firstSignpost->m_next != nullptr) { __debugbreak(); } if (firstSignpost->m_prev != nullptr) { __debugbreak(); } if (firstSignpost->m_isFree != true) { __debugbreak(); } if (firstSignpost->m_size != m_size - sizeof(Signpost)) { __debugbreak(); } free(m_buffer); ConsolePrintf("\nSUCCESSFULLY SHUTDOWN MEMORY MANAGER\n\n"); }
int Lang_Message_Add (t_lang *lang, char *msg_id, char *msg) { // Find message number (#define) by name int n = -1; for (int i = 0; Msg_Translation_Table[i].name; i++) { if (stricmp (msg_id, Msg_Translation_Table[i].name) == 0) { n = Msg_Translation_Table[i].value; break; } } if (n == -1) return (MEKA_ERR_UNKNOWN); // Store message if (lang->Messages [n]) { free (lang->Messages [n]); ConsolePrintf ("In %s: message \"%s\" redefined! Keeping new value.\n", lang->Name, msg_id); } // lang->Messages [n] = strdup (msg); lang->Messages[n] = parse_getword(NULL, 0, &msg, "\"", 0); // Verify that there's nothing after this line parse_skip_spaces(&msg); if (msg[0]) return (MEKA_ERR_SYNTAX); return (MEKA_ERR_OK); }
///--------------------------------------------------------------------------------- /// ///--------------------------------------------------------------------------------- void FireEventForEachFileFound( const std::string& eventToFire, const std::string& directory, const std::string& searchPattern, bool recurseSubfolders ) { Strings files; EnumerateFiles( directory, searchPattern, files, recurseSubfolders ); for (std::string& file : files) { std::string fileWithoutPath = ExtractFileNameFromPath( file ); std::string fileName = RemoveFileExtension( fileWithoutPath ); Strings fileNameTokens; Tokenize( fileWithoutPath, fileNameTokens, "." ); std::string fileExtension = "." + fileNameTokens[1]; std::string relativePath = ConvertBackSlashesToForwardSlashes( file ); char fullPath[_MAX_PATH]; _fullpath( fullPath, relativePath.c_str(), _MAX_PATH ); std::string fullFilePath = ConvertBackSlashesToForwardSlashes( std::string( fullPath ) ); ConsolePrintf( "File without path: %s\n File Name: %s\n File Extension: %s\n File Relative: %s\n File Absolute: %s\n", fileWithoutPath.c_str(), fileName.c_str(), fileExtension.c_str(), relativePath.c_str(), fullFilePath.c_str() ); NamedProperties props; props.Set( "FileName", fileWithoutPath ); props.Set( "FileExtension", fileExtension ); props.Set( "FileNameWithoutExtension", fileName ); props.Set( "FileRelativePath", relativePath ); props.Set( "FileAbsolutePath", fullFilePath ); FireEvent( eventToFire, props ); } }
//-------------------------------------------------------------------------------------------------------------------------- // // 初始化时钟中断 // //-------------------------------------------------------------------------------------------------------------------------- void TimerInit(void) { //设置中断频率 outb(0x34, 0x43); /* binary, mode 2, LSB/MSB, ch 0 */ outb(LATCH & 0xFF, 0x40); /* LSB */ outb(LATCH >> 8, 0x40); /* MSB */ ConsolePrintf("Set the timer driver"); GetCmosTime(&CurrentTime); GetCmosDate(&CurrentDate); SetIntrGate(0x20,&TimerInterrupt); //安装时钟中断处理函数 outb(inb_p(0x21)&~0x01,0x21); //允许时钟中断 ConsolePrintOK(); ConsoleMsg("\n"); ConsoleMsg(" The Timer Frequency is %d HZ\n",HZ); ConsoleMsg(" The Start PC Time is %02d:%02d:%02d %04d-%02d-%02d\n", CurrentTime.hour,CurrentTime.min,CurrentTime.sec, CurrentDate.year,CurrentDate.month,CurrentDate.day); ConsoleMsg("\n"); TickDelay(2); }
/*--------------------------------------------------------------------------*/ static void printf_scilab(char *buffer) { if (buffer) { wchar_t *wcBuffer = NULL; if (getScilabMode() == SCILAB_STD) { ConsolePrintf(buffer); } else { #ifdef _MSC_VER TermPrintf_Windows(buffer); #else printf("%s",buffer); #endif } wcBuffer = to_wide_string(buffer); if (wcBuffer) { diaryWrite(wcBuffer, FALSE); FREE(wcBuffer); wcBuffer = NULL; } } }
/*---------------------------------------------------------------------------* * Routine: WIFI_Associate *---------------------------------------------------------------------------* * Description: * Association and show result on the LCD * Inputs: * void * Outputs: * ATLIBGS_MSG_ID_E *---------------------------------------------------------------------------*/ ATLIBGS_MSG_ID_E WIFI_Associate(void) { ATLIBGS_MSG_ID_E rxMsgId = ATLIBGS_MSG_ID_NONE; DisplayLCD(LCD_LINE7, " Connecting "); /* Associate to a particular AP specified by SSID */ if (strlen(GNV_Setting.webprov.ssid) > 0) { DisplayLCD(LCD_LINE8, (const uint8_t *)GNV_Setting.webprov.ssid); rxMsgId = AtLibGs_Assoc(GNV_Setting.webprov.ssid,NULL,HOST_APP_AP_CHANNEL); } else { DisplayLCD(LCD_LINE8, HOST_APP_AP_SSID); rxMsgId = AtLibGs_Assoc(HOST_APP_AP_SSID, NULL, HOST_APP_AP_CHANNEL); } if (ATLIBGS_MSG_ID_OK != rxMsgId) { /* Association error - we can retry */ #ifdef HOST_APP_DEBUG_ENABLE ConsolePrintf("\n Association error - retry now \n"); #endif DisplayLCD(LCD_LINE7, " Connecting.."); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); } else { /* Association success */ AtLibGs_SetNodeAssociationFlag(); DisplayLCD(LCD_LINE7, " Connected "); MSTimerDelay(2000); DisplayLCD(LCD_LINE7, ""); } return rxMsgId; }
//---------------------------------------------------------------------------------------------------------------------------- // // ÄÚºËÖ÷Èë¿Ú // //---------------------------------------------------------------------------------------------------------------------------- void k_main(void) { unsigned long base_mm; PageDirInit(); KernelGraphicInit(); ConsoleInit(0,0xFFFFFF); ConsolePrintf("Enable The Page"); ConsolePrintOK(); ConsoleMsg(" The Kernel Page Dir at %08x The Page0 at %08x\n",PG_DIR_ADDR,PG_TABLE_ADDR); ConsoleMsg(" The VESA Mapping Page at %08x\n",VESA_PTE); ConsolePrintf("Load The boot Infomation"); ConsolePrintOK(); GetGrubVersion(GrubBootInfo); GetGrubBoot(GrubBootInfo,(int*)&BootParameters.bp_bootdev); GetGrubMemInfo(GrubBootInfo,&base_mm,&BootParameters.bp_ramsize); GetGrubAPM(GrubBootInfo); BootMemInit(); KnlMesQueInit(); PageManagerInit(BootParameters.bp_ramsize); VMemInit(BootParameters.bp_ramsize,0xC0000000-BootParameters.bp_ramsize); TrapInit(); TimerInit(); KeyboardInit(); MouseInit(); //FloppyInit(); HardDiskInit(); //Fat12_Init(); Fat32_Init(); ProcessInit(); SystemCallInit(); __asm__("sti"); ExecInitProc("SHELLER "); SetSwitching(0); while(1); }
int Lang_Post_Check (t_lang *lang) { // Count available messages (skipping MSG_NULL) // and set default for when one is missing int cnt = 0; for (int i = 1; i < MSG_MAX; i++) if (lang->Messages[i]) cnt++; if (cnt < MSG_MAX - 1) { // We need to display the first line even in WIP mode, if this is the // default language, else MEKA will screw up later, with missing strings.. if (lang->WIP == FALSE || lang == Messages.Lang_Default) { ConsolePrintf ("Language \"%s\" is incomplete (%d/%d messages found) !\n", lang->Name, cnt, MSG_MAX - 1); ConsoleEnablePause(); } if (lang->WIP == FALSE) { ConsolePrintf ("The following messages are missing:\n"); for (int i = 1; i < MSG_MAX; i++) { if (lang->Messages[i] == NULL) { for (int j = 0; Msg_Translation_Table[j].name; j++) if (Msg_Translation_Table[j].value == i) ConsolePrintf (" %s\n", Msg_Translation_Table[j].name); if (lang != Messages.Lang_Default) lang->Messages[i] = Messages.Lang_Default->Messages[i]; } } ConsoleEnablePause(); } else { if (lang != Messages.Lang_Default) for (int i = 1; i < MSG_MAX; i++) if (lang->Messages[i] == NULL) lang->Messages[i] = Messages.Lang_Default->Messages[i]; } return (MEKA_ERR_INCOMPLETE); } return (MEKA_ERR_OK); }
///===================================================== /// ///===================================================== void SignpostMemoryManager::PrintMemoryLeaks() const { #ifndef NDEBUG m_criticalSection.Enter(); for (std::map<Signpost*, AllocationTracker>::const_iterator allocIter = m_allocationTracking->cbegin(); allocIter != m_allocationTracking->cend(); ++allocIter) { ConsolePrintf("\nMemory Leak of %i bytes allocated at:\n%s(%u)\n\n", allocIter->first->m_size, allocIter->second.m_filename.c_str(), allocIter->second.m_line); } m_criticalSection.Exit(); #endif }
///---------------------------------------------------------------------------------------------------------- /// void TheApp::StartUp( void* windowHandle ) { m_windowHandle = windowHandle; InitializeTime(); InitializeClockSystem(); m_jobManager = new JobManager(); if (m_jobManager) { m_jobManager->StartUp(0); } m_networkSystem = new NetworkSystem(); if (m_networkSystem) { m_networkSystem->StartUp(); } // m_soundSystem = new SoundSystem(); // if (m_soundSystem){ // m_soundSystem->StartUp(); // } Vector2 displaySize; //initialize renderer m_renderer = new OpenGLRenderer(); if (m_renderer) { m_renderer->StartUp((HWND)windowHandle); displaySize = Vector2(m_renderer->GetDisplayWidth(), m_renderer->GetDisplayHeight()); } //initialize text renderer m_textSystem = new TextSystem(); //mem leak: 648 if (m_textSystem) { m_textSystem->StartUp("Data/Fonts/lucidaCL.fnt", m_renderer); } //initialize input system m_inputSystem = new InputSystem(); if (m_inputSystem) { m_inputSystem->StartUp(m_windowHandle, displaySize); } m_particleSystem = new ParticleSystem(); if (m_particleSystem) { //do something } ConsolePrintf("\n===The App Start Up Completed===\n"); //initialize world m_world = new World(displaySize ); if (m_world) { m_world->StartUp(); } }
//------------------------------------------------------------------------------------------------------------------------------- // // 读取硬盘分区信息函数 // //------------------------------------------------------------------------------------------------------------------------------- int ReadPartition(void) { int i = 0; int sector, head, cylinder; unsigned char buffer[512]; struct partition* p; #ifndef HD_BOOT_SECTOR #define HD_BOOT_SECTOR 0 #endif ConsolePrintf("Check the hard disk partition\n"); sector = HD_BOOT_SECTOR &0xff; cylinder = (HD_BOOT_SECTOR &0xffff00)>>8; head = (HD_BOOT_SECTOR &0xf000000)>>24; while(inb(HD_STATUS) & 0x80); io_wait(); outb(0,HD_CMD); outb(1,0x1f2); ///////////读写的扇区数.这个端口应该是:0X1F2,下面开始增加一 outb(HD_BOOT_SECTOR,0x1f3); ////////开始扇区 outb(cylinder,0x1f4); ///////开始柱面 outb(cylinder>>8,0x1f5); ///////开始柱面高位 outb(0xE0|(0 <<4)|head,0x1f6); /////主磁盘 outb(0x20,0x1F7); ////read命令 while(inb(HD_STATUS) & 0x80); insw(0x1F0, buffer, 256); if (buffer[510] != (unsigned char) 0x55 || buffer[511] != (unsigned char) 0xAA){ ConsolePrintFault(); ConsoleWarning(" read_partition(): Can't Read Harddisk(IDE) partition data\n"); return -1; } ConsolePrintOK(); for (i=1;i<5;i++) { p = (struct partition*)&buffer[0x1be + (i-1)*0x10]; //partition table offset after 446 byte. hd[i].start_sect = p->start_sec; // 从0算起的绝对扇区(分区表的起始扇区,不是FAT表的) hd[i].start_head=p->start_head; hd[i].start_cyl=p->start_cyl; hd[i].nr_sects = p->size; // 分区扇区总数 hd[i].flag = p->type; hd[i].lowsec = p->lowsec; hd[i].type = GetPartitionName( p->type); hd[i].name = 0x42+i; FindActivePartition(p, i); } ReadIDEInfo(); return 0; }
// Initialize Sound Card ------------------------------------------------------ static int Sound_Init_SoundCard (void) { int i; AUDIOINFO Audio_Infos; ConsolePrintf (Msg_Get (MSG_Sound_Init_Soundcard), Sound.SampleRate); ConsolePrint ("\n"); Audio_Infos.nDeviceId = Sound.SoundCard; Audio_Infos.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO; // FIXME: Stereo ? Audio_Infos.nSampleRate = audio_sample_rate = Sound.SampleRate; if (AOpenAudio(&Audio_Infos) != AUDIO_ERROR_NONE) { Quit_Msg ("%s", Msg_Get (MSG_Sound_Init_Error_Audio)); return (MEKA_ERR_FAIL); } // FIXME: original sound engine was trying different sample rate on failure // Unused // Maybe it was intended to check out number of channels there ? // AGetAudioCaps (Audio_Infos.nDeviceId, &Audio_Caps); // Open voices if (AOpenVoices(Sound.Voices_Max) != AUDIO_ERROR_NONE) { Quit_Msg ("%s", Msg_Get (MSG_Sound_Init_Error_Voices)); return (MEKA_ERR_FAIL); } ASetAudioMixerValue (AUDIO_MIXER_MASTER_VOLUME, 256); // Allocate voices and waveforms Sound.Voices = Memory_Alloc (sizeof (t_voice) * Sound.Voices_Max); for (i = 0; i < Sound.Voices_Max; i++) { if (ACreateAudioVoice(&Sound.Voices[i].hVoice) != AUDIO_ERROR_NONE) { Quit_Msg (Msg_Get (MSG_Sound_Init_Error_Voice_N), i); return (MEKA_ERR_FAIL); } ASetVoicePanning(Sound.Voices[i].hVoice, 128); // Center voice Sound.Voices[i].lpWave = NULL; Sound.Voices[i].playing = FALSE; } // FIXME: is this needed ? AUpdateAudio (); // FIXME: is this needed ? // Check frame sample rate audio_sample_rate = nominal_sample_rate = Audio_Infos.nSampleRate; return (MEKA_ERR_OK); }
///===================================================== /// ///===================================================== void SignpostMemoryManager::PrintStats() const { ConsolePrintf("\nTotal Memory Allocations Requested: %u\n", m_totalAllocationsRequested); ConsolePrintf("Total Memory Frees Requested: %u\n", m_totalFreesRequested); ConsolePrintf("Total Bytes Allocated: %lu\n", m_totalBytesAllocated); ConsolePrintf("Average Memory Allocated: %u\n", GetAverageAllocationRequested()); ConsolePrintf("Largest Allocation Requested: %u\n", m_largestAllocationRequested); ConsolePrintf("Current Bytes Free: %u\n", m_currentBytesFree); ConsolePrintf("Allocations This Frame: %u\n\n", m_allocationsThisFrame); }
//--------------------------------------- int Effect::GetUniformLocation( const char* name ) const { GLint location = glGetUniformLocation( mProgramId, name ); // Warn bad name if ( location == INVALID_LOCATION ) { ConsolePrintf( CONSOLE_WARNING, "Warning: Unable to get the location of uniform '%s' in program '%s'.\n", name, "(todo names blah blah)" ); } return location; }
void TickDelay(int sec) { unsigned long NewDelayTick,OldDelayTick; __asm__("sti"); OldDelayTick=NewDelayTick=jiffies; while(NewDelayTick-OldDelayTick<1000*sec) { NewDelayTick=jiffies; ConsolePrintf(""); } __asm__("cli"); }
//----------------------------------------------------------------------------- // DB_Load (const char *filename) // Initialize and load given Meka DB file //----------------------------------------------------------------------------- void DB_Load (const char *filename) { t_tfile * tf; t_list * lines; char * line; int line_cnt; ConsolePrint (Msg_Get (MSG_DB_Loading)); // Open and read file tf = tfile_read (filename); if (tf == NULL) { ConsolePrintf ("%s\n", meka_strerror()); return; } // Ok ConsolePrint ("\n"); // Parse each line line_cnt = 0; for (lines = tf->data_lines; lines; lines = lines->next) { line_cnt += 1; line = lines->elem; // Strip comments // FIXME // Trim spaces? // FIXME // Skip empty lines //if (line[0] == EOSTR) // continue; if (DB_Load_Line (line) == 0) { tfile_free (tf); Quit_Msg (Msg_Get (MSG_DB_SyntaxError), line_cnt); } } // Free file data tfile_free(tf); // FIXME - Uncomment for counting progress of DB transition //ConsolePrintf ("ENTRIES NEW = %d, OLD = %d\n", DB.entries_counter_format_new, DB.entries_counter_format_old); //Quit(); }
bool XAudio2SourceVoice::SetReverbSettings(float Diffusion, float RoomSize) { AudioSource::SetReverbSettings(Diffusion, RoomSize); FXREVERB_PARAMETERS ReverbParameters; ReverbParameters.Diffusion = m_ReverbSettings.Diffusion; ReverbParameters.RoomSize = m_ReverbSettings.RoomSize; if (!XAudio2CheckedCall(m_Source->SetEffectParameters(0, &ReverbParameters, sizeof(ReverbParameters)))) { ConsolePrintf(TEXT("XAudio2: Failed to set reverb effect parameters on source voice.")); return false; } return true; }
void GLMesh::GLCheckError(const char* fileName, int lineNum) { fileName; lineNum; #if defined(OPENGL_CHECK_ERRORS) GLenum error = glGetError(); if (error != GL_NO_ERROR) { std::stringstream out; out << lineNum; std::string header = "Error:" + ConsolePrintf("0x%04x\n", error) + "at" + out.str(); std::string mesage1 = fileName; MessageBoxA(NULL, mesage1.c_str(), header.c_str(), MB_OK); } #endif }
///--------------------------------------------------------------------------------- /// ///--------------------------------------------------------------------------------- DeveloperConsoleCommand::DeveloperConsoleCommand( std::string name, DeveloperConsoleCommandFunc command, std::string helpMessage ) { name = ConvertToLowerCase( name ); m_name = name; m_command = command; m_help = helpMessage; if (!s_allCommands) s_allCommands = new std::map < std::string, DeveloperConsoleCommand* >(); if (s_allCommands->find( name ) != s_allCommands->end()) { ConsolePrintf( "Duplicate command registered: %s \n", name ); return; } s_allCommands->insert( std::pair< std::string, DeveloperConsoleCommand*>( name, (this) ) ); }
//------------------------------------------------------------------------------------------------------------------------------- // // 硬盘初始化函数 // //------------------------------------------------------------------------------------------------------------------------------- void HardDiskInit (void) { ConsolePrintf("Set the hard disk driver"); if(GetIDENum()==0) { ConsolePrintFault(); ConsoleMsg("\n"); ConsoleMsg(" System had no hard disk!\n"); ConsoleMsg("\n"); return;} ConsolePrintOK(); ConsoleMsg("\n"); if(NR_HD_DEV==1) ConsoleMsg(" System only one hard disk\n"); else if(NR_HD_DEV==2) ConsoleMsg(" System have two hard disk\n"); ConsoleMsg(" Hard disk Type: %s\n", HardDiskName ); ConsoleMsg("\n"); //for(i=0 ; i<NR_BLK_REQUEST ; i++) { // hd_req[i].flag = -1; // hd_req[i].next = NULL; // semaphore_init (&(hd_req[i].sem), 0); //} //semaphore_init(&request_sem, NR_BLK_REQUEST); SetIntrGate(0x2E,(void*)HardDiskInterrupt); outb_p(inb_p(0x21)&0xfb,0x21); outb(inb_p(0xA1)&0xbf,0xA1); TickDelay(1); ReadPartition(); //Must before fs!!! TickDelay(1); }
void Inputs_Joystick_Init(void) { int i; int num_joy; bool found = FALSE; for (i = 0; i < Inputs.Sources_Max; i++) { t_input_src *src = Inputs.Sources[i]; if (src->type == INPUT_SRC_TYPE_JOYPAD) { found = TRUE; break; } } if (found == FALSE) return; // There is at least one joypad so we'll launch initialization ConsolePrint(Msg_Get(MSG_Inputs_Joy_Init)); if (!al_install_joystick() || ((num_joy = al_get_num_joysticks()) == 0)) { ConsolePrint(Msg_Get(MSG_Inputs_Joy_Init_None)); ConsolePrint("\n"); return; } ConsolePrintf (Msg_Get(MSG_Inputs_Joy_Init_Found), num_joy); ConsolePrint("\n"); // Flag available devices "connected and ready" for (i = 0; i < Inputs.Sources_Max; i++) { t_input_src *src = Inputs.Sources[i]; if (src->type == INPUT_SRC_TYPE_JOYPAD) if (src->Connection_Port < num_joy) src->Connected_and_Ready = TRUE; } }
/*---------------------------------------------------------------------------* * Routine: App_InitModule *---------------------------------------------------------------------------* * Description: * Setup the mode by first checking if there is a link and either * report or continue to the rest of the program. * Inputs: * void * Outputs: * void *---------------------------------------------------------------------------*/ void App_InitModule(void) { ATLIBGS_MSG_ID_E r = ATLIBGS_MSG_ID_NONE; DisplayLCD(LCD_LINE7, " Preparing"); DisplayLCD(LCD_LINE8, " Init Mod"); /* Give the unit a little time to start up */ /* (300 ms for GS1011 and 1000 ms for GS1500) */ MSTimerDelay(1000); /* Check the link */ #ifdef ATLIBGS_DEBUG_ENABLE ConsolePrintf("Checking link\r\n"); #endif /* Wait for the banner (if any) */ MSTimerDelay(500); /* Clear out the buffers */ AtLibGs_FlushRxBuffer(); /* Send command to check */ do { AtLibGs_FlushIncomingMessage(); DisplayLCD(LCD_LINE8, "Checking..."); r = AtLibGs_Check(); } while (ATLIBGS_MSG_ID_OK != r); /* Send command to DISABLE echo */ do { DisplayLCD(LCD_LINE8, "Echo Off..."); r = AtLibGs_SetEcho(ATLIBGS_DISABLE); } while (ATLIBGS_MSG_ID_OK != r); /* Done */ DisplayLCD(LCD_LINE7, ""); DisplayLCD(LCD_LINE8, ""); }
std::string NetworkSession::GetAddressStringForHostName(int addrFamily){ addrinfo hints; addrinfo* addr; std::string host_name = AllocLocalHostName(); std::string service = IntToString((int)m_port); memset(&hints, 0, sizeof(hints)); hints.ai_family = addrFamily; //get all addresses AF_INET or AF_INET6 hints.ai_socktype = SOCK_STREAM; // stream based, determines transport layer TCP hints.ai_flags = AI_PASSIVE; // used for binding/listening int status = getaddrinfo(host_name.c_str(), service.c_str(), &hints, &addr); if (status != 0) { ConsolePrintf("Failed to create socket address! %s\n", (char*)gai_strerror(status)); } std::string addressString = "\n===" + host_name + "===\n"; addrinfo *iter; char addr_name[INET6_ADDRSTRLEN]; for (iter = addr; iter != nullptr; iter = iter->ai_next) { PCSTR addressPCStr = inet_ntop(iter->ai_family, GetInAddress(iter->ai_addr), addr_name, INET6_ADDRSTRLEN); char* addressCStr = (char*)addressPCStr; addressString += "IP: "; addressString += addressCStr; addressString += " | PORT: " + service; addressString += "\n"; } return addressString; }
inline void ConsolePrintPhysicsMotion2D(const PhysicsMotion2D& consolePhysicsMotion2D){ ConsolePrintf("| PhysicsMotion2D |\n| Position< "); ConsolePrintVector2(consolePhysicsMotion2D.m_position); //if(consolePhysicsMotion2D.m_velocityUnitsPerSecond != Vector2(0.0f, 0.0f) ){ ConsolePrintf(" >\n| Velocity< "); ConsolePrintVector2(consolePhysicsMotion2D.m_velocityUnitsPerSecond); //} //if(consolePhysicsMotion2D.m_accelerationUnitsPerSecondSquared != Vector2(0.0f, 0.0f) ){ ConsolePrintf(" >\n| Acceleration< "); ConsolePrintVector2(consolePhysicsMotion2D.m_accelerationUnitsPerSecondSquared); //} ConsolePrintf(" >\n| OrientationDegrees ="); ConsolePrintf(" %.02f |\n", consolePhysicsMotion2D.m_orientationDegrees); //if(consolePhysicsMotion2D.m_angularVelocityDegreesPerSecond != 0.0f){ ConsolePrintf("| AngularVelocityDegrees ="); ConsolePrintf(" %.02f |\n", consolePhysicsMotion2D.m_angularVelocityDegreesPerSecond); //} }