diff --git a/CMakeLists.txt b/CMakeLists.txt index 32714587..7d77a776 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,6 +246,7 @@ SET(SRC_GTK src/gtk/gameboyadvanceconfig.cpp src/gtk/cheatlist.cpp src/gtk/cheatedit.cpp + src/gtk/gameboycheatlist.cpp src/gtk/joypadconfig.cpp src/gtk/directoriesconfig.cpp src/gtk/displayconfig.cpp diff --git a/po/gvbam.pot b/po/gvbam.pot index 65f57c10..369b0255 100644 --- a/po/gvbam.pot +++ b/po/gvbam.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-24 17:56+0100\n" +"POT-Creation-Date: 2011-02-25 18:50+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -13,23 +13,33 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/gtk/cheatedit.cpp:48 +#: ../src/gtk/cheatedit.cpp:83 msgid "Generic Code" msgstr "" -#: ../src/gtk/cheatedit.cpp:53 +#: ../src/gtk/cheatedit.cpp:88 msgid "Gameshark Advance" msgstr "" -#: ../src/gtk/cheatedit.cpp:58 +#: ../src/gtk/cheatedit.cpp:93 msgid "CodeBreaker Advance" msgstr "" -#: ../src/gtk/cheatlist.cpp:73 tmp/cheatlist.ui.h:5 +#: ../src/gtk/cheatedit.cpp:103 +msgid "GameShark" +msgstr "" + +#: ../src/gtk/cheatedit.cpp:108 +msgid "GameGenie" +msgstr "" + +#: ../src/gtk/cheatlist.cpp:73 ../src/gtk/gameboycheatlist.cpp:73 +#: tmp/cheatlist.ui.h:5 msgid "Open cheat list" msgstr "" -#: ../src/gtk/cheatlist.cpp:96 tmp/cheatlist.ui.h:6 +#: ../src/gtk/cheatlist.cpp:96 ../src/gtk/gameboycheatlist.cpp:96 +#: tmp/cheatlist.ui.h:6 msgid "Save cheat list" msgstr "" @@ -226,19 +236,19 @@ msgstr "" msgid "" msgstr "" -#: ../src/gtk/main.cpp:42 ../src/gtk/windowcallbacks.cpp:496 +#: ../src/gtk/main.cpp:41 ../src/gtk/windowcallbacks.cpp:506 msgid "VBA-M" msgstr "" -#: ../src/gtk/main.cpp:51 +#: ../src/gtk/main.cpp:50 msgid "Main VBA-M options" msgstr "" -#: ../src/gtk/main.cpp:56 +#: ../src/gtk/main.cpp:55 msgid "Output version information." msgstr "" -#: ../src/gtk/main.cpp:82 +#: ../src/gtk/main.cpp:81 #, c-format msgid "VisualBoyAdvance version %s [GTK+]\n" msgstr "" @@ -248,92 +258,88 @@ msgstr "" msgid "*** OpenGL : Cannot open display.\n" msgstr "" -#: ../src/gtk/window.cpp:426 +#: ../src/gtk/window.cpp:427 #, c-format msgid "Unable to initialize output, falling back to Cairo\n" msgstr "" -#: ../src/gtk/window.cpp:467 +#: ../src/gtk/window.cpp:468 #, c-format msgid "Failed to init SDL: %s" msgstr "" -#: ../src/gtk/window.cpp:975 +#: ../src/gtk/window.cpp:1021 #, c-format msgid "Unknown file type %s" msgstr "" -#: ../src/gtk/window.cpp:1114 +#: ../src/gtk/window.cpp:1158 #, c-format msgid "VBA-M - %d%%" msgstr "" -#: ../src/gtk/window.cpp:1119 +#: ../src/gtk/window.cpp:1163 #, c-format msgid "VBA-M - %d%% (%d, %d fps)" msgstr "" -#: ../src/gtk/window.cpp:1221 +#: ../src/gtk/window.cpp:1265 msgid "Open" msgstr "" -#: ../src/gtk/window.cpp:1256 +#: ../src/gtk/window.cpp:1300 msgid "All Gameboy Advance files" msgstr "" -#: ../src/gtk/window.cpp:1263 +#: ../src/gtk/window.cpp:1307 msgid "Gameboy Advance files" msgstr "" -#: ../src/gtk/window.cpp:1270 +#: ../src/gtk/window.cpp:1314 msgid "Gameboy files" msgstr "" -#: ../src/gtk/window.cpp:1296 +#: ../src/gtk/window.cpp:1340 msgid "Loaded battery" msgstr "" -#: ../src/gtk/window.cpp:1313 +#: ../src/gtk/window.cpp:1357 msgid "Saved battery" msgstr "" -#: ../src/gtk/window.cpp:1338 ../src/gtk/window.cpp:1383 +#: ../src/gtk/window.cpp:1382 ../src/gtk/window.cpp:1427 msgid "----/--/-- --:--:--" msgstr "" -#: ../src/gtk/window.cpp:1368 +#: ../src/gtk/window.cpp:1412 msgid "%Y/%m/%d %H:%M:%S" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:83 +#: ../src/gtk/windowcallbacks.cpp:84 msgid "Load game" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:98 ../src/gtk/windowcallbacks.cpp:133 +#: ../src/gtk/windowcallbacks.cpp:99 ../src/gtk/windowcallbacks.cpp:134 msgid "VisualBoyAdvance save game" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:116 +#: ../src/gtk/windowcallbacks.cpp:117 msgid "Save game" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:149 ../src/gtk/windowcallbacks.cpp:311 +#: ../src/gtk/windowcallbacks.cpp:150 ../src/gtk/windowcallbacks.cpp:312 msgid "File already exists. Overwrite it?" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:276 +#: ../src/gtk/windowcallbacks.cpp:277 msgid "Save screenshot" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:293 +#: ../src/gtk/windowcallbacks.cpp:294 msgid "PNG image" msgstr "" -#: ../src/gtk/windowcallbacks.cpp:461 -msgid "Only Gameboy Advance cheats are supported" -msgstr "" - -#: ../src/gtk/windowcallbacks.cpp:498 +#: ../src/gtk/windowcallbacks.cpp:508 msgid "Nintendo GameBoy Advance emulator." msgstr "" diff --git a/src/gtk/cheatedit.cpp b/src/gtk/cheatedit.cpp index 456b3b31..76b5de1e 100644 --- a/src/gtk/cheatedit.cpp +++ b/src/gtk/cheatedit.cpp @@ -42,23 +42,6 @@ CheatEditDialog::CheatEditDialog(GtkDialog* _pstDialog, const Glib::RefPtrset_model(m_poCheatTypeStore); - Gtk::TreeModel::Row row = *(m_poCheatTypeStore->append()); - - row[m_oTypeModel.iType] = CheatGeneric; - row[m_oTypeModel.uText] = _("Generic Code"); - - row = *(m_poCheatTypeStore->append()); - - row[m_oTypeModel.iType] = CheatGSA; - row[m_oTypeModel.uText] = _("Gameshark Advance"); - - row = *(m_poCheatTypeStore->append()); - - row[m_oTypeModel.iType] = CheatCBA; - row[m_oTypeModel.uText] = _("CodeBreaker Advance"); - - m_poCheatTypeComboBox->set_active(CheatGeneric); - m_poCheatApplyButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatEditDialog::vOnApply)); m_poCheatCancelButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatEditDialog::vOnCancel)); } @@ -87,6 +70,47 @@ ECheatType CheatEditDialog::vGetType() return CheatGeneric; } +void CheatEditDialog::vSetWindow(VBA::Window * _poWindow) +{ + m_poWindow = _poWindow; + + // GameBoy Advance + if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGBA) + { + Gtk::TreeModel::Row row = *(m_poCheatTypeStore->append()); + + row[m_oTypeModel.iType] = CheatGeneric; + row[m_oTypeModel.uText] = _("Generic Code"); + + row = *(m_poCheatTypeStore->append()); + + row[m_oTypeModel.iType] = CheatGSA; + row[m_oTypeModel.uText] = _("Gameshark Advance"); + + row = *(m_poCheatTypeStore->append()); + + row[m_oTypeModel.iType] = CheatCBA; + row[m_oTypeModel.uText] = _("CodeBreaker Advance"); + + m_poCheatTypeComboBox->set_active(CheatGeneric); + } + // GameBoy + else if (m_poWindow->eGetCartridge() == VBA::Window::CartridgeGB) + { + Gtk::TreeModel::Row row = *(m_poCheatTypeStore->append()); + + row[m_oTypeModel.iType] = CheatGS; + row[m_oTypeModel.uText] = _("GameShark"); + + row = *(m_poCheatTypeStore->append()); + + row[m_oTypeModel.iType] = CheatGG; + row[m_oTypeModel.uText] = _("GameGenie"); + + m_poCheatTypeComboBox->set_active(0); + } +} + void CheatEditDialog::vOnApply() { response(Gtk::RESPONSE_APPLY); diff --git a/src/gtk/cheatedit.h b/src/gtk/cheatedit.h index 4e9fe2f0..7a349152 100644 --- a/src/gtk/cheatedit.h +++ b/src/gtk/cheatedit.h @@ -34,7 +34,9 @@ enum ECheatType { CheatGeneric, CheatGSA, - CheatCBA + CheatCBA, + CheatGS, + CheatGG }; class EditCheatCodeColumns : public Gtk::TreeModel::ColumnRecord @@ -59,6 +61,7 @@ public: Glib::RefPtr vGetCode(); Glib::ustring vGetDesc(); ECheatType vGetType(); + void vSetWindow(VBA::Window * _poWindow); private: void vOnApply(); diff --git a/src/gtk/cheatlist.cpp b/src/gtk/cheatlist.cpp index ce1b7f0d..7073b871 100644 --- a/src/gtk/cheatlist.cpp +++ b/src/gtk/cheatlist.cpp @@ -74,7 +74,7 @@ void CheatListDialog::vOnCheatOpen() oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); - oDialog.set_current_folder(Glib::get_home_dir()); // TODO: remember dir? + oDialog.set_current_folder(Glib::get_home_dir()); while (oDialog.run() == Gtk::RESPONSE_OK) { @@ -111,6 +111,7 @@ void CheatListDialog::vOnCheatAdd() CheatEditDialog * poDialog = 0; poBuilder->get_widget_derived("CheatEditDialog", poDialog); poDialog->set_transient_for(*this); + poDialog->vSetWindow(m_poWindow); int response = poDialog->run(); poDialog->hide(); @@ -198,6 +199,7 @@ void CheatListDialog::vOnCheatAdd() } // end of loop } // end of case + default:; // silence warnings } // end of switch vUpdateList(previous); @@ -253,6 +255,11 @@ void CheatListDialog::vOnCheatToggled(Glib::ustring const& string_path) vToggleCheat(row[m_oRecordModel.iIndex], row[m_oRecordModel.bEnabled]); } +void CheatListDialog::vSetWindow(VBA::Window * _poWindow) +{ + m_poWindow = _poWindow; +} + void CheatListDialog::vToggleCheat(int index, bool enable) { if (enable) cheatsEnable(index); diff --git a/src/gtk/cheatlist.h b/src/gtk/cheatlist.h index 39bc9d3c..0ebd8639 100644 --- a/src/gtk/cheatlist.h +++ b/src/gtk/cheatlist.h @@ -53,6 +53,7 @@ class CheatListDialog : public Gtk::Dialog { public: CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr& refBuilder); + void vSetWindow(VBA::Window * _poWindow); private: void vAddCheat(int index, Glib::ustring desc, bool enabled = true); diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index afca5aaa..2e5e7711 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -42,6 +42,7 @@ #include "gameboyadvanceconfig.h" #include "generalconfig.h" #include "cheatlist.h" +#include "gameboycheatlist.h" namespace VBA { @@ -453,19 +454,28 @@ void Window::vOnCheatList() CheatListDialog * poDialog = 0; poBuilder->get_widget_derived("CheatListDialog", poDialog); poDialog->set_transient_for(*this); + poDialog->vSetWindow(this); poDialog->run(); poDialog->hide(); } - else + else if (m_eCartridge == CartridgeGB) { - vPopupError(_("Only Gameboy Advance cheats are supported")); + std::string sUiFile = sGetUiFilePath("cheatlist.ui"); + Glib::RefPtr poBuilder = Gtk::Builder::create_from_file(sUiFile); + + GameBoyCheatListDialog * poDialog = 0; + poBuilder->get_widget_derived("CheatListDialog", poDialog); + poDialog->set_transient_for(*this); + poDialog->vSetWindow(this); + poDialog->run(); + poDialog->hide(); } } void Window::vOnCheatDisableToggled(Gtk::CheckMenuItem * _poCMI) { if (m_eCartridge == CartridgeGB) { - // TODO: implement + cheatsEnabled = !cheatsEnabled; } else if (m_eCartridge == CartridgeGBA) { cheatsEnabled = !cheatsEnabled;