applied gtk_rtc.patch by unmacaque

This commit is contained in:
squall-leonhart 2010-11-27 01:06:20 +00:00
parent 36d59dd398
commit 81862972a9
5 changed files with 65 additions and 0 deletions

View File

@ -31,11 +31,13 @@ GameBoyAdvanceConfigDialog::GameBoyAdvanceConfigDialog(GtkDialog* _pstDialog, co
refBuilder->get_widget("FlashSizeComboBox", m_poFlashSizeComboBox);
refBuilder->get_widget("BiosCheckButton", m_poBiosCheckButton);
refBuilder->get_widget("BiosFileChooserButton", m_poBiosFileChooserButton);
refBuilder->get_widget("RTCCheckButton", m_poRTCCheckButton);
m_poSaveTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnSaveTypeChanged));
m_poFlashSizeComboBox->signal_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnFlashSizeChanged));
m_poBiosCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnUseBiosChanged));
m_poBiosFileChooserButton->signal_selection_changed().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnBiosSelectionChanged));
m_poRTCCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &GameBoyAdvanceConfigDialog::vOnEnableRTCChanged));
}
void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Window * _poWindow)
@ -83,6 +85,9 @@ void GameBoyAdvanceConfigDialog::vSetConfig(Config::Section * _poConfig, VBA::Wi
m_poBiosFileChooserButton->add_filter(oAllFilter);
m_poBiosFileChooserButton->add_filter(oBiosFilter);
m_poBiosFileChooserButton->set_filter(oBiosFilter);
bool bEnableRTC = m_poConfig->oGetKey<bool>("enable_rtc");
m_poRTCCheckButton->set_active(bEnableRTC);
}
void GameBoyAdvanceConfigDialog::vOnSaveTypeChanged()
@ -120,4 +125,10 @@ void GameBoyAdvanceConfigDialog::vOnBiosSelectionChanged()
m_poConfig->vSetKey("bios_file", sBios);
}
void GameBoyAdvanceConfigDialog::vOnEnableRTCChanged()
{
bool bEnableRTC = m_poRTCCheckButton->get_active();
m_poConfig->vSetKey("enable_rtc", bEnableRTC);
}
} // namespace VBA

View File

@ -39,6 +39,7 @@ private:
void vOnFlashSizeChanged();
void vOnUseBiosChanged();
void vOnBiosSelectionChanged();
void vOnEnableRTCChanged();
VBA::Window * m_poWindow;
@ -47,6 +48,7 @@ private:
Gtk::ComboBox * m_poFlashSizeComboBox;
Gtk::CheckButton * m_poBiosCheckButton;
Gtk::FileChooserButton * m_poBiosFileChooserButton;
Gtk::CheckButton * m_poRTCCheckButton;
};
} // namespace VBA

View File

@ -194,6 +194,42 @@
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="RTCCheckButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable real-time clock</property>
<property name="draw_indicator">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Real-Time Clock&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">

View File

@ -27,6 +27,7 @@
#include <SDL.h>
#include "../gba/GBA.h"
#include "../gba/RTC.h"
#include "../gba/Sound.h"
#include "../gb/gb.h"
#include "../gb/gbGlobals.h"
@ -148,6 +149,7 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
vApplyConfigGBPrinter();
vApplyConfigGBASaveType();
vApplyConfigGBAFlashSize();
vApplyConfigGBARTC();
Gtk::MenuItem * poMI;
Gtk::CheckMenuItem * poCMI;
@ -570,6 +572,7 @@ void Window::vInitConfig()
m_poCoreConfig->vSetKey("frameskip", "auto" );
m_poCoreConfig->vSetKey("use_bios_file", false );
m_poCoreConfig->vSetKey("bios_file", "" );
m_poCoreConfig->vSetKey("enable_rtc", false );
m_poCoreConfig->vSetKey("save_type", SaveAuto );
m_poCoreConfig->vSetKey("flash_size", 64 );
m_poCoreConfig->vSetKey("gb_border", false );
@ -675,6 +678,10 @@ void Window::vCheckConfig()
{
m_poCoreConfig->vSetKey("use_bios_file", false);
}
if (m_poCoreConfig->sGetKey("enable_rtc") == "")
{
m_poCoreConfig->vSetKey("enable_rtc", false);
}
sValue = m_poCoreConfig->sGetKey("gb_bios_file");
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_REGULAR))
@ -895,6 +902,12 @@ void Window::vApplyConfigGBAFlashSize()
}
}
void Window::vApplyConfigGBARTC()
{
bool iRTC = m_poCoreConfig->oGetKey<bool>("enable_rtc");
rtcEnable(iRTC);
}
void Window::vHistoryAdd(const std::string & _rsFile)
{
std::string sURL = "file://" + _rsFile;
@ -1038,6 +1051,8 @@ bool Window::bLoadROM(const std::string & _rsFile)
m_poUseBiosItem->set_sensitive(false);
m_poCoreConfig->vSetKey("bios_file", "");
}
rtcEnable(m_poCoreConfig->oGetKey<bool>("enable_rtc"));
}
}

View File

@ -106,6 +106,7 @@ public:
void vApplyConfigGBPrinter();
void vApplyConfigGBASaveType();
void vApplyConfigGBAFlashSize();
void vApplyConfigGBARTC();
void vUpdateScreen();
inline ECartridge eGetCartridge() const { return m_eCartridge; }