本文整理匯總了C++中DebugLog函數的典型用法代碼示例。如果您正苦於以下問題:C++ DebugLog函數的具體用法?C++ DebugLog怎麽用?C++ DebugLog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DebugLog函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: WinMain
//.........這裏部分代碼省略.........
int args_consumed = arg_handler.handler(saved_argc, saved_argv);
if (args_consumed < 0) {
printf("Failed parsing parameter '%s'\n", *(argv - 1));
exit(1);
}
saved_argc -= args_consumed;
saved_argv += args_consumed;
arg_handled = true;
break;
}
}
// Ingore unknown options.
if (!arg_handled) {
--saved_argc;
++saved_argv;
}
}
}
if (!assure_dir_exist(FILENAMES["user_dir"].c_str())) {
printf("Can't open or create %s. Check permissions.\n",
FILENAMES["user_dir"].c_str());
exit(1);
}
setupDebug();
/**
* OS X does not populate locale env vars correctly (they usually default to
* "C") so don't bother trying to set the locale based on them.
*/
#if (!defined MACOSX)
if (setlocale(LC_ALL, "") == NULL) {
DebugLog(D_WARNING, D_MAIN) << "Error while setlocale(LC_ALL, '').";
} else {
#endif
try {
std::locale::global( std::locale( "" ) );
} catch( const std::exception& ) {
// if user default locale retrieval isn't implemented by system
try{
// default to basic C locale
std::locale::global( std::locale::classic() );
} catch( const std::exception &err ) {
debugmsg( "%s", err.what() );
exit_handler(-999);
}
}
#if (!defined MACOSX)
}
#endif
get_options().init();
get_options().load();
set_language();
// in test mode don't initialize curses to avoid escape sequences being inserted into output stream
if( !test_mode ) {
try {
catacurses::init_interface();
} catch( const std::exception &err ) {
// can't use any curses function as it has not been initialized
std::cerr << "Error while initializing the interface: " << err.what() << std::endl;
DebugLog( D_ERROR, DC_ALL ) << "Error while initializing the interface: " << err.what() << "\n";
return 1;
}
示例2: eraseToken
void TokensTree::eraseToken(Token* oldToken)
{
if(!oldToken)
return;
int idx = oldToken->m_Self;
if(m_Tokens[idx]!=oldToken)
return;
// Step 1: Detach token from its parent
Token* parentToken = 0;
if((size_t)(oldToken->m_ParentIndex) >= m_Tokens.size())
oldToken->m_ParentIndex = -1;
if(oldToken->m_ParentIndex >= 0)
parentToken = m_Tokens[oldToken->m_ParentIndex];
if(parentToken)
parentToken->m_Children.erase(idx);
TokenIdxSet nodes;
TokenIdxSet::iterator it;
// Step 2: Detach token from its ancestors
nodes = (oldToken->m_DirectAncestors);
for(it = nodes.begin();it!=nodes.end(); it++)
{
int ancestoridx = *it;
if(ancestoridx < 0 || (size_t)ancestoridx >= m_Tokens.size())
continue;
Token* ancestor = m_Tokens[ancestoridx];
if(ancestor)
ancestor->m_Descendants.erase(idx);
}
oldToken->m_Ancestors.clear();
oldToken->m_DirectAncestors.clear();
// Step 3: erase children
nodes = (oldToken->m_Children); // Copy the list to avoid interference
for(it = nodes.begin();it!=nodes.end(); it++)
eraseToken(*it);
// m_Children SHOULD be empty by now - but clear anyway.
oldToken->m_Children.clear();
// Step 4: erase descendants
nodes = oldToken->m_Descendants; // Copy the list to avoid interference
for(it = nodes.begin();it!=nodes.end(); it++)
{
if(*it == idx) // that should not happen, we can not be our own descendant, but in fact that can happen with boost
{
DebugLog(cc_text("Break out the loop to erase descendants, to avoid a crash. We can not be our own descendant !!"));
break;
}
eraseToken(*it);
}
// m_Descendants SHOULD be empty by now - but clear anyway.
oldToken->m_Descendants.clear();
// Step 5: Detach token from the SearchTrees
int idx2 = m_Tree.GetItemIdx(oldToken->m_Name);
if(idx2)
{
TokenIdxSet& curlist = m_Tree.GetItemAtPos(idx2);
curlist.erase(idx);
}
// Now, from the global namespace (if applicable)
if(oldToken->m_ParentIndex == -1)
{
m_GlobalNameSpace.erase(idx);
m_TopNameSpaces.erase(idx);
}
// Step 6: Finally, erase it from the list.
eraseTokenFromList(idx);
}
示例3: SDLInit
string SDLInit(const char *title, int2 &screensize, bool fullscreen)
{
//SDL_SetMainReady();
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER /* | SDL_INIT_AUDIO*/) < 0)
{
return SDLError("Unable to initialize SDL");
}
SDL_SetEventFilter(SDLHandleAppEvents, nullptr);
DebugLog(-1, "SDL initialized...");
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
// on demand now
//extern bool sfxr_init();
//if (!sfxr_init())
// return SDLError("Unable to initialize audio");
#ifdef PLATFORM_MOBILE
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
#else
//certain older Intel HD GPUs and also Nvidia Quadro 1000M don't support 3.1 ? the 1000M is supposed to support 4.2
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
#ifndef WIN32
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
#endif
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
#endif
//SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); // set this if we're in 2D mode for speed on mobile?
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); // because we redraw the screen each frame
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
DebugLog(-1, "SDL about to figure out display mode...");
#ifdef PLATFORM_MOBILE
landscape = screensize.x() >= screensize.y();
int modes = SDL_GetNumDisplayModes(0);
screensize = int2(0);
for (int i = 0; i < modes; i++)
{
SDL_DisplayMode mode;
SDL_GetDisplayMode(0, i, &mode);
//printf("mode: %d %d\n", mode.w, mode.h);
if (landscape ? mode.w > screensize.x() : mode.h > screensize.y())
{
screensize = int2(mode.w, mode.h);
}
}
DebugLog(-1, inttoa(screensize.x()));
DebugLog(-1, inttoa(screensize.y()));
DebugLog(-1, "SDL about to create window...");
_sdl_window = SDL_CreateWindow(title,
0, 0,
screensize.x(), screensize.y(),
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS);
DebugLog(-1, _sdl_window ? "SDL window passed..." : "SDL window FAILED...");
if (landscape) SDL_SetHint("SDL_HINT_ORIENTATIONS", "LandscapeLeft LandscapeRight");
int ax = 0, ay = 0;
SDL_GetWindowSize(_sdl_window, &ax, &ay);
int2 actualscreensize(ax, ay);
//screenscalefactor = screensize.x / actualscreensize.x; // should be 2 on retina
#ifdef __IOS__
assert(actualscreensize == screensize);
screensize = actualscreensize;
#else
screensize = actualscreensize; // __ANDROID__
DebugLog(-1, inttoa(screensize.x()));
DebugLog(-1, inttoa(screensize.y()));
#endif
#else
_sdl_window = SDL_CreateWindow(title,
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
screensize.x(), screensize.y(),
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE |
(fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
#endif
if (!_sdl_window)
return SDLError("Unable to create window");
DebugLog(-1, "SDL window opened...");
_sdl_context = SDL_GL_CreateContext(_sdl_window);
DebugLog(-1, _sdl_context ? "SDL context passed..." : "SDL context FAILED...");
if (!_sdl_context) return SDLError("Unable to create OpenGL context");
DebugLog(-1, "SDL OpenGL context created...");
//.........這裏部分代碼省略.........
示例4: DebugLog
void HelloScene::OnOptionButtonClick(CBView* item,int index)
{
DebugLog("HelloScene::OnOptionButtonClick [%d]\n",index);
}
示例5: WarningLog
bool X3100monitor::start(IOService * provider)
{
if (!provider || !super::start(provider)) return false;
if (!(fakeSMC = waitForService(serviceMatching(kFakeSMCDeviceService)))) {
WarningLog("Can't locate fake SMC device, kext will not load");
return false;
}
IOMemoryDescriptor * theDescriptor;
IOPhysicalAddress bar = (IOPhysicalAddress)((VCard->configRead32(kMCHBAR)) & ~0xf);
DebugLog("Fx3100: register space=%08lx\n", (long unsigned int)bar);
theDescriptor = IOMemoryDescriptor::withPhysicalAddress (bar, 0x2000, kIODirectionOutIn); // | kIOMapInhibitCache);
if(theDescriptor != NULL)
{
mmio = theDescriptor->map();
if(mmio != NULL)
{
mmio_base = (volatile UInt8 *)mmio->getVirtualAddress();
#if DEBUG
DebugLog(" MCHBAR mapped\n");
for (int i=0; i<0x2f; i +=16) {
DebugLog("%04lx: ", (long unsigned int)i+0x1000);
for (int j=0; j<16; j += 1) {
DebugLog("%02lx ", (long unsigned int)INVID8(i+j+0x1000));
}
DebugLog("\n");
}
#endif
}
else
{
InfoLog(" MCHBAR failed to map\n");
return -1;
}
}
char name[5];
//try to find empty key
for (int i = 0; i < 0x10; i++) {
snprintf(name, 5, KEY_FORMAT_GPU_DIODE_TEMPERATURE, i);
UInt8 length = 0;
void * data = 0;
IOReturn result = fakeSMC->callPlatformFunction(kFakeSMCGetKeyValue, true, (void *)name, (void *)&length, (void *)&data, 0);
if (kIOReturnSuccess == result) {
continue;
}
if (addSensor(name, TYPE_SP78, 2, i)) {
numCard = i;
break;
}
}
if (kIOReturnSuccess != fakeSMC->callPlatformFunction(kFakeSMCAddKeyHandler, false, (void *)name, (void *)TYPE_SP78, (void *)2, this)) {
WarningLog("Can't add key to fake SMC device, kext will not load");
return false;
}
return true;
}
示例6: UnloadGame
CGameLoaderHandler::~CGameLoaderHandler()
{
UnloadGame();
DebugLog("Destructing the game loader component...");
};
示例7: DebugLog
CFileSystem::~CFileSystem()
{
DebugLog("CFileSystem::~CFileSystem");
};
示例8: e1000_lv_jumbo_workaround_ich8lan
void IntelMausi::intelSetupRxControl(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
u32 rctl, rfctl;
/* Workaround Si errata on PCHx - configure jumbo frame flow.
* If jumbo frames not set, program related MAC/PHY registers
* to h/w defaults
*/
if (hw->mac.type >= e1000_pch2lan) {
s32 ret_val;
if (mtu > ETH_DATA_LEN)
ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
else
ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
if (ret_val)
DebugLog("Ethernet [IntelMausi]: failed to enable/disable jumbo frame workaround mode.\n");
}
/* Program MC offset vector base */
rctl = intelReadMem32(E1000_RCTL);
rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
rctl |= E1000_RCTL_BAM | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
/* Do not Store bad packets */
rctl &= ~E1000_RCTL_SBP;
/* Enable Long Packet receive */
if (mtu <= ETH_DATA_LEN)
rctl &= ~E1000_RCTL_LPE;
else
rctl |= E1000_RCTL_LPE;
/* Some systems expect that the CRC is included in SMBUS traffic. The
* hardware strips the CRC before sending to both SMBUS (BMC) and to
* host memory when this is enabled
*/
if (adapter->flags2 & FLAG2_CRC_STRIPPING)
rctl |= E1000_RCTL_SECRC;
/* Workaround Si errata on 82577 PHY - configure IPG for jumbos */
if ((hw->phy.type == e1000_phy_82577) && (rctl & E1000_RCTL_LPE)) {
u16 phy_data;
e1e_rphy(hw, PHY_REG(770, 26), &phy_data);
phy_data &= 0xfff8;
phy_data |= (1 << 2);
e1e_wphy(hw, PHY_REG(770, 26), phy_data);
e1e_rphy(hw, 22, &phy_data);
phy_data &= 0x0fff;
phy_data |= (1 << 14);
e1e_wphy(hw, 0x10, 0x2823);
e1e_wphy(hw, 0x11, 0x0003);
e1e_wphy(hw, 22, phy_data);
}
/* Set buffer sizes to 2048 */
//rctl |= (0x2 << E1000_RCTL_FLXB_SHIFT);
rctl &= ~(E1000_RCTL_SZ_256 | E1000_RCTL_BSEX);
/* Enable Extended Status in all Receive Descriptors */
rfctl = intelReadMem32(E1000_RFCTL);
rfctl |= (E1000_RFCTL_NEW_IPV6_EXT_DIS | E1000_RFCTL_IPV6_EX_DIS | E1000_RFCTL_EXTEN | E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
intelWriteMem32(E1000_RFCTL, rfctl);
intelWriteMem32(E1000_RCTL, rctl);
}
示例9: load_auto_pickup
void load_auto_pickup(bool bCharacter)
{
std::ifstream fin;
std::string sFile = "data/auto_pickup.txt";
if (bCharacter) {
sFile = "save/" + base64_encode(g->u.name) + ".apu.txt";
}
fin.open(sFile.c_str());
if(!fin.is_open()) {
fin.close();
create_default_auto_pickup(bCharacter);
fin.open(sFile.c_str());
if(!fin.is_open()) {
DebugLog() << "Could neither read nor create " << sFile << "\n";
return;
}
}
vAutoPickupRules[(bCharacter) ? 2 : 1].clear();
std::string sLine;
while(!fin.eof()) {
getline(fin, sLine);
if(sLine != "" && sLine[0] != '#') {
int iNum = std::count(sLine.begin(), sLine.end(), ';');
if(iNum != 2) {
/*int iNum = std::count(sLine.begin(), sLine.end(), ' ');
if(iNum == 1) { //its an option! hurray
} else {*/
DebugLog() << "Bad Rule: " << sLine << "\n";
//}
} else {
std::string sRule = "";
bool bActive = true;
bool bExclude = false;
size_t iPos = 0;
int iCol = 1;
do {
iPos = sLine.find(";");
std::string sTemp = (iPos == std::string::npos) ? sLine : sLine.substr(0, iPos);
if (iCol == 1) {
sRule = sTemp;
} else if (iCol == 2) {
bActive = (sTemp == "T" || sTemp == "True") ? true : false;
} else if (iCol == 3) {
bExclude = (sTemp == "T" || sTemp == "True") ? true : false;
}
iCol++;
if (iPos != std::string::npos) {
sLine = sLine.substr(iPos+1, sLine.size());
}
} while(iPos != std::string::npos);
vAutoPickupRules[(bCharacter) ? 2 : 1].push_back(cPickupRules(sRule, bActive, bExclude));
}
}
}
fin.close();
merge_vector();
createPickupRules();
}
示例10: DebugLog
// |----------------------------------------------------------------------------|
// | Initialize |
// |----------------------------------------------------------------------------|
bool Player::Initialize() {
GameObject::Initialize();
// Set up ship
Graphic* graphic = new Graphic;
graphic->SetTint(1.0f,1.0f,1.0f,1.0f);
graphic->SetShader("Texture");
graphic->SetShader("Light");
graphic->SetTexture("shiptexture");
graphic->SetModel("ship");
graphic->SetScale(Coord(0.01f,0.01f,0.01f));
graphic->SetReflectiveness(0.95f);
graphic->Initialize();
m_ship = new GameObject;
m_ship->Initialize();
m_ship->SetGraphic(graphic);
m_ship->SetPosition(Coord(0.0f,0.0f,0.0f));
m_ship->SetOrientation(Coord(0.0f,0.0f,0.0f));
// Set up left thruster
m_leftThruster = new ParticleSystem;
m_leftThruster->Initialize();
graphic = new Billboard;
graphic->SetShader("Texture");
graphic->SetTexture("fireball");
graphic->SetAlphaBlend(true);
graphic->SetScale(Coord(0.003f,0.003f,0.003f));
graphic->Initialize();
m_leftThruster->SetGraphic(graphic);
m_leftThruster->SetPosition(Coord(-0.6f,0.0f,-0.7f));
m_leftThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
m_leftThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
m_leftThruster->SetParticleSpawnFrequency(0.01f);
m_leftThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
m_leftThruster->SetParticleLifetime(0.5f);
m_leftThruster->SetParticleFadeout(0.2f);
m_leftThruster->SetMaxParticles(100);
m_leftThruster->SetTint(0.8f,0.9f,1.0f);
m_leftThruster->SetTintVar(0.2f,0.2f,0.2f);
// Set up right thruster
m_rightThruster = new ParticleSystem;
m_rightThruster->Initialize();
graphic = new Billboard;
graphic->SetShader("Texture");
graphic->SetTexture("fireball");
graphic->SetAlphaBlend(true);
graphic->SetScale(Coord(0.003f,0.003f,0.003f));
graphic->Initialize();
m_rightThruster->SetGraphic(graphic);
m_rightThruster->SetPosition(Coord(0.6f,0.0f,-0.7f));
m_rightThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
m_rightThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
m_rightThruster->SetParticleSpawnFrequency(0.001f);
m_rightThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
m_rightThruster->SetParticleLifetime(0.5f);
m_rightThruster->SetParticleFadeout(0.2f);
m_rightThruster->SetMaxParticles(100);
m_rightThruster->SetTint(0.8f,0.9f,1.0f);
m_rightThruster->SetTintVar(0.2f,0.2f,0.2f);
DebugLog ("Player: object initialized.");
return true;
}
示例11: intelFlushLPIC
void IntelMausi::intelDisable()
{
struct e1000_hw *hw = &adapterData.hw;
UInt32 wufc = adapterData.wol;
UInt32 ctrl, ctrlExt, rctl, status;
/* Flush LPIC. */
intelFlushLPIC();
status = intelReadMem32(E1000_STATUS);
if (status & E1000_STATUS_LU)
wufc &= ~E1000_WUFC_LNKC;
if (wolActive && wufc) {
intelDown(&adapterData, false);
intelSetupRxControl(&adapterData);
rctl = intelReadMem32(E1000_RCTL);
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
/* turn on all-multi mode if wake on multicast is enabled */
if (wufc & E1000_WUFC_MC)
rctl |= E1000_RCTL_MPE;
intelWriteMem32(E1000_RCTL, rctl);
ctrl = intelReadMem32(E1000_CTRL);
ctrl |= E1000_CTRL_ADVD3WUC;
if (!(adapterData.flags2 & FLAG2_HAS_PHY_WAKEUP))
ctrl |= E1000_CTRL_EN_PHY_PWR_MGMT;
intelWriteMem32(E1000_CTRL, ctrl);
if (adapterData.hw.phy.media_type == e1000_media_type_fiber ||
adapterData.hw.phy.media_type == e1000_media_type_internal_serdes) {
/* keep the laser running in D3 */
ctrlExt = intelReadMem32(E1000_CTRL_EXT);
ctrlExt |= E1000_CTRL_EXT_SDP3_DATA;
intelWriteMem32(E1000_CTRL_EXT, ctrlExt);
}
if (adapterData.flags & FLAG_IS_ICH)
e1000_suspend_workarounds_ich8lan(hw);
if (adapterData.flags2 & FLAG2_HAS_PHY_WAKEUP) {
/* enable wakeup by the PHY */
intelInitPhyWakeup(wufc);
} else {
/* enable wakeup by the MAC */
intelWriteMem32(E1000_WUFC, wufc);
intelWriteMem32(E1000_WUC, E1000_WUC_PME_EN);
}
DebugLog("Ethernet [IntelMausi]: WUFC=0x%08x.\n", wufc);
} else {
intelDown(&adapterData, true);
intelWriteMem32(E1000_WUC, 0);
intelWriteMem32(E1000_WUFC, 0);
intelPowerDownPhy(&adapterData);
}
/* If AMT is enabled, let the firmware know that the network
* interface is now closed
*/
if (adapterData.flags & FLAG_HAS_AMT)
e1000e_release_hw_control(&adapterData);
}
示例12: USBmakebmRequestType
IOReturn BrcmPatchRAM::hciCommand(void * command, UInt16 length)
{
IOReturn result;
IOUSBDevRequest request =
{
.bmRequestType = USBmakebmRequestType(kUSBOut, kUSBClass, kUSBDevice),
.bRequest = 0,
.wValue = 0,
.wIndex = 0,
.wLength = length,
.pData = command
};
if ((result = mInterface->DeviceRequest(&request)) != kIOReturnSuccess)
AlwaysLog("[%04x:%04x]: device request failed (\"%s\" 0x%08x).\n", mVendorId, mProductId, stringFromReturn(result), result);
return result;
}
IOReturn BrcmPatchRAM::hciParseResponse(void* response, UInt16 length, void* output, UInt8* outputLength)
{
HCI_RESPONSE* header = (HCI_RESPONSE*)response;
IOReturn result = kIOReturnSuccess;
switch (header->eventCode)
{
case HCI_EVENT_COMMAND_COMPLETE:
{
HCI_COMMAND_COMPLETE* event = (HCI_COMMAND_COMPLETE*)response;
switch (event->opcode)
{
case HCI_OPCODE_READ_VERBOSE_CONFIG:
DebugLog("[%04x:%04x]: READ VERBOSE CONFIG complete (status: 0x%02x, length: %d bytes).\n",
mVendorId, mProductId, event->status, header->length);
mFirmareVersion = *(UInt16*)(((char*)response) + 10);
DebugLog("[%04x:%04x]: Firmware version: v%d.\n",
mVendorId, mProductId, mFirmareVersion + 0x1000);
// Device does not require a firmware patch at this time
if (mFirmareVersion > 0)
mDeviceState = kUpdateComplete;
else
mDeviceState = kFirmwareVersion;
break;
case HCI_OPCODE_DOWNLOAD_MINIDRIVER:
DebugLog("[%04x:%04x]: DOWNLOAD MINIDRIVER complete (status: 0x%02x, length: %d bytes).\n",
mVendorId, mProductId, event->status, header->length);
mDeviceState = kMiniDriverComplete;
break;
case HCI_OPCODE_LAUNCH_RAM:
//DebugLog("[%04x:%04x]: LAUNCH RAM complete (status: 0x%02x, length: %d bytes).\n",
// mVendorId, mProductId, event->status, header->length);
mDeviceState = kInstructionWritten;
break;
case HCI_OPCODE_END_OF_RECORD:
DebugLog("[%04x:%04x]: END OF RECORD complete (status: 0x%02x, length: %d bytes).\n",
mVendorId, mProductId, event->status, header->length);
mDeviceState = kFirmwareWritten;
break;
case HCI_OPCODE_RESET:
DebugLog("[%04x:%04x]: RESET complete (status: 0x%02x, length: %d bytes).\n",
mVendorId, mProductId, event->status, header->length);
mDeviceState = kResetComplete;
break;
default:
DebugLog("[%04x:%04x]: Event COMMAND COMPLETE (opcode 0x%04x, status: 0x%02x, length: %d bytes).\n",
mVendorId, mProductId, event->opcode, event->status, header->length);
break;
}
if (output && outputLength)
{
bzero(output, *outputLength);
// Return the received data
if (*outputLength >= length)
{
DebugLog("[%04x:%04x]: Returning output data %d bytes.\n", mVendorId, mProductId, length);
*outputLength = length;
memcpy(output, response, length);
}
else
// Not enough buffer space for data
result = kIOReturnMessageTooLarge;
}
break;
}
case HCI_EVENT_NUM_COMPLETED_PACKETS:
DebugLog("[%04x:%04x]: Number of completed packets.\n", mVendorId, mProductId);
break;
case HCI_EVENT_CONN_COMPLETE:
//.........這裏部分代碼省略.........
示例13: DebugLog
CGameLoaderHandler::CGameLoaderHandler()
{
DebugLog("Constructing the game loader component...");
};
示例14: IOLockLock
bool BrcmPatchRAM::performUpgrade()
{
BrcmFirmwareStore* firmwareStore;
OSArray* instructions = NULL;
OSCollectionIterator* iterator = NULL;
OSData* data;
#ifdef DEBUG
DeviceState previousState = kUnknown;
#endif
IOLockLock(mCompletionLock);
mDeviceState = kInitialize;
while (true)
{
#ifdef DEBUG
if (mDeviceState != kInstructionWrite && mDeviceState != kInstructionWritten)
DebugLog("[%04x:%04x]: State \"%s\" --> \"%s\".\n", mVendorId, mProductId, getState(previousState), getState(mDeviceState));
previousState = mDeviceState;
#endif
// Break out when done
if (mDeviceState == kUpdateAborted || mDeviceState == kUpdateComplete)
break;
// Note on following switch/case:
// use 'break' when a response from io completion callback is expected
// use 'continue' when a change of state with no expected response (loop again)
switch (mDeviceState)
{
case kInitialize:
hciCommand(&HCI_VSC_READ_VERBOSE_CONFIG, sizeof(HCI_VSC_READ_VERBOSE_CONFIG));
break;
case kFirmwareVersion:
// Unable to retrieve firmware store
if (!(firmwareStore = getFirmwareStore()))
{
mDeviceState = kUpdateAborted;
continue;
}
instructions = firmwareStore->getFirmware(OSDynamicCast(OSString, getProperty(kFirmwareKey)));
// Unable to retrieve firmware instructions
if (!instructions)
{
mDeviceState = kUpdateAborted;
continue;
}
// Initiate firmware upgrade
hciCommand(&HCI_VSC_DOWNLOAD_MINIDRIVER, sizeof(HCI_VSC_DOWNLOAD_MINIDRIVER));
break;
case kMiniDriverComplete:
// Write firmware data to bulk pipe
iterator = OSCollectionIterator::withCollection(instructions);
if (!iterator)
{
mDeviceState = kUpdateAborted;
continue;
}
// If this IOSleep is not issued, the device is not ready to receive
// the firmware instructions and we will deadlock due to lack of
// responses.
IOSleep(10);
// Write first 2 instructions to trigger response
if ((data = OSDynamicCast(OSData, iterator->getNextObject())))
bulkWrite(data->getBytesNoCopy(), data->getLength());
if ((data = OSDynamicCast(OSData, iterator->getNextObject())))
bulkWrite(data->getBytesNoCopy(), data->getLength());
break;
case kInstructionWrite:
// should never happen, but would cause a crash
if (!iterator)
{
mDeviceState = kUpdateAborted;
continue;
}
if ((data = OSDynamicCast(OSData, iterator->getNextObject())))
bulkWrite(data->getBytesNoCopy(), data->getLength());
else
// Firmware data fully written
hciCommand(&HCI_VSC_END_OF_RECORD, sizeof(HCI_VSC_END_OF_RECORD));
break;
case kInstructionWritten:
mDeviceState = kInstructionWrite;
continue;
case kFirmwareWritten:
hciCommand(&HCI_RESET, sizeof(HCI_RESET));
break;
case kResetComplete:
resetDevice();
//.........這裏部分代碼省略.........
示例15: DebugLog
std::string mod_ui::get_information( MOD_INFORMATION *mod )
{
if( mod == NULL ) {
return "";
}
std::string modident = mod->ident;
std::string note = ( !mm_tree->is_available( modident ) ) ? mm_tree->get_node(
modident )->s_errors() : "";
std::ostringstream info;
// color the note red!
if( !note.empty() ) {
std::stringstream newnote;
newnote << "<color_red>" << note << "</color>";
note = newnote.str();
}
std::vector<std::string> dependencies = mod->dependencies;
std::vector<std::string> authors = mod->authors;
std::string description = mod->description;
std::string dependency_string = "";
if( !dependencies.empty() ) {
DebugLog( D_PEDANTIC_INFO, DC_ALL ) << mod->name << " Dependencies --";
for( size_t i = 0; i < dependencies.size(); ++i ) {
if( i > 0 ) {
//~ delimiter for mod dependency enumeration
dependency_string += pgettext( "mod manager", ", " );
}
DebugLog( D_PEDANTIC_INFO, DC_ALL ) << "\t" << dependencies[i];
if( active_manager->mod_map.find( dependencies[i] ) != active_manager->mod_map.end() ) {
dependency_string += "[" + active_manager->mod_map[dependencies[i]]->name + "]";
} else {
dependency_string += "[<color_red>" + dependencies[i] + "</color>]";
}
}
DebugLog( D_PEDANTIC_INFO, DC_ALL ) << "\n";
}
std::string author_string = "";
if( !authors.empty() ) {
for( size_t i = 0; i < authors.size(); ++i ) {
if( i > 0 ) {
//~ delimiter for mod author enumeration
author_string += pgettext( "mod manager", ", " );
}
author_string += authors[i];
}
info << string_format( ngettext( "Author: %s\n", "Authors: %s\n", authors.size() ),
author_string.c_str() );
} else {
info << _( "Authors: [UNKNOWN]\n" );
}
if( !dependencies.empty() ) {
info << string_format( ngettext( "Dependency: %s\n", "Dependencies: %s\n", dependencies.size() ),
dependency_string.c_str() );
} else {
info << _( "Dependencies: [NONE]\n" );
}
if( !description.empty() ) {
info << string_format( _( "Description: %s\n" ), description.c_str() );
} else {
info << _( "Description: [NONE]\n" );
}
if( mod->_type == MT_SUPPLEMENTAL && !note.empty() ) {
info << note;
}
#ifndef LUA
if( mod->need_lua ) {
std::string lua_msg = "";
lua_msg += "<color_red>";
lua_msg += _( "This mod requires Lua but your CDDA build doesn't support it!" );
lua_msg += "</color>";
info << lua_msg;
}
#endif
return info.str();
}