mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Merge branch 'master' of https://github.com/mamedev/mame.git
This commit is contained in:
commit
3ff75c6ec8
@ -243,11 +243,12 @@ function qtdebuggerbuild()
|
||||
local version = str_to_version(_OPTIONS["gcc_version"])
|
||||
if _OPTIONS["gcc"]~=nil and (string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "asmjs")) then
|
||||
configuration { "gmake or ninja" }
|
||||
if (version >= 30600) then
|
||||
buildoptions {
|
||||
"-Wno-inconsistent-missing-override",
|
||||
}
|
||||
end
|
||||
if (version >= 30600) then
|
||||
buildoptions {
|
||||
"-Wno-inconsistent-missing-override",
|
||||
}
|
||||
end
|
||||
configuration { }
|
||||
end
|
||||
|
||||
files {
|
||||
|
@ -1288,6 +1288,31 @@ UINT8 threecom3c505_device::read_command_port()
|
||||
case CMD_TRANSMIT_PACKET_18_COMPLETE:
|
||||
m_netstat.tot_xmit++;
|
||||
|
||||
// append the Ethernet Frame Check Sequence
|
||||
// see also http://www.edaboard.com/thread120700.html
|
||||
{
|
||||
// compute the Ethernet Frame Check Sequence
|
||||
static const UINT32 crc_table[] =
|
||||
{ 0x4DBDF21C, 0x500AE278, 0x76D3D2D4, 0x6B64C2B0,
|
||||
0x3B61B38C, 0x26D6A3E8, 0x000F9344, 0x1DB88320,
|
||||
0xA005713C, 0xBDB26158, 0x9B6B51F4, 0x86DC4190,
|
||||
0xD6D930AC, 0xCB6E20C8, 0xEDB71064, 0xF0000000 };
|
||||
UINT32 n, crc = 0;
|
||||
for (n = 0; n < m_tx_data_buffer.get_length(); n++)
|
||||
{
|
||||
UINT8 data = m_tx_data_buffer.get(n);
|
||||
crc = (crc >> 4) ^ crc_table[(crc ^ (data >> 0)) & 0x0f]; /* lower nibble */
|
||||
crc = (crc >> 4) ^ crc_table[(crc ^ (data >> 4)) & 0x0f]; /* upper nibble */
|
||||
}
|
||||
|
||||
// append the Ethernet Frame Check Sequence
|
||||
for (n = 0; n < 4; n++)
|
||||
{
|
||||
m_tx_data_buffer.append(crc & 0xff);
|
||||
crc >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (!send(m_tx_data_buffer.get_data(), m_tx_data_buffer.get_length()))
|
||||
{
|
||||
// FIXME: failed to send the Ethernet packet
|
||||
|
@ -1171,6 +1171,7 @@ void mb86901_device::execute_wrsr(UINT32 op)
|
||||
else
|
||||
{
|
||||
PSR = result &~ PSR_ZERO_MASK;
|
||||
update_gpr_pointers();
|
||||
}
|
||||
}
|
||||
else if (WRWIM)
|
||||
|
@ -35,41 +35,49 @@ ADDRESS_MAP_END
|
||||
|
||||
WRITE8_MEMBER(address_map_bank_device::write8)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
m_program->write_byte(m_offset + offset, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(address_map_bank_device::write16)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
m_program->write_word(m_offset + (offset * 2), data, mem_mask);
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(address_map_bank_device::write32)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
m_program->write_dword(m_offset + (offset * 4), data, mem_mask);
|
||||
}
|
||||
|
||||
WRITE64_MEMBER(address_map_bank_device::write64)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
m_program->write_qword(m_offset + (offset * 8), data, mem_mask);
|
||||
}
|
||||
|
||||
READ8_MEMBER(address_map_bank_device::read8)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
return m_program->read_byte(m_offset + offset);
|
||||
}
|
||||
|
||||
READ16_MEMBER(address_map_bank_device::read16)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
return m_program->read_word(m_offset + (offset * 2), mem_mask);
|
||||
}
|
||||
|
||||
READ32_MEMBER(address_map_bank_device::read32)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
return m_program->read_dword(m_offset + (offset * 4), mem_mask);
|
||||
}
|
||||
|
||||
READ64_MEMBER(address_map_bank_device::read64)
|
||||
{
|
||||
m_program->set_debugger_access(space.debugger_access());
|
||||
return m_program->read_qword(m_offset + (offset * 8), mem_mask);
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,8 @@ READ8_MEMBER( s2636_device::read_data )
|
||||
{
|
||||
case REG_COL_BG_CMPL:
|
||||
case REG_VBL_COL_OBJ:
|
||||
m_registers[offset] = 0x00; // collision/completion/VRESET flags reset on read
|
||||
if (!space.debugger_access())
|
||||
m_registers[offset] = 0x00; // collision/completion/VRESET flags reset on read
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ const int debug_view_state::REG_FRAME;
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_state_source::debug_view_state_source(const char *name, device_t &device)
|
||||
: debug_view_source(name, &device),
|
||||
m_stateintf(dynamic_cast<device_state_interface *>(&device)),
|
||||
m_execintf(dynamic_cast<device_execute_interface *>(&device))
|
||||
: debug_view_source(name, &device)
|
||||
, m_stateintf(dynamic_cast<device_state_interface *>(&device))
|
||||
, m_execintf(dynamic_cast<device_execute_interface *>(&device))
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,9 +45,9 @@ debug_view_state_source::debug_view_state_source(const char *name, device_t &dev
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_state::debug_view_state(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate)
|
||||
: debug_view(machine, DVT_STATE, osdupdate, osdprivate),
|
||||
m_divider(0),
|
||||
m_last_update(0)
|
||||
: debug_view(machine, DVT_STATE, osdupdate, osdprivate)
|
||||
, m_divider(0)
|
||||
, m_last_update(0)
|
||||
{
|
||||
// fail if no available sources
|
||||
enumerate_sources();
|
||||
@ -147,7 +147,7 @@ void debug_view_state::recompute()
|
||||
{
|
||||
count++;
|
||||
maxtaglen = (std::max)(maxtaglen, item.m_symbol.length());
|
||||
maxvallen = (std::max)(maxvallen, item.m_vallen);
|
||||
maxvallen = (std::max)(maxvallen, item.value_length());
|
||||
}
|
||||
|
||||
// set the current divider and total cols
|
||||
@ -186,125 +186,108 @@ void debug_view_state::view_update()
|
||||
recompute();
|
||||
|
||||
// get cycle count if we have an execute interface
|
||||
const debug_view_state_source &source = downcast<const debug_view_state_source &>(*m_source);
|
||||
UINT64 total_cycles = 0;
|
||||
if (source.m_execintf != nullptr)
|
||||
total_cycles = source.m_execintf->total_cycles();
|
||||
debug_view_state_source const &source(downcast<debug_view_state_source const &>(*m_source));
|
||||
UINT64 const total_cycles(source.m_execintf ? source.m_execintf->total_cycles() : 0);
|
||||
bool const cycles_changed(m_last_update != total_cycles);
|
||||
|
||||
// find the first entry
|
||||
auto it = m_state_list.begin();
|
||||
for (INT32 index = 0; (index < m_topleft.y) && (it != m_state_list.end()); ++index, ++it) { }
|
||||
|
||||
// loop over visible rows
|
||||
screen_device *screen = machine().first_screen();
|
||||
debug_view_char *dest = &m_viewdata[0];
|
||||
for (UINT32 row = 0; row < m_visible.y; row++)
|
||||
// loop over rows
|
||||
auto it(m_state_list.begin());
|
||||
screen_device const *const screen(machine().first_screen());
|
||||
debug_view_char *dest(&m_viewdata[0]);
|
||||
for (INT32 index = 0, limit = m_topleft.y + m_visible.y; (index < limit) || (it != m_state_list.end()); ++index)
|
||||
{
|
||||
UINT32 col = 0;
|
||||
|
||||
// if this visible row is valid, add it to the buffer
|
||||
bool const visible((index >= m_topleft.y) && (index < limit));
|
||||
UINT32 col(0);
|
||||
|
||||
if (it != m_state_list.end())
|
||||
{
|
||||
state_item &curitem = *it;
|
||||
// advance to the next item
|
||||
state_item &curitem(*it++);
|
||||
|
||||
UINT32 effcol = m_topleft.x;
|
||||
UINT8 attrib = DCA_NORMAL;
|
||||
UINT32 len = 0;
|
||||
// update item and get the effective string
|
||||
std::string valstr;
|
||||
|
||||
// get the effective string
|
||||
if (curitem.m_index >= REG_FRAME && curitem.m_index <= REG_DIVIDER)
|
||||
switch (curitem.index())
|
||||
{
|
||||
curitem.m_lastval = curitem.m_currval;
|
||||
switch (curitem.m_index)
|
||||
case REG_DIVIDER:
|
||||
curitem.m_symbol.clear();
|
||||
curitem.m_symbol.resize(m_total.x, '-');
|
||||
break;
|
||||
|
||||
case REG_CYCLES:
|
||||
if (source.m_execintf)
|
||||
{
|
||||
case REG_DIVIDER:
|
||||
curitem.m_vallen = 0;
|
||||
curitem.m_symbol.clear();
|
||||
for (int i = 0; i < m_total.x; i++)
|
||||
curitem.m_symbol.append("-");
|
||||
break;
|
||||
curitem.update(source.m_execintf->cycles_remaining(), cycles_changed);
|
||||
valstr = string_format("%-8d", curitem.value());
|
||||
}
|
||||
break;
|
||||
|
||||
case REG_CYCLES:
|
||||
if (source.m_execintf != nullptr)
|
||||
{
|
||||
curitem.m_currval = source.m_execintf->cycles_remaining();
|
||||
valstr = string_format("%-8d", UINT32(curitem.m_currval));
|
||||
}
|
||||
break;
|
||||
case REG_BEAMX:
|
||||
if (screen)
|
||||
{
|
||||
curitem.update(screen->hpos(), cycles_changed);
|
||||
valstr = string_format("%4d", curitem.value());
|
||||
}
|
||||
break;
|
||||
|
||||
case REG_BEAMX:
|
||||
if (screen != nullptr)
|
||||
{
|
||||
curitem.m_currval = screen->hpos();
|
||||
valstr = string_format("%4d", UINT32(curitem.m_currval));
|
||||
}
|
||||
break;
|
||||
case REG_BEAMY:
|
||||
if (screen)
|
||||
{
|
||||
curitem.update(screen->vpos(), cycles_changed);
|
||||
valstr = string_format("%4d", curitem.value());
|
||||
}
|
||||
break;
|
||||
|
||||
case REG_BEAMY:
|
||||
if (screen != nullptr)
|
||||
{
|
||||
curitem.m_currval = screen->vpos();
|
||||
valstr = string_format("%4d", UINT32(curitem.m_currval));
|
||||
}
|
||||
break;
|
||||
case REG_FRAME:
|
||||
if (screen)
|
||||
{
|
||||
curitem.update(screen->frame_number(), cycles_changed);
|
||||
valstr = string_format("%6d", curitem.value());
|
||||
}
|
||||
break;
|
||||
|
||||
case REG_FRAME:
|
||||
if (screen != nullptr)
|
||||
{
|
||||
curitem.m_currval = screen->frame_number();
|
||||
valstr = string_format("%6d", UINT32(curitem.m_currval));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
curitem.update(source.m_stateintf->state_int(curitem.index()), cycles_changed);
|
||||
valstr = source.m_stateintf->state_string(curitem.index());
|
||||
}
|
||||
|
||||
// if this row is visible, add it to the buffer
|
||||
if (visible)
|
||||
{
|
||||
// see if we changed
|
||||
const UINT8 attrib(curitem.changed() ? DCA_CHANGED: DCA_NORMAL);
|
||||
|
||||
// build up a string
|
||||
char temp[256];
|
||||
UINT32 len(0);
|
||||
if (curitem.m_symbol.length() < (m_divider - 1))
|
||||
{
|
||||
memset(&temp[len], ' ', m_divider - 1 - curitem.m_symbol.length());
|
||||
len += m_divider - 1 - curitem.m_symbol.length();
|
||||
}
|
||||
|
||||
memcpy(&temp[len], curitem.m_symbol.c_str(), curitem.m_symbol.length());
|
||||
len += curitem.m_symbol.length();
|
||||
|
||||
temp[len++] = ' ';
|
||||
temp[len++] = ' ';
|
||||
|
||||
memcpy(&temp[len], valstr.c_str(), curitem.value_length());
|
||||
len += curitem.value_length();
|
||||
|
||||
temp[len++] = ' ';
|
||||
temp[len] = 0;
|
||||
|
||||
// copy data
|
||||
for (UINT32 effcol = m_topleft.x; (col < m_visible.x) && (effcol < len); ++dest, ++col)
|
||||
{
|
||||
dest->byte = temp[effcol++];
|
||||
dest->attrib = attrib | ((effcol <= m_divider) ? DCA_ANCILLARY : DCA_NORMAL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_last_update != total_cycles)
|
||||
curitem.m_lastval = curitem.m_currval;
|
||||
curitem.m_currval = source.m_stateintf->state_int(curitem.m_index);
|
||||
valstr = source.m_stateintf->state_string(curitem.m_index);
|
||||
}
|
||||
|
||||
// see if we changed
|
||||
if (curitem.m_lastval != curitem.m_currval)
|
||||
attrib = DCA_CHANGED;
|
||||
|
||||
// build up a string
|
||||
char temp[256];
|
||||
if (curitem.m_symbol.length() < m_divider - 1)
|
||||
{
|
||||
memset(&temp[len], ' ', m_divider - 1 - curitem.m_symbol.length());
|
||||
len += m_divider - 1 - curitem.m_symbol.length();
|
||||
}
|
||||
|
||||
memcpy(&temp[len], curitem.m_symbol.c_str(), curitem.m_symbol.length());
|
||||
len += curitem.m_symbol.length();
|
||||
|
||||
temp[len++] = ' ';
|
||||
temp[len++] = ' ';
|
||||
|
||||
memcpy(&temp[len], valstr.c_str(), curitem.m_vallen);
|
||||
len += curitem.m_vallen;
|
||||
|
||||
temp[len++] = ' ';
|
||||
temp[len] = 0;
|
||||
|
||||
// copy data
|
||||
while (col < m_visible.x && effcol < len)
|
||||
{
|
||||
dest->byte = temp[effcol++];
|
||||
dest->attrib = attrib | ((effcol <= m_divider) ? DCA_ANCILLARY : DCA_NORMAL);
|
||||
dest++;
|
||||
col++;
|
||||
}
|
||||
|
||||
// advance to the next item
|
||||
++it;
|
||||
}
|
||||
|
||||
|
||||
// fill the rest with blanks
|
||||
while (col < m_visible.x)
|
||||
while (visible && (col < m_visible.x))
|
||||
{
|
||||
dest->byte = ' ';
|
||||
dest->attrib = DCA_NORMAL;
|
||||
@ -330,3 +313,15 @@ debug_view_state::state_item::state_item(int index, const char *name, UINT8 valu
|
||||
, m_symbol(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// update - update value and save previous
|
||||
//-------------------------------------------------
|
||||
|
||||
void debug_view_state::state_item::update(UINT64 newval, bool save)
|
||||
{
|
||||
if (save)
|
||||
m_lastval = m_currval;
|
||||
m_currval = newval;
|
||||
}
|
||||
|
@ -50,19 +50,30 @@ protected:
|
||||
virtual void view_notify(debug_view_notification type) override;
|
||||
|
||||
private:
|
||||
struct state_item
|
||||
class state_item
|
||||
{
|
||||
public:
|
||||
state_item(int index, const char *name, UINT8 valuechars);
|
||||
state_item(const state_item &) = default;
|
||||
state_item(state_item &&) = default;
|
||||
state_item &operator=(const state_item &) = default;
|
||||
state_item &operator=(state_item &&) = default;
|
||||
|
||||
UINT64 m_lastval; // last value
|
||||
UINT64 m_currval; // current value
|
||||
int m_index; // index
|
||||
UINT8 m_vallen; // number of value chars
|
||||
std::string m_symbol; // symbol
|
||||
UINT64 value() const { return m_currval; }
|
||||
bool changed() const { return m_lastval != m_currval; }
|
||||
int index() const { return m_index; }
|
||||
UINT8 value_length() const { return m_vallen; }
|
||||
|
||||
void update(UINT64 newval, bool save);
|
||||
|
||||
private:
|
||||
UINT64 m_lastval; // last value
|
||||
UINT64 m_currval; // current value
|
||||
int m_index; // index
|
||||
UINT8 m_vallen; // number of value chars
|
||||
|
||||
public:
|
||||
std::string m_symbol; // symbol
|
||||
};
|
||||
|
||||
// internal helpers
|
||||
|
@ -10,7 +10,10 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "validity.h"
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "video/rgbutil.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@ -49,6 +52,20 @@ inline int validity_checker::get_defstr_index(const char *string, bool suppress_
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// random_u64
|
||||
// random_s64
|
||||
// random_u32
|
||||
// random_s32
|
||||
//-------------------------------------------------
|
||||
#undef rand
|
||||
inline INT32 validity_checker::random_i32() { return INT32(random_u32()); }
|
||||
inline UINT32 validity_checker::random_u32() { return rand() ^ (rand() << 15); }
|
||||
inline INT64 validity_checker::random_i64() { return INT64(random_u64()); }
|
||||
inline UINT64 validity_checker::random_u64() { return UINT64(random_u32()) ^ (UINT64(random_u32()) << 30); }
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// validate_tag - ensure that the given tag
|
||||
// meets the general requirements
|
||||
@ -182,6 +199,7 @@ bool validity_checker::check_all_matching(const char *string)
|
||||
validate_begin();
|
||||
validate_core();
|
||||
validate_inlines();
|
||||
validate_rgb();
|
||||
|
||||
// if we had warnings or errors, output
|
||||
if (m_errors > 0 || m_warnings > 0 || !m_verbose_text.empty())
|
||||
@ -362,13 +380,12 @@ void validity_checker::validate_core()
|
||||
|
||||
void validity_checker::validate_inlines()
|
||||
{
|
||||
#undef rand
|
||||
volatile UINT64 testu64a = rand() ^ (rand() << 15) ^ ((UINT64)rand() << 30) ^ ((UINT64)rand() << 45);
|
||||
volatile INT64 testi64a = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
|
||||
volatile UINT32 testu32a = rand() ^ (rand() << 15);
|
||||
volatile UINT32 testu32b = rand() ^ (rand() << 15);
|
||||
volatile INT32 testi32a = rand() ^ (rand() << 15);
|
||||
volatile INT32 testi32b = rand() ^ (rand() << 15);
|
||||
volatile UINT64 testu64a = random_i64();
|
||||
volatile INT64 testi64a = random_i64();
|
||||
volatile UINT32 testu32a = random_u32();
|
||||
volatile UINT32 testu32b = random_u32();
|
||||
volatile INT32 testi32a = random_i32();
|
||||
volatile INT32 testi32b = random_i32();
|
||||
INT32 resulti32, expectedi32;
|
||||
UINT32 resultu32, expectedu32;
|
||||
INT64 resulti64, expectedi64;
|
||||
@ -481,6 +498,545 @@ void validity_checker::validate_inlines()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// validate_rgb - validate optimised RGB utility
|
||||
// class
|
||||
//-------------------------------------------------
|
||||
|
||||
void validity_checker::validate_rgb()
|
||||
{
|
||||
/*
|
||||
This performs cursory tests of most of the vector-optimised RGB
|
||||
utilities, concentrating on the low-level maths. It uses random
|
||||
values most of the time for a quick go/no-go indication rather
|
||||
than trying to exercise edge cases. It doesn't matter too much
|
||||
if the compiler optimises out some of the operations since it's
|
||||
really intended to check for logic bugs in the vector code.
|
||||
|
||||
The following functions are not tested yet:
|
||||
rgbaint_t()
|
||||
clamp_and_clear(const UINT32)
|
||||
sign_extend(const UINT32, const UINT32)
|
||||
min(const INT32)
|
||||
max(const INT32)
|
||||
blend(const rgbaint_t&, UINT8)
|
||||
scale_and_clamp(const rgbaint_t&)
|
||||
scale_imm_and_clamp(const INT32)
|
||||
scale2_add_and_clamp(const rgbaint_t&, const rgbaint_t&, const rgbaint_t&)
|
||||
scale_add_and_clamp(const rgbaint_t&, const rgbaint_t&);
|
||||
scale_imm_add_and_clamp(const INT32, const rgbaint_t&);
|
||||
cmpeq(const rgbaint_t&)
|
||||
cmpeq_imm(const INT32)
|
||||
cmpeq_imm_rgba(const INT32, const INT32, const INT32, const INT32)
|
||||
cmpgt(const rgbaint_t&)
|
||||
cmpgt_imm(const INT32)
|
||||
cmpgt_imm_rgba(const INT32, const INT32, const INT32, const INT32)
|
||||
cmplt(const rgbaint_t&)
|
||||
cmplt_imm(const INT32)
|
||||
cmplt_imm_rgba(const INT32, const INT32, const INT32, const INT32)
|
||||
static bilinear_filter(UINT32, UINT32, UINT32, UINT32, UINT8, UINT8)
|
||||
bilinear_filter_rgbaint(UINT32, UINT32, UINT32, UINT32, UINT8, UINT8)
|
||||
*/
|
||||
|
||||
volatile INT32 expected_a, expected_r, expected_g, expected_b;
|
||||
volatile INT32 actual_a, actual_r, actual_g, actual_b;
|
||||
volatile INT32 imm;
|
||||
rgbaint_t rgb, other;
|
||||
rgb_t packed;
|
||||
auto check_expected = [&] (const char *desc)
|
||||
{
|
||||
const volatile INT32 a = rgb.get_a32();
|
||||
const volatile INT32 r = rgb.get_r32();
|
||||
const volatile INT32 g = rgb.get_g32();
|
||||
const volatile INT32 b = rgb.get_b32();
|
||||
if (a != expected_a) osd_printf_error("Error testing %s get_a32() = %d (expected %d)\n", desc, a, expected_a);
|
||||
if (r != expected_r) osd_printf_error("Error testing %s get_r32() = %d (expected %d)\n", desc, r, expected_r);
|
||||
if (g != expected_g) osd_printf_error("Error testing %s get_g32() = %d (expected %d)\n", desc, g, expected_g);
|
||||
if (b != expected_b) osd_printf_error("Error testing %s get_b32() = %d (expected %d)\n", desc, b, expected_b);
|
||||
};
|
||||
|
||||
// check set/get
|
||||
expected_a = random_i32();
|
||||
expected_r = random_i32();
|
||||
expected_g = random_i32();
|
||||
expected_b = random_i32();
|
||||
rgb.set(expected_a, expected_r, expected_g, expected_b);
|
||||
check_expected("rgbaint_t::set(a, r, g, b)");
|
||||
|
||||
// check construct/set
|
||||
expected_a = random_i32();
|
||||
expected_r = random_i32();
|
||||
expected_g = random_i32();
|
||||
expected_b = random_i32();
|
||||
rgb.set(rgbaint_t(expected_a, expected_r, expected_g, expected_b));
|
||||
check_expected("rgbaint_t::set(rgbaint_t)");
|
||||
|
||||
// check construct/assign
|
||||
expected_a = random_i32();
|
||||
expected_r = random_i32();
|
||||
expected_g = random_i32();
|
||||
expected_b = random_i32();
|
||||
rgb = rgbaint_t(expected_a, expected_r, expected_g, expected_b);
|
||||
check_expected("rgbaint_t assignment");
|
||||
|
||||
// check piecewise set
|
||||
rgb.set_a(expected_a = random_i32());
|
||||
check_expected("rgbaint_t::set_a");
|
||||
rgb.set_r(expected_r = random_i32());
|
||||
check_expected("rgbaint_t::set_r");
|
||||
rgb.set_g(expected_g = random_i32());
|
||||
check_expected("rgbaint_t::set_g");
|
||||
rgb.set_b(expected_b = random_i32());
|
||||
check_expected("rgbaint_t::set_b");
|
||||
|
||||
// test merge_alpha
|
||||
expected_a = rand();
|
||||
rgb.merge_alpha(rgbaint_t(expected_a, rand(), rand(), rand()));
|
||||
check_expected("rgbaint_t::merge_alpha");
|
||||
|
||||
// test RGB addition (method)
|
||||
expected_a += actual_a = random_i32();
|
||||
expected_r += actual_r = random_i32();
|
||||
expected_g += actual_g = random_i32();
|
||||
expected_b += actual_b = random_i32();
|
||||
rgb.add(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::add");
|
||||
|
||||
// test RGB addition (operator)
|
||||
expected_a += actual_a = random_i32();
|
||||
expected_r += actual_r = random_i32();
|
||||
expected_g += actual_g = random_i32();
|
||||
expected_b += actual_b = random_i32();
|
||||
rgb += rgbaint_t(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::operator+=");
|
||||
|
||||
// test offset addition (method)
|
||||
imm = random_i32();
|
||||
expected_a += imm;
|
||||
expected_r += imm;
|
||||
expected_g += imm;
|
||||
expected_b += imm;
|
||||
rgb.add_imm(imm);
|
||||
check_expected("rgbaint_t::add_imm");
|
||||
|
||||
// test offset addition (operator)
|
||||
imm = random_i32();
|
||||
expected_a += imm;
|
||||
expected_r += imm;
|
||||
expected_g += imm;
|
||||
expected_b += imm;
|
||||
rgb += imm;
|
||||
check_expected("rgbaint_t::operator+=");
|
||||
|
||||
// test immediate RGB addition
|
||||
expected_a += actual_a = random_i32();
|
||||
expected_r += actual_r = random_i32();
|
||||
expected_g += actual_g = random_i32();
|
||||
expected_b += actual_b = random_i32();
|
||||
rgb.add_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::add_imm_rgba");
|
||||
|
||||
// test RGB subtraction (method)
|
||||
expected_a -= actual_a = random_i32();
|
||||
expected_r -= actual_r = random_i32();
|
||||
expected_g -= actual_g = random_i32();
|
||||
expected_b -= actual_b = random_i32();
|
||||
rgb.sub(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::sub");
|
||||
|
||||
// test RGB subtraction (operator)
|
||||
expected_a -= actual_a = random_i32();
|
||||
expected_r -= actual_r = random_i32();
|
||||
expected_g -= actual_g = random_i32();
|
||||
expected_b -= actual_b = random_i32();
|
||||
rgb -= rgbaint_t(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::operator-=");
|
||||
|
||||
// test offset subtraction
|
||||
imm = random_i32();
|
||||
expected_a -= imm;
|
||||
expected_r -= imm;
|
||||
expected_g -= imm;
|
||||
expected_b -= imm;
|
||||
rgb.sub_imm(imm);
|
||||
check_expected("rgbaint_t::sub_imm");
|
||||
|
||||
// test immediate RGB subtraction
|
||||
expected_a -= actual_a = random_i32();
|
||||
expected_r -= actual_r = random_i32();
|
||||
expected_g -= actual_g = random_i32();
|
||||
expected_b -= actual_b = random_i32();
|
||||
rgb.sub_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::sub_imm_rgba");
|
||||
|
||||
// test reversed RGB subtraction
|
||||
expected_a = (actual_a = random_i32()) - expected_a;
|
||||
expected_r = (actual_r = random_i32()) - expected_r;
|
||||
expected_g = (actual_g = random_i32()) - expected_g;
|
||||
expected_b = (actual_b = random_i32()) - expected_b;
|
||||
rgb.subr(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::subr");
|
||||
|
||||
// test reversed offset subtraction
|
||||
imm = random_i32();
|
||||
expected_a = imm - expected_a;
|
||||
expected_r = imm - expected_r;
|
||||
expected_g = imm - expected_g;
|
||||
expected_b = imm - expected_b;
|
||||
rgb.subr_imm(imm);
|
||||
check_expected("rgbaint_t::subr_imm");
|
||||
|
||||
// test reversed immediate RGB subtraction
|
||||
expected_a = (actual_a = random_i32()) - expected_a;
|
||||
expected_r = (actual_r = random_i32()) - expected_r;
|
||||
expected_g = (actual_g = random_i32()) - expected_g;
|
||||
expected_b = (actual_b = random_i32()) - expected_b;
|
||||
rgb.subr_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::subr_imm_rgba");
|
||||
|
||||
// test RGB multiplication (method)
|
||||
expected_a *= actual_a = random_i32();
|
||||
expected_r *= actual_r = random_i32();
|
||||
expected_g *= actual_g = random_i32();
|
||||
expected_b *= actual_b = random_i32();
|
||||
rgb.mul(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::mul");
|
||||
|
||||
// test RGB multiplication (operator)
|
||||
expected_a *= actual_a = random_i32();
|
||||
expected_r *= actual_r = random_i32();
|
||||
expected_g *= actual_g = random_i32();
|
||||
expected_b *= actual_b = random_i32();
|
||||
rgb *= rgbaint_t(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::operator*=");
|
||||
|
||||
// test factor multiplication (method)
|
||||
imm = random_i32();
|
||||
expected_a *= imm;
|
||||
expected_r *= imm;
|
||||
expected_g *= imm;
|
||||
expected_b *= imm;
|
||||
rgb.mul_imm(imm);
|
||||
check_expected("rgbaint_t::mul_imm");
|
||||
|
||||
// test factor multiplication (operator)
|
||||
imm = random_i32();
|
||||
expected_a *= imm;
|
||||
expected_r *= imm;
|
||||
expected_g *= imm;
|
||||
expected_b *= imm;
|
||||
rgb *= imm;
|
||||
check_expected("rgbaint_t::operator*=");
|
||||
|
||||
// test immediate RGB multiplication
|
||||
expected_a *= actual_a = random_i32();
|
||||
expected_r *= actual_r = random_i32();
|
||||
expected_g *= actual_g = random_i32();
|
||||
expected_b *= actual_b = random_i32();
|
||||
rgb.mul_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::mul_imm_rgba");
|
||||
|
||||
// test RGB and not
|
||||
expected_a &= ~(actual_a = random_i32());
|
||||
expected_r &= ~(actual_r = random_i32());
|
||||
expected_g &= ~(actual_g = random_i32());
|
||||
expected_b &= ~(actual_b = random_i32());
|
||||
rgb.andnot_reg(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::andnot_reg");
|
||||
|
||||
// test RGB or
|
||||
expected_a |= actual_a = random_i32();
|
||||
expected_r |= actual_r = random_i32();
|
||||
expected_g |= actual_g = random_i32();
|
||||
expected_b |= actual_b = random_i32();
|
||||
rgb.or_reg(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::or_reg");
|
||||
|
||||
// test RGB and
|
||||
expected_a &= actual_a = random_i32();
|
||||
expected_r &= actual_r = random_i32();
|
||||
expected_g &= actual_g = random_i32();
|
||||
expected_b &= actual_b = random_i32();
|
||||
rgb.and_reg(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::and_reg");
|
||||
|
||||
// test RGB xor
|
||||
expected_a ^= actual_a = random_i32();
|
||||
expected_r ^= actual_r = random_i32();
|
||||
expected_g ^= actual_g = random_i32();
|
||||
expected_b ^= actual_b = random_i32();
|
||||
rgb.xor_reg(rgbaint_t(actual_a, actual_r, actual_g, actual_b));
|
||||
check_expected("rgbaint_t::xor_reg");
|
||||
|
||||
// test uniform or
|
||||
imm = random_i32();
|
||||
expected_a |= imm;
|
||||
expected_r |= imm;
|
||||
expected_g |= imm;
|
||||
expected_b |= imm;
|
||||
rgb.or_imm(imm);
|
||||
check_expected("rgbaint_t::or_imm");
|
||||
|
||||
// test uniform and
|
||||
imm = random_i32();
|
||||
expected_a &= imm;
|
||||
expected_r &= imm;
|
||||
expected_g &= imm;
|
||||
expected_b &= imm;
|
||||
rgb.and_imm(imm);
|
||||
check_expected("rgbaint_t::and_imm");
|
||||
|
||||
// test uniform xor
|
||||
imm = random_i32();
|
||||
expected_a ^= imm;
|
||||
expected_r ^= imm;
|
||||
expected_g ^= imm;
|
||||
expected_b ^= imm;
|
||||
rgb.xor_imm(imm);
|
||||
check_expected("rgbaint_t::xor_imm");
|
||||
|
||||
// test immediate RGB or
|
||||
expected_a |= actual_a = random_i32();
|
||||
expected_r |= actual_r = random_i32();
|
||||
expected_g |= actual_g = random_i32();
|
||||
expected_b |= actual_b = random_i32();
|
||||
rgb.or_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::or_imm_rgba");
|
||||
|
||||
// test immediate RGB and
|
||||
expected_a &= actual_a = random_i32();
|
||||
expected_r &= actual_r = random_i32();
|
||||
expected_g &= actual_g = random_i32();
|
||||
expected_b &= actual_b = random_i32();
|
||||
rgb.and_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::and_imm_rgba");
|
||||
|
||||
// test immediate RGB xor
|
||||
expected_a ^= actual_a = random_i32();
|
||||
expected_r ^= actual_r = random_i32();
|
||||
expected_g ^= actual_g = random_i32();
|
||||
expected_b ^= actual_b = random_i32();
|
||||
rgb.xor_imm_rgba(actual_a, actual_r, actual_g, actual_b);
|
||||
check_expected("rgbaint_t::xor_imm_rgba");
|
||||
|
||||
// test 8-bit get
|
||||
expected_a = INT32(UINT32(expected_a) & 0x00ff);
|
||||
expected_r = INT32(UINT32(expected_r) & 0x00ff);
|
||||
expected_g = INT32(UINT32(expected_g) & 0x00ff);
|
||||
expected_b = INT32(UINT32(expected_b) & 0x00ff);
|
||||
actual_a = INT32(UINT32(rgb.get_a()));
|
||||
actual_r = INT32(UINT32(rgb.get_r()));
|
||||
actual_g = INT32(UINT32(rgb.get_g()));
|
||||
actual_b = INT32(UINT32(rgb.get_b()));
|
||||
if (actual_a != expected_a) osd_printf_error("Error testing rgbaint_t::get_a() = %d (expected %d)\n", actual_a, expected_a);
|
||||
if (actual_r != expected_r) osd_printf_error("Error testing rgbaint_t::get_r() = %d (expected %d)\n", actual_r, expected_r);
|
||||
if (actual_g != expected_g) osd_printf_error("Error testing rgbaint_t::get_g() = %d (expected %d)\n", actual_g, expected_g);
|
||||
if (actual_b != expected_b) osd_printf_error("Error testing rgbaint_t::get_b() = %d (expected %d)\n", actual_b, expected_b);
|
||||
|
||||
// test set from packed RGBA
|
||||
imm = random_i32();
|
||||
expected_a = INT32((UINT32(imm) >> 24) & 0x00ff);
|
||||
expected_r = INT32((UINT32(imm) >> 16) & 0x00ff);
|
||||
expected_g = INT32((UINT32(imm) >> 8) & 0x00ff);
|
||||
expected_b = INT32((UINT32(imm) >> 0) & 0x00ff);
|
||||
rgb.set(UINT32(imm));
|
||||
check_expected("rgbaint_t::set(UINT32)");
|
||||
|
||||
// while we have a value loaded that we know doesn't exceed 8-bit range, check the non-clamping convert-to-rgba
|
||||
packed = rgb.to_rgba();
|
||||
if (UINT32(imm) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", UINT32(packed), UINT32(imm));
|
||||
|
||||
// test construct from packed RGBA and assign
|
||||
imm = random_i32();
|
||||
expected_a = INT32((UINT32(imm) >> 24) & 0x00ff);
|
||||
expected_r = INT32((UINT32(imm) >> 16) & 0x00ff);
|
||||
expected_g = INT32((UINT32(imm) >> 8) & 0x00ff);
|
||||
expected_b = INT32((UINT32(imm) >> 0) & 0x00ff);
|
||||
rgb = rgbaint_t(UINT32(imm));
|
||||
check_expected("rgbaint_t(UINT32)");
|
||||
|
||||
// while we have a value loaded that we know doesn't exceed 8-bit range, check the non-clamping convert-to-rgba
|
||||
packed = rgb.to_rgba();
|
||||
if (UINT32(imm) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", UINT32(packed), UINT32(imm));
|
||||
|
||||
// test set with rgb_t
|
||||
packed = random_u32();
|
||||
expected_a = INT32(UINT32(packed.a()));
|
||||
expected_r = INT32(UINT32(packed.r()));
|
||||
expected_g = INT32(UINT32(packed.g()));
|
||||
expected_b = INT32(UINT32(packed.b()));
|
||||
rgb.set(packed);
|
||||
check_expected("rgbaint_t::set(rgba_t)");
|
||||
|
||||
// test construct with rgb_t
|
||||
packed = random_u32();
|
||||
expected_a = INT32(UINT32(packed.a()));
|
||||
expected_r = INT32(UINT32(packed.r()));
|
||||
expected_g = INT32(UINT32(packed.g()));
|
||||
expected_b = INT32(UINT32(packed.b()));
|
||||
rgb = rgbaint_t(packed);
|
||||
check_expected("rgbaint_t::set(rgba_t)");
|
||||
|
||||
// test clamping convert-to-rgba with hand-crafted values to catch edge cases
|
||||
rgb.set(std::numeric_limits<INT32>::min(), -1, 0, 1);
|
||||
packed = rgb.to_rgba_clamp();
|
||||
if (UINT32(0x00000001) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00000001)\n", UINT32(packed));
|
||||
rgb.set(254, 255, 256, std::numeric_limits<INT32>::max());
|
||||
packed = rgb.to_rgba_clamp();
|
||||
if (UINT32(0xfeffffff) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xfeffffff)\n", UINT32(packed));
|
||||
rgb.set(std::numeric_limits<INT32>::max(), std::numeric_limits<INT32>::min(), 256, -1);
|
||||
packed = rgb.to_rgba_clamp();
|
||||
if (UINT32(0xff00ff00) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xff00ff00)\n", UINT32(packed));
|
||||
rgb.set(0, 255, 1, 254);
|
||||
packed = rgb.to_rgba_clamp();
|
||||
if (UINT32(0x00ff01fe) != UINT32(packed))
|
||||
osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00ff01fe)\n", UINT32(packed));
|
||||
|
||||
// test in-place clamping with hand-crafted values to catch edge cases
|
||||
expected_a = 0;
|
||||
expected_r = 0;
|
||||
expected_g = 0;
|
||||
expected_b = 1;
|
||||
rgb.set(std::numeric_limits<INT32>::min(), -1, 0, 1);
|
||||
rgb.clamp_to_uint8();
|
||||
check_expected("rgbaint_t::clamp_to_uint8");
|
||||
expected_a = 254;
|
||||
expected_r = 255;
|
||||
expected_g = 255;
|
||||
expected_b = 255;
|
||||
rgb.set(254, 255, 256, std::numeric_limits<INT32>::max());
|
||||
rgb.clamp_to_uint8();
|
||||
check_expected("rgbaint_t::clamp_to_uint8");
|
||||
expected_a = 255;
|
||||
expected_r = 0;
|
||||
expected_g = 255;
|
||||
expected_b = 0;
|
||||
rgb.set(std::numeric_limits<INT32>::max(), std::numeric_limits<INT32>::min(), 256, -1);
|
||||
rgb.clamp_to_uint8();
|
||||
check_expected("rgbaint_t::clamp_to_uint8");
|
||||
expected_a = 0;
|
||||
expected_r = 255;
|
||||
expected_g = 1;
|
||||
expected_b = 254;
|
||||
rgb.set(0, 255, 1, 254);
|
||||
rgb.clamp_to_uint8();
|
||||
check_expected("rgbaint_t::clamp_to_uint8");
|
||||
|
||||
// test shift left
|
||||
expected_a = (actual_a = random_i32()) << 19;
|
||||
expected_r = (actual_r = random_i32()) << 3;
|
||||
expected_g = (actual_g = random_i32()) << 21;
|
||||
expected_b = (actual_b = random_i32()) << 6;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shl(rgbaint_t(19, 3, 21, 6));
|
||||
check_expected("rgbaint_t::shl");
|
||||
|
||||
// test shift left immediate
|
||||
expected_a = (actual_a = random_i32()) << 7;
|
||||
expected_r = (actual_r = random_i32()) << 7;
|
||||
expected_g = (actual_g = random_i32()) << 7;
|
||||
expected_b = (actual_b = random_i32()) << 7;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shl_imm(7);
|
||||
check_expected("rgbaint_t::shl_imm");
|
||||
|
||||
// test logical shift right
|
||||
expected_a = INT32(UINT32(actual_a = random_i32()) >> 8);
|
||||
expected_r = INT32(UINT32(actual_r = random_i32()) >> 18);
|
||||
expected_g = INT32(UINT32(actual_g = random_i32()) >> 26);
|
||||
expected_b = INT32(UINT32(actual_b = random_i32()) >> 4);
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shr(rgbaint_t(8, 18, 26, 4));
|
||||
check_expected("rgbaint_t::shr");
|
||||
|
||||
// test logical shift right with opposite signs
|
||||
expected_a = INT32(UINT32(actual_a = -actual_a) >> 21);
|
||||
expected_r = INT32(UINT32(actual_r = -actual_r) >> 13);
|
||||
expected_g = INT32(UINT32(actual_g = -actual_g) >> 11);
|
||||
expected_b = INT32(UINT32(actual_b = -actual_b) >> 17);
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shr(rgbaint_t(21, 13, 11, 17));
|
||||
check_expected("rgbaint_t::shr");
|
||||
|
||||
// test logical shift right immediate
|
||||
expected_a = INT32(UINT32(actual_a = random_i32()) >> 5);
|
||||
expected_r = INT32(UINT32(actual_r = random_i32()) >> 5);
|
||||
expected_g = INT32(UINT32(actual_g = random_i32()) >> 5);
|
||||
expected_b = INT32(UINT32(actual_b = random_i32()) >> 5);
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shr_imm(5);
|
||||
check_expected("rgbaint_t::shr_imm");
|
||||
|
||||
// test logical shift right immediate with opposite signs
|
||||
expected_a = INT32(UINT32(actual_a = -actual_a) >> 15);
|
||||
expected_r = INT32(UINT32(actual_r = -actual_r) >> 15);
|
||||
expected_g = INT32(UINT32(actual_g = -actual_g) >> 15);
|
||||
expected_b = INT32(UINT32(actual_b = -actual_b) >> 15);
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.shr_imm(15);
|
||||
check_expected("rgbaint_t::shr_imm");
|
||||
|
||||
// test arithmetic shift right
|
||||
expected_a = (actual_a = random_i32()) >> 16;
|
||||
expected_r = (actual_r = random_i32()) >> 20;
|
||||
expected_g = (actual_g = random_i32()) >> 14;
|
||||
expected_b = (actual_b = random_i32()) >> 2;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.sra(rgbaint_t(16, 20, 14, 2));
|
||||
check_expected("rgbaint_t::sra");
|
||||
|
||||
// test arithmetic shift right with opposite signs
|
||||
expected_a = (actual_a = -actual_a) >> 1;
|
||||
expected_r = (actual_r = -actual_r) >> 29;
|
||||
expected_g = (actual_g = -actual_g) >> 10;
|
||||
expected_b = (actual_b = -actual_b) >> 22;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.sra(rgbaint_t(1, 29, 10, 22));
|
||||
check_expected("rgbaint_t::sra");
|
||||
|
||||
// test arithmetic shift right immediate (method)
|
||||
expected_a = (actual_a = random_i32()) >> 12;
|
||||
expected_r = (actual_r = random_i32()) >> 12;
|
||||
expected_g = (actual_g = random_i32()) >> 12;
|
||||
expected_b = (actual_b = random_i32()) >> 12;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.sra_imm(12);
|
||||
check_expected("rgbaint_t::sra_imm");
|
||||
|
||||
// test arithmetic shift right immediate with opposite signs (method)
|
||||
expected_a = (actual_a = -actual_a) >> 9;
|
||||
expected_r = (actual_r = -actual_r) >> 9;
|
||||
expected_g = (actual_g = -actual_g) >> 9;
|
||||
expected_b = (actual_b = -actual_b) >> 9;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb.sra_imm(9);
|
||||
check_expected("rgbaint_t::sra_imm");
|
||||
|
||||
// test arithmetic shift right immediate (operator)
|
||||
expected_a = (actual_a = random_i32()) >> 7;
|
||||
expected_r = (actual_r = random_i32()) >> 7;
|
||||
expected_g = (actual_g = random_i32()) >> 7;
|
||||
expected_b = (actual_b = random_i32()) >> 7;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb >>= 7;
|
||||
check_expected("rgbaint_t::operator>>=");
|
||||
|
||||
// test arithmetic shift right immediate with opposite signs (operator)
|
||||
expected_a = (actual_a = -actual_a) >> 11;
|
||||
expected_r = (actual_r = -actual_r) >> 11;
|
||||
expected_g = (actual_g = -actual_g) >> 11;
|
||||
expected_b = (actual_b = -actual_b) >> 11;
|
||||
rgb.set(actual_a, actual_r, actual_g, actual_b);
|
||||
rgb >>= 11;
|
||||
check_expected("rgbaint_t::operator>>=");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// validate_driver - validate basic driver
|
||||
// information
|
||||
@ -1024,42 +1580,45 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
|
||||
std::string output;
|
||||
switch (channel)
|
||||
{
|
||||
case OSD_OUTPUT_CHANNEL_ERROR:
|
||||
// count the error
|
||||
m_errors++;
|
||||
case OSD_OUTPUT_CHANNEL_ERROR:
|
||||
// count the error
|
||||
m_errors++;
|
||||
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
|
||||
// generate the string
|
||||
strcatvprintf(output, msg, args);
|
||||
m_error_text.append(output);
|
||||
break;
|
||||
case OSD_OUTPUT_CHANNEL_WARNING:
|
||||
// count the error
|
||||
m_warnings++;
|
||||
// generate the string
|
||||
strcatvprintf(output, msg, args);
|
||||
m_error_text.append(output);
|
||||
break;
|
||||
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
case OSD_OUTPUT_CHANNEL_WARNING:
|
||||
// count the error
|
||||
m_warnings++;
|
||||
|
||||
// generate the string and output to the original target
|
||||
strcatvprintf(output, msg, args);
|
||||
m_warning_text.append(output);
|
||||
break;
|
||||
case OSD_OUTPUT_CHANNEL_VERBOSE:
|
||||
// if we're not verbose, skip it
|
||||
if (!m_print_verbose) break;
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
// generate the string and output to the original target
|
||||
strcatvprintf(output, msg, args);
|
||||
m_warning_text.append(output);
|
||||
break;
|
||||
|
||||
// generate the string and output to the original target
|
||||
strcatvprintf(output, msg, args);
|
||||
m_verbose_text.append(output);
|
||||
break;
|
||||
default:
|
||||
chain_output(channel, msg, args);
|
||||
break;
|
||||
case OSD_OUTPUT_CHANNEL_VERBOSE:
|
||||
// if we're not verbose, skip it
|
||||
if (!m_print_verbose) break;
|
||||
|
||||
// output the source(driver) device 'tag'
|
||||
build_output_prefix(output);
|
||||
|
||||
// generate the string and output to the original target
|
||||
strcatvprintf(output, msg, args);
|
||||
m_verbose_text.append(output);
|
||||
break;
|
||||
|
||||
default:
|
||||
chain_output(channel, msg, args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1075,7 +1634,7 @@ void validity_checker::output_via_delegate(osd_output_channel channel, const cha
|
||||
|
||||
// call through to the delegate with the proper parameters
|
||||
va_start(argptr, format);
|
||||
this->chain_output(channel, format, argptr);
|
||||
chain_output(channel, format, argptr);
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#ifndef MAME_EMU_VALIDITY_H
|
||||
#define MAME_EMU_VALIDITY_H
|
||||
|
||||
#ifndef __VALIDITY_H__
|
||||
#define __VALIDITY_H__
|
||||
#pragma once
|
||||
|
||||
#include "emu.h"
|
||||
#include "drivenum.h"
|
||||
@ -28,10 +28,6 @@ class machine_config;
|
||||
// core validity checker class
|
||||
class validity_checker : public osd_output
|
||||
{
|
||||
// internal map types
|
||||
typedef std::unordered_map<std::string,const game_driver *> game_driver_map;
|
||||
typedef std::unordered_map<std::string,FPTR> int_map;
|
||||
|
||||
public:
|
||||
validity_checker(emu_options &options);
|
||||
~validity_checker();
|
||||
@ -63,6 +59,10 @@ protected:
|
||||
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override;
|
||||
|
||||
private:
|
||||
// internal map types
|
||||
typedef std::unordered_map<std::string,const game_driver *> game_driver_map;
|
||||
typedef std::unordered_map<std::string,FPTR> int_map;
|
||||
|
||||
// internal helpers
|
||||
const char *ioport_string_from_index(UINT32 index);
|
||||
int get_defstr_index(const char *string, bool suppress_error = false);
|
||||
@ -75,6 +75,7 @@ private:
|
||||
// internal sub-checks
|
||||
void validate_core();
|
||||
void validate_inlines();
|
||||
void validate_rgb();
|
||||
void validate_driver();
|
||||
void validate_roms();
|
||||
void validate_analog_input_field(ioport_field &field);
|
||||
@ -88,6 +89,12 @@ private:
|
||||
void output_via_delegate(osd_output_channel channel, const char *format, ...) ATTR_PRINTF(3,4);
|
||||
void output_indented_errors(std::string &text, const char *header);
|
||||
|
||||
// random number generation
|
||||
INT32 random_i32();
|
||||
UINT32 random_u32();
|
||||
INT64 random_i64();
|
||||
UINT64 random_u64();
|
||||
|
||||
// internal driver list
|
||||
driver_enumerator m_drivlist;
|
||||
|
||||
@ -115,4 +122,4 @@ private:
|
||||
bool m_validate_all;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // MAME_EMU_VALIDITY_H
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __RGBGEN__
|
||||
#define __RGBGEN__
|
||||
#ifndef MAME_EMU_VIDEO_RGBGEN_H
|
||||
#define MAME_EMU_VIDEO_RGBGEN_H
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -19,36 +19,48 @@
|
||||
class rgbaint_t
|
||||
{
|
||||
public:
|
||||
inline rgbaint_t(): m_a(0), m_r(0), m_g(0), m_b(0) { }
|
||||
inline rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
inline rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
inline rgbaint_t(const rgb_t& rgba) { set(rgba); }
|
||||
rgbaint_t(): m_a(0), m_r(0), m_g(0), m_b(0) { }
|
||||
explicit rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
explicit rgbaint_t(const rgb_t& rgba) { set(rgba); }
|
||||
|
||||
inline void set(rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); }
|
||||
inline void set(UINT32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); }
|
||||
inline void set(INT32 a, INT32 r, INT32 g, INT32 b)
|
||||
void set(const rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); }
|
||||
void set(UINT32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); }
|
||||
void set(INT32 a, INT32 r, INT32 g, INT32 b)
|
||||
{
|
||||
m_a = a;
|
||||
m_r = r;
|
||||
m_g = g;
|
||||
m_b = b;
|
||||
}
|
||||
inline void set(const rgb_t& rgba) { set(rgba.a(), rgba.r(), rgba.g(), rgba.b()); }
|
||||
void set(const rgb_t& rgba) { set(rgba.a(), rgba.r(), rgba.g(), rgba.b()); }
|
||||
|
||||
inline rgb_t to_rgba() const
|
||||
{
|
||||
return rgb_t(m_a, m_r, m_g, m_b);
|
||||
}
|
||||
rgb_t to_rgba() const { return rgb_t(get_a(), get_r(), get_g(), get_b()); }
|
||||
|
||||
inline rgb_t to_rgba_clamp() const
|
||||
rgb_t to_rgba_clamp() const
|
||||
{
|
||||
UINT8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a;
|
||||
UINT8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r;
|
||||
UINT8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g;
|
||||
UINT8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b;
|
||||
const UINT8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a;
|
||||
const UINT8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r;
|
||||
const UINT8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g;
|
||||
const UINT8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b;
|
||||
return rgb_t(a, r, g, b);
|
||||
}
|
||||
|
||||
void set_a(const INT32 value) { m_a = value; }
|
||||
void set_r(const INT32 value) { m_r = value; }
|
||||
void set_g(const INT32 value) { m_g = value; }
|
||||
void set_b(const INT32 value) { m_b = value; }
|
||||
|
||||
UINT8 get_a() const { return UINT8(UINT32(m_a)); }
|
||||
UINT8 get_r() const { return UINT8(UINT32(m_r)); }
|
||||
UINT8 get_g() const { return UINT8(UINT32(m_g)); }
|
||||
UINT8 get_b() const { return UINT8(UINT32(m_b)); }
|
||||
|
||||
INT32 get_a32() const { return m_a; }
|
||||
INT32 get_r32() const { return m_r; }
|
||||
INT32 get_g32() const { return m_g; }
|
||||
INT32 get_b32() const { return m_b; }
|
||||
|
||||
inline void add(const rgbaint_t& color)
|
||||
{
|
||||
add_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b);
|
||||
@ -85,7 +97,7 @@ public:
|
||||
m_b -= b;
|
||||
}
|
||||
|
||||
inline void subr(rgbaint_t& color)
|
||||
inline void subr(const rgbaint_t& color)
|
||||
{
|
||||
subr_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b);
|
||||
}
|
||||
@ -103,67 +115,7 @@ public:
|
||||
m_b = b - m_b;
|
||||
}
|
||||
|
||||
inline void set_a(const INT32 value)
|
||||
{
|
||||
m_a = value;
|
||||
}
|
||||
|
||||
inline void set_r(const INT32 value)
|
||||
{
|
||||
m_r = value;
|
||||
}
|
||||
|
||||
inline void set_g(const INT32 value)
|
||||
{
|
||||
m_g = value;
|
||||
}
|
||||
|
||||
inline void set_b(const INT32 value)
|
||||
{
|
||||
m_b = value;
|
||||
}
|
||||
|
||||
inline UINT8 get_a() const
|
||||
{
|
||||
return m_a;
|
||||
}
|
||||
|
||||
inline UINT8 get_r() const
|
||||
{
|
||||
return m_r;
|
||||
}
|
||||
|
||||
inline UINT8 get_g() const
|
||||
{
|
||||
return m_g;
|
||||
}
|
||||
|
||||
inline UINT8 get_b() const
|
||||
{
|
||||
return m_b;
|
||||
}
|
||||
|
||||
inline INT32 get_a32() const
|
||||
{
|
||||
return m_a;
|
||||
}
|
||||
|
||||
inline INT32 get_r32() const
|
||||
{
|
||||
return m_r;
|
||||
}
|
||||
|
||||
inline INT32 get_g32() const
|
||||
{
|
||||
return m_g;
|
||||
}
|
||||
|
||||
inline INT32 get_b32() const
|
||||
{
|
||||
return m_b;
|
||||
}
|
||||
|
||||
inline void mul(rgbaint_t& color)
|
||||
inline void mul(const rgbaint_t& color)
|
||||
{
|
||||
mul_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b);
|
||||
}
|
||||
@ -202,10 +154,10 @@ public:
|
||||
|
||||
inline void shr(const rgbaint_t& shift)
|
||||
{
|
||||
m_a >>= shift.m_a;
|
||||
m_r >>= shift.m_r;
|
||||
m_g >>= shift.m_g;
|
||||
m_b >>= shift.m_b;
|
||||
m_a = INT32(UINT32(m_a) >> shift.m_a);
|
||||
m_r = INT32(UINT32(m_r) >> shift.m_r);
|
||||
m_g = INT32(UINT32(m_g) >> shift.m_g);
|
||||
m_b = INT32(UINT32(m_b) >> shift.m_b);
|
||||
}
|
||||
|
||||
inline void shr_imm(const UINT8 shift)
|
||||
@ -213,10 +165,10 @@ public:
|
||||
if (shift == 0)
|
||||
return;
|
||||
|
||||
m_a >>= shift;
|
||||
m_r >>= shift;
|
||||
m_g >>= shift;
|
||||
m_b >>= shift;
|
||||
m_a = INT32(UINT32(m_a) >> shift);
|
||||
m_r = INT32(UINT32(m_r) >> shift);
|
||||
m_g = INT32(UINT32(m_g) >> shift);
|
||||
m_b = INT32(UINT32(m_b) >> shift);
|
||||
}
|
||||
|
||||
inline void sra(const rgbaint_t& shift)
|
||||
@ -321,22 +273,12 @@ public:
|
||||
|
||||
inline void clamp_and_clear(const UINT32 sign)
|
||||
{
|
||||
if (m_a & sign)
|
||||
m_a = 0;
|
||||
if (m_a & sign) m_a = 0;
|
||||
if (m_r & sign) m_r = 0;
|
||||
if (m_g & sign) m_g = 0;
|
||||
if (m_b & sign) m_b = 0;
|
||||
|
||||
if (m_r & sign)
|
||||
m_r = 0;
|
||||
|
||||
if (m_g & sign)
|
||||
m_g = 0;
|
||||
|
||||
if (m_b & sign)
|
||||
m_b = 0;
|
||||
|
||||
m_a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a;
|
||||
m_r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r;
|
||||
m_g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g;
|
||||
m_b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b;
|
||||
clamp_to_uint8();
|
||||
}
|
||||
|
||||
inline void clamp_to_uint8()
|
||||
@ -370,6 +312,14 @@ public:
|
||||
m_b = (m_b > value) ? value : m_b;
|
||||
}
|
||||
|
||||
inline void max(const INT32 value)
|
||||
{
|
||||
m_a = (m_a < value) ? value : m_a;
|
||||
m_r = (m_r < value) ? value : m_r;
|
||||
m_g = (m_g < value) ? value : m_g;
|
||||
m_b = (m_b < value) ? value : m_b;
|
||||
}
|
||||
|
||||
void blend(const rgbaint_t& other, UINT8 factor);
|
||||
|
||||
void scale_and_clamp(const rgbaint_t& scale);
|
||||
@ -426,35 +376,50 @@ public:
|
||||
m_b = (m_b < value) ? 0xffffffff : 0;
|
||||
}
|
||||
|
||||
inline void merge_alpha(rgbaint_t& alpha)
|
||||
inline void merge_alpha(const rgbaint_t& alpha)
|
||||
{
|
||||
m_a = alpha.m_a;
|
||||
}
|
||||
|
||||
inline rgbaint_t operator=(const rgbaint_t& other)
|
||||
rgbaint_t &operator=(const rgbaint_t& other)
|
||||
{
|
||||
m_a = other.m_a;
|
||||
m_r = other.m_r;
|
||||
m_g = other.m_g;
|
||||
m_b = other.m_b;
|
||||
set(other.m_a, other.m_r, other.m_g, other.m_b);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline rgbaint_t& operator+=(const rgbaint_t& other)
|
||||
rgbaint_t& operator+=(const rgbaint_t& other)
|
||||
{
|
||||
m_a += other.m_a;
|
||||
m_r += other.m_r;
|
||||
m_g += other.m_g;
|
||||
m_b += other.m_b;
|
||||
add_imm_rgba(other.m_a, other.m_r, other.m_g, other.m_b);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline rgbaint_t& operator+=(const INT32 other)
|
||||
rgbaint_t& operator+=(const INT32 other)
|
||||
{
|
||||
m_a += other;
|
||||
m_r += other;
|
||||
m_g += other;
|
||||
m_b += other;
|
||||
add_imm_rgba(other, other, other, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
rgbaint_t &operator-=(const rgbaint_t& other)
|
||||
{
|
||||
sub_imm_rgba(other.m_a, other.m_r, other.m_g, other.m_b);
|
||||
return *this;
|
||||
}
|
||||
|
||||
rgbaint_t& operator*=(const rgbaint_t& other)
|
||||
{
|
||||
mul_imm_rgba(other.m_a, other.m_r, other.m_g, other.m_b);
|
||||
return *this;
|
||||
}
|
||||
|
||||
rgbaint_t& operator*=(const INT32 other)
|
||||
{
|
||||
mul_imm_rgba(other, other, other, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
rgbaint_t& operator>>=(const INT32 shift)
|
||||
{
|
||||
sra_imm(shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -477,7 +442,7 @@ public:
|
||||
return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff);
|
||||
}
|
||||
|
||||
inline void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
{
|
||||
UINT32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
|
||||
UINT32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
|
||||
@ -504,4 +469,4 @@ protected:
|
||||
INT32 m_b;
|
||||
};
|
||||
|
||||
#endif /* __RGBGEN__ */
|
||||
#endif // MAME_EMU_VIDEO_RGBGEN_H
|
||||
|
@ -166,13 +166,13 @@ const struct rgbaint_t::_statics rgbaint_t::statics =
|
||||
|
||||
void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor)
|
||||
{
|
||||
__m128i scale1 = _mm_set1_epi32(factor);
|
||||
__m128i scale2 = _mm_sub_epi32(_mm_set1_epi32(0x100), scale1);
|
||||
const __m128i scale1 = _mm_set1_epi32(factor);
|
||||
const rgbaint_t scale2(_mm_sub_epi32(_mm_set1_epi32(0x100), scale1));
|
||||
|
||||
rgbaint_t scaled_other(other);
|
||||
scaled_other.mul(scale2);
|
||||
|
||||
mul(scale1);
|
||||
mul(rgbaint_t(scale1));
|
||||
add(scaled_other);
|
||||
sra_imm(8);
|
||||
}
|
||||
|
@ -10,10 +10,16 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __RGBSSE__
|
||||
#define __RGBSSE__
|
||||
#ifndef MAME_EMU_VIDEO_RGBSSE_H
|
||||
#define MAME_EMU_VIDEO_RGBSSE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <emmintrin.h>
|
||||
#ifdef __SSE4_1__
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
@ -22,16 +28,16 @@
|
||||
class rgbaint_t
|
||||
{
|
||||
public:
|
||||
inline rgbaint_t() { }
|
||||
inline rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
inline rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
inline rgbaint_t(const rgb_t& rgb) { set(rgb); }
|
||||
inline rgbaint_t(__m128i rgba) { m_value = rgba; }
|
||||
rgbaint_t() { }
|
||||
explicit rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
explicit rgbaint_t(const rgb_t& rgb) { set(rgb); }
|
||||
explicit rgbaint_t(__m128i rgba) { m_value = rgba; }
|
||||
|
||||
inline void set(rgbaint_t& other) { m_value = other.m_value; }
|
||||
inline void set(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); }
|
||||
inline void set(INT32 a, INT32 r, INT32 g, INT32 b) { m_value = _mm_set_epi32(a, r, g, b); }
|
||||
inline void set(const rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); }
|
||||
void set(const rgbaint_t& other) { m_value = other.m_value; }
|
||||
void set(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); }
|
||||
void set(INT32 a, INT32 r, INT32 g, INT32 b) { m_value = _mm_set_epi32(a, r, g, b); }
|
||||
void set(const rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); }
|
||||
|
||||
inline rgb_t to_rgba() const
|
||||
{
|
||||
@ -43,6 +49,35 @@ public:
|
||||
return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, _mm_setzero_si128()), _mm_setzero_si128()));
|
||||
}
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
void set_a(const INT32 value) { m_value = _mm_insert_epi32(m_value, value, 3); }
|
||||
void set_r(const INT32 value) { m_value = _mm_insert_epi32(m_value, value, 2); }
|
||||
void set_g(const INT32 value) { m_value = _mm_insert_epi32(m_value, value, 1); }
|
||||
void set_b(const INT32 value) { m_value = _mm_insert_epi32(m_value, value, 0); }
|
||||
#else
|
||||
void set_a(const INT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0)); }
|
||||
void set_r(const INT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0)); }
|
||||
void set_g(const INT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0)); }
|
||||
void set_b(const INT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value)); }
|
||||
#endif
|
||||
|
||||
UINT8 get_a() const { return UINT8(unsigned(_mm_extract_epi16(m_value, 6))); }
|
||||
UINT8 get_r() const { return UINT8(unsigned(_mm_extract_epi16(m_value, 4))); }
|
||||
UINT8 get_g() const { return UINT8(unsigned(_mm_extract_epi16(m_value, 2))); }
|
||||
UINT8 get_b() const { return UINT8(unsigned(_mm_extract_epi16(m_value, 0))); }
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
INT32 get_a32() const { return _mm_extract_epi32(m_value, 3); }
|
||||
INT32 get_r32() const { return _mm_extract_epi32(m_value, 2); }
|
||||
INT32 get_g32() const { return _mm_extract_epi32(m_value, 1); }
|
||||
INT32 get_b32() const { return _mm_extract_epi32(m_value, 0); }
|
||||
#else
|
||||
INT32 get_a32() const { return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); }
|
||||
INT32 get_r32() const { return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); }
|
||||
INT32 get_g32() const { return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); }
|
||||
INT32 get_b32() const { return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); }
|
||||
#endif
|
||||
|
||||
inline void add(const rgbaint_t& color2)
|
||||
{
|
||||
m_value = _mm_add_epi32(m_value, color2.m_value);
|
||||
@ -73,7 +108,7 @@ public:
|
||||
m_value = _mm_sub_epi32(m_value, _mm_set_epi32(a, r, g, b));
|
||||
}
|
||||
|
||||
inline void subr(rgbaint_t& color2)
|
||||
inline void subr(const rgbaint_t& color2)
|
||||
{
|
||||
m_value = _mm_sub_epi32(color2.m_value, m_value);
|
||||
}
|
||||
@ -88,66 +123,6 @@ public:
|
||||
m_value = _mm_sub_epi32(_mm_set_epi32(a, r, g, b), m_value);
|
||||
}
|
||||
|
||||
inline void set_a(const INT32 value)
|
||||
{
|
||||
m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0));
|
||||
}
|
||||
|
||||
inline void set_r(const INT32 value)
|
||||
{
|
||||
m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0));
|
||||
}
|
||||
|
||||
inline void set_g(const INT32 value)
|
||||
{
|
||||
m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0));
|
||||
}
|
||||
|
||||
inline void set_b(const INT32 value)
|
||||
{
|
||||
m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value));
|
||||
}
|
||||
|
||||
inline UINT8 get_a() const
|
||||
{
|
||||
return _mm_extract_epi16(m_value, 6);
|
||||
}
|
||||
|
||||
inline UINT8 get_r() const
|
||||
{
|
||||
return _mm_extract_epi16(m_value, 4);
|
||||
}
|
||||
|
||||
inline UINT8 get_g() const
|
||||
{
|
||||
return _mm_extract_epi16(m_value, 2);
|
||||
}
|
||||
|
||||
inline UINT8 get_b() const
|
||||
{
|
||||
return _mm_extract_epi16(m_value, 0);
|
||||
}
|
||||
|
||||
inline INT32 get_a32() const
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6);
|
||||
}
|
||||
|
||||
inline INT32 get_r32() const
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4);
|
||||
}
|
||||
|
||||
inline INT32 get_g32() const
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2);
|
||||
}
|
||||
|
||||
inline INT32 get_b32() const
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0);
|
||||
}
|
||||
|
||||
inline void mul(const rgbaint_t& color)
|
||||
{
|
||||
__m128i tmp1 = _mm_mul_epu32(m_value, color.m_value);
|
||||
@ -414,7 +389,7 @@ public:
|
||||
m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b));
|
||||
}
|
||||
|
||||
inline rgbaint_t operator=(const rgbaint_t& other)
|
||||
inline rgbaint_t &operator=(const rgbaint_t& other)
|
||||
{
|
||||
m_value = other.m_value;
|
||||
return *this;
|
||||
@ -459,8 +434,12 @@ public:
|
||||
|
||||
inline void merge_alpha(const rgbaint_t& alpha)
|
||||
{
|
||||
#ifdef __SSE4_1__
|
||||
m_value = _mm_insert_epi32(m_value, _mm_extract_epi32(alpha.m_value, 3), 3);
|
||||
#else
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 7), 7);
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 6), 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
@ -487,7 +466,7 @@ public:
|
||||
return _mm_cvtsi128_si32(color01);
|
||||
}
|
||||
|
||||
inline void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
{
|
||||
__m128i color00 = _mm_cvtsi32_si128(rgb00);
|
||||
__m128i color01 = _mm_cvtsi32_si128(rgb01);
|
||||
@ -519,11 +498,11 @@ protected:
|
||||
INT16 scale_table[256][8];
|
||||
};
|
||||
|
||||
static inline __m128i alpha_mask() { return *(__m128i *)&statics.alpha_mask[0]; }
|
||||
static inline __m128i red_mask() { return *(__m128i *)&statics.red_mask[0]; }
|
||||
static inline __m128i green_mask() { return *(__m128i *)&statics.green_mask[0]; }
|
||||
static inline __m128i blue_mask() { return *(__m128i *)&statics.blue_mask[0]; }
|
||||
static inline __m128i scale_factor(UINT8 index) { return *(__m128i *)&statics.scale_table[index][0]; }
|
||||
static __m128i alpha_mask() { return *(__m128i *)&statics.alpha_mask[0]; }
|
||||
static __m128i red_mask() { return *(__m128i *)&statics.red_mask[0]; }
|
||||
static __m128i green_mask() { return *(__m128i *)&statics.green_mask[0]; }
|
||||
static __m128i blue_mask() { return *(__m128i *)&statics.blue_mask[0]; }
|
||||
static __m128i scale_factor(UINT8 index) { return *(__m128i *)&statics.scale_table[index][0]; }
|
||||
|
||||
__m128i m_value;
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __RGBUTIL__
|
||||
#define __RGBUTIL__
|
||||
#ifndef MAME_EMU_VIDEO_RGBUTIL_H
|
||||
#define MAME_EMU_VIDEO_RGBUTIL_H
|
||||
|
||||
/* use SSE on 64-bit implementations, where it can be assumed */
|
||||
// use SSE on 64-bit implementations, where it can be assumed
|
||||
#if (!defined(MAME_DEBUG) || defined(__OPTIMIZE__)) && (defined(__SSE2__) || defined(_MSC_VER)) && defined(PTR64)
|
||||
#include "rgbsse.h"
|
||||
#elif defined(__ALTIVEC__)
|
||||
@ -21,4 +21,4 @@
|
||||
#include "rgbgen.h"
|
||||
#endif
|
||||
|
||||
#endif /* __RGBUTIL__ */
|
||||
#endif // MAME_EMU_VIDEO_RGBUTIL_H
|
||||
|
@ -28,15 +28,15 @@ protected:
|
||||
typedef __vector unsigned int VECU32;
|
||||
|
||||
public:
|
||||
inline rgbaint_t() { set(0, 0, 0, 0); }
|
||||
inline rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
inline rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
inline rgbaint_t(const rgb_t& rgb) { set(rgb); }
|
||||
inline rgbaint_t(VECS32 rgba) : m_value(rgba) { }
|
||||
rgbaint_t() { set(0, 0, 0, 0); }
|
||||
explicit rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
|
||||
explicit rgbaint_t(const rgb_t& rgb) { set(rgb); }
|
||||
explicit rgbaint_t(VECS32 rgba) : m_value(rgba) { }
|
||||
|
||||
inline void set(rgbaint_t& other) { m_value = other.m_value; }
|
||||
void set(const rgbaint_t& other) { m_value = other.m_value; }
|
||||
|
||||
inline void set(UINT32 rgba)
|
||||
void set(UINT32 rgba)
|
||||
{
|
||||
const VECU32 zero = { 0, 0, 0, 0 };
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
@ -48,7 +48,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void set(INT32 a, INT32 r, INT32 g, INT32 b)
|
||||
void set(INT32 a, INT32 r, INT32 g, INT32 b)
|
||||
{
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
const VECS32 result = { b, g, r, a };
|
||||
@ -58,7 +58,7 @@ public:
|
||||
m_value = result;
|
||||
}
|
||||
|
||||
inline void set(const rgb_t& rgb)
|
||||
void set(const rgb_t& rgb)
|
||||
{
|
||||
const VECU32 zero = { 0, 0, 0, 0 };
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
@ -88,6 +88,118 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
void set_a(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, alpha_perm);
|
||||
}
|
||||
|
||||
void set_r(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, red_perm);
|
||||
}
|
||||
|
||||
void set_g(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, green_perm);
|
||||
}
|
||||
|
||||
void set_b(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, blue_perm);
|
||||
}
|
||||
|
||||
UINT8 get_a() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 12), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 3), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT8 get_r() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 8), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 7), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT8 get_g() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 4), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 11), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT8 get_b() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 0), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 15), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
INT32 get_a32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 3), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 0), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
INT32 get_r32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 2), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 1), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
INT32 get_g32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 1), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 2), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
INT32 get_b32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 0), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 3), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void add(const rgbaint_t& color2)
|
||||
{
|
||||
m_value = vec_add(m_value, color2.m_value);
|
||||
@ -130,7 +242,7 @@ public:
|
||||
m_value = vec_sub(m_value, temp);
|
||||
}
|
||||
|
||||
inline void subr(rgbaint_t& color2)
|
||||
inline void subr(const rgbaint_t& color2)
|
||||
{
|
||||
m_value = vec_sub(color2.m_value, m_value);
|
||||
}
|
||||
@ -151,118 +263,6 @@ public:
|
||||
m_value = vec_sub(temp, m_value);
|
||||
}
|
||||
|
||||
inline void set_a(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, alpha_perm);
|
||||
}
|
||||
|
||||
inline void set_r(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, red_perm);
|
||||
}
|
||||
|
||||
inline void set_g(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, green_perm);
|
||||
}
|
||||
|
||||
inline void set_b(const INT32 value)
|
||||
{
|
||||
const VECS32 temp = { value, value, value, value };
|
||||
m_value = vec_perm(m_value, temp, blue_perm);
|
||||
}
|
||||
|
||||
inline UINT8 get_a() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 12), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 3), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline UINT8 get_r() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 8), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 7), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline UINT8 get_g() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 4), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 11), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline UINT8 get_b() const
|
||||
{
|
||||
UINT8 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(VECU8(m_value), 0), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(VECU8(m_value), 15), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline INT32 get_a32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 3), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 0), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline INT32 get_r32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 2), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 1), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline INT32 get_g32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 1), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 2), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline INT32 get_b32() const
|
||||
{
|
||||
INT32 result;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
vec_ste(vec_splat(m_value, 0), 0, &result);
|
||||
#else
|
||||
vec_ste(vec_splat(m_value, 3), 0, &result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void mul(const rgbaint_t& color)
|
||||
{
|
||||
const VECU32 shift = vec_splat_u32(-16);
|
||||
@ -545,7 +545,7 @@ public:
|
||||
m_value = VECS32(vec_cmplt(m_value, temp));
|
||||
}
|
||||
|
||||
inline rgbaint_t operator=(const rgbaint_t& other)
|
||||
inline rgbaint_t &operator=(const rgbaint_t& other)
|
||||
{
|
||||
m_value = other.m_value;
|
||||
return *this;
|
||||
@ -607,7 +607,7 @@ public:
|
||||
m_value = vec_perm(m_value, alpha.m_value, alpha_perm);
|
||||
}
|
||||
|
||||
static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
static UINT32 bilinear_filter(const UINT32 &rgb00, const UINT32 &rgb01, const UINT32 &rgb10, const UINT32 &rgb11, UINT8 u, UINT8 v)
|
||||
{
|
||||
const VECS32 zero = vec_splat_s32(0);
|
||||
|
||||
@ -650,7 +650,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
|
||||
void bilinear_filter_rgbaint(const UINT32 &rgb00, const UINT32 &rgb01, const UINT32 &rgb10, const UINT32 &rgb11, UINT8 u, UINT8 v)
|
||||
{
|
||||
const VECS32 zero = vec_splat_s32(0);
|
||||
|
||||
@ -688,13 +688,13 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
VECS32 m_value;
|
||||
VECS32 m_value;
|
||||
|
||||
static const VECU8 alpha_perm;
|
||||
static const VECU8 red_perm;
|
||||
static const VECU8 green_perm;
|
||||
static const VECU8 blue_perm;
|
||||
static const VECS16 scale_table[256];
|
||||
static const VECU8 alpha_perm;
|
||||
static const VECU8 red_perm;
|
||||
static const VECU8 green_perm;
|
||||
static const VECU8 blue_perm;
|
||||
static const VECS16 scale_table[256];
|
||||
};
|
||||
|
||||
|
||||
|
@ -534,8 +534,8 @@ device_t *media_auditor::find_shared_device(device_t &device, const char *name,
|
||||
|
||||
media_auditor::audit_record::audit_record(const rom_entry &media, media_type type)
|
||||
: m_type(type)
|
||||
, m_status(audit_status::ERROR)
|
||||
, m_substatus(audit_substatus::ERROR)
|
||||
, m_status(audit_status::UNVERIFIED)
|
||||
, m_substatus(audit_substatus::UNVERIFIED)
|
||||
, m_name(ROM_GETNAME(&media))
|
||||
, m_explength(rom_file_size(&media))
|
||||
, m_length(0)
|
||||
@ -548,8 +548,8 @@ media_auditor::audit_record::audit_record(const rom_entry &media, media_type typ
|
||||
|
||||
media_auditor::audit_record::audit_record(const char *name, media_type type)
|
||||
: m_type(type)
|
||||
, m_status(audit_status::ERROR)
|
||||
, m_substatus(audit_substatus::ERROR)
|
||||
, m_status(audit_status::UNVERIFIED)
|
||||
, m_substatus(audit_substatus::UNVERIFIED)
|
||||
, m_name(name)
|
||||
, m_explength(0)
|
||||
, m_length(0)
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
GOOD = 0,
|
||||
FOUND_INVALID,
|
||||
NOT_FOUND,
|
||||
ERROR
|
||||
UNVERIFIED = 100
|
||||
};
|
||||
|
||||
// substatus values
|
||||
@ -74,7 +74,7 @@ public:
|
||||
NOT_FOUND,
|
||||
NOT_FOUND_NODUMP,
|
||||
NOT_FOUND_OPTIONAL,
|
||||
ERROR = 100
|
||||
UNVERIFIED = 100
|
||||
};
|
||||
|
||||
// summary values
|
||||
|
@ -1261,7 +1261,7 @@ static MACHINE_CONFIG_DERIVED( shangon, outrun_base )
|
||||
|
||||
// video hardware
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_25MHz/4, 400, 0, 321, 262, 0, 224)
|
||||
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(segaorun_state, screen_update_shangon)
|
||||
|
||||
MCFG_SEGA_SYS16B_SPRITES_ADD("sprites")
|
||||
|
@ -95,6 +95,8 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(reg0_w);
|
||||
DECLARE_WRITE8_MEMBER(reg1_w);
|
||||
DECLARE_WRITE8_MEMBER(lu_w);
|
||||
DECLARE_WRITE8_MEMBER(hbscrl_w);
|
||||
DECLARE_WRITE8_MEMBER(lbscrl_w);
|
||||
DECLARE_READ16_MEMBER(mem_r);
|
||||
DECLARE_WRITE16_MEMBER(mem_w);
|
||||
|
||||
@ -110,6 +112,7 @@ public:
|
||||
UINT8 m_vom[16];
|
||||
UINT8 m_vpat, m_patmult, m_patcnt, m_patidx;
|
||||
bool m_lb;
|
||||
UINT16 m_scrl;
|
||||
};
|
||||
|
||||
WRITE_LINE_MEMBER(vt240_state::write_keyboard_clock)
|
||||
@ -360,9 +363,7 @@ WRITE16_MEMBER(vt240_state::vram_w)
|
||||
offset &= 0xffff;
|
||||
UINT8 chr = data;
|
||||
|
||||
if(BIT(m_reg1, 2))
|
||||
chr = video_ram[offset];
|
||||
else if(BIT(m_reg0, 4))
|
||||
if(BIT(m_reg0, 4))
|
||||
{
|
||||
if(BIT(m_reg0, 6))
|
||||
{
|
||||
@ -406,7 +407,23 @@ WRITE16_MEMBER(vt240_state::vram_w)
|
||||
out = (out & ~m_mask) | (mem & m_mask);
|
||||
else
|
||||
out = (out & data) | (mem & ~data);
|
||||
video_ram[(offset & 0x7fff) + (0x8000 * i)] = out;
|
||||
if(BIT(m_reg1, 3))
|
||||
{
|
||||
if(BIT(m_reg1, 2))
|
||||
{
|
||||
out = mem;
|
||||
video_ram[((m_scrl << 1) | (offset & 1)) + (0x8000 * i)] = out;
|
||||
}
|
||||
else
|
||||
{
|
||||
video_ram[((m_scrl << 1) | 0) + (0x8000 * i)] = out;
|
||||
video_ram[((m_scrl << 1) | 1) + (0x8000 * i)] = out;
|
||||
}
|
||||
m_scrl += BIT(m_reg1, 1) ? -1 : 1;
|
||||
m_scrl &= 0x3fff;
|
||||
}
|
||||
else
|
||||
video_ram[(offset & 0x7fff) + (0x8000 * i)] = out;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -414,7 +431,23 @@ WRITE16_MEMBER(vt240_state::vram_w)
|
||||
data = (chr & ~m_mask) | (video_ram[offset] & m_mask);
|
||||
else
|
||||
data = (chr & data) | (video_ram[offset] & ~data);
|
||||
video_ram[offset] = data;
|
||||
if(BIT(m_reg1, 3))
|
||||
{
|
||||
if(BIT(m_reg1, 2))
|
||||
{
|
||||
data = video_ram[offset];
|
||||
video_ram[(m_scrl << 1) | (offset & 1)] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
video_ram[(m_scrl << 1) | 0] = data;
|
||||
video_ram[(m_scrl << 1) | 1] = data;
|
||||
}
|
||||
m_scrl += BIT(m_reg1, 1) ? -1 : 1;
|
||||
m_scrl &= 0x3fff;
|
||||
}
|
||||
else
|
||||
video_ram[offset] = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(vt240_state::mask_w)
|
||||
@ -450,6 +483,16 @@ WRITE8_MEMBER(vt240_state::lu_w)
|
||||
m_lu = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(vt240_state::lbscrl_w)
|
||||
{
|
||||
m_scrl = (m_scrl & 0xff00) | data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(vt240_state::hbscrl_w)
|
||||
{
|
||||
m_scrl = (m_scrl & 0xff) | ((data & 0x3f) << 8);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START(bank_map, AS_PROGRAM, 16, vt240_state)
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x00000, 0x1ffff) AM_ROM AM_REGION("maincpu", 0)
|
||||
@ -479,6 +522,8 @@ static ADDRESS_MAP_START( vt240_mem, AS_PROGRAM, 16, vt240_state )
|
||||
AM_RANGE (0174540, 0174541) AM_WRITE8(lu_w, 0x00ff)
|
||||
AM_RANGE (0174600, 0174601) AM_WRITE8(reg0_w, 0x00ff)
|
||||
AM_RANGE (0174640, 0174641) AM_WRITE8(reg1_w, 0x00ff)
|
||||
AM_RANGE (0174700, 0174701) AM_WRITE8(hbscrl_w, 0x00ff)
|
||||
AM_RANGE (0174740, 0174741) AM_WRITE8(lbscrl_w, 0x00ff)
|
||||
AM_RANGE (0175000, 0175005) AM_READWRITE8(i8085_comm_r, i8085_comm_w, 0x00ff)
|
||||
AM_RANGE (0176000, 0176777) AM_DEVREADWRITE8("x2212", x2212_device, read, write, 0x00ff)
|
||||
// 017700x System comm logic
|
||||
@ -505,6 +550,8 @@ static ADDRESS_MAP_START(vt240_char_io, AS_IO, 8, vt240_state)
|
||||
AM_RANGE(0xb0, 0xb0) AM_WRITE(lu_w)
|
||||
AM_RANGE(0xc0, 0xc0) AM_WRITE(reg0_w)
|
||||
AM_RANGE(0xd0, 0xd0) AM_WRITE(reg1_w)
|
||||
AM_RANGE(0xe0, 0xe0) AM_WRITE(hbscrl_w)
|
||||
AM_RANGE(0xf0, 0xf0) AM_WRITE(lbscrl_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( upd7220_map, AS_0, 16, vt240_state)
|
||||
|
@ -518,8 +518,8 @@ int apollo_kbd_device::push_scancode(UINT8 code, UINT8 repeat)
|
||||
switch (code)
|
||||
{
|
||||
case 0x00: code = 0x68; break; // _
|
||||
case 0x0e: code = 0x6b; break; // #
|
||||
case 0x29: code = 0x69; break; // <>
|
||||
case 0x0e: code = 0x69; break; // #
|
||||
case 0x29: code = 0x6b; break; // <>
|
||||
case 0x42: code = 0x6f; break; // NP-
|
||||
case 0x46: code = 0x6e; break; // NP+
|
||||
case 0x4e: code = 0x73; break; // NP ENTER
|
||||
@ -633,7 +633,7 @@ void apollo_kbd_device::scan_keyboard()
|
||||
m_keytime[x] = 0;
|
||||
m_keyon[x] = 0;
|
||||
m_last_pressed = 0;
|
||||
LOG2(("released key 0x%02x at time %d",x, m_keytime[x]));
|
||||
LOG1(("released key 0x%02x at time %d",x, m_keytime[x]));
|
||||
}
|
||||
}
|
||||
else if (m_keyon[x] == 0)
|
||||
@ -644,7 +644,7 @@ void apollo_kbd_device::scan_keyboard()
|
||||
m_keytime[x] = m_mode == KBD_MODE_0_COMPATIBILITY ? m_delay : m_repeat;
|
||||
m_keyon[x] = 1;
|
||||
m_last_pressed = x;
|
||||
LOG2(("pushed key 0x%02x at time %d",x, m_keytime[x]));
|
||||
LOG1(("pushed key 0x%02x at time %d",x, m_keytime[x]));
|
||||
}
|
||||
}
|
||||
else if (m_last_pressed == x)
|
||||
@ -690,7 +690,7 @@ UINT16 apollo_kbd_device::m_code_table[] = {
|
||||
/* B11 ) 0 */ 0x21, 0xA1, 0x30, 0x29, NOP, 0x30, NOP, No,
|
||||
/* B12 _ - */ 0x22, 0xA2, 0x2D, 0x5F, NOP, 0x2D, NOP, Yes,
|
||||
/* B13 + = */ 0x23, 0xA3, 0x3D, 0x2B, NOP, 0x3D, NOP, Yes,
|
||||
/* B14 ~ ' / BS */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No,
|
||||
/* D14 \\ | */ 0x53, 0xD3, 0xC8, 0xC9, NOP, 0xC8, NOP, No,
|
||||
/* B15 BACKSPACE */ 0x25, 0xA5, 0xDE, 0xDE, NOP, 0xDE, NOP, Yes,
|
||||
|
||||
/* C1 TAB */ 0x2C, 0xAC, 0xCA, 0xDA, 0xFA, 0xCA, NOP, No,
|
||||
@ -717,22 +717,22 @@ UINT16 apollo_kbd_device::m_code_table[] = {
|
||||
/* D8 J */ 0x4C, 0xCC, 0x6A, 0x4A, 0x0A, 0x4A, NOP, No,
|
||||
/* D9 K */ 0x4D, 0xCD, 0x6B, 0x4B, 0x0B, 0x4B, NOP, No,
|
||||
/* D10 L */ 0x4E, 0xCE, 0x6C, 0x4C, 0x0C, 0x4C, NOP, No,
|
||||
/* D11 : ; */ 0x4F, 0xCF, 0x3B, 0x3A, 0xFB, 0x3B, NOP, No,
|
||||
/* D11 : ; / Oe */ 0x4F, 0xCF, 0x3B, 0x3A, 0xFB, 0x3B, NOP, No,
|
||||
/* D12 " ' / Ae */ 0x50, 0xD0, 0x27, 0x22, 0xF8, 0x27, NOP, No,
|
||||
/* D14 ! \ */ 0x53, 0xD3, 0xC8, 0xC9, NOP, 0xC8, NOP, No,
|
||||
// Apollo US keyboards have no hash key (#)
|
||||
/* D14 ' # */ NOP, NOP, 0x23, 0x27, NOP, 0x23, NOP, No,
|
||||
|
||||
/* E2 Z */ 0x60, 0xE0, 0x7A, 0x5A, 0x1A, 0x5A, NOP, No,
|
||||
/* E3 X */ 0x61, 0xE1, 0x78, 0x58, 0x18, 0x58, NOP, No,
|
||||
/* E4 C */ 0x62, 0xE2, 0x63, 0x43, 0x03, 0x43, NOP, No,
|
||||
/* E5 V */ 0x63, 0xE3, 0x76, 0x56, 0x16, 0x56, NOP, No,
|
||||
/* E6 8 */ 0x64, 0xE4, 0x62, 0x42, 0x02, 0x42, NOP, No,
|
||||
/* E6 B */ 0x64, 0xE4, 0x62, 0x42, 0x02, 0x42, NOP, No,
|
||||
/* E7 N */ 0x65, 0xE5, 0x6E, 0x4E, 0x0E, 0x4E, NOP, No,
|
||||
/* E8 M */ 0x66, 0xE6, 0x6D, 0x4D, 0x0D, 0x4D, NOP, No,
|
||||
/* E9 < , */ 0x67, 0xE7, 0x2C, 0x3C, NOP, 0x2C, NOP, No,
|
||||
/* E10 > . */ 0x68, 0xE8, 0x2E, 0x3E, NOP, 0x2E, NOP, Yes,
|
||||
/* E11 ? / */ 0x69, 0xE9, 0xCC, 0xDC, 0xFC, 0xCC, NOP, No,
|
||||
|
||||
// /* B14 ~ ' */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No,
|
||||
/* _ */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
|
||||
/* F1 (space bar) */ 0x76, 0xF6, 0x20, 0x20, 0x20, 0x20, NOP, Yes,
|
||||
/* LC0 Home */ 0x27, 0xA7, 0x84, 0x94, 0x84, 0x84, 0xA4, No,
|
||||
|
@ -102,15 +102,18 @@ WRITE8_MEMBER( osborne1_state::videoram_w )
|
||||
|
||||
READ8_MEMBER( osborne1_state::opcode_r )
|
||||
{
|
||||
// Update the flipflops that control bank selection and NMI
|
||||
UINT8 const new_ub6a_q = (m_btn_reset->read() & 0x80) ? 1 : 0;
|
||||
if (!m_rom_mode)
|
||||
if (!space.debugger_access())
|
||||
{
|
||||
set_rom_mode(m_ub4a_q ? 0 : 1);
|
||||
m_ub4a_q = m_ub6a_q;
|
||||
// Update the flipflops that control bank selection and NMI
|
||||
UINT8 const new_ub6a_q = (m_btn_reset->read() & 0x80) ? 1 : 0;
|
||||
if (!m_rom_mode)
|
||||
{
|
||||
set_rom_mode(m_ub4a_q ? 0 : 1);
|
||||
m_ub4a_q = m_ub6a_q;
|
||||
}
|
||||
m_ub6a_q = new_ub6a_q;
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, m_ub6a_q ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
m_ub6a_q = new_ub6a_q;
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, m_ub6a_q ? CLEAR_LINE : ASSERT_LINE);
|
||||
|
||||
// Now that's sorted out we can call the normal read handler
|
||||
return m_maincpu->space(AS_PROGRAM).read_byte(offset);
|
||||
|
@ -155,7 +155,7 @@ void raiden2cop_device::dma_fill()
|
||||
void raiden2cop_device::dma_zsorting(UINT16 data)
|
||||
{
|
||||
struct sort_entry {
|
||||
INT16 sorting_key;
|
||||
INT32 sorting_key;
|
||||
UINT16 val;
|
||||
};
|
||||
|
||||
@ -163,13 +163,13 @@ void raiden2cop_device::dma_zsorting(UINT16 data)
|
||||
for(int i=0; i<data; i++) {
|
||||
sort_entry &e = entries[i];
|
||||
e.val = m_host_space->read_word(cop_sort_lookup + 2*i);
|
||||
e.sorting_key = m_host_space->read_word(cop_sort_ram_addr + e.val);
|
||||
e.sorting_key = m_host_space->read_dword(cop_sort_ram_addr + e.val);
|
||||
}
|
||||
switch(cop_sort_param) {
|
||||
case 1:
|
||||
case 2:
|
||||
std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key > b.sorting_key; });
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b){ return a.sorting_key < b.sorting_key; });
|
||||
break;
|
||||
}
|
||||
|
@ -1710,10 +1710,7 @@ MACHINE_CONFIG_FRAGMENT( apollo_graphics )
|
||||
MCFG_DEFAULT_LAYOUT( layout_apollo_15i )
|
||||
MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER)
|
||||
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
|
||||
MCFG_SCREEN_REFRESH_RATE(76)
|
||||
MCFG_SCREEN_RAW_PARAMS(68000000, 1343, 0, 1024, 841, 0, 800)
|
||||
MCFG_SCREEN_SIZE(1024, 800)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 1023, 0, 799)
|
||||
MCFG_SCREEN_RAW_PARAMS(68000000, 1346, 0, 1024, 841, 0, 800)
|
||||
MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_15i, screen_update)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
@ -1894,10 +1891,7 @@ MACHINE_CONFIG_FRAGMENT( apollo_mono19i )
|
||||
MCFG_PALETTE_ADD_MONOCHROME("palette")
|
||||
MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER)
|
||||
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
|
||||
MCFG_SCREEN_REFRESH_RATE(64)
|
||||
MCFG_SCREEN_RAW_PARAMS(120000000, 1728, 0, 1280, 1066, 0, 1024)
|
||||
MCFG_SCREEN_SIZE(1280, 1024)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023)
|
||||
MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_19i, screen_update)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -342,7 +342,7 @@ void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SS
|
||||
TEX->add(t0);
|
||||
TEX->add(t2);
|
||||
TEX->add(t3);
|
||||
TEX->sra(2);
|
||||
TEX->sra_imm(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,9 @@ key_trans_entry keyboard_trans_table::s_default_table[] =
|
||||
KEY_TRANS_ENTRY1(TILDE, GRAVE, BACKQUOTE, GRAVE, VK_OEM_3, '`'),
|
||||
KEY_TRANS_ENTRY1(LSHIFT, LSHIFT, LSHIFT, LSHIFT, VK_LSHIFT, 0),
|
||||
KEY_TRANS_ENTRY1(BACKSLASH, BACKSLASH, BACKSLASH, BACKSLASH, VK_OEM_5, '\\'),
|
||||
KEY_TRANS_ENTRY1(BACKSLASH2, NONUSHASH, UNKNOWN, OEM_102, VK_OEM_102, '<'),
|
||||
// KEY_TRANS_ENTRY1(BACKSLASH2, NONUSHASH, UNKNOWN, OEM_102, VK_OEM_102, '<'),
|
||||
// This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y.
|
||||
KEY_TRANS_ENTRY1(BACKSLASH2, NONUSBACKSLASH, UNKNOWN, OEM_102, VK_OEM_102, '<'),
|
||||
KEY_TRANS_ENTRY1(Z, Z, z, Z, 'Z', 'Z'),
|
||||
KEY_TRANS_ENTRY1(X, X, x, X, 'X', 'X'),
|
||||
KEY_TRANS_ENTRY1(C, C, c, C, 'C', 'C'),
|
||||
|
@ -79,4 +79,9 @@ struct _IO_FILE {}; //_IO_FILE is an opaque type in the emscripten libc which m
|
||||
#undef _FORTIFY_SOURCE
|
||||
#endif
|
||||
|
||||
// nasty hack to stop altivec #define vector/bool/pixel screwing us over
|
||||
#if defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__)
|
||||
#define __APPLE_ALTIVEC__ 1
|
||||
#endif
|
||||
|
||||
#endif /* SDLMAME_UNIX */
|
||||
|
Loading…
Reference in New Issue
Block a user