chihiro.cpp: game ghostsqu boots too (nw)

This commit is contained in:
yz70s 2016-07-31 22:16:44 +02:00
parent 91fcff1b6d
commit 8b9b6abc5a
3 changed files with 17 additions and 13 deletions

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;