Basically, it's absurd to try to fix a problem that exists in 100s of games at a codepath which is only followed by dozens of games.
]]>That said, just because you don't understand the change doesn't make it a "random numerical hack". It's very specific. You are off by 1. This adds "1.0" and corrects the texture offset. It does so without introducing any regressions that I can see, and I mentioned Dragon Quest only because your comment did, not because it was the only thing I looked at.
What I don't know is whether you are off by exactly 1.0, or if there is some rounding going on in the hardware that the code is instead truncating.
Your suggestion that the bug probably occurs later in the sequence is unlikely - if you mess with the texture coordinates any later than this line of code it affects all texture modes and DOES break other titles.
This line is pretty hairy - it's not impossible that an unexpected truncation is occurring. I suppose we could take this line apart and examine it more closely, but the assertion that this line is 100% correct appears to be made without analysis.
That said, it's your project. Thanks for the consideration.
]]>Thanks for your research, but sorry, at this point, we're not going to add a random numerical hack to fix one game. Especially not one that changes something that is actually 100% correct. The bug is deeper in software rasterizer in the details of the texturing.
We may add a system for per-game hacks at some point, and if we ever do, we'll be sure to add this hack.
Dragon quest 4 I think wasn't written there as a tricky test, just as any test case at all to check for regressions.
]]>It only shows up in one texture mode, and only on the Y axis. This patch reproduces what I had in my codebase to work around it. I don't profess to understand exactly what is wrong, but I suspect it's a rounding error and so adding a fixed point 1 is more a workaround than a fix. However, I tested with all the files I have handy (include the mentioned Dragon Quest IV) and see no new errors, plus Cool Herders now looks like hardware, so I think it's good, at least for now.
--- gfx3d.cpp 2015-09-18 12:35:00.759674100 +0800
+++ gfx3d-new.cpp 2015-09-18 12:07:10.749484100 +0800
@@ -1306,7 +1306,7 @@ static void gfx3d_glTexCoord(s32 val)
{
//dragon quest 4 overworld will test this
last_s = (s32)(((s64)(_s<<12) * mtxCurrent[3][0] + (s64)(_t<<12) * mtxCurrent[3][4] + ((s64)mtxCurrent[3][8]<<12) + ((s64)mtxCurrent[3][12]<<12))>>24);
- last_t = (s32)(((s64)(_s<<12) * mtxCurrent[3][1] + (s64)(_t<<12) * mtxCurrent[3][5] + ((s64)mtxCurrent[3][9]<<12) + ((s64)mtxCurrent[3][13]<<12))>>24);
+ last_t = (s32)(((s64)(_s<<12) * mtxCurrent[3][1] + (s64)(_t<<12) * mtxCurrent[3][5] + ((s64)mtxCurrent[3][9]<<12) + ((s64)mtxCurrent[3][13]<<12))>>24) + 16;
}
else if(texCoordinateTransform == 0)
{