From: S?bastien G. <kx...@us...> - 2004-05-10 22:55:04
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26797/src/gtk Modified Files: vba.glade window.cpp window.h windowcallbacks.cpp Log Message: Added GDB support. Index: vba.glade =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/vba.glade,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** vba.glade 10 May 2004 14:59:43 -0000 1.12 --- vba.glade 10 May 2004 22:54:51 -0000 1.13 *************** *** 51,55 **** <child internal-child="image"> ! <widget class="GtkImage" id="image120"> <property name="visible">True</property> <property name="stock">gtk-open</property> --- 51,55 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image128"> <property name="visible">True</property> <property name="stock">gtk-open</property> *************** *** 473,477 **** <child internal-child="image"> ! <widget class="GtkImage" id="image121"> <property name="visible">True</property> <property name="stock">gtk-close</property> --- 473,477 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image129"> <property name="visible">True</property> <property name="stock">gtk-close</property> *************** *** 494,498 **** <child internal-child="image"> ! <widget class="GtkImage" id="image122"> <property name="visible">True</property> <property name="stock">gtk-quit</property> --- 494,498 ---- <child internal-child="image"> ! <widget class="GtkImage" id="image130"> <property name="visible">True</property> <property name="stock">gtk-quit</property> *************** *** 1877,1881 **** <widget class="GtkMenuItem" id="GdbWait"> <property name="visible">True</property> ! <property name="label" translatable="yes">_Wait for connection...</property> <property name="use_underline">True</property> </widget> --- 1877,1881 ---- <widget class="GtkMenuItem" id="GdbWait"> <property name="visible">True</property> ! <property name="label" translatable="yes">_Wait connection...</property> <property name="use_underline">True</property> </widget> *************** *** 1883,1887 **** <child> ! <widget class="GtkMenuItem" id="GdbLoad"> <property name="visible">True</property> <property name="label" translatable="yes">_Load and wait...</property> --- 1883,1887 ---- <child> ! <widget class="GtkMenuItem" id="GdbLoadAndWait"> <property name="visible">True</property> <property name="label" translatable="yes">_Load and wait...</property> *************** *** 1893,1897 **** <widget class="GtkMenuItem" id="GdbBreak"> <property name="visible">True</property> ! <property name="label" translatable="yes">_Break into GDB</property> <property name="use_underline">True</property> </widget> --- 1893,1897 ---- <widget class="GtkMenuItem" id="GdbBreak"> <property name="visible">True</property> ! <property name="label" translatable="yes">_Break</property> <property name="use_underline">True</property> </widget> *************** *** 1909,1920 **** </widget> </child> - - <child> - <widget class="GtkMenuItem" id="CheatsMenu"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Cheats</property> - <property name="use_underline">True</property> - </widget> - </child> </widget> </child> --- 1909,1912 ---- *************** *** 2050,2054 **** <property name="visible">True</property> <property name="can_focus">True</property> ! <property name="label" translatable="yes">An emulator for Gameboy⢠and GameboyAdvanceâ¢.</property> <property name="use_underline">False</property> <property name="use_markup">False</property> --- 2042,2046 ---- <property name="visible">True</property> <property name="can_focus">True</property> ! <property name="label" translatable="yes">An emulator for Gameboy(TM) and GameboyAdvance(TM).</property> <property name="use_underline">False</property> <property name="use_markup">False</property> *************** *** 2072,2076 **** <property name="visible">True</property> <property name="can_focus">True</property> ! <property name="label" translatable="yes"><small>Copyright © 1999-2004 Forgotten</small></property> <property name="use_underline">False</property> <property name="use_markup">True</property> --- 2064,2068 ---- <property name="visible">True</property> <property name="can_focus">True</property> ! <property name="label" translatable="yes"><small>Copyright (C) 2004 Forgotten and the VBA development team</small></property> <property name="use_underline">False</property> <property name="use_markup">True</property> *************** *** 2153,2220 **** <child> ! <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> ! <property name="homogeneous">False</property> ! <property name="spacing">0</property> <child> ! <widget class="GtkLabel" id="label4"> <property name="visible">True</property> ! <property name="label" translatable="yes">Throttle : </property> ! <property name="use_underline">False</property> ! <property name="use_markup">False</property> ! <property name="justify">GTK_JUSTIFY_LEFT</property> ! <property name="wrap">False</property> ! <property name="selectable">False</property> ! <property name="xalign">1</property> ! <property name="yalign">0.5</property> ! <property name="xpad">0</property> ! <property name="ypad">0</property> ! </widget> ! <packing> ! <property name="padding">0</property> ! <property name="expand">True</property> ! <property name="fill">True</property> ! </packing> ! </child> ! <child> ! <widget class="GtkSpinButton" id="ThrottleSpin"> ! <property name="visible">True</property> ! <property name="can_focus">True</property> ! <property name="climb_rate">1</property> ! <property name="digits">0</property> ! <property name="numeric">True</property> ! <property name="update_policy">GTK_UPDATE_ALWAYS</property> ! <property name="snap_to_ticks">True</property> ! <property name="wrap">True</property> ! <property name="adjustment">100 5 1000 1 25 25</property> ! </widget> ! <packing> ! <property name="padding">0</property> ! <property name="expand">True</property> ! <property name="fill">True</property> ! </packing> ! </child> ! <child> ! <widget class="GtkLabel" id="label5"> ! <property name="visible">True</property> ! <property name="label" translatable="yes"> %</property> ! <property name="use_underline">False</property> ! <property name="use_markup">False</property> ! <property name="justify">GTK_JUSTIFY_LEFT</property> ! <property name="wrap">False</property> ! <property name="selectable">False</property> ! <property name="xalign">0</property> ! <property name="yalign">0.5</property> ! <property name="xpad">0</property> ! <property name="ypad">0</property> </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> </child> </widget> --- 2145,2226 ---- <child> ! <widget class="GtkAlignment" id="alignment4"> <property name="visible">True</property> ! <property name="xalign">0.5</property> ! <property name="yalign">0.5</property> ! <property name="xscale">0</property> ! <property name="yscale">0</property> ! <property name="top_padding">0</property> ! <property name="bottom_padding">0</property> ! <property name="left_padding">0</property> ! <property name="right_padding">0</property> <child> ! <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> ! <property name="homogeneous">False</property> ! <property name="spacing">0</property> ! <child> ! <widget class="GtkLabel" id="label4"> ! <property name="visible">True</property> ! <property name="label" translatable="yes">Throttle : </property> ! <property name="use_underline">False</property> ! <property name="use_markup">False</property> ! <property name="justify">GTK_JUSTIFY_LEFT</property> ! <property name="wrap">False</property> ! <property name="selectable">False</property> ! <property name="xalign">1</property> ! <property name="yalign">0.5</property> ! <property name="xpad">0</property> ! <property name="ypad">0</property> ! </widget> ! <packing> ! <property name="padding">0</property> ! <property name="expand">True</property> ! <property name="fill">True</property> ! </packing> ! </child> ! <child> ! <widget class="GtkSpinButton" id="ThrottleSpin"> ! <property name="visible">True</property> ! <property name="can_focus">True</property> ! <property name="climb_rate">1</property> ! <property name="digits">0</property> ! <property name="numeric">True</property> ! <property name="update_policy">GTK_UPDATE_ALWAYS</property> ! <property name="snap_to_ticks">True</property> ! <property name="wrap">True</property> ! <property name="adjustment">100 5 1000 1 25 25</property> ! </widget> ! <packing> ! <property name="padding">0</property> ! <property name="expand">True</property> ! <property name="fill">True</property> ! </packing> ! </child> ! ! <child> ! <widget class="GtkLabel" id="label5"> ! <property name="visible">True</property> ! <property name="label" translatable="yes"> %</property> ! <property name="use_underline">False</property> ! <property name="use_markup">False</property> ! <property name="justify">GTK_JUSTIFY_LEFT</property> ! <property name="wrap">False</property> ! <property name="selectable">False</property> ! <property name="xalign">0</property> ! <property name="yalign">0.5</property> ! <property name="xpad">0</property> ! <property name="ypad">0</property> ! </widget> ! <packing> ! <property name="padding">0</property> ! <property name="expand">True</property> ! <property name="fill">True</property> ! </packing> ! </child> </widget> </child> </widget> *************** *** 2230,2234 **** <widget class="GtkDialog" id="DirectoriesDialog"> - <property name="visible">True</property> <property name="title" translatable="yes">Directories</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> --- 2236,2239 ---- *************** *** 2824,2828 **** <widget class="GtkDialog" id="JoypadConfigDialog"> - <property name="visible">True</property> <property name="title" translatable="yes">Joypad config</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> --- 2829,2832 ---- *************** *** 3468,3470 **** --- 3472,3603 ---- </widget> + <widget class="GtkDialog" id="TcpPortDialog"> + <property name="title" translatable="yes">TCP port</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">True</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="has_separator">True</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area5"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="cancelbutton4"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-6</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="okbutton4"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="label" translatable="yes">Port : </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkSpinButton" id="TcpPortSpin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">True</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">True</property> + <property name="wrap">True</property> + <property name="adjustment">55555 1 65535 1 100 100</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + </glade-interface> Index: window.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** window.h 10 May 2004 14:59:43 -0000 1.18 --- window.h 10 May 2004 22:54:51 -0000 1.19 *************** *** 187,190 **** --- 187,194 ---- virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad); virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, std::string _sKey, u32 _uiKeyFlag); + virtual void vOnGDBWait(); + virtual void vOnGDBLoadAndWait(); + virtual void vOnGDBBreak(); + virtual void vOnGDBDisconnect(); virtual void vOnHelpAbout(); virtual bool bOnEmuIdle(); *************** *** 302,305 **** --- 306,310 ---- void vDrawDefaultScreen(); void vSetDefaultTitle(); + void vCreateFileOpenDialog(); bool bLoadROM(const std::string & _rsFile); void vLoadBattery(); Index: windowcallbacks.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/windowcallbacks.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** windowcallbacks.cpp 10 May 2004 14:59:43 -0000 1.7 --- windowcallbacks.cpp 10 May 2004 22:54:51 -0000 1.8 *************** *** 40,43 **** --- 40,53 ---- extern bool debugger; extern int RGB_LOW_BITS_MASK; + extern void (*dbgMain)(); + extern void (*dbgSignal)(int, int); + extern void (*dbgOutput)(char *, u32); + extern void remoteInit(); + extern void remoteCleanUp(); + extern void remoteStubMain(); + extern void remoteStubSignal(int, int); + extern void remoteOutput(char *, u32); + extern void remoteSetProtocol(int); + extern void remoteSetPort(int); #ifdef MMX *************** *** 52,132 **** void Window::vOnFileOpen() { - if (m_poFileOpenDialog == NULL) - { - std::string sGBDir = m_poDirConfig->sGetKey("gb_roms"); - std::string sGBADir = m_poDirConfig->sGetKey("gba_roms"); - - #ifdef GTKMM20 - - Gtk::FileSelection * poDialog = new Gtk::FileSelection(_("Open")); - poDialog->set_transient_for(*this); - - if (sGBADir != "") - { - poDialog->set_filename(sGBADir + "/"); - } - else if (sGBDir != "") - { - poDialog->set_filename(sGBDir + "/"); - } - - #else // ! GTKMM20 - - Gtk::FileChooserDialog * poDialog = new Gtk::FileChooserDialog(*this, _("Open")); - poDialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - poDialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); - - if (sGBDir != "") - { - poDialog->add_shortcut_folder(sGBDir); - poDialog->set_current_folder(sGBDir); - } - - if (sGBADir != "" && sGBADir != sGBDir) - { - poDialog->add_shortcut_folder(sGBADir); - poDialog->set_current_folder(sGBADir); - } - - const char * acsPattern[] = - { - // GBA - "*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]", - // GB - "*.[gG][bB]", "*.[sS][gG][bB]", "*.[cC][gG][bB]", "*.[gG][bB][cC]", - // Both - "*.[mM][bB]", "*.[eE][lL][fF]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]" - }; - - Gtk::FileFilter oAllGBAFilter; - oAllGBAFilter.set_name(_("All Gameboy Advance files")); - for (guint i = 0; i < sizeof(acsPattern) / sizeof(acsPattern[0]); i++) - { - oAllGBAFilter.add_pattern(acsPattern[i]); - } - - Gtk::FileFilter oGBAFilter; - oGBAFilter.set_name(_("Gameboy Advance files")); - for (int i = 0; i < 3; i++) - { - oGBAFilter.add_pattern(acsPattern[i]); - } - - Gtk::FileFilter oGBFilter; - oGBFilter.set_name(_("Gameboy files")); - for (int i = 3; i < 7; i++) - { - oGBFilter.add_pattern(acsPattern[i]); - } - - poDialog->add_filter(oAllGBAFilter); - poDialog->add_filter(oGBAFilter); - poDialog->add_filter(oGBFilter); - - #endif // ! GTKMM20 - - m_poFileOpenDialog = poDialog; - } - while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK) { --- 62,65 ---- *************** *** 681,685 **** void Window::vOnFileClose() { ! if (emulating) { soundPause(); --- 614,618 ---- void Window::vOnFileClose() { ! if (m_eCartridge != CartridgeNone) { soundPause(); *************** *** 1293,1296 **** --- 1226,1381 ---- } + void Window::vOnGDBWait() + { + Glib::RefPtr<Xml> poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "TcpPortDialog"); + + Gtk::Dialog * poDialog = dynamic_cast<Gtk::Dialog *>(poXml->get_widget("TcpPortDialog")); + Gtk::SpinButton * poSpin = dynamic_cast<Gtk::SpinButton *>(poXml->get_widget("TcpPortSpin")); + + poDialog->set_transient_for(*this); + + int iPort = 55555; + poSpin->set_value(iPort); + + bool bOk = false; + if (poDialog->run() == Gtk::RESPONSE_OK) + { + bOk = true; + iPort = poSpin->get_value_as_int(); + } + delete poDialog; + + if (! bOk) + { + return; + } + + m_eCartridge = CartridgeGBA; + m_sRomFile = "gnu_stub"; + m_stEmulator = GBASystem; + + rom = (u8 *) malloc(0x2000000); + workRAM = (u8 *) calloc(1, 0x40000); + bios = (u8 *) calloc(1, 0x4000); + internalRAM = (u8 *) calloc(1, 0x8000); + paletteRAM = (u8 *) calloc(1, 0x400); + vram = (u8 *) calloc(1, 0x20000); + oam = (u8 *) calloc(1, 0x400); + pix = (u8 *) calloc(1, 4 * m_iGBAScreenWidth * m_iGBAScreenHeight); + ioMem = (u8 *) calloc(1, 0x400); + + useBios = m_poCoreConfig->oGetKey<bool>("use_bios_file"); + CPUInit(m_poCoreConfig->sGetKey("bios_file").c_str(), useBios); + CPUReset(); + + for (std::list<Gtk::Widget *>::iterator it = m_listSensitiveWhenPlaying.begin(); + it != m_listSensitiveWhenPlaying.end(); + it++) + { + (*it)->set_sensitive(); + } + + if (m_poCoreConfig->oGetKey<bool>("load_game_auto")) + { + vOnLoadGameMostRecent(); + } + + vStartEmu(); + + emulating = 1; + + dbgMain = remoteStubMain; + dbgSignal = remoteStubSignal; + dbgOutput = remoteOutput; + debugger = true; + + remoteSetProtocol(0); + remoteSetPort(iPort); + remoteInit(); + } + + void Window::vOnGDBLoadAndWait() + { + bool bLoaded = false; + + while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK) + { + if (bLoadROM(m_poFileOpenDialog->get_filename())) + { + bLoaded = true; + break; + } + } + m_poFileOpenDialog->hide(); + + if (! bLoaded) + { + return; + } + + if (m_eCartridge != CartridgeGBA) + { + vPopupError(_("Only GBA images are supported.")); + vOnFileClose(); + return; + } + + Glib::RefPtr<Xml> poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "TcpPortDialog"); + + Gtk::Dialog * poDialog = dynamic_cast<Gtk::Dialog *>(poXml->get_widget("TcpPortDialog")); + Gtk::SpinButton * poSpin = dynamic_cast<Gtk::SpinButton *>(poXml->get_widget("TcpPortSpin")); + + poDialog->set_transient_for(*this); + + int iPort = 55555; + poSpin->set_value(iPort); + + bool bOk = false; + if (poDialog->run() == Gtk::RESPONSE_OK) + { + bOk = true; + iPort = poSpin->get_value_as_int(); + } + delete poDialog; + + if (! bOk) + { + return; + } + + dbgMain = remoteStubMain; + dbgSignal = remoteStubSignal; + dbgOutput = remoteOutput; + debugger = true; + + remoteSetProtocol(0); + remoteSetPort(iPort); + remoteInit(); + } + + void Window::vOnGDBBreak() + { + if (armState) + { + armNextPC -= 4; + reg[15].I -= 4; + } + else + { + armNextPC -= 2; + reg[15].I -= 2; + } + + debugger = true; + } + + void Window::vOnGDBDisconnect() + { + remoteCleanUp(); + debugger = false; + } + void Window::vOnHelpAbout() { *************** *** 1309,1312 **** --- 1394,1403 ---- bool Window::bOnEmuIdle() { + if (debugger && m_stEmulator.emuHasDebugger) + { + dbgMain(); + return true; + } + if (m_uiThrottleDelay != 0) { Index: window.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** window.cpp 10 May 2004 14:59:43 -0000 1.18 --- window.cpp 10 May 2004 22:54:51 -0000 1.19 *************** *** 41,44 **** --- 41,54 ---- extern bool debugger; extern int RGB_LOW_BITS_MASK; + extern void (*dbgMain)(); + extern void (*dbgSignal)(int, int); + extern void (*dbgOutput)(char *, u32); + extern void remoteInit(); + extern void remoteCleanUp(); + extern void remoteStubMain(); + extern void remoteStubSignal(int, int); + extern void remoteOutput(char *, u32); + extern void remoteSetProtocol(int); + extern void remoteSetPort(int); #ifdef MMX *************** *** 122,125 **** --- 132,136 ---- } + vCreateFileOpenDialog(); vLoadHistoryFromConfig(); vLoadJoypadsFromConfig(); *************** *** 806,810 **** poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astAutofire[i].m_csName)); poCMI->set_active(m_poInputConfig->oGetKey<bool>(astAutofire[i].m_csKey)); ! vOnAutofireToggled(poCMI, astAutofire[i].m_csName, astAutofire[i].m_eKeyFlag); poCMI->signal_toggled().connect(SigC::bind<Gtk::CheckMenuItem *, std::string, u32>( SigC::slot(*this, &Window::vOnAutofireToggled), --- 817,821 ---- poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astAutofire[i].m_csName)); poCMI->set_active(m_poInputConfig->oGetKey<bool>(astAutofire[i].m_csKey)); ! vOnAutofireToggled(poCMI, astAutofire[i].m_csKey, astAutofire[i].m_eKeyFlag); poCMI->signal_toggled().connect(SigC::bind<Gtk::CheckMenuItem *, std::string, u32>( SigC::slot(*this, &Window::vOnAutofireToggled), *************** *** 812,815 **** --- 823,840 ---- } + // GDB menu + // + poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GdbWait")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBWait)); + + poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GdbLoadAndWait")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBLoadAndWait)); + + poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GdbBreak")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBBreak)); + + poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GdbDisconnect")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBDisconnect)); + // Help menu // *************** *** 1582,1585 **** --- 1607,1692 ---- } + void Window::vCreateFileOpenDialog() + { + if (m_poFileOpenDialog != NULL) + { + return; + } + + std::string sGBDir = m_poDirConfig->sGetKey("gb_roms"); + std::string sGBADir = m_poDirConfig->sGetKey("gba_roms"); + + #ifdef GTKMM20 + + Gtk::FileSelection * poDialog = new Gtk::FileSelection(_("Open")); + poDialog->set_transient_for(*this); + + if (sGBADir != "") + { + poDialog->set_filename(sGBADir + "/"); + } + else if (sGBDir != "") + { + poDialog->set_filename(sGBDir + "/"); + } + + #else // ! GTKMM20 + + Gtk::FileChooserDialog * poDialog = new Gtk::FileChooserDialog(*this, _("Open")); + poDialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + poDialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + if (sGBDir != "") + { + poDialog->add_shortcut_folder(sGBDir); + poDialog->set_current_folder(sGBDir); + } + + if (sGBADir != "" && sGBADir != sGBDir) + { + poDialog->add_shortcut_folder(sGBADir); + poDialog->set_current_folder(sGBADir); + } + + const char * acsPattern[] = + { + // GBA + "*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]", + // GB + "*.[gG][bB]", "*.[sS][gG][bB]", "*.[cC][gG][bB]", "*.[gG][bB][cC]", + // Both + "*.[mM][bB]", "*.[eE][lL][fF]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]" + }; + + Gtk::FileFilter oAllGBAFilter; + oAllGBAFilter.set_name(_("All Gameboy Advance files")); + for (guint i = 0; i < sizeof(acsPattern) / sizeof(acsPattern[0]); i++) + { + oAllGBAFilter.add_pattern(acsPattern[i]); + } + + Gtk::FileFilter oGBAFilter; + oGBAFilter.set_name(_("Gameboy Advance files")); + for (int i = 0; i < 3; i++) + { + oGBAFilter.add_pattern(acsPattern[i]); + } + + Gtk::FileFilter oGBFilter; + oGBFilter.set_name(_("Gameboy files")); + for (int i = 3; i < 7; i++) + { + oGBFilter.add_pattern(acsPattern[i]); + } + + poDialog->add_filter(oAllGBAFilter); + poDialog->add_filter(oGBAFilter); + poDialog->add_filter(oGBFilter); + + #endif // ! GTKMM20 + + m_poFileOpenDialog = poDialog; + } + bool Window::bLoadROM(const std::string & _rsFile) { *************** *** 1637,1640 **** --- 1744,1748 ---- vUpdateScreen(); + debugger = false; // May cause conflicts emulating = 1; m_bWasEmulating = false; |