PK U EK diff.patchdiff -ur --binary model3emu/Src/Graphics/IRender3D.h model3emu-patch/Src/Graphics/IRender3D.h --- model3emu/Src/Graphics/IRender3D.h 2017-10-05 01:22:58.000000000 +0200 +++ model3emu-patch/Src/Graphics/IRender3D.h 2017-10-05 00:52:41.352514700 +0200 @@ -19,7 +19,8 @@ virtual void SetStepping(int stepping) = 0; virtual bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes, unsigned totalXRes, unsigned totalYRes) = 0; virtual void SetSunClamp(bool enable) = 0; - + virtual void SetSignedShade(bool enable) = 0; + virtual ~IRender3D() { } diff -ur --binary model3emu/Src/Graphics/Legacy3D/Legacy3D.cpp model3emu-patch/Src/Graphics/Legacy3D/Legacy3D.cpp --- model3emu/Src/Graphics/Legacy3D/Legacy3D.cpp 2017-10-05 01:22:57.000000000 +0200 +++ model3emu-patch/Src/Graphics/Legacy3D/Legacy3D.cpp 2017-10-05 00:54:50.868139700 +0200 @@ -1301,6 +1301,10 @@ { } +void CLegacy3D::SetSignedShade(bool enable) +{ +} + CLegacy3D::CLegacy3D(const Util::Config::Node &config) : m_config(config) { diff -ur --binary model3emu/Src/Graphics/Legacy3D/Legacy3D.h model3emu-patch/Src/Graphics/Legacy3D/Legacy3D.h --- model3emu/Src/Graphics/Legacy3D/Legacy3D.h 2017-10-05 01:22:57.000000000 +0200 +++ model3emu-patch/Src/Graphics/Legacy3D/Legacy3D.h 2017-10-05 00:54:02.060522500 +0200 @@ -337,7 +337,17 @@ * enable Set clamp mode */ void SetSunClamp(bool enable); - + + /* + * SetSignedShade(bool enable); + * + * Sets the sign-ness of fixed shading value + * + * Parameters: + * enable Fixed shading is expressed as signed value + */ + void SetSignedShade(bool enable); + /* * CLegacy3D(void): * ~CLegacy3D(void): diff -ur --binary model3emu/Src/Graphics/New3D/New3D.cpp model3emu-patch/Src/Graphics/New3D/New3D.cpp --- model3emu/Src/Graphics/New3D/New3D.cpp 2017-10-05 01:22:57.000000000 +0200 +++ model3emu-patch/Src/Graphics/New3D/New3D.cpp 2017-10-05 01:11:55.236303800 +0200 @@ -15,9 +15,9 @@ namespace New3D { CNew3D::CNew3D(const Util::Config::Node &config, std::string gameName) - : m_r3dShader(config), - m_r3dScrollFog(config), - m_gameName(gameName) + : m_r3dShader(config), + m_r3dScrollFog(config), + m_gameName(gameName) { m_cullingRAMLo = nullptr; m_cullingRAMHi = nullptr; @@ -25,6 +25,10 @@ m_vrom = nullptr; m_textureRAM = nullptr; m_sunClamp = true; + m_shadeIsSigned = true; + + // Fall-back mechanism for games with patched (not working) JTAG + if (m_gameName == "swtrilgy") m_shadeIsSigned = false; } CNew3D::~CNew3D() @@ -1134,7 +1138,7 @@ float shade; //========== - if (ph.SpecularEnabled()) { + if (!m_shadeIsSigned) { shade = (ix & 0xFF) / 255.f; // Star wars is the only game to use unsigned fixed shaded values. It's also the only game to set the specular flag on these polys } else { @@ -1603,5 +1607,9 @@ m_sunClamp = enable; } -} // New3D +void CNew3D::SetSignedShade(bool enable) +{ + m_shadeIsSigned = enable; +} +} // New3D diff -ur --binary model3emu/Src/Graphics/New3D/New3D.h model3emu-patch/Src/Graphics/New3D/New3D.h --- model3emu/Src/Graphics/New3D/New3D.h 2017-10-05 01:22:58.000000000 +0200 +++ model3emu-patch/Src/Graphics/New3D/New3D.h 2017-10-05 00:52:12.702124100 +0200 @@ -152,6 +152,16 @@ void SetSunClamp(bool enable); /* + * SetSignedShade(bool enable); + * + * Sets the sign-ness of fixed shading value + * + * Parameters: + * enable Fixed shading is expressed as signed value + */ + void SetSignedShade(bool enable); + + /* * CRender3D(config): * ~CRender3D(void): * @@ -203,7 +213,10 @@ // Misc std::string m_gameName; + + // GPU configuration bool m_sunClamp; + bool m_shadeIsSigned; // Stepping int m_step; diff -ur --binary model3emu/Src/Model3/Real3D.cpp model3emu-patch/Src/Model3/Real3D.cpp --- model3emu/Src/Model3/Real3D.cpp 2017-10-05 01:22:56.000000000 +0200 +++ model3emu-patch/Src/Model3/Real3D.cpp 2017-10-05 00:57:16.571264700 +0200 @@ -153,7 +153,9 @@ static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[]) { bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0; + bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0; Render3D->SetSunClamp(!noSunClamp); + Render3D->SetSignedShade(shadeIsSigned); } void CReal3D::BeginVBlank(int statusCycles) PK U EK $ diff.patch 0=h=0=h=8g=PK\?