0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 13:55:47 +00:00

SNK 40th Anniversary Out of Bounds Fix (#557)

* Check vertex array is enabled before reading constant attribute to avoid out of bounds exception

* Removed new line
This commit is contained in:
BaronKiko 2019-01-18 18:31:25 +00:00 committed by gdkchan
parent 0cd5ba03fe
commit 3731d0ce84

View file

@ -784,12 +784,18 @@ namespace Ryujinx.Graphics.Graphics3d
bool IsRgba = ((Packed >> 31) & 1) != 0; bool IsRgba = ((Packed >> 31) & 1) != 0;
// Check vertex array is enabled to avoid out of bounds exception when reading bytes
bool Enable = (ReadRegister(NvGpuEngine3dReg.VertexArrayNControl + ArrayIndex * 4) & 0x1000) != 0;
//Note: 16 is the maximum size of an attribute, //Note: 16 is the maximum size of an attribute,
//having a component size of 32-bits with 4 elements (a vec4). //having a component size of 32-bits with 4 elements (a vec4).
if (Enable)
{
byte[] Data = Vmm.ReadBytes(VbPosition + Offset, 16); byte[] Data = Vmm.ReadBytes(VbPosition + Offset, 16);
Attribs[ArrayIndex].Add(new GalVertexAttrib(Attr, IsConst, Offset, Data, Size, Type, IsRgba)); Attribs[ArrayIndex].Add(new GalVertexAttrib(Attr, IsConst, Offset, Data, Size, Type, IsRgba));
} }
}
State.VertexBindings = new GalVertexBinding[32]; State.VertexBindings = new GalVertexBinding[32];