Пример #1
0
bool DebuggerManager::RegisterDebugger(cbDebuggerPlugin *plugin)
{
    RegisteredPlugins::iterator it = m_registered.find(plugin);
    if (it != m_registered.end())
        return false;
    const wxString &guiName=plugin->GetGUIName();
    const wxString &settingsName=plugin->GetSettingsName();

    wxRegEx regExSettingsName(wxT("^[a-z_][a-z0-9_]+$"));
    if (!regExSettingsName.Matches(settingsName))
    {
        wxString s;
        s = wxString::Format(_("The settings name for the debugger plugin \"%s\" - \"%s\" contains invalid characters"),
                             guiName.c_str(), settingsName.c_str());
        Manager::Get()->GetLogManager()->LogError(s);
        return false;
    }

    int normalIndex = -1;
    GetLogger(normalIndex);
    plugin->SetupLog(normalIndex);

    PluginData data;

    m_registered[plugin] = data;
    it = m_registered.find(plugin);
    ProcessSettings(it);

    // There should be at least one configuration for every plugin.
    // If this is not the case, something is wrong and should be fixed.
    cbAssert(!it->second.GetConfigurations().empty());

    wxString activeDebuggerName;
    int activeConfig;
    ReadActiveDebuggerConfig(activeDebuggerName, activeConfig);

    if (activeDebuggerName == settingsName)
    {
        if (activeConfig > static_cast<int>(it->second.GetConfigurations().size()))
            activeConfig = 0;

        m_activeDebugger = plugin;
        m_activeDebugger->SetActiveConfig(activeConfig);

        m_menuHandler->SetActiveDebugger(m_activeDebugger);
    }

    CreateWindows();
    m_menuHandler->RebuildMenus();

    return true;
}
Пример #2
0
/*! Initialised the airhockey game
 *
 *  @param          argc            Number of commandl-ine arguments
 *  @param          args            Command-line arguments
 *  @returns        ICRESULT        Success/failure of initialization
**/
ICRESULT SkeeBall::Init(int argc, char* args[])
{
    ICRESULT res = IC_OK;

    // Initialize SkeeBall Settings
    ProcessSettings();

    HACK_FULLSCREEN = m_Settings.bWiiMote;

#ifdef WIIMOTE
    if (m_Settings.bWiiMote)
    {
        // spawn console window and attache input/output streams
        AllocConsole();

        console = GetStdHandle(STD_OUTPUT_HANDLE);
        int hCrt = _open_osfhandle((long) console, _O_TEXT);
        FILE* hf_out = _fdopen(hCrt, "w");
        setvbuf(hf_out, NULL, _IONBF, 1);
        *stdout = *hf_out;

        HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
        hCrt = _open_osfhandle((long) handle_in, _O_TEXT);
        FILE* hf_in = _fdopen(hCrt, "r");
        setvbuf(hf_in, NULL, _IONBF, 128);
        *stdin = *hf_in;
    }
#endif

    // create the main window
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
    uint winFlags = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
    //uint winFlags = WS_CAPTION ;
    //uint winFlags = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
#elif defined __APPLE__
    uint winFlags = kWindowCloseBoxAttribute |
                    kWindowCollapseBoxAttribute |
                    kWindowStandardHandlerAttribute ;
    //uint winFlags = kWindowNoTitleBarAttribute;
#else
    uint winFlags = 0;
#endif

    icWindowDef window = {winFlags,
                          m_Settings.iScreen_x,
                          m_Settings.iScreen_y,
                          0,0,
                          "Skee Ball",
                          m_Settings.bFullscreen
                         };
    m_pMainWin = icWindow::GetWindow(window);

    // create the graphics device
    m_pGxDevice = new icGXDeviceGL();

    // check that we got the goods
    if (!m_pMainWin || !m_pGxDevice)
    {
#ifdef DEBUG_INSTALL
        MessageBoxA(0,"Failed to window or engine", "Error", 0);
#endif
        return IC_FAIL_GEN;
    }

    // initialize the graphics device
    m_pGxDevice->Init(m_pMainWin);

    //m_pGxDevice->EnableFog(m_Settings.bFog, m_Settings.fogParams);

    // Set the clear color to black
    ((icGXDeviceGL*)m_pGxDevice)->SetClearColor(icColor::BLACK);

    // show the main window
    m_pMainWin->Show();

    // initialize the sound engine
    res = m_SoundDevice.Initialize();
    if (ICEFAIL(res))
    {
#ifdef DEBUG_INSTALL
        MessageBoxA(0,"Failed to init audio device", "Error", 0);
#endif
        return res;
    }

    // Initialize the content manager
    m_Content = new icContentLoader(m_pGxDevice, &m_SoundDevice);

    icSoundParam params;
    params.bPaused = false;
    params.fPitch = 1.0f;
    params.bLoop = true;
    params.fVol = m_Settings.fMusic_vol;
    m_Content->Load("Resource/audio/01castlevania.wav",&m_BackGroundMusic);
    m_BackGroundMusic->SetParams(params);


    // start the background music
    if (m_Settings.bMusic)
        m_BackGroundMusic->Play();

    if (ICEFAIL(res))
    {
#ifdef DEBUG_INSTALL
        MessageBoxA(0,"some other shit failed", "Error", 0);
#endif
        return res;
    }

    // push the main menu (TODO, goes to gamestate right now)
    m_GameState.Init(m_Content);
    m_MainMenu.Init(m_Content);
    m_SettingsMenu.Init(m_Content);
    m_PauseMenu.Init(m_Content);
    m_LastGame.Init(m_Content);
    m_StateMachine.PushState(&m_LastGame);
    m_StateMachine.PushState(&m_MainMenu);

    // start keeping time
    m_GameTime.Elapsed();

    m_font.Initialize("Arial",24,m_Content->GetDevice());

    playing = true;

#ifdef WIIMOTE
    if (m_Settings.bWiiMote)
    {
        icThreadCreate<SkeeBall>(this,&SkeeBall::WiiMoteLoop,NULL,&m_pthread);
    }
#endif

    if (!ICEFAIL(res))
        return icApplication::Init(argc,args);


    return res;
}// END FUNCTION Init(int argc, char* args[])
Пример #3
0
/*! Initialised the airhockey game
 *
 *  @param          argc            Number of commandl-ine arguments
 *  @param          args            Command-line arguments
 *  @returns        ICRESULT        Success/failure of initialization
**/
ICRESULT Airhockey::Init(int argc, char* args[])
{
    ICRESULT res = IC_OK;

    // Initialize Airhockey Settings
    ProcessSettings();

    char temp[256];
    int l = gethostname(temp,256);
    hostent *phe = gethostbyname(temp);
    if (phe == 0)
	{
#ifdef DEBUG_INSTALL
		MessageBoxA(0,"Failed to get host name", "Error", 0);
#endif
        return IC_FAIL_GEN;
	}

    if (phe->h_addr_list[0] != 0)
    {
        in_addr addr;
        memcpy(&addr, phe->h_addr_list[0], sizeof(struct in_addr));
        strcpy(temp,inet_ntoa(addr));
    }

    Socket.setHomeAddress(AIRPORT,temp);
    Socket.setDestAddress(AIRPORT,m_Settings.sLast_join_ip.ToChar());

    // create the main window
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
    uint winFlags = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
    //uint winFlags = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
#elif defined __APPLE__
    uint winFlags = kWindowCloseBoxAttribute |
                    kWindowCollapseBoxAttribute |
                    kWindowStandardHandlerAttribute ;
    //uint winFlags = kWindowNoTitleBarAttribute;
#else
        uint winFlags = 0;
#endif

    icWindowDef window = {winFlags,
                          static_cast<short>(m_Settings.iScreen_x),
                          static_cast<short>(m_Settings.iScreen_y),
                          0,0,
                          "Airhockey",
                          m_Settings.bFullscreen};
    m_pMainWin = icWindow::GetWindow(window);

    // create the graphics device
    m_pGxDevice = new icGXDeviceGL();
    //m_pGxDevice = new icGXDeviceDX9();

    // check that we got the goods
    if (!m_pMainWin || !m_pGxDevice)
	{
#ifdef DEBUG_INSTALL
		MessageBoxA(0,"Failed to window or engine", "Error", 0);
#endif
		return IC_FAIL_GEN;
	}

    // initialize the graphics device
    m_pGxDevice->Init(m_pMainWin);

    m_pGxDevice->EnableFog(m_Settings.bFog, m_Settings.fogParams);

    // Set the clear color to black
    m_pGxDevice->SetClearColor(icColor::BLACK);

    // show the main window
    m_pMainWin->Show();

    // initialize the sound engine
    res = m_SoundDevice.Initialize();
    if (ICEFAIL(res))
	{
#ifdef DEBUG_INSTALL
		MessageBoxA(0,"Failed to init audio device", "Error", 0);
#endif
        return res;
	}

    // Initialize the content manager
    m_Content = new icContentLoader(m_pGxDevice, &m_SoundDevice);

    icSoundParam params;
    params.bLoop = false;
    params.bPaused = false;
    params.fPitch = 1.0f;
    params.fVol = m_Settings.fSfx_vol;

    //m_Content->Load("Resource/audio/welcome_to_my_domain.wav",&m_IntroClip);
    m_Content->Load("Resource/audio/insane_laughter.wav",&m_IntroClip);
    m_IntroClip->SetParams(params);

    params.bLoop = true;
    params.fVol = m_Settings.fMusic_vol;
    m_Content->Load("Resource/audio/09 Lateralus.wav",&m_BackGroundMusic);
    m_BackGroundMusic->SetParams(params);

    // play intro audio
    if (m_Settings.bSfx)
        m_IntroClip->Play();

    // start the background music
    if (m_Settings.bMusic)
        m_BackGroundMusic->Play();

    if (ICEFAIL(res))
	{
#ifdef DEBUG_INSTALL
		MessageBoxA(0,"some other shit failed", "Error", 0);
#endif
        return res;
	}

    // push the main menu (TODO, goes to gamestate right now)
    m_GameState.Init(m_Content);
    m_SpinState.Init(m_Content);
    m_MainMenu.Init(m_Content);
    m_SettingsMenu.Init(m_Content);
    m_NetMenu.Init(m_Content);
    m_PauseMenu.Init(m_Content);
    m_StateMachine.PushState(&m_SpinState);
    m_StateMachine.PushState(&m_MainMenu);

    // start keeping time
    m_GameTime.Elapsed();

	icFontParams fontParams = { "Arial", 24 };
	m_pGxDevice->CreateFont(&m_pFont, &fontParams);
    //m_font.Initialize("Arial",24,m_Content);

    if (!ICEFAIL(res))
        return icApplication::Init(argc,args);

    return res;
}// END FUNCTION Init(int argc, char* args[])
Пример #4
0
void DebuggerManager::RebuildAllConfigs()
{
    for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
        ProcessSettings(it);
    m_menuHandler->RebuildMenus();
}