bool SkOSWindow::attachCommandBuffer(int msaaSampleCount, AttachmentInfo* info) { if (!fCommandBuffer) { fCommandBuffer = SkCommandBufferGLContext::Create((HWND)fHWND, msaaSampleCount); if (!fCommandBuffer) return false; SkAutoTUnref<const GrGLInterface> intf(GrGLCreateCommandBufferInterface()); if (intf) { GL_CALL(intf, ClearStencil(0)); GL_CALL(intf, ClearColor(0, 0, 0, 0)); GL_CALL(intf, StencilMask(0xffffffff)); GL_CALL(intf, Clear(GL_STENCIL_BUFFER_BIT |GL_COLOR_BUFFER_BIT)); } } if (fCommandBuffer->makeCurrent()) { info->fStencilBits = fCommandBuffer->getStencilBits(); info->fSampleCount = fCommandBuffer->getSampleCount(); SkAutoTUnref<const GrGLInterface> intf(GrGLCreateCommandBufferInterface()); if (intf ) { GL_CALL(intf, Viewport(0, 0, SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()))); } return true; } return false; }
bool SkOSWindow::attachANGLE(int msaaSampleCount, AttachmentInfo* info) { if (EGL_NO_DISPLAY == fDisplay) { bool bResult = create_ANGLE((HWND)fHWND, msaaSampleCount, &fDisplay, &fContext, &fSurface, &fConfig); if (false == bResult) { return false; } SkAutoTUnref<const GrGLInterface> intf(GrGLCreateANGLEInterface()); if (intf) { ANGLE_GL_CALL(intf, ClearStencil(0)); ANGLE_GL_CALL(intf, ClearColor(0, 0, 0, 0)); ANGLE_GL_CALL(intf, StencilMask(0xffffffff)); ANGLE_GL_CALL(intf, Clear(GL_STENCIL_BUFFER_BIT |GL_COLOR_BUFFER_BIT)); } } if (eglMakeCurrent(fDisplay, fSurface, fSurface, fContext)) { eglGetConfigAttrib(fDisplay, fConfig, EGL_STENCIL_SIZE, &info->fStencilBits); eglGetConfigAttrib(fDisplay, fConfig, EGL_SAMPLES, &info->fSampleCount); SkAutoTUnref<const GrGLInterface> intf(GrGLCreateANGLEInterface()); if (intf ) { ANGLE_GL_CALL(intf, Viewport(0, 0, SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()))); } return true; } return false; }
const list CDebugSystemObjects::GetThreadIdsByIndex(ULONG start, ULONG count) const { list tids; HRESULT r; PULONG d_ids(0); PULONG s_ids(0); CComQIPtr<IDebugSystemObjects> intf(m_intf); try { d_ids = new ULONG[count]; s_ids = new ULONG[count]; Check(r = m_intf->GetThreadIdsByIndex(start, count, d_ids, s_ids)); for (ULONG i = 0; i < count; i++) { tids.append( make_tuple( d_ids[i], s_ids[i] ) ); } } catch (std::exception&) { if (d_ids) // if bjarne knew what finally meant, i might not have to delete [] d_ids; if (s_ids) // initialize and test these explicitly delete [] s_ids; throw; } delete [] d_ids; delete [] s_ids; return tids; }
void SkOSWindow::presentANGLE() { SkAutoTUnref<const GrGLInterface> intf(GrGLCreateANGLEInterface()); if (intf) { ANGLE_GL_CALL(intf, Flush()); } eglSwapBuffers(fDisplay, fSurface); }
const CDebugSystemObjects::CDebugSystem CDebugSystemObjects::GetCurrentSystem(void) const { ULONG id = 0; CComQIPtr<IDebugSystemObjects3> intf(m_intf); Check(intf->GetCurrentSystemId(&id)); return CDebugSystem(this, id); }
ULONG64 CDebugSystemObjects::GetImplicitThreadDataOffset(void) const { CComQIPtr<IDebugSystemObjects2> intf(m_intf); ULONG64 offset; Check(intf->GetImplicitThreadDataOffset(&offset)); return offset; }
const CDebugSystemObjects::CDebugSystem CDebugSystemObjects::GetEventSystem(void) const { CComQIPtr<IDebugSystemObjects3> intf(m_intf); ULONG id; Check(intf->GetEventSystem(&id)); return CDebugSystem(this, id); }
const object CDebugSystemObjects::CCurrentProcess::GetUpTime(void) const { CComQIPtr<IDebugSystemObjects2> intf(m_intf); ULONG uptime; Check(intf->GetCurrentProcessUpTime(&uptime)); static const ULONG SECONDS_PER_DAY = 60 * 60 * 24; return object(handle<>(::PyDelta_FromDSU(uptime / SECONDS_PER_DAY, uptime % SECONDS_PER_DAY, 0))); }
template <class charT, class traits> inline void basic_unzip_streambuf<charT, traits>::put_back_from_zip_stream(void) { if(_zip_stream.avail_in == 0) return; _istream.clear(std::ios::goodbit); _istream.seekg(-intf(_zip_stream.avail_in), std::ios_base::cur); _zip_stream.avail_in = 0; }
void test_dispatcher() { RefCountedPtr<SysContext> ctx(new SysContext); RefCountedPtr<iSysComponent> cpt( new StdLogger( StdLogger::LOGC_DEBUG) ); ctx->addComponent( cpt ); // create the interfaces RefCountedPtr<RpcInterface> intf( new RpcInterface( NTEXT("interface"), ctx )); RefCountedPtr<RpcInterface> intf1( new RpcInterface( NTEXT("interface"), ctx )); RefCountedPtr<RpcInterface> intf2( new RpcInterface( NTEXT("interface"), ctx )); // create the methods RefCountedPtr<Object1Method1> method( new Object1Method1(NTEXT("method"), NTEXT("default")) ); intf->addMethod( (RefCountedPtr<iRpcMethod>&)method ); RefCountedPtr<Object1Method1> method1( new Object1Method1(NTEXT("method"), NTEXT("apache")) ); intf1->addMethod( (RefCountedPtr<iRpcMethod>&)method1 ); RefCountedPtr<Object1Method1> method2( new Object1Method1(NTEXT("method"), NTEXT("cslib")) ); intf2->addMethod( (RefCountedPtr<iRpcMethod>&)method2 ); RpcDispatcher disp( NTEXT("test-dispatcher"), ctx ); disp.addInterface( intf ); disp.addInterface( intf1, APACHE_TENANT ); disp.addInterface( intf2, CSLIB_TENANT ); DOMDocument* requestDoc = DomUtils::getDocument( NTEXT("rpc_dispatcher.xml") ); if (requestDoc != NULL) { StreamFormatTarget targ(COUT); DOMDocument* responseDoc = DomUtils::createDocument( NTEXT("default") ); if (responseDoc != NULL) { disp.dispatch( requestDoc, responseDoc ); disp.dispatch( requestDoc, responseDoc, APACHE_TENANT ); disp.dispatch( requestDoc, responseDoc, CSLIB_TENANT ); disp.dispatch( requestDoc, responseDoc, INVALID_TENANT ); DomUtils::print( responseDoc, NTEXT("UTF-8"), targ ); responseDoc->release(); } requestDoc->release(); } }
const list CDebugSystemObjects::GetSystems(void) const { CComQIPtr<IDebugSystemObjects3> intf(m_intf); ULONG number = 0, id = 0; Check(intf->GetNumberSystems(&number)); list systems; for (ULONG i=0; i<number; i++) { Check(intf->GetSystemIdsByIndex(i, 1, &id)); CDebugSystem system(this, id); systems.append(system); } return systems; }
void mld_group_interface::output_info(base_stream &ctx, bool detailed) const { ctx.xprintf("Group-Interface %s [MLD]\n", intf()->name()); ctx.inc_level(); int maxsources = 3; const address_set &srcs = active_set(); if (detailed) { maxsources = srcs.size(); } ctx.xprintf("Filter: %s ", filter_mode() == include ? "Include" : "Exclude"); if (srcs.empty()) { ctx.write("{}"); } else { ctx.write("{"); address_set::const_iterator i = srcs.begin(); ctx.xprintf("%{addr}", *i); ++i; for (int k = 1; k < maxsources && i != srcs.end(); ++i) { ctx.xprintf(", %{addr}", *i); k++; } if (i != srcs.end()) ctx.write(", ..."); ctx.write(" }"); } if (g_filter_timer.is_running()) { ctx.xprintf(" (Reset in %{duration})", g_filter_timer.time_left_d()); } ctx.newl(); if (detailed) { if (!g_sources_timers.empty()) { ctx.writeline("Sources:"); ctx.inc_level(); std::vector<source_timer>::const_iterator i; for (i = g_sources_timers.begin(); i != g_sources_timers.end(); ++i) { ctx.xprintf("%{addr} for %{duration}", i->argument(), i->time_left_d()); } ctx.dec_level(); } } output_inner_info(ctx, detailed); ctx.dec_level(); }
base_stream &group_interface::log() const { return intf()->log().xprintf("(%{Addr}) ", owner()->id()); }
void CDebugSystemObjects::SetImplicitThreadDataOffset(ULONG64 offset) const { CComQIPtr<IDebugSystemObjects2> intf(m_intf); Check(intf->SetImplicitThreadDataOffset(offset)); }
void CDebugSystemObjects::SetCurrentSystem(const CDebugSystemObjects::CDebugSystem& system) const { CComQIPtr<IDebugSystemObjects3> intf(m_intf); Check(intf->SetCurrentSystemId(system.GetId())); }
int main (int argc, char **argv) { int opt; int temp_int; int option_index = 0; bool bOptionHelp = false; /* Create application instance */ // QApplication::setStyle( new QWindowsStyle ); QApplication qapp (argc, argv); /* Print the version number */ displayVersion(); // create the data location manager (with user data under ~/.showeq DataLocationMgr dataLocMgr(".showeq"); /* Initialize the parameters with default values */ QFileInfo configFileDefInfo = dataLocMgr.findExistingFile(".", "seqdef.xml", true, false); if (!configFileDefInfo.exists()) { fprintf(stderr, "Fatal: Couldn't find seqdef.xml!\n" "\tDid you remember to do 'make install'\n"); exit(-1); } QString configFileDef = configFileDefInfo.absFilePath(); QFileInfo configFileInfo = dataLocMgr.findWriteFile(".", "showeq.xml", true, true); // deal with funky border case since we may be running setuid QString configFile; if (configFileInfo.dir() != QDir::root()) configFile = configFileInfo.absFilePath(); else configFile = QFileInfo(dataLocMgr.userDataDir(".").absPath(), "showeq.xml").absFilePath(); // scan command line arguments for a specified config file int i = 1; while (i < argc) { if ((argv[i][0] == '-') && (argv[i][1] == 'o')) configFile = argv[i + 1]; i ++; } /* NOTE: See preferencefile.cpp for info on how to use prefrences class */ printf("Using config file '%s'\n", (const char*)configFile); pSEQPrefs = new XMLPreferences(configFileDef, configFile); showeq_params = new ShowEQParams; QString section; section = "Interface"; /* Allow map depth filtering */ showeq_params->retarded_coords = pSEQPrefs->getPrefBool("RetardedCoords", section, 0); showeq_params->systime_spawntime = pSEQPrefs->getPrefBool("SystimeSpawntime", section, false); showeq_params->pvp = pSEQPrefs->getPrefBool("PvPTeamColoring", section, false); showeq_params->deitypvp = pSEQPrefs->getPrefBool("DeityPvPTeamColoring", section, false); showeq_params->keep_selected_visible = pSEQPrefs->getPrefBool("KeepSelected", section, true); section = "Misc"; showeq_params->fast_machine = pSEQPrefs->getPrefBool("FastMachine", section, true); showeq_params->createUnknownSpawns = pSEQPrefs->getPrefBool("CreateUnknownSpawns", section, true); showeq_params->walkpathrecord = pSEQPrefs->getPrefBool("WalkPathRecording", section, false); showeq_params->walkpathlength = pSEQPrefs->getPrefInt("WalkPathLength", section, 25); /* Tells SEQ whether or not to display casting messages (Turn this off if you're on a big raid) */ section = "SpawnList"; showeq_params->showRealName = pSEQPrefs->getPrefBool("ShowRealName", section, false); /* Different files for different kinds of raw data */ section = "SaveState"; showeq_params->saveZoneState = pSEQPrefs->getPrefBool("ZoneState", section, 1); showeq_params->savePlayerState = pSEQPrefs->getPrefBool("PlayerState", section, 1); showeq_params->saveSpawns = pSEQPrefs->getPrefBool("Spawns", section, false); showeq_params->saveSpawnsFrequency = pSEQPrefs->getPrefInt("SpawnsFrequency", section, (120 * 1000)); showeq_params->restorePlayerState = false; showeq_params->restoreZoneState = false; showeq_params->restoreSpawns = false; showeq_params->saveRestoreBaseFilename = dataLocMgr.findWriteFile("tmp", pSEQPrefs->getPrefString("BaseFilename", section, "last")).absFilePath(); /* Parse the commandline for commandline parameters */ while ((opt = getopt_long( argc, argv, OPTION_LIST, option_list, &option_index )) != -1 ) { switch (opt) { /* Set the request to use a despawn list based off the spawn alert list. */ /* Set the interface */ case 'i': { pSEQPrefs->setPrefString("Device", "Network", optarg, XMLPreferences::Runtime); break; } /* Set pcap thread to realtime */ case 'r': { pSEQPrefs->setPrefBool("RealTimeThread", "Network", true, XMLPreferences::Runtime); break; } /* Set the spawn filter file */ case 'f': { pSEQPrefs->setPrefString("FilterFile", "Filters", optarg, XMLPreferences::Runtime); break; } /* Packet playback mode */ case 'j': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Playback", "VPacket", true, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Record", "VPacket", false, XMLPreferences::Runtime); break; } /* Packet record mode */ case 'g': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Playback", "VPacket", false, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Record", "VPacket", true, XMLPreferences::Runtime); break; } /* Config file was already taken care of, ignore */ case 'o': break; /* Make filter case sensitive */ case 'C': { pSEQPrefs->setPrefBool("IsCaseSensitive", "Filters", true, XMLPreferences::Runtime); break; } /* Use retarded coordinate system yxz */ case 'c': { showeq_params->retarded_coords = 1; break; } /* Fast machine updates.. framerate vs packet based */ case 'F': { showeq_params->fast_machine = 1; break; } /* Show unknown spawns */ case 'K': { showeq_params->createUnknownSpawns = 1; break; } /* Select spawn on 'Consider' */ case 'S': { pSEQPrefs->setPrefBool("SelectOnCon", "Interface", true, XMLPreferences::Runtime); break; } /* Select spawn on 'Target' */ case 'e': { pSEQPrefs->setPrefBool("SelectOnTarget", "Interface", true, XMLPreferences::Runtime); break; } /* Show net info */ case 'N': { pSEQPrefs->getPrefBool("ShowNetStats", section, true, XMLPreferences::Runtime); break; } /* 't'rack pathing for mobs */ case 't': { showeq_params->walkpathrecord = 1; break; } /* Maximum spawn path tracking length */ case 'L': { showeq_params->walkpathlength = atoi(optarg); break; } /* Log spawns! */ case 'x': { pSEQPrefs->setPrefBool("LogSpawns", "Misc", true, XMLPreferences::Runtime); break; } /* Display the version info... */ case 'V': case 'v': { exit(0); break; } /* Don't autodetect character settings */ case 'W': { pSEQPrefs->getPrefBool("AutoDetectCharSettings", "Defaults", false, XMLPreferences::Runtime); break; } /* Set default player level */ case 'X': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 70) { printf ("Invalid default level. Valid range is 1 - 70.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultLevel", "Defaults", temp_int, XMLPreferences::Runtime); break; } /* Set default player race */ case 'Y': { temp_int = atoi(optarg); if ((temp_int < 1 || temp_int > 12) && (temp_int != 128) && (temp_int != 130) && (temp_int != 26) && (temp_int != 330)) { printf ("Invalid default race, please use showeq -h to list valid race options.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultRace", "Defaults", temp_int, XMLPreferences::Runtime); break; } /* Set default player class */ case 'Z': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 16) { printf ("Invalid default class, please use showeq -h to list valid class options.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultClass", "Defaults", temp_int); break; } /* IP address to track */ case IPADDR_OPTION: { pSEQPrefs->setPrefString("IP", "Network", optarg, XMLPreferences::Runtime); break; } /* MAC address to track for those on DHCP */ case MACADDR_OPTION: { pSEQPrefs->setPrefString("MAC", "Network", optarg, XMLPreferences::Runtime); break; } /* Filename for logging all packets */ case GLOBAL_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("GlobalLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging world change packets */ case WORLD_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("WorldLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging zone change packets */ case ZONE_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("ZoneLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging unknown zone change packets */ case UNKNOWN_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("UnknownZoneLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Log everything */ case GLOBAL_LOG_OPTION: { pSEQPrefs->setPrefBool("LogAllPackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Log all zone change packets */ case ZONE_LOG_OPTION: { pSEQPrefs->setPrefBool("LogZonePackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Log only unfamiliar zone change packets */ case UNKNOWN_ZONE_LOG_OPTION: { pSEQPrefs->setPrefBool("LogUnknownZonePackets", "PacketLogging", true, XMLPreferences::Runtime); break; } case PLAYBACK_SPEED_OPTION: { pSEQPrefs->setPrefInt("PlaybackRate", "VPacket", atoi(optarg), XMLPreferences::Runtime); break; } /* Enable logging of raw packets... */ case RAW_LOG_OPTION: { pSEQPrefs->setPrefBool("LogRawPackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Display spawntime in UNIX time (time_t) instead of hh:mm format */ case SYSTIME_SPAWNTIME_OPTION: { showeq_params->systime_spawntime = 1; break; } case SPAWNLOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("SpawnLogFilename", "Misc", optarg, XMLPreferences::Runtime); break; } case ITEMDB_DATA_FILENAME_OPTION: { pSEQPrefs->setPrefString("DataDBFilename", "ItemDB", optarg, XMLPreferences::Runtime); break; } case ITEMDB_RAW_FILENAME_OPTION: { pSEQPrefs->setPrefString("RawDataDBFilename", "ItemDB", optarg, XMLPreferences::Runtime); break; } case ITEMDB_DATABASES_ENABLED: { pSEQPrefs->setPrefInt("DatabasesEnabled", "ItemDB", atoi(optarg), XMLPreferences::Runtime); break; } case ITEMDB_DISABLE: { pSEQPrefs->setPrefBool("Enabled", "ItemDB", false, XMLPreferences::Runtime); break; } case ITEMDB_ENABLE: { pSEQPrefs->setPrefBool("Enabled", "ItemDB", true, XMLPreferences::Runtime); break; } case RESTORE_PLAYER_STATE: { showeq_params->restorePlayerState = true; break; } case RESTORE_ZONE_STATE: { showeq_params->restoreZoneState = true; break; } case RESTORE_SPAWNS: { showeq_params->restoreSpawns = true; break; } case RESTORE_ALL: { showeq_params->restorePlayerState = true; showeq_params->restoreZoneState = true; showeq_params->restoreSpawns = true; break; } /* Spit out the help */ case 'h': /* Fall through */ default: { bOptionHelp = true; break; } } } if (bOptionHelp) { displayOptions(argv[0]); exit (0); } /* Set up individual files for logging selected packet types based on a common filename base. The types to log were found by following where pre_worked was a precondition for further analysis. */ int ret; // just to add a scope to better control when the main interface gets // destroyed if (1) { /* The main interface widget */ EQInterface intf(&dataLocMgr, 0, "interface"); qapp.setMainWidget (&intf); /* Start the main loop */ ret = qapp.exec (); } // delete the preferences data delete pSEQPrefs; // delete the showeq_params data delete showeq_params; return ret; }
bool group_interface::should_log(int level) const { return owner_node()->should_log(level) && intf()->should_log(level); }