1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Disable hardware lighting for ucodes with custom lighting methods.

Fixed #1542 Turok 2/Turok 3 Per Pixel Lighting Rainbow Weapons.
This commit is contained in:
Sergey Lipskiy 2017-10-31 17:42:48 +07:00
parent adc2b547e8
commit dcf8784dca
8 changed files with 29 additions and 11 deletions

View File

@ -6,6 +6,7 @@
#include "RSP.h"
#include "PluginAPI.h"
#include "Config.h"
#include "GBI.h"
#include "wst.h"
void Config::resetToDefaults()
@ -112,3 +113,10 @@ void Config::resetToDefaults()
debug.dumpMode = 0;
}
bool isHWLightingAllowed()
{
if (config.generalEmulation.enableHWLighting == 0)
return false;
return GBI.isHWLSupported();
}

View File

@ -200,4 +200,6 @@ void Config_LoadConfig();
void Config_DoConfig(/*HWND hParent*/);
#endif
bool isHWLightingAllowed();
#endif // CONFIG_H

View File

@ -60,7 +60,7 @@ SpecialMicrocodeInfo specialMicrocodes[] =
{ Turbo3D, false, true, 0x2bdcfc8a, "Turbo3D" },
{ F3DEX2CBFD, true, true, 0x1b4ace88, "Conker's Bad Fur Day" },
{ F3DSWRS, false, false, 0xda51ccdb, "Star Wars RS" },
{ F3DZEX2, true, true, 0xd39a0d4f, "Animal Forest" },
{ F3DZEX2MM, true, true, 0xd39a0d4f, "Animal Forest" },
{ S2DEX2, false, true, 0x2c399dd, "Animal Forest" },
{ T3DUX, false, true, 0xbad437f2, "T3DUX vers 0.83 for Toukon Road" },
{ T3DUX, false, true, 0xd0a1aa3d, "T3DUX vers 0.85 for Toukon Road 2" },
@ -141,10 +141,14 @@ bool GBIInfo::isHWLSupported() const
if (m_pCurrent == nullptr)
return false;
switch (m_pCurrent->type) {
case L3D:
case L3DEX:
case L3DEX2:
case S2DEX:
case S2DEX2:
case F3DDKR:
case F3DJFG:
case F3DZEX2MM:
case F3DEX2CBFD:
case F3DEX2ACCLAIM:
return false;
@ -191,7 +195,8 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
case F3DEX2CBFD: F3DEX2CBFD_Init(); break;
case F3DSETA: F3DSETA_Init(); break;
case F3DGOLDEN: F3DGOLDEN_Init(); break;
case F3DZEX2: F3DZEX2_Init(); break;
case F3DZEX2OOT:
case F3DZEX2MM: F3DZEX2_Init(); break;
case F3DTEXA: F3DTEXA_Init(); break;
case T3DUX: F3D_Init(); break;
case F3DEX2ACCLAIM: F3DEX2ACCLAIM_Init(); break;
@ -304,7 +309,10 @@ void GBIInfo::loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize)
type = F3DFLX2;
else if (strncmp(&uc_str[14], "F3DZEX", 6) == 0) {
// Zelda games
type = F3DZEX2;
if (uc_str[34] == '6')
type = F3DZEX2OOT;
else
type = F3DZEX2MM;
current.combineMatrices = false;
} else if (strncmp(&uc_str[14], "F3DTEX/A", 8) == 0)
type = F3DTEXA;

View File

@ -23,9 +23,10 @@
#define Turbo3D 14
#define ZSortp 15
#define F3DSETA 16
#define F3DZEX2 17
#define F3DTEXA 18
#define T3DUX 19
#define F3DZEX2OOT 17
#define F3DZEX2MM 18
#define F3DTEXA 19
#define T3DUX 20
#define F3DEX2ACCLAIM 21
#define F3DAM 22
#define F3DSWRS 23

View File

@ -1873,8 +1873,7 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
const bool bUseTextures = combinerInputs.usesTexture();
const bool bIsRect = _key.isRectKey();
const bool bUseHWLight = !bIsRect && // Rects not use lighting
config.generalEmulation.enableHWLighting != 0 &&
GBI.isHWLSupported() &&
isHWLightingAllowed() &&
combinerInputs.usesShadeColor();
if (bUseHWLight)

View File

@ -195,7 +195,7 @@ void BufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParamete
{
_updateTrianglesBuffers(_params);
if (config.generalEmulation.enableHWLighting != 0)
if (isHWLightingAllowed())
glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight));
if (_params.elements == nullptr) {

View File

@ -69,7 +69,7 @@ void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParame
glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_FALSE, sizeof(SPVertex), ptr);
}
if (config.generalEmulation.enableHWLighting != 0)
if (isHWLightingAllowed())
glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight));
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);

View File

@ -477,7 +477,7 @@ template <u32 VNUM>
void gSPLightVertexStandard(u32 v, SPVertex * spVtx)
{
#ifndef __NEON_OPT
if (config.generalEmulation.enableHWLighting == 0) {
if (!isHWLightingAllowed()) {
for(int j = 0; j < VNUM; ++j) {
SPVertex & vtx = spVtx[v+j];
vtx.r = gSP.lights.rgb[gSP.numLights][R];