Merge branch 'master' into separate_softlist_image_load

This commit is contained in:
Nathan Woods 2016-07-31 22:42:27 -04:00
commit 7b7faffd01
6 changed files with 112 additions and 41 deletions

View File

@ -189,6 +189,15 @@ ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
return INPUT_PORTS_NAME( keyboard );
}
static MACHINE_CONFIG_FRAGMENT( keyboard_components )
MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz)
MACHINE_CONFIG_END
machine_config_constructor apricot_keyboard_hle_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( keyboard_components );
}
//**************************************************************************
// LIVE DEVICE
@ -202,7 +211,9 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__),
device_apricot_keyboard_interface(mconfig, *this),
device_buffered_serial_interface(mconfig, *this),
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c")
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c"),
m_rtc(*this, "rtc"),
m_rtc_index(0)
{
}
@ -234,19 +245,72 @@ void apricot_keyboard_hle_device::device_reset()
start_processing(attotime::from_hz(7800));
}
//-------------------------------------------------
// tra_callback - send bit to host
//-------------------------------------------------
void apricot_keyboard_hle_device::tra_callback()
{
m_host->in_w(transmit_register_get_data_bit());
}
void apricot_keyboard_hle_device::tra_complete()
{
device_buffered_serial_interface::tra_complete();
}
//-------------------------------------------------
// received_byte - handle received byte
//-------------------------------------------------
void apricot_keyboard_hle_device::received_byte(UINT8 byte)
{
logerror("received command: %02x\n", byte);
if ((byte & 0xf0) == 0xf0)
{
// rtc data
if (m_rtc_index >= 0)
{
m_rtc->address_w(m_rtc_index--);
m_rtc->data_w(machine().driver_data()->generic_space(), 0, byte);
}
}
else
{
switch (byte)
{
case CMD_REQ_TIME_AND_DATE:
logerror("System requests current time\n");
// remove pending keys just in case
clear_fifo();
// send time prefix
transmit_byte(0xed);
// make rtc chip ready
m_rtc->cs_w(1);
m_rtc->read_w(1);
// send bcd encoded date and time to system
for (int i = 12; i >= 0; i--)
{
m_rtc->address_w(i);
transmit_byte(0xf0 | m_rtc->data_r(machine().driver_data()->generic_space(), 0));
}
break;
case CMD_SET_TIME_AND_DATE:
logerror("System requests to set time\n");
// we start with the year
m_rtc_index = 12;
// make rtc chip ready
m_rtc->cs_w(1);
m_rtc->write_w(1);
break;
default:
logerror("Unhandled command: %02x\n", byte);
}
}
}
//-------------------------------------------------
@ -269,20 +333,15 @@ void apricot_keyboard_hle_device::key_break(UINT8 row, UINT8 column)
transmit_byte(0x80 | (row << 3) | column);
}
//-------------------------------------------------
// out_w - receive bit from host
//-------------------------------------------------
void apricot_keyboard_hle_device::out_w(int state)
{
device_buffered_serial_interface::rx_w(state);
}
//-------------------------------------------------
// transmit_byte - send a byte or queue it
//-------------------------------------------------
void apricot_keyboard_hle_device::transmit_byte(UINT8 byte)
{
device_buffered_serial_interface::transmit_byte(byte);
}
//-------------------------------------------------
// device_timer - device-specific timer
//-------------------------------------------------

View File

@ -14,6 +14,7 @@
#include "emu.h"
#include "keyboard.h"
#include "machine/keyboard.h"
#include "machine/msm5832.h"
//**************************************************************************
@ -24,7 +25,7 @@
class apricot_keyboard_hle_device : public device_t,
public device_apricot_keyboard_interface,
public device_buffered_serial_interface<8>,
public device_buffered_serial_interface<16>,
protected device_matrix_keyboard_interface<13>
{
public:
@ -37,22 +38,29 @@ public:
protected:
// device_t overrides
virtual ioport_constructor device_input_ports() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_start() override;
virtual void device_reset() override;
// device_buffered_serial_interface overrides
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void received_byte(UINT8 byte) override;
// device_matrix_keyboard_interface overrides
virtual void key_make(UINT8 row, UINT8 column) override;
virtual void key_break(UINT8 row, UINT8 column) override;
void transmit_byte(UINT8 byte);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
required_device<msm5832_device> m_rtc;
enum {
CMD_REQ_TIME_AND_DATE = 0xe1,
CMD_SET_TIME_AND_DATE = 0xe4
};
int m_rtc_index;
};

View File

@ -297,15 +297,22 @@ protected:
std::string m_basename_noext;
std::string m_filetype;
// working directory; persists across mounts
std::string m_working_directory;
// Software information
std::string m_full_software_name;
const software_info *m_software_info_ptr;
const software_part *m_software_part_ptr;
std::string m_software_list_name;
private:
static image_error_t image_error_from_file_error(osd_file::error filerr);
bool schedule_postload_hard_reset_if_needed();
// creation info
formatlist_type m_formatlist;
// working directory; persists across mounts
std::string m_working_directory;
// info read from the hash file/software list
std::string m_longname;
std::string m_manufacturer;
@ -331,13 +338,6 @@ protected:
bool m_user_loadable;
bool m_is_loading;
private:
static image_error_t image_error_from_file_error(osd_file::error filerr);
bool schedule_postload_hard_reset_if_needed();
// creation info
formatlist_type m_formatlist;
};
// iterator

View File

@ -710,6 +710,7 @@ void chihiro_state::hack_eeprom()
m_maincpu->space(0).write_byte(0x3b767, 0xc3);
}
#define HACK_ITEMS 4
static const struct {
const char *game_name;
const bool disable_usb;
@ -717,10 +718,11 @@ static const struct {
UINT32 address;
UINT8 write_byte;
} modify[16];
} hacks[3] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
{ "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
};
} hacks[HACK_ITEMS] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
{ "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
{ "ghostsqu", false, { { 0x78833/*4d833*/, 0x90 },{ 0x78834/*4d834*/, 0x90 }, { 0, 0 } } },
};
void chihiro_state::hack_usb()
{
@ -1569,7 +1571,7 @@ void chihiro_state::machine_start()
machine().debugger().console().register_command("chihiro", CMDFLAG_NONE, 0, 1, 4, std::bind(&chihiro_state::debug_commands, this, _1, _2, _3));
}
usbhack_index = -1;
for (int a = 1; a < 3; a++)
for (int a = 1; a < HACK_ITEMS; a++)
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
usbhack_index = a;
if (hacks[a].disable_usb == true)

View File

@ -707,7 +707,7 @@ public:
float modelview[4][4];
float modelview_inverse[4][4];
float projection[4][4];
float traslate[4];
float translate[4];
float scale[4];
} matrix;
struct {

View File

@ -2366,6 +2366,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *desti
// should use either the vertex program or transformation matrices
if (vertex_pipeline == 4) {
// transformation matrices
// this part needs more testing
for (m = 0; m < count; m++) {
for (int i = 0; i < 4; i++) {
t[i] = 0;
@ -2382,7 +2383,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *desti
v[i] *= matrix.scale[i];
}
for (int i = 0; i < 3; i++) {
v[i] += matrix.traslate[i];
v[i] += matrix.translate[i];
}*/
destination[m].w = v[3];
destination[m].x = (v[0] / v[3])*supersample_factor_x; // source[m].attribute[0].fv[0];
@ -2681,7 +2682,7 @@ UINT32 nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render
vi[2] = &_v3;
for (int n=0;n < 3;n++)
{
// remove traslate
// remove translate
vi[n]->x = vi[n]->x - translatex;
vi[n]->y = vi[n]->y - translatey;
vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] - translatez;
@ -2733,7 +2734,7 @@ UINT32 nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render
vo[n].x = vo[n].x * scalex;
vo[n].y = vo[n].y * scaley;
vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] * scalez;
// apply traslate
// apply translate
vo[n].x = vo[n].x + translatex;
vo[n].y = vo[n].y + translatey;
vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] + translatez;
@ -3503,15 +3504,15 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
*(UINT32 *)(&matrix.projection[maddress >> 2][maddress & 3]) = data;
countlen--;
}
// viewport traslate
// viewport translate
if ((maddress >= 0x0a20) && (maddress < 0x0a30)) {
maddress = (maddress - 0x0a20) / 4;
*(UINT32 *)(&matrix.traslate[maddress]) = data;
*(UINT32 *)(&matrix.translate[maddress]) = data;
// set corresponding vertex shader constant too
vertexprogram.exec.c_constant[59].iv[maddress] = data; // constant -37
#ifdef LOG_NV2A
if (maddress == 3)
machine().logerror("viewport traslate = {%f %f %f %f}\n", matrix.traslate[0], matrix.traslate[1], matrix.traslate[2], matrix.traslate[3]);
machine().logerror("viewport translate = {%f %f %f %f}\n", matrix.translate[0], matrix.translate[1], matrix.translate[2], matrix.translate[3]);
#endif
countlen--;
}
@ -3588,7 +3589,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN
#ifdef LOG_NV2A
if ((vertexprogram.upload_parameter_index == 58) || (vertexprogram.upload_parameter_index == 59))
machine().logerror("vp constant %d (%s) = {%f %f %f %f}\n", vertexprogram.upload_parameter_index,
vertexprogram.upload_parameter_index == 58 ? "viewport scale" : "viewport traslate",
vertexprogram.upload_parameter_index == 58 ? "viewport scale" : "viewport translate",
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[0],
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[1],
vertexprogram.exec.c_constant[vertexprogram.upload_parameter_index].fv[2],
@ -4655,6 +4656,7 @@ WRITE32_MEMBER(nv2a_renderer::geforce_w)
if (((*dmaput == 0x048cf000) && (*dmaget == 0x07f4d000)) || // only for outr2
((*dmaput == 0x045cd000) && (*dmaget == 0x07f4d000)) || // only for scg06nt
((*dmaput == 0x0494c000) && (*dmaget == 0x07f4d000)) || // only for wangmid
((*dmaput == 0x05acd000) && (*dmaget == 0x07f4d000)) || // only for ghostsqu
((*dmaput == 0x07dca000) && (*dmaget == 0x07f4d000))) // only for crtaxihr
{
*dmaget = *dmaput;