bool MachineBridge::registerListener() //TODO select only events that I'm interested to
{
	nsresult rc;

	if(session == nsnull)
		return false;
	
	NS_CHECK_AND_DEBUG_ERROR(session, GetConsole(getter_AddRefs(console)), rc);
	if(NS_FAILED(rc))
		return false;

	NS_CHECK_AND_DEBUG_ERROR(console, GetEventSource(getter_AddRefs(eventSource)), rc);
	if(NS_FAILED(rc))
		return false;
	
// 	QVector<VBoxEventType> events;
	uint32_t events[1];
// 	events << VBoxEventType::Any;
	events[0] = VBoxEventType::Any;
	NS_CHECK_AND_DEBUG_ERROR(eventSource, RegisterListener(eventListener, /*events.count()*/ 1, events, (PRBool) true), rc);
	if(NS_FAILED(rc))
		return false;

	return true;
}
OrientationListener::OrientationEventListenerInternal::OrientationEventListenerInternal(
    /* [in] */ IContext* context,
    /* [in] */ Int32 rate,
    /* [in] */ OrientationListener* host)
{
    mHost = host;
    constructor(context, rate);
    RegisterListener(mHost);
}
Exemple #3
0
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			m_actInfo = *pActInfo;
			SAFE_HUD_FUNC(RegisterListener(this));
			break;
		case eFE_Activate:
			{
			}
			break;
		}
	}
Exemple #4
0
LogManager::LogManager()
{
	// create log containers
	m_Log[LogTypes::ACTIONREPLAY]       = new LogContainer("ActionReplay",    "ActionReplay");
	m_Log[LogTypes::AUDIO]              = new LogContainer("Audio",           "Audio Emulator");
	m_Log[LogTypes::AUDIO_INTERFACE]    = new LogContainer("AI",              "Audio Interface (AI)");
	m_Log[LogTypes::BOOT]               = new LogContainer("BOOT",            "Boot");
	m_Log[LogTypes::COMMANDPROCESSOR]   = new LogContainer("CP",              "CommandProc");
	m_Log[LogTypes::COMMON]             = new LogContainer("COMMON",          "Common");
	m_Log[LogTypes::CONSOLE]            = new LogContainer("CONSOLE",         "Dolphin Console");
	m_Log[LogTypes::DISCIO]             = new LogContainer("DIO",             "Disc IO");
	m_Log[LogTypes::DSPHLE]             = new LogContainer("DSPHLE",          "DSP HLE");
	m_Log[LogTypes::DSPLLE]             = new LogContainer("DSPLLE",          "DSP LLE");
	m_Log[LogTypes::DSP_MAIL]           = new LogContainer("DSPMails",        "DSP Mails");
	m_Log[LogTypes::DSPINTERFACE]       = new LogContainer("DSP",             "DSPInterface");
	m_Log[LogTypes::DVDINTERFACE]       = new LogContainer("DVD",             "DVD Interface");
	m_Log[LogTypes::DYNA_REC]           = new LogContainer("JIT",             "Dynamic Recompiler");
	m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI",             "Expansion Interface");
	m_Log[LogTypes::FILEMON]            = new LogContainer("FileMon",         "File Monitor");
	m_Log[LogTypes::GDB_STUB]           = new LogContainer("GDB_STUB",        "GDB Stub");
	m_Log[LogTypes::GPFIFO]             = new LogContainer("GP",              "GPFifo");
	m_Log[LogTypes::HOST_GPU]           = new LogContainer("Host GPU",        "Host GPU");
	m_Log[LogTypes::MASTER_LOG]         = new LogContainer("*",               "Master Log");
	m_Log[LogTypes::MEMCARD_MANAGER]    = new LogContainer("MemCard Manager", "MemCard Manager");
	m_Log[LogTypes::MEMMAP]             = new LogContainer("MI",              "MI & memmap");
	m_Log[LogTypes::NETPLAY]            = new LogContainer("NETPLAY",         "Netplay");
	m_Log[LogTypes::OSHLE]              = new LogContainer("HLE",             "HLE");
	m_Log[LogTypes::OSREPORT]           = new LogContainer("OSREPORT",        "OSReport");
	m_Log[LogTypes::PAD]                = new LogContainer("PAD",             "Pad");
	m_Log[LogTypes::PIXELENGINE]        = new LogContainer("PE",              "PixelEngine");
	m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI",              "ProcessorInt");
	m_Log[LogTypes::POWERPC]            = new LogContainer("PowerPC",         "IBM CPU");
	m_Log[LogTypes::SERIALINTERFACE]    = new LogContainer("SI",              "Serial Interface (SI)");
	m_Log[LogTypes::SP1]                = new LogContainer("SP1",             "Serial Port 1");
	m_Log[LogTypes::VIDEO]              = new LogContainer("Video",           "Video Backend");
	m_Log[LogTypes::VIDEOINTERFACE]     = new LogContainer("VI",              "Video Interface (VI)");
	m_Log[LogTypes::WIIMOTE]            = new LogContainer("Wiimote",         "Wiimote");
	m_Log[LogTypes::WII_IPC]            = new LogContainer("WII_IPC",         "WII IPC");
	m_Log[LogTypes::WII_IPC_DVD]        = new LogContainer("WII_IPC_DVD",     "WII IPC DVD");
	m_Log[LogTypes::WII_IPC_ES]         = new LogContainer("WII_IPC_ES",      "WII IPC ES");
	m_Log[LogTypes::WII_IPC_FILEIO]     = new LogContainer("WII_IPC_FILEIO",  "WII IPC FILEIO");
	m_Log[LogTypes::WII_IPC_HID]        = new LogContainer("WII_IPC_HID",     "WII IPC HID");
	m_Log[LogTypes::WII_IPC_HLE]        = new LogContainer("WII_IPC_HLE",     "WII IPC HLE");
	m_Log[LogTypes::WII_IPC_SD]         = new LogContainer("WII_IPC_SD",      "WII IPC SD");
	m_Log[LogTypes::WII_IPC_SSL]        = new LogContainer("WII_IPC_SSL",     "WII IPC SSL");
	m_Log[LogTypes::WII_IPC_STM]        = new LogContainer("WII_IPC_STM",     "WII IPC STM");
	m_Log[LogTypes::WII_IPC_NET]        = new LogContainer("WII_IPC_NET",     "WII IPC NET");
	m_Log[LogTypes::WII_IPC_WC24]       = new LogContainer("WII_IPC_WC24",    "WII IPC WC24");
	m_Log[LogTypes::WII_IPC_WIIMOTE]    = new LogContainer("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");

	RegisterListener(LogListener::FILE_LISTENER, new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)));
	RegisterListener(LogListener::CONSOLE_LISTENER, new ConsoleListener());

	IniFile ini;
	ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
	IniFile::Section* logs = ini.GetOrCreateSection("Logs");
	IniFile::Section* options = ini.GetOrCreateSection("Options");
	bool write_file;
	bool write_console;
	options->Get("WriteToFile", &write_file, false);
	options->Get("WriteToConsole", &write_console, true);

	for (LogContainer* container : m_Log)
	{
		bool enable;
		logs->Get(container->GetShortName(), &enable, false);
		container->SetEnable(enable);
		if (enable && write_file)
			container->AddListener(LogListener::FILE_LISTENER);
		if (enable && write_console)
			container->AddListener(LogListener::CONSOLE_LISTENER);
	}
}
int
main(int argc,
     char *argv[]) {

  char address[MAX_MACHINE_NAME + 1];
  IPAddress addresses[MAX_ADDRESSES];
  unsigned int addressesCount;
  char addressList[255 + 1];
  const char *c;
  char errorFile[127 + 1];
  char logFile[127 + 1];
  struct host_desc memoryDesc;
  double nextBeatTime;
  struct host_desc nsDesc;
  double now;
  int opt;
  extern char *optarg;
  char password[127 + 1];
  const char *USAGE =
    "nws_memory [-D] [-a name] [-d dir] [-el file] [-N host] [-p port] [-s size]";

  /* Set up default values that will be overwritten by command line args. */
  addressList[0] = '\0';
  errorFile[0] = '\0';
  fileSize = atoi(GetEnvironmentValue("MEMORY_SIZE",
                                      "~", ".nwsrc", DEFAULT_MEMORY_SIZE));
  journalFileSize = atoi(GetEnvironmentValue("JOURNAL_SIZE",
                                      "~", ".nwsrc", DEFAULT_JOURNAL_SIZE));
  logFile[0] = '\0';
  HostDValue(MyMachineName(), DefaultHostPort(MEMORY_HOST), &memoryDesc);
  SAFESTRCPY(memoryDir,
             GetEnvironmentValue("MEMORY_DIR", "~", ".nwsrc",
                                 DEFAULT_MEMORY_DIR));;
  SAFESTRCPY(nsDesc.host_name,
             GetEnvironmentValue("NAME_SERVER", "~", ".nwsrc", "noname"));
  HostDValue(nsDesc.host_name, DefaultHostPort(NAME_SERVER_HOST), &nsDesc);
  password[0] = '\0';
  memLogLocation.loc_type = MEMORY_LOG_LOCAL;
  debug = 0;

  while((int)(opt = getopt(argc, argv, SWITCHES)) != EOF) {

    switch(opt) {

    case 'a':
      SAFESTRCPY(addressList, optarg);
      break;

    case 'D':
      debug = 1;
      break;

    case 'd':
      SAFESTRCPY(memoryDir, optarg);
      break;

    case 'e':
      SAFESTRCPY(errorFile, optarg);
      break;

    case 'l':
      SAFESTRCPY(logFile, optarg);
      break;

    case 'N':
      HostDValue(optarg, DefaultHostPort(NAME_SERVER_HOST), &nsDesc);
      break;

    case 'p':
      memoryDesc.port = atoi(optarg);
      break;

    case 'P':
      fprintf(stdout, "Password? ");
      fscanf(stdin, "%s", password);
      break;

    case 's':
      fileSize = atoi(optarg);
      break;

    case 'j':
      journalFileSize = atoi(optarg);
      break;
#if defined(ENABLE_CACHE)
    case 'C':
      RC_entries = atoi(optarg);
      break;
#endif
    default:
      fprintf(stderr, "nws_memory: unrecognized switch\n%s\n", USAGE);
      exit(1);
      break;

    }

  }
#if defined(ENABLE_CACHE)
  /*
   * WARNING: these two had better be the same or the cache and backing
   * store could be inconsistent
   */
  RCMemorySize = fileSize;
  /*
   * make sure entries value is sane
   */
  if(RC_entries <= 0)
	  RC_entries = 0;
#endif

  if (debug) {
    DirectDiagnostics(DIAGINFO, stdout);
    DirectDiagnostics(DIAGLOG, stdout);
    DirectDiagnostics(DIAGWARN, stderr);
    DirectDiagnostics(DIAGERROR, stderr);
    DirectDiagnostics(DIAGFATAL, stderr);
  }

  for(addressesCount = 0, c = addressList;
      GETTOK(address, c, ",", &c);
      addressesCount++) {
    if(!IPAddressValue(address, &addresses[addressesCount])) {
      ABORT1("Unable to convert '%s' into an IP address\n", address);
    }
  }
  addressesCount += IPAddressValues(memoryDesc.host_name,
                                    &addresses[addressesCount],
                                    MAX_ADDRESSES - addressesCount);

  if(memoryDir[strlen(memoryDir) - 1] != '/') {
    strcat(memoryDir, "/");
  }
  if(!MakeDirectory(memoryDir, 0775, 1)) {
    ABORT1("Unable to establish %s as state directory\n", memoryDir);
  }
  SAFESTRCPY(memLogLocation.path,memoryDir);

  if(!EstablishHost(NameOfHost(&memoryDesc),
                    MEMORY_HOST,
                    addresses,
                    addressesCount,
                    memoryDesc.port,
                    errorFile,
                    logFile,
                    password,
                    &nsDesc,
                    NULL)) {
    exit(1);
  }

  vstrncpy(journalPath, sizeof(journalPath), 4,
           memoryDir, EstablishedRegistration(), ".", JOURNAL);

  fclose(stdin);
  signal(SIGPIPE, SocketFailure);
  RegisterListener(STORE_STATE, "STORE_STATE", &ProcessRequest);
  RegisterListener(FETCH_STATE, "FETCH_STATE", &ProcessRequest);
  RegisterListener(AUTOFETCH_BEGIN, "AUTOFETCH_BEGIN", &ProcessRequest);
  RegisterListener(MEMORY_CLEAN, "MEMORY_CLEAN", &ProcessRequest);
#ifdef WITH_NETLOGGER
  RegisterListener(MEMORY_LOGDEST, "MEMORY_LOGDEST", &ProcessRequest);
#endif
  NotifyOnDisconnection(&EndAutoFetch);
  nextBeatTime = CurrentTime();

  /* main service loop */
  while(1) {
    now = CurrentTime();
    if(now >= nextBeatTime) {
      RegisterHost(DEFAULT_HOST_BEAT * 2);
      nextBeatTime =
        now + (HostHealthy() ? DEFAULT_HOST_BEAT : SHORT_HOST_BEAT);
    }
    ListenForMessages(nextBeatTime - now);
  }

  /* return(0); Never reached */

}
int
main(int argc,
     char *argv[]) {

  char address[MAX_MACHINE_NAME + 1];
  IPAddress addresses[MAX_ADDRESSES];
  unsigned int addressesCount;
  char addressList[255 + 1];
  const char *c;
  unsigned long compressionFreq;
  char errorFile[127 + 1];
  char logFile[127 + 1];
  unsigned long nextCompression;
  struct host_desc nsDesc;
  char password[127 + 1];
  int opt;
  extern char *optarg;
  char registrationFileName[255 + 1];
  const char *USAGE =
    "nws_nameserver [-D] [-a name] [-c seconds] [-efl file] [-p port]";

  /* Set up default values that will be overwritten by command line args. */
  addressList[0] = '\0';
  compressionFreq = DEFAULT_COMPRESSION_FREQUENCY;
  errorFile[0] = '\0';
  logFile[0] = '\0';
  HostDValue(MyMachineName(), DefaultHostPort(NAME_SERVER_HOST), &nsDesc);
  SAFESTRCPY(registrationFileName, DEFAULT_FILE);
  password[0] = '\0';
  debug = 0;

  while((int)(opt = getopt(argc, argv, SWITCHES)) != EOF) {

    switch(opt) {

    case 'a':
      SAFESTRCPY(addressList, optarg);
      break;

    case 'c':
      compressionFreq = atol(optarg);
      break;

    case 'D':
      debug = 1;
      break;

    case 'e':
      SAFESTRCPY(errorFile, optarg);
      break;

    case 'f':
      SAFESTRCPY(registrationFileName, optarg);
      break;

    case 'l':
      SAFESTRCPY(logFile, optarg);
      break;

    case 'p':
      nsDesc.port = atoi(optarg);
      break;

    case 'P':
      fprintf(stdout, "Password? ");
      fscanf(stdin, "%s", password);
      break;

    default:
      fprintf(stderr, "nws_nameserver: unrecognized switch\n%s\n", USAGE);
      exit(1);
      break;

    }

  }

  if (debug) {
    DirectDiagnostics(DIAGINFO, stdout);
    DirectDiagnostics(DIAGLOG, stdout);
    DirectDiagnostics(DIAGWARN, stderr);
    DirectDiagnostics(DIAGERROR, stderr);
    DirectDiagnostics(DIAGFATAL, stderr);
  }

  addressesCount = IPAddressValues(nsDesc.host_name, addresses, MAX_ADDRESSES);
  for(c = addressList; GETTOK(address, c, ",", &c); ) {
    if(!IPAddressValue(address, &addresses[addressesCount++])) {
      ABORT1("Unable to convert '%s' into an IP address\n", address);
    }
  }

  registrationFile = fopen(registrationFileName, "r+");
  if(registrationFile == NULL) {
    registrationFile = fopen(registrationFileName, "w+");
  }
  
  if(registrationFile == NULL) {
    ABORT1("Unable to open %s for storing registrations\n",
           registrationFileName);
  }

  if(!EstablishHost(NameOfHost(&nsDesc),
                    NAME_SERVER_HOST,
                    addresses,
                    addressesCount,
                    nsDesc.port,
                    errorFile,
                    logFile,
                    password,
                    &nsDesc,
                    &NSExit)) {
    exit(1);
  }

  fclose(stdin);
  signal(SIGPIPE, SocketFailure);
  RegisterListener(NS_REGISTER, "NS_REGISTER", &ProcessRequest);
  RegisterListener(NS_SEARCH, "NS_SEARCH", &ProcessRequest);
  RegisterListener(NS_UNREGISTER, "NS_UNREGISTER", &ProcessRequest);
  nextCompression = CurrentTime() + compressionFreq;

  /* main service loop */
  while(1) {
    ListenForMessages(nextCompression - CurrentTime());
    if(CurrentTime() > nextCompression) {
      CompressRegistrations();
      nextCompression = CurrentTime() + compressionFreq;
    }
  }

  /* return 0; Never reached */

}
STDMETHODIMP GuestEventListener::HandleEvent(VBoxEventType_T aType, IEvent *aEvent)
{
    switch (aType)
    {
    case VBoxEventType_OnGuestSessionRegistered:
    {
        HRESULT rc;
        do
        {
            ComPtr<IGuestSessionRegisteredEvent> pEvent = aEvent;
            Assert(!pEvent.isNull());

            ComPtr<IGuestSession> pSession;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Session)(pSession.asOutParam()));
            AssertBreak(!pSession.isNull());
            BOOL fRegistered;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Registered)(&fRegistered));
            Bstr strName;
            CHECK_ERROR_BREAK(pSession, COMGETTER(Name)(strName.asOutParam()));
            ULONG uID;
            CHECK_ERROR_BREAK(pSession, COMGETTER(Id)(&uID));

            RTPrintf("Session ID=%RU32 \"%s\" %s\n",
                     uID, Utf8Str(strName).c_str(),
                     fRegistered ? "registered" : "unregistered");
            if (fRegistered)
            {
                if (mfVerbose)
                    RTPrintf("Registering ...\n");

                /* Register for IGuestSession events. */
                ComObjPtr<GuestSessionEventListenerImpl> pListener;
                pListener.createObject();
                CHECK_ERROR_BREAK(pListener, init(new GuestSessionEventListener()));

                ComPtr<IEventSource> es;
                CHECK_ERROR_BREAK(pSession, COMGETTER(EventSource)(es.asOutParam()));
                com::SafeArray<VBoxEventType_T> eventTypes;
                eventTypes.push_back(VBoxEventType_OnGuestFileRegistered);
                eventTypes.push_back(VBoxEventType_OnGuestProcessRegistered);
                CHECK_ERROR_BREAK(es, RegisterListener(pListener, ComSafeArrayAsInParam(eventTypes),
                                                       true /* Active listener */));

                GuestSessionStats sessionStats(pListener);
                mSessions[pSession] = sessionStats;
            }
            else
            {
                GuestEventSessions::iterator itSession = mSessions.find(pSession);
                if (itSession != mSessions.end())
                {
                    if (mfVerbose)
                        RTPrintf("Unregistering ...\n");

                    if (!itSession->first.isNull())
                    {
                        /* Listener unregistration. */
                        ComPtr<IEventSource> pES;
                        CHECK_ERROR_BREAK(itSession->first, COMGETTER(EventSource)(pES.asOutParam()));
                        if (!pES.isNull())
                            CHECK_ERROR_BREAK(pES, UnregisterListener(itSession->second.mListener));
                        itSession->first->Release();
                    }

                    mSessions.erase(itSession);
                }
            }

        } while (0);
        break;
    }

    default:
        AssertFailed();
    }

    return S_OK;
}
STDMETHODIMP GuestSessionEventListener::HandleEvent(VBoxEventType_T aType, IEvent *aEvent)
{
    switch (aType)
    {
    case VBoxEventType_OnGuestFileRegistered:
    {
        HRESULT rc;
        do
        {
            ComPtr<IGuestFileRegisteredEvent> pEvent = aEvent;
            Assert(!pEvent.isNull());

            ComPtr<IGuestFile> pFile;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(File)(pFile.asOutParam()));
            AssertBreak(!pFile.isNull());
            BOOL fRegistered;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Registered)(&fRegistered));
            Bstr strPath;
            CHECK_ERROR_BREAK(pFile, COMGETTER(FileName)(strPath.asOutParam()));

            RTPrintf("File \"%s\" %s\n",
                     Utf8Str(strPath).c_str(),
                     fRegistered ? "registered" : "unregistered");
            if (fRegistered)
            {
                if (mfVerbose)
                    RTPrintf("Registering ...\n");

                /* Register for IGuestFile events. */
                ComObjPtr<GuestFileEventListenerImpl> pListener;
                pListener.createObject();
                CHECK_ERROR_BREAK(pListener, init(new GuestFileEventListener()));

                ComPtr<IEventSource> es;
                CHECK_ERROR_BREAK(pFile, COMGETTER(EventSource)(es.asOutParam()));
                com::SafeArray<VBoxEventType_T> eventTypes;
                eventTypes.push_back(VBoxEventType_OnGuestFileStateChanged);
                CHECK_ERROR_BREAK(es, RegisterListener(pListener, ComSafeArrayAsInParam(eventTypes),
                                                       true /* Active listener */));

                GuestFileStats fileStats(pListener);
                mFiles[pFile] = fileStats;
            }
            else
            {
                GuestEventFiles::iterator itFile = mFiles.find(pFile);
                if (itFile != mFiles.end())
                {
                    if (mfVerbose)
                        RTPrintf("Unregistering file ...\n");

                    if (!itFile->first.isNull())
                    {
                        /* Listener unregistration. */
                        ComPtr<IEventSource> pES;
                        CHECK_ERROR(itFile->first, COMGETTER(EventSource)(pES.asOutParam()));
                        if (!pES.isNull())
                            CHECK_ERROR(pES, UnregisterListener(itFile->second.mListener));
                        itFile->first->Release();
                    }

                    mFiles.erase(itFile);
                }
            }

        } while (0);
        break;
    }

    case VBoxEventType_OnGuestProcessRegistered:
    {
        HRESULT rc;
        do
        {
            ComPtr<IGuestProcessRegisteredEvent> pEvent = aEvent;
            Assert(!pEvent.isNull());

            ComPtr<IGuestProcess> pProcess;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Process)(pProcess.asOutParam()));
            AssertBreak(!pProcess.isNull());
            BOOL fRegistered;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Registered)(&fRegistered));
            Bstr strPath;
            CHECK_ERROR_BREAK(pProcess, COMGETTER(ExecutablePath)(strPath.asOutParam()));

            RTPrintf("Process \"%s\" %s\n",
                     Utf8Str(strPath).c_str(),
                     fRegistered ? "registered" : "unregistered");
            if (fRegistered)
            {
                if (mfVerbose)
                    RTPrintf("Registering ...\n");

                /* Register for IGuestProcess events. */
                ComObjPtr<GuestProcessEventListenerImpl> pListener;
                pListener.createObject();
                CHECK_ERROR_BREAK(pListener, init(new GuestProcessEventListener()));

                ComPtr<IEventSource> es;
                CHECK_ERROR_BREAK(pProcess, COMGETTER(EventSource)(es.asOutParam()));
                com::SafeArray<VBoxEventType_T> eventTypes;
                eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged);
                CHECK_ERROR_BREAK(es, RegisterListener(pListener, ComSafeArrayAsInParam(eventTypes),
                                                       true /* Active listener */));

                GuestProcStats procStats(pListener);
                mProcs[pProcess] = procStats;
            }
            else
            {
                GuestEventProcs::iterator itProc = mProcs.find(pProcess);
                if (itProc != mProcs.end())
                {
                    if (mfVerbose)
                        RTPrintf("Unregistering process ...\n");

                    if (!itProc->first.isNull())
                    {
                        /* Listener unregistration. */
                        ComPtr<IEventSource> pES;
                        CHECK_ERROR(itProc->first, COMGETTER(EventSource)(pES.asOutParam()));
                        if (!pES.isNull())
                            CHECK_ERROR(pES, UnregisterListener(itProc->second.mListener));
                        itProc->first->Release();
                    }

                    mProcs.erase(itProc);
                }
            }

        } while (0);
        break;
    }

    case VBoxEventType_OnGuestSessionStateChanged:
    {
        HRESULT rc;
        do
        {
            ComPtr<IGuestSessionStateChangedEvent> pEvent = aEvent;
            Assert(!pEvent.isNull());
            ComPtr<IGuestSession> pSession;
            CHECK_ERROR_BREAK(pEvent, COMGETTER(Session)(pSession.asOutParam()));
            AssertBreak(!pSession.isNull());

            GuestSessionStatus_T sessSts;
            CHECK_ERROR_BREAK(pSession, COMGETTER(Status)(&sessSts));
            ULONG uID;
            CHECK_ERROR_BREAK(pSession, COMGETTER(Id)(&uID));
            Bstr strName;
            CHECK_ERROR_BREAK(pSession, COMGETTER(Name)(strName.asOutParam()));

            RTPrintf("Session ID=%RU32 \"%s\" changed status to [%s]\n",
                     uID, Utf8Str(strName).c_str(), gctlGuestSessionStatusToText(sessSts));

        } while (0);
        break;
    }

    default:
        AssertFailed();
    }

    return S_OK;
}
Exemple #9
0
LogManager::LogManager()
{
  // create log containers
  m_log[LogTypes::ACTIONREPLAY] = {"ActionReplay", "ActionReplay"};
  m_log[LogTypes::AUDIO] = {"Audio", "Audio Emulator"};
  m_log[LogTypes::AUDIO_INTERFACE] = {"AI", "Audio Interface (AI)"};
  m_log[LogTypes::BOOT] = {"BOOT", "Boot"};
  m_log[LogTypes::COMMANDPROCESSOR] = {"CP", "CommandProc"};
  m_log[LogTypes::COMMON] = {"COMMON", "Common"};
  m_log[LogTypes::CONSOLE] = {"CONSOLE", "Dolphin Console"};
  m_log[LogTypes::CORE] = {"CORE", "Core"};
  m_log[LogTypes::DISCIO] = {"DIO", "Disc IO"};
  m_log[LogTypes::DSPHLE] = {"DSPHLE", "DSP HLE"};
  m_log[LogTypes::DSPLLE] = {"DSPLLE", "DSP LLE"};
  m_log[LogTypes::DSP_MAIL] = {"DSPMails", "DSP Mails"};
  m_log[LogTypes::DSPINTERFACE] = {"DSP", "DSPInterface"};
  m_log[LogTypes::DVDINTERFACE] = {"DVD", "DVD Interface"};
  m_log[LogTypes::DYNA_REC] = {"JIT", "Dynamic Recompiler"};
  m_log[LogTypes::EXPANSIONINTERFACE] = {"EXI", "Expansion Interface"};
  m_log[LogTypes::FILEMON] = {"FileMon", "File Monitor"};
  m_log[LogTypes::GDB_STUB] = {"GDB_STUB", "GDB Stub"};
  m_log[LogTypes::GPFIFO] = {"GP", "GPFifo"};
  m_log[LogTypes::HOST_GPU] = {"Host GPU", "Host GPU"};
  m_log[LogTypes::IOS] = {"IOS", "IOS"};
  m_log[LogTypes::IOS_DI] = {"IOS_DI", "IOS - Drive Interface"};
  m_log[LogTypes::IOS_ES] = {"IOS_ES", "IOS - ETicket Services"};
  m_log[LogTypes::IOS_FILEIO] = {"IOS_FILEIO", "IOS - FileIO"};
  m_log[LogTypes::IOS_SD] = {"IOS_SD", "IOS - SDIO"};
  m_log[LogTypes::IOS_SSL] = {"IOS_SSL", "IOS - SSL"};
  m_log[LogTypes::IOS_STM] = {"IOS_STM", "IOS - State Transition Manager"};
  m_log[LogTypes::IOS_NET] = {"IOS_NET", "IOS - Network"};
  m_log[LogTypes::IOS_USB] = {"IOS_USB", "IOS - USB"};
  m_log[LogTypes::IOS_WC24] = {"IOS_WC24", "IOS - WiiConnect24"};
  m_log[LogTypes::IOS_WIIMOTE] = {"IOS_WIIMOTE", "IOS - Wii Remote"};
  m_log[LogTypes::MASTER_LOG] = {"*", "Master Log"};
  m_log[LogTypes::MEMCARD_MANAGER] = {"MemCard Manager", "MemCard Manager"};
  m_log[LogTypes::MEMMAP] = {"MI", "MI & memmap"};
  m_log[LogTypes::NETPLAY] = {"NETPLAY", "Netplay"};
  m_log[LogTypes::OSHLE] = {"HLE", "HLE"};
  m_log[LogTypes::OSREPORT] = {"OSREPORT", "OSReport"};
  m_log[LogTypes::PAD] = {"PAD", "Pad"};
  m_log[LogTypes::PIXELENGINE] = {"PE", "PixelEngine"};
  m_log[LogTypes::PROCESSORINTERFACE] = {"PI", "ProcessorInt"};
  m_log[LogTypes::POWERPC] = {"PowerPC", "IBM CPU"};
  m_log[LogTypes::SERIALINTERFACE] = {"SI", "Serial Interface (SI)"};
  m_log[LogTypes::SP1] = {"SP1", "Serial Port 1"};
  m_log[LogTypes::VIDEO] = {"Video", "Video Backend"};
  m_log[LogTypes::VIDEOINTERFACE] = {"VI", "Video Interface (VI)"};
  m_log[LogTypes::WIIMOTE] = {"Wiimote", "Wiimote"};
  m_log[LogTypes::WII_IPC] = {"WII_IPC", "WII IPC"};

  RegisterListener(LogListener::FILE_LISTENER,
                   new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)));
  RegisterListener(LogListener::CONSOLE_LISTENER, new ConsoleListener());

  // Set up log listeners
  int verbosity = Config::Get(LOGGER_VERBOSITY);
  ;

  // Ensure the verbosity level is valid
  if (verbosity < 1)
    verbosity = 1;
  if (verbosity > MAX_LOGLEVEL)
    verbosity = MAX_LOGLEVEL;

  SetLogLevel(static_cast<LogTypes::LOG_LEVELS>(verbosity));
  EnableListener(LogListener::FILE_LISTENER, Config::Get(LOGGER_WRITE_TO_FILE));
  EnableListener(LogListener::CONSOLE_LISTENER, Config::Get(LOGGER_WRITE_TO_CONSOLE));
  EnableListener(LogListener::LOG_WINDOW_LISTENER, Config::Get(LOGGER_WRITE_TO_WINDOW));

  for (LogContainer& container : m_log)
    container.m_enable = Config::Get(
        Config::ConfigInfo<bool>{{Config::System::Logger, "Logs", container.m_short_name}, false});

  m_path_cutoff_point = DeterminePathCutOffPoint();
}