void CCCSHandler::writeStatus(wxFFile& file)
{
	for (unsigned int i = 0U; i < m_count; i++) {
		CCCSHandler* handler = m_handlers[i];
		if (handler != NULL) {
			struct tm* tm = ::gmtime(&handler->m_time);

			switch (handler->m_direction) {
				case DIR_OUTGOING:
					if (handler->m_state == CS_ACTIVE) {
						wxString text;
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Outgoing\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							handler->m_callsign.c_str(), handler->m_yourCall.c_str());
						file.Write(text);
					}
					break;

				case DIR_INCOMING:
					if (handler->m_state == CS_ACTIVE) {
						wxString text;
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Incoming\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							handler->m_callsign.c_str(), handler->m_yourCall.c_str());
						file.Write(text);
					}
					break;
			}
		}
	}
}
示例#2
0
void SilentBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
   for(int i = 0; i < depth; i++)
      xmlFile.Write("\t");
   xmlFile.Write("<silentblockfile ");
   xmlFile.Write(wxString::Format("len='%d' ", mLen));
   xmlFile.Write("/>\n");
}
示例#3
0
void systemStopGameRecording()
{
    if (!game_recording)
        return;

    if (game_file.Write(&game_frame, sizeof(game_frame)) != sizeof(game_frame) || game_file.Write(&game_joypad, sizeof(game_joypad)) != sizeof(game_joypad) || !game_file.Close())
        wxLogError(_("Error writing game recording"));

    game_recording = false;
    MainFrame* mf = wxGetApp().frame;
    mf->cmd_enable &= ~CMDEN_GREC;
    mf->cmd_enable |= CMDEN_NGREC | CMDEN_NGPLAY;
    mf->enable_menus();
}
void CDPlusHandler::writeStatus(wxFFile& file)
{
	for (unsigned int i = 0U; i < m_maxReflectors; i++) {
		CDPlusHandler* reflector = m_reflectors[i];
		if (reflector != NULL) {
			wxString text;

			struct tm* tm = ::gmtime(&reflector->m_time);

			if (reflector->m_linkState == DPLUS_LINKED) {
				switch (reflector->m_direction) {
					case DIR_OUTGOING:
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle Rptr: %s Refl: %s Dir: Outgoing\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
						break;

					case DIR_INCOMING:
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Incoming\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							reflector->m_reflector.c_str());
						break;
				}

				file.Write(text);
			}
		}
	}
}
示例#5
0
void PPToken::print(wxFFile &fp)
{
#if 0
	wxString buff;
	buff << wxT("Name          : ") << name << wxT("\n");
	buff << wxT("replacement   : ") << replacement << wxT("\n");
	buff << wxT("isFunctionLike: ") << isFunctionLike << wxT("\n");
	if(isFunctionLike) {
		for(size_t i=0; i<args.size(); i++) {
			buff << wxT("Arg: ") << args.Item(i) << wxT("\n");
		}
	}
	buff << wxT(" ---- \n");
	fp.Write(buff);
#else
	wxString buff;
	buff << name << wxT("(") << (flags & IsFunctionLike) << wxT(")") << wxT("=") << replacement << wxT("\n");
	fp.Write(buff);
#endif
}
void CXReflectorDPlusHandler::writeStatus(wxFFile& file)
{
    for (unsigned int i = 0U; i < m_maxReflectors; i++) {
        CXReflectorDPlusHandler* reflector = m_reflectors[i];
        if (reflector != NULL) {
            struct tm* tm = ::gmtime(&reflector->m_time);

            wxString text;
            text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Inbound\n"),
                        tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
                        reflector->m_reflector.c_str());

            file.Write(text);
        }
    }
}
示例#7
0
bool DbgGdb::ExecuteCmd( const wxString &cmd )
{
    if( m_gdbProcess ) {
        if ( m_info.enableDebugLog ) {
#if DBG_LOG
            if(gfp.IsOpened()) {
                gfp.Write(wxString::Format( wxT( "DEBUG>>%s\n" ), cmd.c_str() ));
                gfp.Flush();
            }
#else
            m_observer->UpdateAddLine( wxString::Format( wxT( "DEBUG>>%s" ), cmd.c_str() ) );
#endif
        }
        return m_gdbProcess->Write( cmd );
    }
    return false;
}
示例#8
0
void systemStartGameRecording(const wxString &fname)
{
	GameArea* panel = wxGetApp().frame->GetPanel();

	if (!panel || panel->game_type() == IMAGE_UNKNOWN ||
	        !panel->emusys->emuWriteState)
	{
		wxLogError(_("No game in progress to record"));
		return;
	}

	systemStopGamePlayback();
	wxString fn = fname;

	if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false))
		fn.append(wxT(".vmv"));

	u32 version = 1;

	if (!game_file.Open(fn.c_str(), wxT("wb")) ||
	        game_file.Write(&version, sizeof(version)) != sizeof(version))
	{
		wxLogError(_("Cannot open output file %s"), fname.c_str());
		return;
	}

	fn[fn.size() - 1] = wxT('0');

	if (!panel->emusys->emuWriteState(fn.mb_fn_str()))
	{
		wxLogError(_("Error writing game recording"));
		game_file.Close();
		return;
	}

	game_frame = 0;
	game_joypad = 0;
	game_recording = true;
	MainFrame* mf = wxGetApp().frame;
	mf->cmd_enable &= ~(CMDEN_NGREC | CMDEN_GPLAY | CMDEN_NGPLAY);
	mf->cmd_enable |= CMDEN_GREC;
	mf->enable_menus();
}
示例#9
0
    void GenerateHeaderCode(wxFFile& file)
    {

        file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
                   + _T(" {\nprotected:\n"));
        size_t i;
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write(
                _T(" ") + w.GetClass() + _T("* ") + w.GetName()
                + _T(";\n"));
        }
        file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(){\n")
                   _T("  wxXmlResource::Get()->LoadObject(this,NULL,_T(\"")
                   +  m_className
                   +  _T("\"), _T(\"")
                   +  m_parentClassName
                   +  _T("\"));\n"));
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write( _T("  ")
                        + w.GetName()
                        + _T(" = XRCCTRL(*this,\"")
                        + w.GetName()
                        + _T("\",")
                        + w.GetClass()
                        + _T(");\n")
                );
        }
        file.Write(_T(" }\n"));

        file.Write(
            _T("public:\n")
            + m_className
            + _T("::")
            + m_className
            + _T("(){\n")
            + _T("  InitWidgetsFromXRC();\n")
              _T(" }\n")
              _T("};\n")
        );
    };
示例#10
0
void PCMAliasBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
   for(int i = 0; i < depth; i++)
      xmlFile.Write("\t");
   xmlFile.Write("<pcmaliasblockfile ");
   xmlFile.Write(wxString::Format("summaryfile='%s' ",
                                  XMLTagHandler::XMLEsc(mFileName.GetFullName()).c_str()));
   xmlFile.Write(wxString::Format("aliasfile='%s' ",
                                  XMLTagHandler::XMLEsc(mAliasedFileName.GetFullPath()).c_str()));
   xmlFile.Write(wxString::Format("aliasstart='%d' ", mAliasStart));
   xmlFile.Write(wxString::Format("aliaslen='%d' ", mLen));
   xmlFile.Write(wxString::Format("aliaschannel='%d' ", mAliasChannel));
   xmlFile.Write(wxString::Format("min='%s' ",
            Internat::ToString(mMin).c_str()));
   xmlFile.Write(wxString::Format("max='%s' ",
            Internat::ToString(mMax).c_str()));
   xmlFile.Write(wxString::Format("rms='%s'",
            Internat::ToString(mRMS).c_str()));
   xmlFile.Write("/>\n");
}
示例#11
0
void DbgGdb::Poke()
{
    static wxRegEx reCommand( wxT( "^([0-9]{8})" ) );



    //poll the debugger output
    wxString curline;
    if ( !m_gdbProcess || m_gdbOutputArr.IsEmpty() ) {
        return;
    }

    while ( DoGetNextLine( curline ) ) {

        GetDebugeePID(curline);

        // For string manipulations without damaging the original line read
        wxString tmpline ( curline );
        StripString( tmpline );
        tmpline.Trim().Trim( false );
        if ( m_info.enableDebugLog ) {
            //Is logging enabled?

            if ( curline.IsEmpty() == false && !tmpline.StartsWith( wxT( ">" ) ) ) {
                wxString strdebug( wxT( "DEBUG>>" ) );
                strdebug << curline;
#if DBG_LOG
                if(gfp.IsOpened()) {
                    gfp.Write(strdebug);
                    gfp.Flush();
                }
#else
                m_observer->UpdateAddLine( strdebug );
#endif
            }
        }

        if ( reConnectionRefused.Matches( curline ) ) {
            StripString( curline );
#ifdef __WXGTK__
            m_consoleFinder.FreeConsole();
#endif
            m_observer->UpdateAddLine( curline );
            m_observer->UpdateGotControl( DBG_EXITED_NORMALLY );
            return;
        }

        // Check for "Operation not permitted" usually means
        // that the process does not have enough permission to
        // attach to the process
        if( curline.Contains(wxT("Operation not permitted")) ) {
#ifdef __WXGTK__
            m_consoleFinder.FreeConsole();
#endif
            m_observer->UpdateAddLine( _("Failed to start debugger: permission denied") );
            m_observer->UpdateGotControl( DBG_EXITED_NORMALLY );
            return;

        }

        if( tmpline.StartsWith( wxT( ">" ) ) ) {
            // Shell line, probably user command line
            continue;
        }

        if ( curline.StartsWith( wxT( "~" ) ) || curline.StartsWith( wxT( "&" ) ) || curline.StartsWith("@") ) {

            // lines starting with ~ are considered "console stream" message
            // and are important to the CLI handler
            bool consoleStream( false );
            bool targetConsoleStream(false);

            if ( curline.StartsWith( wxT( "~" ) ) ) {
                consoleStream = true;
            }

            if ( curline.StartsWith( wxT( "@" ) ) ) {
                targetConsoleStream = true;
            }

            // Filter out some gdb error lines...
            if ( FilterMessage( curline ) ) {
                continue;
            }

            StripString( curline );

            // If we got a valid "CLI Handler" instead of writing the output to
            // the output view, concatenate it into the handler buffer
            if ( targetConsoleStream ) {
                m_observer->UpdateAddLine( curline );

            } else if ( consoleStream && GetCliHandler()) {
                GetCliHandler()->Append( curline );

            } else if ( consoleStream ) {
                // log message
                m_observer->UpdateAddLine( curline );

            }

        } else if ( reCommand.Matches( curline ) ) {

            //not a gdb message, get the command associated with the message
            wxString id = reCommand.GetMatch( curline, 1 );

            if ( GetCliHandler() && GetCliHandler()->GetCommandId() == id ) {
                // probably the "^done" message of the CLI command
                GetCliHandler()->ProcessOutput( curline );
                SetCliHandler( NULL ); // we are done processing the CLI

            } else {
                //strip the id from the line
                curline = curline.Mid( 8 );
                DoProcessAsyncCommand( curline, id );

            }
        } else if ( curline.StartsWith( wxT( "^done" ) ) || curline.StartsWith( wxT( "*stopped" ) ) ) {
            //Unregistered command, use the default AsyncCommand handler to process the line
            DbgCmdHandlerAsyncCmd cmd( m_observer, this );
            cmd.ProcessOutput( curline );
        } else {
            //Unknow format, just log it
            if( m_info.enableDebugLog && !FilterMessage( curline ) ) {
                m_observer->UpdateAddLine( curline );
            }
        }
    }
}
示例#12
0
文件: wxrc.cpp 项目: EdgarTx/wx
    void GenerateHeaderCode(wxFFile& file)
    {

        file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
                   + _T(" {\nprotected:\n"));
        size_t i;
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write(
                _T(" ") + w.GetClass() + _T("* ") + w.GetName()
                + _T(";\n"));
        }
        file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(wxWindow *parent){\n")
                   _T("  wxXmlResource::Get()->LoadObject(this,parent,_T(\"")
                   +  m_className
                   +  _T("\"), _T(\"")
                   +  m_parentClassName
                   +  _T("\"));\n"));
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write( _T("  ")
                        + w.GetName()
                        + _T(" = XRCCTRL(*this,\"")
                        + w.GetName()
                        + _T("\",")
                        + w.GetClass()
                        + _T(");\n"));
        }
        file.Write(_T(" }\n"));

        file.Write( _T("public:\n"));

        if ( m_ancestorClassNames.size() == 1 )
        {
            file.Write
                 (
                    m_className +
                    _T("(") +
                        *m_ancestorClassNames.begin() +
                        _T(" *parent=NULL){\n") +
                    _T("  InitWidgetsFromXRC((wxWindow *)parent);\n")
                    _T(" }\n")
                    _T("};\n")
                 );
        }
        else
        {
            file.Write(m_className + _T("(){\n") +
                       _T("  InitWidgetsFromXRC(NULL);\n")
                       _T(" }\n")
                       _T("};\n"));

            for ( StringSet::const_iterator it = m_ancestorClassNames.begin();
                  it != m_ancestorClassNames.end();
                  ++it )
            {
                file.Write(m_className + _T("(") + *it + _T(" *parent){\n") +
                            _T("  InitWidgetsFromXRC((wxWindow *)parent);\n")
                            _T(" }\n")
                            _T("};\n"));
            }
        }
    }
示例#13
0
// return information about the given joystick, -1 for default joystick
u32 systemReadJoypad(int joy)
{
	if (joy < 0 || joy > 3)
		joy = gopts.default_stick - 1;

	uint32_t ret = joypress[joy];

	if (turbo)
		ret |= KEYM_SPEED;

	u32 af = autofire;

	if (ret & KEYM_AUTO_A)
	{
		ret |= KEYM_A;
		af |= KEYM_A;
	}

	if (ret & KEYM_AUTO_B)
	{
		ret |= KEYM_B;
		af |= KEYM_B;
	}

	static int autofire_trigger = 1;
	static bool autofire_state = true;
	u32 af_but = af & ret;

	if (af_but)
	{
		if (!autofire_state)
			ret &= ~af_but;

		if (!--autofire_trigger)
		{
			autofire_trigger = gopts.autofire_rate;
			autofire_state = !autofire_state;
		}
	}
	else
	{
		autofire_state = true;
		autofire_trigger = gopts.autofire_rate;
	}

	// disallow opposite directionals simultaneously
	ret &= ~((ret & (KEYM_LEFT | KEYM_DOWN | KEYM_MOTION_DOWN | KEYM_MOTION_RIGHT)) >> 1);
	ret &= REALKEY_MASK;

	if (game_recording)
	{
		u32 rret = ret & ~(KEYM_SPEED | KEYM_CAPTURE);

		if (rret != game_joypad)
		{
			game_joypad = rret;
			u32 gf = wxUINT32_SWAP_ON_BE(game_frame);
			u32 jp = wxUINT32_SWAP_ON_BE(game_joypad);

			if (game_file.Write(&gf, sizeof(gf)) != sizeof(gf) ||
			        game_file.Write(&jp, sizeof(jp)) != sizeof(jp))
			{
				game_file.Close();
				game_recording = false;
				wxLogError(_("Error writing game recording"));
			}
		}
	}
	else if (game_playback)
	{
		while (game_frame >= game_next_frame)
		{
			game_joypad = game_next_joypad;
			u32 gf, jp;

			if (game_file.Read(&gf, sizeof(gf)) != sizeof(gf) ||
			        game_file.Read(&jp, sizeof(jp)) != sizeof(jp))
			{
				game_file.Close();
				game_playback = false;
				wxString msg(_("Playback ended"));
				systemScreenMessage(msg);
				break;
			}

			game_next_frame = wxUINT32_SWAP_ON_BE(gf);
			game_next_joypad = wxUINT32_SWAP_ON_BE(jp);
		}

		ret = game_joypad;
	}

	return ret;
}