Added some more friendly macros to help define custom palette formats (nw)

This commit is contained in:
Alex W. Jackson 2014-06-03 07:39:21 +00:00
parent 8a06918131
commit 10e08f136a
3 changed files with 8 additions and 4 deletions

View File

@ -111,6 +111,10 @@
#define DECLARE_PALETTE_INIT(_Name) void PALETTE_INIT_NAME(_Name)(palette_device &palette)
#define PALETTE_INIT_MEMBER(_Class, _Name) void _Class::PALETTE_INIT_NAME(_Name)(palette_device &palette)
#define PALETTE_DECODER_NAME(_Name) _Name##_decoder
#define DECLARE_PALETTE_DECODER(_Name) static rgb_t PALETTE_DECODER_NAME(_Name)(UINT32 raw)
#define PALETTE_DECODER_MEMBER(_Class, _Name) rgb_t _Class::PALETTE_DECODER_NAME(_Name)(UINT32 raw)
// standard 3-3-2 formats
#define PALETTE_FORMAT_BBGGGRRR raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>)
#define PALETTE_FORMAT_RRRGGGBB raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 5,2,0>)
@ -180,8 +184,8 @@
#define MCFG_PALETTE_FORMAT(_format) \
palette_device::static_set_format(*device, PALETTE_FORMAT_##_format);
#define MCFG_PALETTE_FORMAT_CLASS(_bytes_per_entry, _class, _format) \
palette_device::static_set_format(*device, raw_to_rgb_converter(_bytes_per_entry, &_class::_format##_decoder));
#define MCFG_PALETTE_FORMAT_CLASS(_bytes_per_entry, _class, _method) \
palette_device::static_set_format(*device, raw_to_rgb_converter(_bytes_per_entry, &_class::PALETTE_DECODER_NAME(_method)));
#define MCFG_PALETTE_MEMBITS(_width) \
palette_device::static_set_membits(*device, _width);

View File

@ -349,7 +349,7 @@ public:
void mfp_trigger_irq(int irq);
void mfp_set_timer(int timer, unsigned char data);
void mfp_recv_data(int data);
static rgb_t GGGGGRRRRRBBBBBI_decoder(UINT32 raw);
DECLARE_PALETTE_DECODER(GGGGGRRRRRBBBBBI);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);

View File

@ -38,7 +38,7 @@
#include "machine/ram.h"
rgb_t x68k_state::GGGGGRRRRRBBBBBI_decoder(UINT32 raw)
PALETTE_DECODER_MEMBER(x68k_state, GGGGGRRRRRBBBBBI)
{
UINT8 i = raw & 1;
UINT8 r = pal6bit(((raw >> 5) & 0x3e) | i);