mirror of
https://github.com/holub/mame
synced 2025-10-08 17:37:56 +03:00
Merge pull request #1306 from GiuseppeGorgoglione/master
gba: 1st batch of code refactorings
This commit is contained in:
commit
1f22ce8bda
File diff suppressed because it is too large
Load Diff
@ -60,10 +60,15 @@ class gba_registers
|
|||||||
protected:
|
protected:
|
||||||
static constexpr unsigned REG_BASE = BASE;
|
static constexpr unsigned REG_BASE = BASE;
|
||||||
|
|
||||||
UINT32 &WORD(unsigned x) { return m_regs[(x - REG_BASE) / 4]; } // 32-bit Register
|
// 32-bit Register
|
||||||
const UINT32 &WORD(unsigned x) const { return m_regs[(x - REG_BASE) / 4]; } // 32-bit Register
|
UINT32 &WORD(unsigned x) { return m_regs[(x - REG_BASE) / 4]; }
|
||||||
UINT16 HWHI(unsigned x) const { return UINT16(WORD(x) >> 16); } // 16-bit Register, Upper Half-Word
|
const UINT32 &WORD(unsigned x) const { return m_regs[(x - REG_BASE) / 4]; }
|
||||||
UINT16 HWLO(unsigned x) const { return UINT16(WORD(x)); } // 16-bit Register, Lower Half-Word
|
|
||||||
|
// 16-bit Register, Upper Half-Word
|
||||||
|
UINT16 HWHI(unsigned x) const { return UINT16(WORD(x) >> 16); }
|
||||||
|
|
||||||
|
// 16-bit Register, Lower Half-Word
|
||||||
|
UINT16 HWLO(unsigned x) const { return UINT16(WORD(x)); }
|
||||||
|
|
||||||
UINT32 &WORD_SET(unsigned x, UINT32 y) { return WORD(x) |= y; }
|
UINT32 &WORD_SET(unsigned x, UINT32 y) { return WORD(x) |= y; }
|
||||||
UINT32 &HWHI_SET(unsigned x, UINT16 y) { return WORD(x) |= UINT32(y) << 16; }
|
UINT32 &HWHI_SET(unsigned x, UINT16 y) { return WORD(x) |= UINT32(y) << 16; }
|
||||||
@ -131,6 +136,10 @@ protected:
|
|||||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
UINT32 bg_screen_base(UINT32 bgxcnt);
|
||||||
|
UINT32 bg_char_base(UINT32 bgxcnt);
|
||||||
|
void bg_screen_size(UINT16 bgxcnt, bool text, int &width, int &height);
|
||||||
|
|
||||||
inline void update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask);
|
inline void update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask);
|
||||||
void draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp);
|
void draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp);
|
||||||
void draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth);
|
void draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth);
|
||||||
|
@ -346,6 +346,25 @@ inline Dest downcast(Source &src)
|
|||||||
return static_cast<Dest>(src);
|
return static_cast<Dest>(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template function which takes a strongly typed enumerator and returns its value as a compile-time constant
|
||||||
|
template <typename E>
|
||||||
|
using enable_enum_t = typename std::enable_if_t<std::is_enum<E>::value, typename std::underlying_type_t<E>>;
|
||||||
|
|
||||||
|
template <typename E>
|
||||||
|
constexpr inline enable_enum_t<E>
|
||||||
|
underlying_value(E e) noexcept
|
||||||
|
{
|
||||||
|
return static_cast< typename std::underlying_type<E>::type >( e );
|
||||||
|
}
|
||||||
|
|
||||||
|
// template function which takes an integral value and returns its representation as enumerator (even strongly typed)
|
||||||
|
template <typename E , typename T>
|
||||||
|
constexpr inline typename std::enable_if_t<std::is_enum<E>::value && std::is_integral<T>::value, E>
|
||||||
|
enum_value(T value) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<E>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user