mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
-getaway.cpp: Fixed steering control.
* Works fine with an analog stick/wheel, difficult to steer on the slippery "dotted" surface with keyboard/D-pad. -osd: Moved GCC intrinsics out of eminline.h so MAME_NOASM will take the pure C++ implementation with GCC (makes testing the fallback easier). -Removed a bunch of [[maybe_unused]] that aren't actually needed.
This commit is contained in:
parent
463e48a7e5
commit
205511eea7
@ -18,7 +18,7 @@ void rf5c296_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
void rf5c296_device::reg_w([[maybe_unused]] uint8_t reg, uint8_t data)
|
||||
void rf5c296_device::reg_w(uint8_t reg, uint8_t data)
|
||||
{
|
||||
// fprintf(stderr, "%s rf5c296_reg_w %02x, %02x\n", machine().describe_context().c_str(), reg, data);
|
||||
switch (reg)
|
||||
@ -37,7 +37,7 @@ void rf5c296_device::reg_w([[maybe_unused]] uint8_t reg, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t rf5c296_device::reg_r([[maybe_unused]] uint8_t reg)
|
||||
uint8_t rf5c296_device::reg_r(uint8_t reg)
|
||||
{
|
||||
// fprintf(stderr, "%s rf5c296_reg_r %02x\n", machine().describe_context().c_str(), reg);
|
||||
return 0x00;
|
||||
|
@ -26,8 +26,8 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
void reg_w([[maybe_unused]] uint8_t reg, uint8_t data);
|
||||
uint8_t reg_r([[maybe_unused]] uint8_t reg);
|
||||
void reg_w(uint8_t reg, uint8_t data);
|
||||
uint8_t reg_r(uint8_t reg);
|
||||
|
||||
unsigned char m_rf5c296_reg;
|
||||
required_device<pccard_slot_device> m_pccard;
|
||||
|
@ -3892,13 +3892,13 @@ void cane_state::cane_unknown_port0_w(u8 data)
|
||||
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
u8 orbite_state::orbite_scattered_colorram_r([[maybe_unused]] address_space &space, [[maybe_unused]] offs_t offset, [[maybe_unused]] u8 mem_mask)
|
||||
u8 orbite_state::orbite_scattered_colorram_r(address_space &space, offs_t offset, u8 mem_mask)
|
||||
{
|
||||
return m_scattered_colorram[(offset & 0x1f) | ((offset & 0x1f80) >> 2)];
|
||||
}
|
||||
|
||||
|
||||
void orbite_state::orbite_scattered_colorram_w([[maybe_unused]] address_space &space, [[maybe_unused]] offs_t offset, [[maybe_unused]] u8 data, [[maybe_unused]] u8 mem_mask)
|
||||
void orbite_state::orbite_scattered_colorram_w(address_space &space, offs_t offset, u8 data, u8 mem_mask)
|
||||
{
|
||||
m_scattered_colorram[(offset & 0x1f) | ((offset & 0x1f80) >> 2)] = data;
|
||||
}
|
||||
|
@ -47,18 +47,22 @@ namespace {
|
||||
class getaway_state : public driver_device
|
||||
{
|
||||
public:
|
||||
getaway_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag)
|
||||
getaway_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_gfxrom(*this, "gfx")
|
||||
, m_screen(*this, "screen")
|
||||
, m_inputs(*this, "IN.%u", 0)
|
||||
, m_dsw(*this, "DSW.%u", 0)
|
||||
, m_wheel(*this, "WHEEL")
|
||||
{ }
|
||||
|
||||
// machine configs
|
||||
void getaway(machine_config &config);
|
||||
|
||||
// input functions
|
||||
ioport_value read_wheel() { return (m_wheel->read() - 0x08) & 0xff; }
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
@ -69,6 +73,7 @@ private:
|
||||
required_device<screen_device> m_screen;
|
||||
required_ioport_array<3> m_inputs;
|
||||
required_ioport_array<2> m_dsw;
|
||||
required_ioport m_wheel;
|
||||
|
||||
void main_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
@ -336,9 +341,12 @@ static INPUT_PORTS_START( getaway )
|
||||
PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(10) PORT_KEYDELTA(15)
|
||||
|
||||
PORT_START("IN.2")
|
||||
// steering wheel, 0x00 is neutral, range seems to be 0xe0-0x1f where bit 7 on goes to left dir.
|
||||
// TODO: better input type/defaults
|
||||
PORT_BIT( 0xff, 0, IPT_AD_STICK_X ) PORT_MINMAX(0x80, 0x7f) PORT_SENSITIVITY(5) PORT_KEYDELTA(5) // PORT_CENTERDELTA(0)
|
||||
// steering wheel, signed byte, absolute values larger than 8 ignored
|
||||
PORT_BIT( 0xff, 0x00, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(getaway_state, read_wheel)
|
||||
|
||||
PORT_START("WHEEL")
|
||||
// TODO: check sensitivity and key delta
|
||||
PORT_BIT( 0xff, 0x08, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0x10) PORT_SENSITIVITY(5) PORT_KEYDELTA(25) // PORT_CENTERDELTA(0)
|
||||
|
||||
// dips are two banks, a regular 8 banks one
|
||||
// and a tiny 4. They are labeled, hard to read from the provided pic :=(
|
||||
|
@ -674,7 +674,7 @@ private:
|
||||
|
||||
void update_disc();
|
||||
void gx700pwbf_output( int offset, uint8_t data );
|
||||
void gx700pwfbf_init( void ( ksys573_state::*output_callback_func )( [[maybe_unused]] offs_t offset, [[maybe_unused]] uint8_t data ) );
|
||||
void gx700pwfbf_init( void ( ksys573_state::*output_callback_func )( offs_t offset, uint8_t data ) );
|
||||
void gn845pwbb_do_w( int offset, int data );
|
||||
void gn845pwbb_clk_w( int offset, int data );
|
||||
|
||||
@ -697,7 +697,7 @@ private:
|
||||
int m_h8_clk;
|
||||
|
||||
uint8_t m_gx700pwbf_output_data[ 4 ];
|
||||
void ( ksys573_state::*m_gx700pwfbf_output_callback )( [[maybe_unused]] offs_t offset, [[maybe_unused]] uint8_t data );
|
||||
void ( ksys573_state::*m_gx700pwfbf_output_callback )( offs_t offset, uint8_t data );
|
||||
|
||||
uint32_t m_stage_mask;
|
||||
struct
|
||||
@ -1238,7 +1238,7 @@ void ksys573_state::gx700pwbf_io_w(offs_t offset, uint16_t data, uint16_t mem_ma
|
||||
}
|
||||
}
|
||||
|
||||
void ksys573_state::gx700pwfbf_init( void ( ksys573_state::*output_callback_func )( [[maybe_unused]] offs_t offset, [[maybe_unused]] uint8_t data ) )
|
||||
void ksys573_state::gx700pwfbf_init( void ( ksys573_state::*output_callback_func )( offs_t offset, uint8_t data ) )
|
||||
{
|
||||
std::fill_n( m_gx700pwbf_output_data, sizeof( m_gx700pwbf_output_data ), 0);
|
||||
|
||||
|
@ -333,8 +333,8 @@ protected:
|
||||
|
||||
virtual void machine_start() override;
|
||||
|
||||
u8 orbite_scattered_colorram_r([[maybe_unused]] address_space &space, [[maybe_unused]] offs_t offset, [[maybe_unused]] u8 mem_mask = 0xff);
|
||||
void orbite_scattered_colorram_w([[maybe_unused]] address_space &space, [[maybe_unused]] offs_t offset, [[maybe_unused]] u8 data, [[maybe_unused]] u8 mem_mask = 0xff);
|
||||
u8 orbite_scattered_colorram_r(address_space &space, offs_t offset, u8 mem_mask = 0xff);
|
||||
void orbite_scattered_colorram_w(address_space &space, offs_t offset, u8 data, u8 mem_mask = 0xff);
|
||||
|
||||
private:
|
||||
void orbite_io_map(address_map &map);
|
||||
|
88
src/osd/eigcc.h
Normal file
88
src/osd/eigcc.h
Normal file
@ -0,0 +1,88 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Vas Crabb
|
||||
/***************************************************************************
|
||||
|
||||
eigccppc.h
|
||||
|
||||
Inline implementations for GCC compilers. This code is automatically
|
||||
included if appropriate by eminline.h.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAME_OSD_EIGCC_H
|
||||
#define MAME_OSD_EIGCC_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
INLINE MATH FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
addu_32x32_co - perform an unsigned 32 bit + 32
|
||||
bit addition and return the result with carry
|
||||
out
|
||||
-------------------------------------------------*/
|
||||
|
||||
#ifndef addu_32x32_co
|
||||
#define addu_32x32_co _addu_32x32_co
|
||||
inline bool _addu_32x32_co(uint32_t a, uint32_t b, uint32_t &sum)
|
||||
{
|
||||
return __builtin_add_overflow(a, b, &sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
addu_64x64_co - perform an unsigned 64 bit + 64
|
||||
bit addition and return the result with carry
|
||||
out
|
||||
-------------------------------------------------*/
|
||||
|
||||
#ifndef addu_64x64_co
|
||||
#define addu_64x64_co _addu_64x64_co
|
||||
inline bool _addu_64x64_co(uint64_t a, uint64_t b, uint64_t &sum)
|
||||
{
|
||||
return __builtin_add_overflow(a, b, &sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
INLINE BIT MANIPULATION FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
population_count_32 - return the number of
|
||||
one bits in a 32-bit value
|
||||
-------------------------------------------------*/
|
||||
|
||||
#ifndef population_count_32
|
||||
#define population_count_32 _population_count_32
|
||||
inline unsigned _population_count_32(uint32_t val)
|
||||
{
|
||||
// uses CPU feature if available, otherwise falls back to implementation similar to eminline.h
|
||||
static_assert(sizeof(val) == sizeof(unsigned), "expected 32-bit unsigned int");
|
||||
return unsigned(__builtin_popcount(static_cast<unsigned>(val)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
population_count_64 - return the number of
|
||||
one bits in a 64-bit value
|
||||
-------------------------------------------------*/
|
||||
|
||||
#ifndef population_count_64
|
||||
#define population_count_64 _population_count_64
|
||||
inline unsigned _population_count_64(uint64_t val)
|
||||
{
|
||||
// uses CPU feature if available, otherwise falls back to implementation similar to eminline.h
|
||||
static_assert(sizeof(val) == sizeof(unsigned long long), "expected 64-bit unsigned long long int");
|
||||
return unsigned(__builtin_popcountll(static_cast<unsigned long long>(val)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MAME_OSD_EIGCC_H
|
@ -29,6 +29,8 @@
|
||||
#include "eigccarm.h"
|
||||
#endif
|
||||
|
||||
#include "eigcc.h"
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#if (defined(_M_IX86) || defined(_M_X64))
|
||||
@ -323,12 +325,8 @@ inline uint64_t mulu_64x64(uint64_t a, uint64_t b, uint64_t &hi)
|
||||
#ifndef addu_32x32_co
|
||||
inline bool addu_32x32_co(uint32_t a, uint32_t b, uint32_t &sum)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return __builtin_add_overflow(a, b, &sum);
|
||||
#else
|
||||
sum = a + b;
|
||||
return (a > sum) || (b > sum);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -342,12 +340,8 @@ inline bool addu_32x32_co(uint32_t a, uint32_t b, uint32_t &sum)
|
||||
#ifndef addu_64x64_co
|
||||
inline bool addu_64x64_co(uint64_t a, uint64_t b, uint64_t &sum)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return __builtin_add_overflow(a, b, &sum);
|
||||
#else
|
||||
sum = a + b;
|
||||
return (a > sum) || (b > sum);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -398,10 +392,6 @@ inline unsigned population_count_32(uint32_t val)
|
||||
{
|
||||
#if defined(__NetBSD__)
|
||||
return popcount32(val);
|
||||
#elif defined(__GNUC__)
|
||||
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
||||
static_assert(sizeof(val) == sizeof(unsigned), "expected 32-bit unsigned int");
|
||||
return unsigned(__builtin_popcount(static_cast<unsigned>(val)));
|
||||
#else
|
||||
// optimal Hamming weight assuming fast 32*32->32
|
||||
constexpr uint32_t m1(0x55555555);
|
||||
@ -427,10 +417,6 @@ inline unsigned population_count_64(uint64_t val)
|
||||
{
|
||||
#if defined(__NetBSD__)
|
||||
return popcount64(val);
|
||||
#elif defined(__GNUC__)
|
||||
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
||||
static_assert(sizeof(val) == sizeof(unsigned long long), "expected 64-bit unsigned long long int");
|
||||
return unsigned(__builtin_popcountll(static_cast<unsigned long long>(val)));
|
||||
#else
|
||||
// guess that architectures with 64-bit pointers have 64-bit multiplier
|
||||
if (sizeof(void *) >= sizeof(uint64_t))
|
||||
|
@ -28,7 +28,7 @@ class render_target;
|
||||
|
||||
typedef uintptr_t HashT;
|
||||
|
||||
#define OSDWORK_CALLBACK(name) void *name(void *param, [[maybe_unused]] int threadid)
|
||||
#define OSDWORK_CALLBACK(name) void *name(void *param, int threadid)
|
||||
|
||||
class mac_window_info : public osd_window_t<void *>
|
||||
{
|
||||
|
@ -119,9 +119,9 @@ FUNCTOR(op_yuv16pal_argb32rot, return pixel_ycc_to_rgb_pal(&src, palbase); )
|
||||
// Copy and rotation
|
||||
//============================================================
|
||||
|
||||
struct blit_base {
|
||||
blit_base(int dest_bpp, bool is_rot, bool is_passthrough)
|
||||
: m_dest_bpp(dest_bpp), m_is_rot(is_rot), m_is_passthrough(is_passthrough)
|
||||
struct blit_base
|
||||
{
|
||||
blit_base(int dest_bpp, bool is_rot, bool is_passthrough) : m_dest_bpp(dest_bpp), m_is_rot(is_rot), m_is_passthrough(is_passthrough)
|
||||
{ }
|
||||
virtual ~blit_base() { }
|
||||
|
||||
@ -137,13 +137,12 @@ struct blit_texcopy : public blit_base
|
||||
blit_texcopy() : blit_base(sizeof(_dest_type) / _len_div, false, false) { }
|
||||
void texop(const texture_info *texture, const render_texinfo *texsource) const override
|
||||
{
|
||||
[[maybe_unused]] const rgb_t *palbase = texsource->palette;
|
||||
int x, y;
|
||||
const rgb_t *palbase = texsource->palette;
|
||||
/* loop over Y */
|
||||
for (y = 0; y < texsource->height; y++) {
|
||||
for (int y = 0; y < texsource->height; y++) {
|
||||
_src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div);
|
||||
_dest_type *dst = (_dest_type *)((uint8_t *)texture->m_pixels + y * texture->m_pitch);
|
||||
x = texsource->width / (_len_div);
|
||||
int x = texsource->width / (_len_div);
|
||||
while (x > 0) {
|
||||
*dst++ = m_op.op(*src, palbase);
|
||||
++src;
|
||||
@ -164,17 +163,16 @@ struct blit_texrot : public blit_base
|
||||
blit_texrot() : blit_base(sizeof(_dest_type), true, false) { }
|
||||
void texop(const texture_info *texture, const render_texinfo *texsource) const override
|
||||
{
|
||||
[[maybe_unused]] const rgb_t *palbase = texsource->palette;
|
||||
int x, y;
|
||||
const rgb_t *palbase = texsource->palette;
|
||||
const quad_setup_data *setup = &texture->m_setup;
|
||||
int dudx = setup->dudx;
|
||||
int dvdx = setup->dvdx;
|
||||
/* loop over Y */
|
||||
for (y = 0; y < setup->rotheight; y++) {
|
||||
for (int y = 0; y < setup->rotheight; y++) {
|
||||
int32_t curu = setup->startu + y * setup->dudy;
|
||||
int32_t curv = setup->startv + y * setup->dvdy;
|
||||
_dest_type *dst = (_dest_type *)((uint8_t *)texture->m_pixels + y * texture->m_pitch);
|
||||
x = setup->rotwidth;
|
||||
int x = setup->rotwidth;
|
||||
while (x>0) {
|
||||
_src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16);
|
||||
*dst++ = m_op.op(*src, palbase);
|
||||
|
@ -25,13 +25,13 @@
|
||||
COMPILER-SPECIFIC NASTINESS
|
||||
***************************************************************************/
|
||||
|
||||
/* The Win32 port requires this constant for variable arg routines. */
|
||||
// The Win32 port requires this constant for variable arg routines.
|
||||
#ifndef CLIB_DECL
|
||||
#define CLIB_DECL
|
||||
#endif
|
||||
|
||||
|
||||
/* Some optimizations/warnings cleanups for GCC */
|
||||
// Some optimizations/warnings cleanups for GCC
|
||||
#if defined(__GNUC__)
|
||||
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
|
||||
#define ATTR_CONST __attribute__((const))
|
||||
@ -76,7 +76,7 @@ using s64 = std::int64_t;
|
||||
FUNDAMENTAL MACROS
|
||||
***************************************************************************/
|
||||
|
||||
/* Concatenate/extract 32-bit halves of 64-bit values */
|
||||
// Concatenate/extract 32-bit halves of 64-bit values
|
||||
constexpr uint64_t concat_64(uint32_t hi, uint32_t lo) { return (uint64_t(hi) << 32) | uint32_t(lo); }
|
||||
constexpr uint32_t extract_64hi(uint64_t val) { return uint32_t(val >> 32); }
|
||||
constexpr uint32_t extract_64lo(uint64_t val) { return uint32_t(val); }
|
||||
@ -94,7 +94,7 @@ template <typename T, typename U, std::size_t N> struct equivalent_array<T, U[N]
|
||||
template <typename T, typename U> using equivalent_array_t = typename equivalent_array<T, U>::type;
|
||||
#define EQUIVALENT_ARRAY(a, T) equivalent_array_t<T, std::remove_reference_t<decltype(a)> >
|
||||
|
||||
/* Macros for normalizing data into big or little endian formats */
|
||||
// Macros for normalizing data into big or little endian formats
|
||||
constexpr uint16_t swapendian_int16(uint16_t val) { return (val << 8) | (val >> 8); }
|
||||
|
||||
constexpr uint32_t swapendian_int32_partial16(uint32_t val) { return ((val << 8) & 0xFF00FF00U) | ((val >> 8) & 0x00FF00FFU); }
|
||||
@ -118,7 +118,7 @@ constexpr uint64_t big_endianize_int64(uint64_t x) { return x; }
|
||||
constexpr uint16_t little_endianize_int16(uint16_t x) { return swapendian_int16(x); }
|
||||
constexpr uint32_t little_endianize_int32(uint32_t x) { return swapendian_int32(x); }
|
||||
constexpr uint64_t little_endianize_int64(uint64_t x) { return swapendian_int64(x); }
|
||||
#endif /* LSB_FIRST */
|
||||
#endif // LSB_FIRST
|
||||
|
||||
#ifdef _MSC_VER
|
||||
using ssize_t = std::make_signed_t<size_t>;
|
||||
@ -130,4 +130,4 @@ using ssize_t = std::make_signed_t<size_t>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* MAME_OSD_OSDCOMM_H */
|
||||
#endif // MAME_OSD_OSDCOMM_H
|
||||
|
@ -33,7 +33,7 @@ class SDL_DM_Wrapper;
|
||||
|
||||
typedef uintptr_t HashT;
|
||||
|
||||
#define OSDWORK_CALLBACK(name) void *name(void *param, [[maybe_unused]] int threadid)
|
||||
#define OSDWORK_CALLBACK(name) void *name(void *param, int threadid)
|
||||
|
||||
class sdl_window_info : public osd_window_t<SDL_Window*>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user