This commit is contained in:
David Haywood 2016-04-14 11:30:36 +01:00
commit 9a4d7eeb28
38 changed files with 1525 additions and 699 deletions

View File

@ -278,9 +278,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.TexCoord = TexCoord.xy;
TexCoord += VectorScreen
? 0.5f / TargetDims.xy
: 0.5f / SourceDims.xy;
TexCoord += 0.5f / SourceDims;
Output.BloomCoord = TexCoord.xy;

View File

@ -89,8 +89,6 @@ uniform float2 ScreenDims; // size of the window or fullscreen
uniform float2 TargetDims; // size of the target surface
uniform float2 QuadDims; // size of the screen quad
uniform bool VectorScreen;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
@ -120,7 +118,6 @@ uniform float VignettingAmount = 0.0f;
uniform float ReflectionAmount = 0.0f;
uniform bool SwapXY = false;
uniform int RotationType = 0; // 0 = 0°, 1 = 90°, 2 = 180°, 3 = 270°
float GetNoiseFactor(float3 n, float random)
{
@ -146,40 +143,16 @@ float GetSpotAddend(float2 coord, float amount)
{
float2 SpotCoord = coord;
// hack for vector screen
if (VectorScreen)
{
// upper right quadrant
float2 spotOffset =
RotationType == 1 // 90°
? float2(-0.25f, -0.25f)
: RotationType == 2 // 180°
? float2(0.25f, -0.25f)
: RotationType == 3 // 270° else 0°
? float2(0.25f, 0.25f)
: float2(-0.25f, 0.25f);
// upper right quadrant
float2 spotOffset = float2(-0.25f, 0.25f);
// normalized screen canvas ratio
float2 CanvasRatio = SwapXY
? float2(QuadDims.x / QuadDims.y, 1.0f)
: float2(1.0f, QuadDims.y / QuadDims.x);
// normalized screen canvas ratio
float2 CanvasRatio = SwapXY
? float2(1.0f, QuadDims.x / QuadDims.y)
: float2(1.0f, QuadDims.y / QuadDims.x);
SpotCoord += spotOffset;
SpotCoord *= CanvasRatio;
}
else
{
// upper right quadrant
float2 spotOffset = float2(-0.25f, 0.25f);
// normalized screen canvas ratio
float2 CanvasRatio = SwapXY
? float2(1.0f, QuadDims.x / QuadDims.y)
: float2(1.0f, QuadDims.y / QuadDims.x);
SpotCoord += spotOffset;
SpotCoord *= CanvasRatio;
}
SpotCoord += spotOffset;
SpotCoord *= CanvasRatio;
float SpotBlur = amount;
@ -201,7 +174,7 @@ float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount)
smoothAmount = min(smoothAmount, radiusAmount);
float2 quadDims = QuadDims;
quadDims = !VectorScreen && SwapXY
quadDims = SwapXY
? quadDims.yx
: quadDims.xy;

View File

@ -55,8 +55,6 @@ uniform float2 ScreenDims;
uniform float2 TargetDims;
uniform float2 QuadDims;
uniform bool VectorScreen;
static const float2 Coord0Offset = float2(-0.5f, -0.5f);
static const float2 Coord1Offset = float2( 0.5f, -0.5f);
static const float2 Coord2Offset = float2(-0.5f, 0.5f);
@ -67,9 +65,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
VS_OUTPUT Output = (VS_OUTPUT)0;
float2 HalfTargetTexelDims = 0.5f / TargetDims;
HalfTargetTexelDims *= VectorScreen
? (ScreenDims / QuadDims)
: 1.0f;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;

View File

@ -175,27 +175,22 @@ float2 GetShadowCoord(float2 QuadCoord, float2 SourceCoord)
float2 shadowUV = ShadowUV;
float2 shadowCount = ShadowCount;
// swap x/y vector and raster in screen mode (not source mode)
// swap x/y in screen mode (not source mode)
canvasCoord = ShadowTileMode == 0 && SwapXY
? canvasCoord.yx
: canvasCoord.xy;
// swap x/y vector and raster in screen mode (not source mode)
// swap x/y in screen mode (not source mode)
shadowCount = ShadowTileMode == 0 && SwapXY
? shadowCount.yx
: shadowCount.xy;
float2 shadowTile = canvasTexelDims * shadowCount;
// swap x/y vector in screen mode (not raster and not source mode)
shadowTile = VectorScreen && ShadowTileMode == 0 && SwapXY
? shadowTile.yx
: shadowTile.xy;
float2 shadowFrac = frac(canvasCoord / shadowTile);
// swap x/y raster in screen mode (not vector and not source mode)
shadowFrac = !VectorScreen && ShadowTileMode == 0 && SwapXY
// swap x/y in screen mode (not source mode)
shadowFrac = ShadowTileMode == 0 && SwapXY
? shadowFrac.yx
: shadowFrac.xy;
@ -215,12 +210,8 @@ float4 ps_main(PS_INPUT Input) : COLOR
float4 BaseColor = tex2D(DiffuseSampler, TexCoord);
BaseColor.a = 1.0f;
// keep border
if (!PrepareBloom)
{
// clip border
clip(TexCoord < 0.0f || TexCoord > 1.0f ? -1 : 1);
}
// clip border
clip(TexCoord < 0.0f || TexCoord > 1.0f ? -1 : 1);
// Mask Simulation (may not affect bloom)
if (!PrepareBloom && ShadowAlpha > 0.0f)

View File

@ -55,8 +55,6 @@ uniform float2 ScreenDims;
uniform float2 TargetDims;
uniform float2 QuadDims;
uniform bool VectorScreen;
VS_OUTPUT vs_screen_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;

View File

@ -28,7 +28,7 @@ struct PS_INPUT
{
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
float2 LineInfo : TEXCOORD1;
float2 LineInfo : TEXCOORD1; // x is the line length, y is unused
};
//-----------------------------------------------------------------------------
@ -47,9 +47,9 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
Output.Position.y = 1.0f - Output.Position.y; // flip y
Output.Position.y = 1.0f - Output.Position.y;
Output.Position.xy -= 0.5f; // center
Output.Position.xy *= 2.0f * (ScreenDims / QuadDims); // zoom
Output.Position.xy *= 2.0f; // zoom
Output.TexCoord = Input.TexCoord;

View File

@ -66,6 +66,7 @@ function cheat.startplugin()
local cheats = {}
local output = {}
local line = 0
local start_time = 0
local function load_cheats()
local filename = emu.romname()
@ -146,6 +147,11 @@ function cheat.startplugin()
return result
end
local function time()
return emu.time() - start_time
end
local function parse_cheat(cheat)
cheat.cheat_env = { draw_text = draw_text,
draw_line = draw_line,
@ -154,6 +160,7 @@ function cheat.startplugin()
frombcd = frombcd,
pairs = pairs,
ipairs = ipairs,
time = time,
table =
{ insert = table.insert,
remove = table.remove } }
@ -422,6 +429,7 @@ function cheat.startplugin()
end, "Cheat")
emu.register_start(function()
start_time = emu.time()
cheats = load_cheats()
for num, cheat in pairs(cheats) do
parse_cheat(cheat)

View File

@ -705,7 +705,7 @@ end
---------------------------------------------------
--
--@src/devices/bus/intv/slot.h,BUSES["INTV_CTRL"] = true
--@src/devices/bus/intv_ctrl/ctrl.h,BUSES["INTV_CTRL"] = true
---------------------------------------------------
if (BUSES["INTV_CTRL"]~=null) then
@ -1949,6 +1949,23 @@ if (BUSES["NEOGEO"]~=null) then
end
---------------------------------------------------
--
--@src/devices/bus/neogeo_ctrl/ctrl.h,BUSES["NEOGEO_CTRL"] = true
---------------------------------------------------
if (BUSES["NEOGEO_CTRL"]~=null) then
files {
MAME_DIR .. "src/devices/bus/neogeo_ctrl/ctrl.cpp",
MAME_DIR .. "src/devices/bus/neogeo_ctrl/ctrl.h",
MAME_DIR .. "src/devices/bus/neogeo_ctrl/joystick.cpp",
MAME_DIR .. "src/devices/bus/neogeo_ctrl/joystick.h",
MAME_DIR .. "src/devices/bus/neogeo_ctrl/mahjong.cpp",
MAME_DIR .. "src/devices/bus/neogeo_ctrl/mahjong.h",
}
end
---------------------------------------------------
--
--@src/devices/bus/saturn/sat_slot.h,BUSES["SATURN"] = true

View File

@ -617,6 +617,7 @@ BUSES["MIDI"] = true
--BUSES["MEGADRIVE"] = true
--BUSES["MSX_SLOT"] = true
BUSES["NEOGEO"] = true
BUSES["NEOGEO_CTRL"] = true
--BUSES["NES"] = true
--BUSES["NUBUS"] = true
--BUSES["O2"] = true

View File

@ -631,6 +631,7 @@ BUSES["MEGADRIVE"] = true
BUSES["MSX_SLOT"] = true
BUSES["NASBUS"] = true
BUSES["NEOGEO"] = true
BUSES["NEOGEO_CTRL"] = true
BUSES["NES"] = true
BUSES["NES_CTRL"] = true
BUSES["NEWBRAIN"] = true
@ -1968,6 +1969,7 @@ createMESSProjects(_target, _subtarget, "mb")
files {
MAME_DIR .. "src/mame/drivers/mbdtower.cpp",
MAME_DIR .. "src/mame/drivers/microvsn.cpp",
MAME_DIR .. "src/mame/drivers/phantom.cpp",
}
createMESSProjects(_target, _subtarget, "mchester")

View File

@ -53,31 +53,11 @@
CF31: control/flags: bit 4 = 1 to assert reset on V30, 5 = 1 to assert halt on V30
TODO:
- Code at $70b0-$70c5 waits for the V30 to answer some configuration data.
- Code at $70b0-$70c5 waits for the V30 to answer FPU presence.
- What's going on at CF0E/CF0F?
- There's likely A2 ROM at CnXX and C800-CBFF to support the "Slinky" memory
expansion card emulation function inside one of the custom ASICs. Need to
dump this...
- The manual indicates there is no ROM; special drivers installed into ProDOS 8
provide the RAMdisk and A2-accessing-PC-drives functionality.
The final stages before the software settles into its loop are:
20 to C800 at cf30
00 to C800 at cf31
12 to C800 at cf2b
21 to C800 at cf25
33 to C800 at cf24
80 to C800 at cf31
20 to C800 at cf30
loop:
Read $C800 at cf36
Read $C800 at cf31
Read $C800 at cf31
Read $C800 at cf36
Read $C800 at cf31
Read $C800 at cf31
80 to C800 at cf31
loop end: (return to loop)
*********************************************************************/
#include "pc_xporter.h"
@ -94,7 +74,6 @@ const device_type A2BUS_PCXPORTER = &device_creator<a2bus_pcxporter_device>;
static ADDRESS_MAP_START( pc_map, AS_PROGRAM, 16, a2bus_pcxporter_device )
ADDRESS_MAP_UNMAP_HIGH
//AM_RANGE(0xf0000, 0xfffff) AM_READ(pc_bios_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START(pc_io, AS_IO, 16, a2bus_pcxporter_device )
@ -108,10 +87,11 @@ static ADDRESS_MAP_START(pc_io, AS_IO, 16, a2bus_pcxporter_device )
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT( pcxporter )
MCFG_CPU_ADD("v30", V30, XTAL_14_31818MHz/3)
MCFG_CPU_ADD("v30", V30, XTAL_14_31818MHz/2) // 7.16 MHz as per manual
MCFG_CPU_PROGRAM_MAP(pc_map)
MCFG_CPU_IO_MAP(pc_io)
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb)
MCFG_DEVICE_DISABLE()
MCFG_DEVICE_ADD("pit8253", PIT8253, 0)
MCFG_PIT8253_CLK0(XTAL_14_31818MHz/12) /* heartbeat IRQ */
@ -121,7 +101,7 @@ MACHINE_CONFIG_FRAGMENT( pcxporter )
MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) /* pio port c pin 4, and speaker polling enough */
MCFG_PIT8253_OUT2_HANDLER(WRITELINE(a2bus_pcxporter_device, pc_pit8253_out2_changed))
MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_14_31818MHz/3 )
MCFG_DEVICE_ADD( "dma8237", PCXPORT_DMAC, XTAL_14_31818MHz/2 )
MCFG_I8237_OUT_HREQ_CB(WRITELINE(a2bus_pcxporter_device, pc_dma_hrq_changed))
MCFG_I8237_OUT_EOP_CB(WRITELINE(a2bus_pcxporter_device, pc_dma8237_out_eop))
MCFG_I8237_IN_MEMR_CB(READ8(a2bus_pcxporter_device, pc_dma_read_byte))
@ -145,8 +125,8 @@ MACHINE_CONFIG_FRAGMENT( pcxporter )
MCFG_I8255_OUT_PORTB_CB(WRITE8(a2bus_pcxporter_device, pc_ppi_portb_w))
MCFG_I8255_IN_PORTC_CB(READ8(a2bus_pcxporter_device, pc_ppi_portc_r))
MCFG_DEVICE_ADD("isa", ISA16, 0)
MCFG_ISA16_CPU("^v30")
MCFG_DEVICE_ADD("isa", ISA8, 0)
MCFG_ISA8_CPU("^v30")
MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w))
MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w))
MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w))
@ -167,8 +147,8 @@ MACHINE_CONFIG_FRAGMENT( pcxporter )
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MCFG_ISA16_SLOT_ADD("isa", "isa1", pc_isa8_cards, "cga", true)
MCFG_ISA16_SLOT_ADD("isa", "isa2", pc_isa8_cards, "fdc_xt", true)
MCFG_ISA8_SLOT_ADD("isa", "isa1", pc_isa8_cards, "cga", true)
MCFG_ISA8_SLOT_ADD("isa", "isa2", pc_isa8_cards, "fdc_xt", true)
MACHINE_CONFIG_END
/***************************************************************************
@ -377,22 +357,53 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN
case 0x703: // write w/increment
m_ram[m_offset] = data;
if (m_offset >= 0xb0000 && m_offset <= 0xb7fff) m_pcmem_space->write_byte(m_offset+0x8000, data);
if (m_offset >= 0xb8000 && m_offset <= 0xbffff) m_pcmem_space->write_byte(m_offset, data);
if (m_offset >= 0xb0000 && m_offset <= 0xb3fff) m_pcmem_space->write_byte(m_offset+0x8000, data);
else if (m_offset >= 0xb4000 && m_offset <= 0xb7fff) m_pcmem_space->write_byte(m_offset+0x4000, data);
else if (m_offset >= 0xb8000 && m_offset <= 0xbbfff) m_pcmem_space->write_byte(m_offset, data);
else if (m_offset >= 0xbc000 && m_offset <= 0xbffff) m_pcmem_space->write_byte(m_offset-0x4000, data);
m_offset++;
break;
case 0x704: // write w/o increment
m_ram[m_offset] = data;
if (m_offset >= 0xb0000 && m_offset <= 0xb7fff) m_pcmem_space->write_byte(m_offset+0x8000, data);
if (m_offset >= 0xb8000 && m_offset <= 0xbffff) m_pcmem_space->write_byte(m_offset, data);
if (m_offset >= 0xb0000 && m_offset <= 0xb3fff) m_pcmem_space->write_byte(m_offset+0x8000, data);
else if (m_offset >= 0xb4000 && m_offset <= 0xb7fff) m_pcmem_space->write_byte(m_offset+0x4000, data);
else if (m_offset >= 0xb8000 && m_offset <= 0xbbfff) m_pcmem_space->write_byte(m_offset, data);
else if (m_offset >= 0xbc000 && m_offset <= 0xbffff) m_pcmem_space->write_byte(m_offset-0x4000, data);
break;
case 0x72c: // CGA 6845 register select
m_pcio_space->write_byte(0x3d6, data);
m_6845_reg = data;
break;
case 0x72d: // CGA 6845 data read/write
// HACK: adjust the 40 column mode the 6502 sets to
// be more within specs.
switch (m_6845_reg)
{
case 0:
if (data == 0x3e)
{
data -= 6;
}
break;
case 2:
if (data == 0x29)
{
data += 4;
}
break;
case 3:
if (data == 0x5)
{
data *= 2;
}
break;
}
m_pcio_space->write_byte(0x3d7, data);
break;
@ -415,6 +426,7 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN
}
m_v30->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
m_v30->resume(SUSPEND_REASON_HALT | SUSPEND_REASON_DISABLE);
}
break;
@ -424,7 +436,7 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN
break;
default:
printf("%02x to C800 at %x\n", data, offset + 0xc800);
// printf("%02x to C800 at %x\n", data, offset + 0xc800);
m_regs[offset] = data;
break;
}

View File

@ -123,6 +123,8 @@ private:
address_space *m_pcmem_space, *m_pcio_space;
bool m_reset_during_halt;
UINT8 m_6845_reg;
void pc_select_dma_channel(int channel, bool state);
};

View File

@ -28,8 +28,11 @@ public:
virtual void rom_alloc(size_t size, int width, endianness_t end, const char *tag);
virtual void ram_alloc(UINT32 size);
UINT8* get_rom_base() { if (m_region.found()) return m_region->base(); return m_rom; }
UINT32 get_rom_size() { if (m_region.found()) return m_region->bytes(); return m_rom_size; }
UINT8* get_rom_base() { return m_rom; }
UINT32 get_rom_size() { return m_rom_size; }
UINT8* get_region_base() { if (m_region.found()) return m_region->base(); return nullptr; }
UINT32 get_region_size() { if (m_region.found()) return m_region->bytes(); return 0; }
UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_ram_size() { return m_ram.size(); }
@ -140,9 +143,27 @@ public:
virtual void rom_alloc(size_t size, int width, endianness_t end) { if (m_cart) m_cart->rom_alloc(size, width, end, tag()); }
virtual void ram_alloc(UINT32 size) { if (m_cart) m_cart->ram_alloc(size); }
UINT8* get_rom_base() { if (m_cart) return m_cart->get_rom_base(); return nullptr; }
UINT8* get_ram_base() { if (m_cart) return m_cart->get_ram_base(); return nullptr; }
UINT32 get_rom_size() { if (m_cart) return m_cart->get_rom_size(); return 0; }
UINT8* get_rom_base() {
if (m_cart)
{
if (!user_loadable())
return m_cart->get_region_base();
else
return m_cart->get_rom_base();
}
return nullptr;
}
UINT32 get_rom_size() {
if (m_cart)
{
if (!user_loadable())
return m_cart->get_region_size();
else
return m_cart->get_rom_size();
}
return 0;
}
UINT8* get_ram_base() { if (m_cart) return m_cart->get_ram_base(); return nullptr; }
void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }

View File

@ -0,0 +1,112 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Controller Port emulation
**********************************************************************/
#include "ctrl.h"
// slot devices
#include "joystick.h"
#include "mahjong.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type NEOGEO_CONTROL_PORT = &device_creator<neogeo_control_port_device>;
//**************************************************************************
// CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_neogeo_control_port_interface - constructor
//-------------------------------------------------
device_neogeo_control_port_interface::device_neogeo_control_port_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig,device)
{
m_port = dynamic_cast<neogeo_control_port_device *>(device.owner());
}
//-------------------------------------------------
// ~device_neogeo_control_port_interface - destructor
//-------------------------------------------------
device_neogeo_control_port_interface::~device_neogeo_control_port_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_control_port_device - constructor
//-------------------------------------------------
neogeo_control_port_device::neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NEOGEO_CONTROL_PORT, "SNK Neo Geo control port", tag, owner, clock, "neogeo_control_port", __FILE__),
device_slot_interface(mconfig, *this), m_device(nullptr)
{
}
//-------------------------------------------------
// ~neogeo_control_port_device - destructor
//-------------------------------------------------
neogeo_control_port_device::~neogeo_control_port_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_control_port_device::device_start()
{
m_device = dynamic_cast<device_neogeo_control_port_interface *>(get_card_device());
}
UINT8 neogeo_control_port_device::read_ctrl()
{
UINT8 data = 0;
if (m_device)
data |= m_device->read_ctrl();
return data;
}
UINT8 neogeo_control_port_device::read_start_sel()
{
UINT8 data = 0;
if (m_device)
data |= m_device->read_start_sel();
return data;
}
void neogeo_control_port_device::write_ctrlsel(UINT8 data)
{
if (m_device)
m_device->write_ctrlsel(data);
}
//-------------------------------------------------
// SLOT_INTERFACE( neogeo_control_port_devices )
//-------------------------------------------------
SLOT_INTERFACE_START( neogeo_controls )
SLOT_INTERFACE("joy", NEOGEO_JOYSTICK)
SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL)
SLOT_INTERFACE_END

View File

@ -0,0 +1,80 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo controller port emulation
**********************************************************************/
#pragma once
#ifndef __NEOGEO_CONTROL_PORT__
#define __NEOGEO_CONTROL_PORT__
#include "emu.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class neogeo_control_port_device;
// ======================> device_neogeo_control_port_interface
class device_neogeo_control_port_interface : public device_slot_card_interface
{
public:
// construction/destruction
device_neogeo_control_port_interface(const machine_config &mconfig, device_t &device);
virtual ~device_neogeo_control_port_interface();
virtual UINT8 read_ctrl() { return 0xff; };
virtual UINT8 read_start_sel() { return 0xff; };
virtual void write_ctrlsel(UINT8 data) { };
protected:
neogeo_control_port_device *m_port;
};
// ======================> neogeo_control_port_device
class neogeo_control_port_device : public device_t,
public device_slot_interface
{
public:
// construction/destruction
neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~neogeo_control_port_device();
UINT8 read_ctrl();
UINT8 read_start_sel();
void write_ctrlsel(UINT8 data);
DECLARE_READ8_MEMBER( ctrl_r ) { return read_ctrl(); }
protected:
// device-level overrides
virtual void device_start() override;
device_neogeo_control_port_interface *m_device;
};
// device type definition
extern const device_type NEOGEO_CONTROL_PORT;
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_NEOGEO_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, NEOGEO_CONTROL_PORT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
SLOT_INTERFACE_EXTERN( neogeo_controls );
#endif

View File

@ -0,0 +1,98 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Joystick emulation
**********************************************************************/
#include "joystick.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type NEOGEO_JOYSTICK = &device_creator<neogeo_joystick_device>;
static INPUT_PORTS_START( neogeo_joy )
PORT_START("JOY")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_START("START_SELECT")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SELECT )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor neogeo_joystick_device::device_input_ports() const
{
return INPUT_PORTS_NAME( neogeo_joy );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_joystick_device - constructor
//-------------------------------------------------
neogeo_joystick_device::neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NEOGEO_JOYSTICK, "SNK Neo Geo Joystick", tag, owner, clock, "neogeo_joy", __FILE__),
device_neogeo_control_port_interface(mconfig, *this),
m_joy(*this, "JOY"),
m_ss(*this, "START_SELECT")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_joystick_device::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void neogeo_joystick_device::device_reset()
{
}
//-------------------------------------------------
// read_ctrl
//-------------------------------------------------
UINT8 neogeo_joystick_device::read_ctrl()
{
return m_joy->read();
}
//-------------------------------------------------
// read_start_sel
//-------------------------------------------------
UINT8 neogeo_joystick_device::read_start_sel()
{
return m_ss->read();
}

View File

@ -0,0 +1,79 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Joystick emulation
**********************************************************************/
#pragma once
#ifndef __NEOGEO_JOYSTICK__
#define __NEOGEO_JOYSTICK__
#include "emu.h"
#include "ctrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> neogeo_joystick_device
class neogeo_joystick_device : public device_t,
public device_neogeo_control_port_interface
{
public:
// construction/destruction
neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT8 read_ctrl() override;
virtual UINT8 read_start_sel() override;
private:
required_ioport m_joy;
required_ioport m_ss;
};
// ======================> neogeo_joy_ac_device
class neogeo_joy_ac_device : public device_t,
public device_neogeo_control_port_interface
{
public:
// construction/destruction
neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT8 read_ctrl() override;
private:
required_ioport m_joy;
};
// device type definition
extern const device_type NEOGEO_JOYSTICK;
extern const device_type NEOGEO_JOY_AC;
#endif

View File

@ -0,0 +1,151 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Mahjong controller emulation
**********************************************************************/
#include "mahjong.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type NEOGEO_MJCTRL = &device_creator<neogeo_mjctrl_device>;
static INPUT_PORTS_START( neogeo_joy )
PORT_START("MJ.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_F )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_G )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("MJ.1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_H )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_I )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_L )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_M )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_N )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 )
// is this actually connected?
PORT_START("MJ.2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_START("MJ.3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("START_SELECT")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor neogeo_mjctrl_device::device_input_ports() const
{
return INPUT_PORTS_NAME( neogeo_joy );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_joystick_device - constructor
//-------------------------------------------------
neogeo_mjctrl_device::neogeo_mjctrl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NEOGEO_MJCTRL, "SNK Neo Geo Mahjong controller", tag, owner, clock, "neogeo_mjctrl", __FILE__),
device_neogeo_control_port_interface(mconfig, *this),
m_mjpanel(*this, "MJ"),
m_ss(*this, "START_SELECT")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_mjctrl_device::device_start()
{
save_item(NAME(m_ctrl_sel));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void neogeo_mjctrl_device::device_reset()
{
m_ctrl_sel = 0;
}
//-------------------------------------------------
// read_ctrl
//-------------------------------------------------
UINT8 neogeo_mjctrl_device::read_ctrl()
{
UINT8 res = 0;
switch (m_ctrl_sel)
{
default:
case 0x00: res = 0xff; break;
case 0x09: res = m_mjpanel[0]->read(); break;
case 0x12: res = m_mjpanel[1]->read(); break;
case 0x1b: res = m_mjpanel[2]->read(); break;
case 0x24: res = m_mjpanel[3]->read(); break;
}
return res;
}
//-------------------------------------------------
// read_start_sel
//-------------------------------------------------
UINT8 neogeo_mjctrl_device::read_start_sel()
{
return m_ss->read();
}
//-------------------------------------------------
// write_ctrlsel
//-------------------------------------------------
void neogeo_mjctrl_device::write_ctrlsel(UINT8 data)
{
m_ctrl_sel = data;
}

View File

@ -0,0 +1,55 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Mahjong controller emulation
**********************************************************************/
#pragma once
#ifndef __NEOGEO_MJCTRL__
#define __NEOGEO_MJCTRL__
#include "emu.h"
#include "ctrl.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> neogeo_mjctrl_device
class neogeo_mjctrl_device : public device_t,
public device_neogeo_control_port_interface
{
public:
// construction/destruction
neogeo_mjctrl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT8 read_ctrl() override;
virtual UINT8 read_start_sel() override;
virtual void write_ctrlsel(UINT8 data) override;
private:
required_ioport_array<4> m_mjpanel;
required_ioport m_ss;
UINT8 m_ctrl_sel;
};
// device type definition
extern const device_type NEOGEO_MJCTRL;
#endif

View File

@ -263,7 +263,7 @@ static const UINT8 int_register_map[REG_I_COUNT] =
static UINT8 float_register_map[REG_F_COUNT] =
{
0
REG_XMM6, REG_XMM7, REG_XMM8, REG_XMM9
};
// condition mapping table

View File

@ -22,9 +22,6 @@
* Support for FPU exceptions
* New instructions?
- FCOPYI, ICOPYF
copy raw between float and integer registers
- VALID opcode_desc,handle,param
checksum/compare code referenced by opcode_desc; if not
matching, generate exception with handle,param

View File

@ -49,6 +49,7 @@
const device_type AM9517A = &device_creator<am9517a_device>;
const device_type V53_DMAU = &device_creator<upd71071_v53_device>;
const device_type PCXPORT_DMAC = &device_creator<pcxport_dmac_device>;
//**************************************************************************
@ -422,7 +423,7 @@ inline void am9517a_device::dma_advance()
// end_of_process -
//-------------------------------------------------
inline void am9517a_device::end_of_process()
void am9517a_device::end_of_process()
{
// terminal count
if (COMMAND_MEM_TO_MEM)
@ -530,6 +531,11 @@ upd71071_v53_device::upd71071_v53_device(const machine_config &mconfig, const ch
{
}
pcxport_dmac_device::pcxport_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: am9517a_device(mconfig, PCXPORT_DMAC, "PC Transporter DMAC", tag, owner, clock, "pcx_dmac")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -1277,3 +1283,58 @@ WRITE8_MEMBER(upd71071_v53_device::write)
trigger(1);
}
void pcxport_dmac_device::device_reset()
{
m_state = STATE_SI;
m_command = 0;
m_status = 0;
m_request = 0;
m_mask = 0;
m_temp = 0;
m_msb = 0;
m_current_channel = -1;
m_last_channel = 3;
m_hreq = -1;
m_eop = 0;
set_hreq(0);
set_eop(ASSERT_LINE);
set_dack();
}
void pcxport_dmac_device::end_of_process()
{
// terminal count
if (COMMAND_MEM_TO_MEM)
{
m_status |= 1 << 0;
m_status |= 1 << 1;
m_request &= ~(1 << 0);
m_request &= ~(1 << 1);
}
else
{
m_status |= 1 << m_current_channel;
m_request &= ~(1 << m_current_channel);
}
if (MODE_AUTOINITIALIZE)
{
// autoinitialize
m_channel[m_current_channel].m_address = m_channel[m_current_channel].m_base_address;
m_channel[m_current_channel].m_count = m_channel[m_current_channel].m_base_count;
}
// don't mask out channel if not autoinitialize
// signal end of process
set_eop(ASSERT_LINE);
set_hreq(0);
m_current_channel = -1;
set_dack();
m_state = STATE_SI;
}

View File

@ -46,6 +46,8 @@
class am9517a_device : public device_t,
public device_execute_interface
{
friend class pcxport_dmac_device;
public:
// construction/destruction
am9517a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname);
@ -90,6 +92,8 @@ protected:
virtual void device_reset() override;
virtual void execute_run() override;
virtual void end_of_process();
int m_icount;
UINT32 m_address_mask;
@ -127,7 +131,6 @@ private:
inline void dma_read();
inline void dma_write();
inline void dma_advance();
inline void end_of_process();
devcb_write_line m_out_hreq_cb;
devcb_write_line m_out_eop_cb;
@ -176,11 +179,24 @@ protected:
};
class pcxport_dmac_device : public am9517a_device
{
public:
// construction/destruction
pcxport_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
virtual void device_reset() override;
virtual void end_of_process() override;
};
// device type definition
extern const device_type AM9517A;
extern const device_type V53_DMAU;
extern const device_type PCXPORT_DMAC;
/***************************************************************************

View File

@ -25,6 +25,8 @@ public:
virtual void ExecCommand() override;
virtual void WriteData( UINT8 *data, int dataLength ) override;
virtual void ReadData( UINT8 *data, int dataLength ) override;
// ksys573 changes discs without telling the cdrom_image_device
virtual void process_buffer() override { atapi_hle_device::process_buffer(); }
protected:
// device-level overrides

View File

@ -518,6 +518,12 @@ void info_xml_creator::output_bios()
// skip if no ROMs
if (m_drivlist.driver().rom == nullptr)
return;
// first determine the default BIOS name
std::string defaultname;
for (const rom_entry *rom = m_drivlist.driver().rom; !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISDEFAULT_BIOS(rom))
defaultname = ROM_GETNAME(rom);
// iterate over ROM entries and look for BIOSes
for (const rom_entry *rom = m_drivlist.driver().rom; !ROMENTRY_ISEND(rom); rom++)
@ -527,7 +533,7 @@ void info_xml_creator::output_bios()
fprintf(m_output, "\t\t<biosset");
fprintf(m_output, " name=\"%s\"", xml_normalize_string(ROM_GETNAME(rom)));
fprintf(m_output, " description=\"%s\"", xml_normalize_string(ROM_GETHASHDATA(rom)));
if (ROM_GETBIOSFLAGS(rom) == 1)
if (defaultname == ROM_GETNAME(rom))
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
}

View File

@ -1880,12 +1880,6 @@ void render_target::add_container_primitives(render_primitive_list &list, const
}
else
{
if (curitem.flags() & PRIMFLAG_VECTORBUF_MASK)
{
// determine UV coordinates
prim->texcoords = oriented_texcoords[0];
}
// adjust the color for brightness/contrast/gamma
prim->color.r = container.apply_brightness_contrast_gamma_fp(prim->color.r);
prim->color.g = container.apply_brightness_contrast_gamma_fp(prim->color.g);
@ -1894,12 +1888,33 @@ void render_target::add_container_primitives(render_primitive_list &list, const
// no texture
prim->texture.base = nullptr;
// set the basic flags
prim->flags = (curitem.flags() & ~PRIMFLAG_BLENDMODE_MASK)
| PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
if (PRIMFLAG_GET_VECTORBUF(curitem.flags()))
{
// determine the final orientation (textures are up-side down, so flip y-axis for vectors to immitate that behavior)
int finalorient = orientation_add(ORIENTATION_FLIP_Y, container_xform.orientation);
// apply clipping
clipped = render_clip_quad(&prim->bounds, &cliprect, nullptr);
// determine UV coordinates
prim->texcoords = oriented_texcoords[finalorient];
// apply clipping
clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
// apply the final orientation from the quad flags and then build up the final flags
prim->flags = (curitem.flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK))
| PRIMFLAG_TEXORIENT(finalorient);
prim->flags |= blendmode != -1
? PRIMFLAG_BLENDMODE(blendmode)
: PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem.flags()));
}
else
{
// set the basic flags
prim->flags = (curitem.flags() & ~PRIMFLAG_BLENDMODE_MASK)
| PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
// apply clipping
clipped = render_clip_quad(&prim->bounds, &cliprect, nullptr);
}
}
break;
}

View File

@ -54,6 +54,7 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_beep(*this, "beeper")
, m_keyboard(*this, "LINE")
{ }
DECLARE_WRITE16_MEMBER(glasgow_lcd_w);
@ -95,6 +96,7 @@ private:
UINT8 m_mouse_down;
UINT16 m_Line18_LED;
UINT16 m_Line18_REED;
UINT8 m_selected[2];
UINT8 pos_to_num( UINT8 );
void set_board( );
@ -102,7 +104,7 @@ private:
required_device<cpu_device> m_maincpu;
required_device<beep_device> m_beep;
required_ioport_array<8> m_keyboard;
};
typedef struct
@ -196,33 +198,37 @@ WRITE16_MEMBER( glasgow_state::glasgow_lcd_flag_w )
READ16_MEMBER( glasgow_state::glasgow_keys_r )
{
static const char *const keynames[] = { "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" };
UINT8 pos2num_res = 0;
m_board_row++;
m_board_row &= 7;
// See if we are moving a piece
UINT8 data = ioport(keynames[m_board_row])->read();
UINT8 data = m_keyboard[m_board_row]->read();
if ((data != 0xff) && (!m_mouse_down))
if ((data < 0xff) && (m_mouse_down == 0))
{
pos2num_res = pos_to_num(data);
UINT8 pos2num_res = pos_to_num(data);
UINT8 piece = l_board[m_board_row][pos2num_res].piece;
if (!(pos2num_res < 8))
if (pos2num_res > 7)
logerror("Position out of bound!");
else
if ((m_mouse_hold) && (!l_board[m_board_row][pos2num_res].piece))
if ((m_mouse_hold > 0) && ((piece == 0) || (piece > 12))) // putting a piece down onto blank spot or a shadow
{
// Moving a piece onto a blank
if (m_selected[0] < 8)
{
l_board[m_selected[0]][m_selected[1]].piece = 0; // remove shadow
m_selected[0] = 0xff;
}
l_board[m_board_row][pos2num_res].piece = m_mouse_hold;
m_mouse_hold = 0;
}
else
if ((!m_mouse_hold) && (l_board[m_board_row][pos2num_res].piece))
if ((m_mouse_hold == 0) && (piece) && (piece < 13)) // picking up a piece
{
// Picking up a piece
m_mouse_hold = l_board[m_board_row][pos2num_res].piece;
l_board[m_board_row][pos2num_res].piece = 0;
m_mouse_hold = piece;
l_board[m_board_row][pos2num_res].piece = m_mouse_hold + 12; // replace piece with shadow
m_selected[0] = m_board_row;
m_selected[1] = pos2num_res; // save position of shadow
}
m_mouse_down = m_board_row + 1;
@ -233,7 +239,14 @@ READ16_MEMBER( glasgow_state::glasgow_keys_r )
// See if we are taking a piece off the board
if (!ioport("LINE10")->read())
{
m_mouse_hold = 0;
if (m_selected[0] < 8)
{
l_board[m_selected[0]][m_selected[1]].piece = 0; // remove shadow
m_selected[0] = 0xff;
}
}
// See if any keys pressed
data = 3;
@ -519,6 +532,7 @@ MACHINE_START_MEMBER( glasgow_state, dallas32 )
MACHINE_RESET_MEMBER( glasgow_state, glasgow )
{
m_lcd_shift_counter = 3;
m_selected[0] = 0xff;
set_board();
}
@ -562,7 +576,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( chessboard )
PORT_START("LINE2")
PORT_START("LINE.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -571,7 +585,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE3")
PORT_START("LINE.1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -580,7 +594,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE4")
PORT_START("LINE.2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -589,7 +603,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE5")
PORT_START("LINE.3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -598,7 +612,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE6")
PORT_START("LINE.4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -607,7 +621,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE7")
PORT_START("LINE.5")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -616,7 +630,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE8")
PORT_START("LINE.6")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
@ -625,7 +639,7 @@ static INPUT_PORTS_START( chessboard )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_START("LINE9")
PORT_START("LINE.7")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,143 @@
// license:BSD-3-Clause
// copyright-holders:hap
/******************************************************************************
Milton Bradley Phantom chess computer
TODO:
- no romdump of MB version yet
- sort out fphantom memory map
-------------------------------------------------------------------------------
Milton Bradley Phantom (1983):
sold as Milton in Europe, Phantom in UK, Grand Master in USA
Hardware notes:
- CPU: SY6502A, 2MHz?(resonator)
- ROM: 2x8KB?, labels C19679, C19680
- RAM: 2KB 4*2114
- magnetized x/y motor under chessboard, chesspieces have magnet underneath
- piezo speaker, LEDs
-------------------------------------------------------------------------------
Fidelity Phantom (1988, model 6100):
Fidelity bought the design from Milton Bradley and released their own version.
It has a small LCD panel added, the rest looks nearly the same from the outside.
Hardware notes:
- CPU: 6502, 5MHz?
- ROM 2*32KB
- RAM: 8KB?
- LCD driver, display panel for digits
- assume rest is same as MB version
After Fidelity was taken over by H&G, it was rereleased in 1990 as the Mephisto
Phantom. This is assumed to be identical.
******************************************************************************/
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "sound/speaker.h"
// internal artwork
#include "fphantom.lh" // clickable
class phantom_state : public driver_device
{
public:
phantom_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_speaker(*this, "speaker")
{ }
// devices/pointers
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
};
// machine start/reset
void phantom_state::machine_start()
{
// zerofill
// register for savestates
}
void phantom_state::machine_reset()
{
}
/******************************************************************************
I/O, Memory Maps
******************************************************************************/
static ADDRESS_MAP_START( fphantom_mem, AS_PROGRAM, 8, phantom_state )
AM_RANGE(0x0000, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0xffff) AM_ROM
ADDRESS_MAP_END
/******************************************************************************
Input Ports
******************************************************************************/
static INPUT_PORTS_START( fphantom )
INPUT_PORTS_END
/******************************************************************************
Machine Drivers
******************************************************************************/
static MACHINE_CONFIG_START( fphantom, phantom_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6502, 5000000) // 5MHz?
MCFG_CPU_PERIODIC_INT_DRIVER(phantom_state, irq0_line_hold, 600) // guessed
MCFG_CPU_PROGRAM_MAP(fphantom_mem)
MCFG_DEFAULT_LAYOUT(layout_fphantom)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
/******************************************************************************
ROM Definitions
******************************************************************************/
ROM_START( fphantom )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD("4_4.u4", 0x0000, 0x8000, CRC(e4181ba2) SHA1(1f77d1867c6f566be98645fc252a01108f412c96) )
ROM_LOAD("4_3c.u3", 0x8000, 0x8000, CRC(fb7c38ae) SHA1(a1aa7637705052cb4eec92644dc79aee7ba4d77c) )
ROM_END
/******************************************************************************
Drivers
******************************************************************************/
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
CONS( 1988, fphantom, 0, 0, fphantom, fphantom, driver_device, 0, "Fidelity Electronics", "Phantom (Fidelity)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )

View File

@ -22,8 +22,8 @@
2nd revision:
Spelling B (US), 1979
- TMS0270 MCU TMC0274*
- TMC0355 4KB VSM ROM CD2602*
- TMS0270 MCU TMC0274
- TMC0355 4KB VSM ROM CD2602
- 8-digit cyan VFD display
- 1-bit sound (indicated by a music note symbol on the top-right of the casing)
- note: much rarer than the 1978 version, not much luck finding one on eBay
@ -415,6 +415,21 @@ ROM_START( spellb )
ROM_LOAD( "tms1980_spellb_output.pla", 0, 525, CRC(1e26a719) SHA1(eb031aa216fe865bc9e40b070ca5de2b1509f13b) )
ROM_END
ROM_START( spellb79 )
ROM_REGION( 0x1000, "maincpu", 0 )
ROM_LOAD( "tmc0274n2l", 0x0000, 0x1000, CRC(98e3bd32) SHA1(e79b59ac29b0183bf1ee8d84b2944450c5e5d8fb) )
ROM_REGION( 1246, "maincpu:ipla", 0 )
ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) )
ROM_REGION( 2127, "maincpu:mpla", 0 )
ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) )
ROM_REGION( 1246, "maincpu:opla", 0 )
ROM_LOAD( "tms0270_spellb79_output.pla", 0, 1246, CRC(b95e35e6) SHA1(430917486856c9e6c28af10ff3758242048096c4) )
ROM_REGION( 0x1000, "tms6100", 0 )
ROM_LOAD( "cd2602.vsm", 0x0000, 0x1000, CRC(dd1fff8c) SHA1(f1760b29aa50fc96a1538db814cc73289654ac25) )
ROM_END
ROM_START( mrchalgr )
ROM_REGION( 0x1000, "maincpu", 0 )
@ -433,7 +448,8 @@ ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
COMP( 1978, spellb, 0, 0, rev1, spellb, driver_device, 0, "Texas Instruments", "Spelling B (1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
COMP( 1978, spellb, 0, 0, rev1, spellb, driver_device, 0, "Texas Instruments", "Spelling B (1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
COMP( 1979, spellb79, spellb, 0, rev2, spellb, driver_device, 0, "Texas Instruments", "Spelling B (1979 version)", MACHINE_SUPPORTS_SAVE )
COMP( 1979, mrchalgr, 0, 0, rev2, mrchalgr, driver_device, 0, "Texas Instruments", "Mr. Challenger", MACHINE_SUPPORTS_SAVE )
COMP( 1979, mrchalgr, 0, 0, rev2, mrchalgr, driver_device, 0, "Texas Instruments", "Mr. Challenger", MACHINE_SUPPORTS_SAVE )

View File

@ -22,6 +22,8 @@
#include "bus/neogeo/sbp_prot.h"
#include "bus/neogeo/kog_prot.h"
#include "bus/neogeo_ctrl/ctrl.h"
// On scanline 224, /VBLANK goes low 56 mclks (14 pixels) from the rising edge of /HSYNC.
// Two mclks after /VBLANK goes low, the hardware sets a pending IRQ1 flip-flop.
#define NEOGEO_VBLANK_IRQ_HTIM (attotime::from_ticks(56+2, NEOGEO_MASTER_CLOCK))

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<mamelayout version="2">
<!-- define elements -->
<element name="led" defstate="0">
<disk state="0"><color red="0.2" green="0.04" blue="0.046" /></disk>
<disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk>
</element>
<!-- build screen -->
<view name="Internal Layout">
<bounds left="0" right="100" top="0" bottom="100" />
<bezel name="0.0" element="led"><bounds x="1" y="1" width="1" height="1" /></bezel>
</view>
</mamelayout>

View File

@ -29756,6 +29756,9 @@ orleg2 // (c) 2007
orleg2o //
orleg2oa //
@source:phantom.cpp
fphantom //
@source:phc25.cpp
phc25 //
phc25j //
@ -34763,6 +34766,7 @@ vocaid //
@source:tispellb.cpp
mrchalgr //
spellb //
spellb79 //
@source:tk2000.cpp
tk2000 // Microdigital TK2000

View File

@ -431,6 +431,7 @@ peoplepc.cpp
pes.cpp
pet.cpp
phc25.cpp
phantom.cpp
phunsy.cpp
pimps.cpp
pipbug.cpp

View File

@ -134,8 +134,7 @@ public:
bool orientation_swap_xy =
(machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool rotation_swap_xy =
(target()->orientation() & ROT90) == ROT90 ||
(target()->orientation() & ROT270) == ROT270;
(target()->orientation() & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
return orientation_swap_xy ^ rotation_swap_xy;
};

View File

@ -992,14 +992,12 @@ int shaders::create_resources(bool reset, std::vector<ui_menu_item>& sliders)
post_effect->add_uniform("ScanlineBrightOffset", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_BRIGHT_OFFSET);
post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER);
post_effect->add_uniform("Floor", uniform::UT_VEC3, uniform::CU_POST_FLOOR);
post_effect->add_uniform("RotationType", uniform::UT_INT, uniform::CU_ROTATION_TYPE);
distortion_effect->add_uniform("VignettingAmount", uniform::UT_FLOAT, uniform::CU_POST_VIGNETTING);
distortion_effect->add_uniform("CurvatureAmount", uniform::UT_FLOAT, uniform::CU_POST_CURVATURE);
distortion_effect->add_uniform("RoundCornerAmount", uniform::UT_FLOAT, uniform::CU_POST_ROUND_CORNER);
distortion_effect->add_uniform("SmoothBorderAmount", uniform::UT_FLOAT, uniform::CU_POST_SMOOTH_BORDER);
distortion_effect->add_uniform("ReflectionAmount", uniform::UT_FLOAT, uniform::CU_POST_REFLECTION);
distortion_effect->add_uniform("RotationType", uniform::UT_INT, uniform::CU_ROTATION_TYPE);
initialized = true;
@ -1656,7 +1654,11 @@ void shaders::render_quad(poly_info *poly, int vertnum)
{
lines_pending = true;
curr_render_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0);
bool swap_xy = d3d->window().swap_xy();
int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width();
int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height();
curr_render_target = find_render_target(source_width, source_height, 0, 0);
d3d_render_target *rt = curr_render_target;
if (rt == nullptr)
@ -1679,7 +1681,11 @@ void shaders::render_quad(poly_info *poly, int vertnum)
{
curr_screen = curr_screen < num_screens ? curr_screen : 0;
curr_render_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0);
bool swap_xy = d3d->window().swap_xy();
int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width();
int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height();
curr_render_target = find_render_target(source_width, source_height, 0, 0);
d3d_render_target *rt = curr_render_target;
if (rt == nullptr)
@ -1820,14 +1826,21 @@ d3d_render_target* shaders::get_vector_target(render_primitive *prim)
return nullptr;
}
int target_width = static_cast<int>(prim->get_quad_width() + 0.5f);
int target_height = static_cast<int>(prim->get_quad_height() + 0.5f);
bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
int target_height = swap_xy
? static_cast<int>(prim->get_quad_width() + 0.5f)
: static_cast<int>(prim->get_quad_height() + 0.5f);
int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width();
int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height();
target_width *= oversampling_enable ? 2 : 1;
target_height *= oversampling_enable ? 2 : 1;
// find render target and check of the size of the target quad has changed
d3d_render_target *target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0);
d3d_render_target *target = find_render_target(source_width, source_height, 0, 0);
if (target != nullptr && target->target_width == target_width && target->target_height == target_height)
{
return target;
@ -1840,14 +1853,21 @@ d3d_render_target* shaders::get_vector_target(render_primitive *prim)
void shaders::create_vector_target(render_primitive *prim)
{
int target_width = static_cast<int>(prim->get_quad_width() + 0.5f);
int target_height = static_cast<int>(prim->get_quad_height() + 0.5f);
bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
int target_height = swap_xy
? static_cast<int>(prim->get_quad_width() + 0.5f)
: static_cast<int>(prim->get_quad_height() + 0.5f);
int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width();
int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height();
target_width *= oversampling_enable ? 2 : 1;
target_height *= oversampling_enable ? 2 : 1;
osd_printf_verbose("create_vector_target() - %d, %d\n", target_width, target_height);
if (!add_render_target(d3d, nullptr, d3d->get_width(), d3d->get_height(), target_width, target_height))
if (!add_render_target(d3d, nullptr, source_width, source_height, target_width, target_height))
{
vector_enable = false;
}
@ -2587,10 +2607,26 @@ void uniform::update()
}
case CU_SOURCE_DIMS:
{
if (shadersys->curr_texture)
bool vector_screen =
d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR;
if (vector_screen)
{
vec2f sourcedims = shadersys->curr_texture->get_rawdims();
m_shader->set_vector("SourceDims", 2, &sourcedims.c.x);
if (shadersys->curr_render_target)
{
// vector screen has no source texture, so take the source dimensions of the render target
float sourcedims[2] = {
static_cast<float>(shadersys->curr_render_target->width),
static_cast<float>(shadersys->curr_render_target->height) };
m_shader->set_vector("SourceDims", 2, sourcedims);
}
}
else
{
if (shadersys->curr_texture)
{
vec2f sourcedims = shadersys->curr_texture->get_rawdims();
m_shader->set_vector("SourceDims", 2, &sourcedims.c.x);
}
}
break;
}
@ -2623,35 +2659,6 @@ void uniform::update()
m_shader->set_bool("SwapXY", d3d->window().swap_xy());
break;
}
case CU_ORIENTATION_SWAP:
{
bool orientation_swap_xy =
(d3d->window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
m_shader->set_bool("OrientationSwapXY", orientation_swap_xy);
break;
}
case CU_ROTATION_SWAP:
{
bool rotation_swap_xy =
(d3d->window().target()->orientation() & ROT90) == ROT90 ||
(d3d->window().target()->orientation() & ROT270) == ROT270;
m_shader->set_bool("RotationSwapXY", rotation_swap_xy);
break;
}
case CU_ROTATION_TYPE:
{
int rotation_type =
(d3d->window().target()->orientation() & ROT90) == ROT90
? 1
: (d3d->window().target()->orientation() & ROT180) == ROT180
? 2
: (d3d->window().target()->orientation() & ROT270) == ROT270
? 3
: 0;
m_shader->set_int("RotationType", rotation_type);
break;
}
case CU_VECTOR_SCREEN:
{
bool vector_screen =

View File

@ -49,9 +49,6 @@ public:
CU_QUAD_DIMS,
CU_SWAP_XY,
CU_ORIENTATION_SWAP,
CU_ROTATION_SWAP,
CU_ROTATION_TYPE,
CU_VECTOR_SCREEN,
CU_NTSC_CCFREQ,

View File

@ -1398,13 +1398,13 @@ void renderer_d3d9::batch_vectors()
{
windows_options &options = downcast<windows_options &>(window().machine().options());
float quad_width = 0.0f;
float quad_height = 0.0f;
int vector_size = (options.antialias() ? 24 : 6);
m_vectorbatch = mesh_alloc(m_line_count * vector_size);
m_batchindex = 0;
float width = 0.0f;
float height = 0.0f;
static int start_index = 0;
int line_index = 0;
float period = options.screen_vector_time_period();
@ -1432,8 +1432,8 @@ void renderer_d3d9::batch_vectors()
case render_primitive::QUAD:
if (PRIMFLAG_GET_VECTORBUF(prim.flags))
{
width = prim.bounds.x1 - prim.bounds.x0;
height = prim.bounds.y1 - prim.bounds.y0;
quad_width = prim.bounds.x1 - prim.bounds.x0;
quad_height = prim.bounds.y1 - prim.bounds.y0;
}
break;
@ -1443,9 +1443,76 @@ void renderer_d3d9::batch_vectors()
}
}
// handle orientation and rotation for vectors as they were a texture
if (m_shaders->enabled())
{
bool orientation_swap_xy =
(window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool rotation_swap_xy =
(window().target()->orientation() & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
bool swap_xy = orientation_swap_xy ^ rotation_swap_xy;
bool rotation_0 = window().target()->orientation() == ROT0;
bool rotation_90 = window().target()->orientation() == ROT90;
bool rotation_180 = window().target()->orientation() == ROT180;
bool rotation_270 = window().target()->orientation() == ROT270;
bool flip_x =
((rotation_0 || rotation_270) && orientation_swap_xy) ||
((rotation_180 || rotation_270) && !orientation_swap_xy);
bool flip_y =
((rotation_0 || rotation_90) && orientation_swap_xy) ||
((rotation_180 || rotation_90) && !orientation_swap_xy);
float screen_width = static_cast<float>(this->get_width());
float screen_height = static_cast<float>(this->get_height());
float half_screen_width = screen_width * 0.5f;
float half_screen_height = screen_height * 0.5f;
float screen_swap_x_factor = 1.0f / screen_width * screen_height;
float screen_swap_y_factor = 1.0f / screen_height * screen_width;
float screen_quad_ratio_x = screen_width / quad_width;
float screen_quad_ratio_y = screen_height / quad_height;
if (swap_xy)
{
std::swap(screen_quad_ratio_x, screen_quad_ratio_y);
}
for (int batchindex = 0; batchindex < m_batchindex; batchindex++)
{
if (swap_xy)
{
m_vectorbatch[batchindex].x *= screen_swap_x_factor;
m_vectorbatch[batchindex].y *= screen_swap_y_factor;
std::swap(m_vectorbatch[batchindex].x, m_vectorbatch[batchindex].y);
}
if (flip_x)
{
m_vectorbatch[batchindex].x = screen_width - m_vectorbatch[batchindex].x;
}
if (flip_y)
{
m_vectorbatch[batchindex].y = screen_height - m_vectorbatch[batchindex].y;
}
// center
m_vectorbatch[batchindex].x -= half_screen_width;
m_vectorbatch[batchindex].y -= half_screen_height;
// correct screen/quad ratio (vectors are created in screen coordinates and have to be adjusted for texture corrdinates of the quad)
m_vectorbatch[batchindex].x *= screen_quad_ratio_x;
m_vectorbatch[batchindex].y *= screen_quad_ratio_y;
// un-center
m_vectorbatch[batchindex].x += half_screen_width;
m_vectorbatch[batchindex].y += half_screen_height;
}
}
// now add a polygon entry
m_poly[m_numpolys].init(D3DPT_TRIANGLELIST, m_line_count * (options.antialias() ? 8 : 2), vector_size * m_line_count, cached_flags,
m_texture_manager->get_vector_texture(), D3DTOP_MODULATE, 0.0f, 1.0f, width, height);
m_texture_manager->get_vector_texture(), D3DTOP_MODULATE, 0.0f, 1.0f, quad_width, quad_height);
m_numpolys++;
start_index += (int)((float)line_index * period);
@ -1470,13 +1537,22 @@ void renderer_d3d9::batch_vector(const render_primitive &prim, float line_time)
render_bounds b0, b1;
render_line_to_quad(&prim.bounds, effwidth, &b0, &b1);
float dx = b1.x1 - b0.x1;
float dy = b1.y1 - b0.y1;
float line_length = sqrtf(dx * dx + dy * dy);
vec2f& start = (get_vector_texture() ? get_vector_texture()->get_uvstart() : get_default_texture()->get_uvstart());
vec2f& stop = (get_vector_texture() ? get_vector_texture()->get_uvstop() : get_default_texture()->get_uvstop());
// iterate over AA steps
for (const line_aa_step *step = PRIMFLAG_GET_ANTIALIAS(prim.flags) ? line_aa_4step : line_aa_1step;
step->weight != 0; step++)
{
// get a pointer to the vertex buffer
if (m_vectorbatch == nullptr)
{
return;
}
m_vectorbatch[m_batchindex + 0].x = b0.x0 + step->xoffs;
m_vectorbatch[m_batchindex + 0].y = b0.y0 + step->yoffs;
@ -1492,10 +1568,6 @@ void renderer_d3d9::batch_vector(const render_primitive &prim, float line_time)
m_vectorbatch[m_batchindex + 5].x = b1.x1 + step->xoffs;
m_vectorbatch[m_batchindex + 5].y = b1.y1 + step->yoffs;
float dx = b1.x1 - b0.x1;
float dy = b1.y1 - b0.y1;
float line_length = sqrtf(dx * dx + dy * dy);
// determine the color of the line
INT32 r = (INT32)(prim.color.r * step->weight * 255.0f);
INT32 g = (INT32)(prim.color.g * step->weight * 255.0f);
@ -1518,9 +1590,6 @@ void renderer_d3d9::batch_vector(const render_primitive &prim, float line_time)
if (a > 255) a = 255;
DWORD color = D3DCOLOR_ARGB(a, r, g, b);
vec2f& start = (get_vector_texture() ? get_vector_texture()->get_uvstart() : get_default_texture()->get_uvstart());
vec2f& stop = (get_vector_texture() ? get_vector_texture()->get_uvstop() : get_default_texture()->get_uvstop());
m_vectorbatch[m_batchindex + 0].u0 = start.c.x;
m_vectorbatch[m_batchindex + 0].v0 = start.c.y;
m_vectorbatch[m_batchindex + 1].u0 = start.c.x;