diff --git a/src/dmg/gbSound.cpp b/src/dmg/gbSound.cpp index a965297d..a96e5311 100644 --- a/src/dmg/gbSound.cpp +++ b/src/dmg/gbSound.cpp @@ -57,8 +57,6 @@ u8 gbSoundRead( u16 address ) void gbSoundEvent(register u16 address, register int data) { - int freq = 0; - gbMemory[address] = data; if ( gb_apu && address >= NR10 && address <= 0xFF3F ) diff --git a/src/gtk/input.cpp b/src/gtk/input.cpp index 5eecbf11..5beb4073 100644 --- a/src/gtk/input.cpp +++ b/src/gtk/input.cpp @@ -18,36 +18,25 @@ #include "input.h" -#include - namespace VBA { Keymap::Keymap() { - m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal); - if (m_pstTable == NULL) - { - throw std::bad_alloc(); - } } Keymap::~Keymap() { - g_hash_table_destroy(m_pstTable); } -void Keymap::vRegister(guint _uiVal, EKey _eKey) +void Keymap::vRegister(int _iVal, EKey _eKey) { - g_hash_table_insert(m_pstTable, - GUINT_TO_POINTER(_uiVal), - GUINT_TO_POINTER(_eKey)); + m_oTable[_iVal] = _eKey; } void Keymap::vClear() { - g_hash_table_destroy(m_pstTable); - m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal); + m_oTable.clear(); } } // namespace VBA diff --git a/src/gtk/input.h b/src/gtk/input.h index 5b2b21e6..948fd705 100644 --- a/src/gtk/input.h +++ b/src/gtk/input.h @@ -20,7 +20,7 @@ #ifndef __VBA_INPUT_H__ #define __VBA_INPUT_H__ -#include +#include namespace VBA { @@ -68,22 +68,21 @@ class Keymap Keymap(); ~Keymap(); - void vRegister(guint _uiVal, EKey _eKey); + void vRegister(int _iVal, EKey _eKey); void vClear(); - inline EKey eGetKey(guint _uiVal); + inline EKey eGetKey(int _iVal); private: - GHashTable * m_pstTable; + std::map m_oTable; // noncopyable Keymap(const Keymap &); Keymap & operator=(const Keymap &); }; -inline EKey Keymap::eGetKey(guint _uiVal) +inline EKey Keymap::eGetKey(int _iVal) { - return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable, - GUINT_TO_POINTER(_uiVal))); + return m_oTable[_iVal]; } } // namespace VBA