From 205cb2c29df59326bc6febc7ccff5567c7ee5d8a Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 15 Jul 2022 17:50:41 +0200 Subject: [PATCH] iCore: Fix more negative array index warnings. Forgot these. Codacy. --- pcsx2/x86/iCore.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pcsx2/x86/iCore.cpp b/pcsx2/x86/iCore.cpp index e0bf5001f1..38e5ff1e2a 100644 --- a/pcsx2/x86/iCore.cpp +++ b/pcsx2/x86/iCore.cpp @@ -400,13 +400,21 @@ int _allocGPRtoXMMreg(int xmmreg, int gprreg, int mode) if (xmmreg == -1) xmmreg = _getFreeXMMreg(); - g_xmmtypes[xmmreg] = XMMT_INT; - xmmregs[xmmreg].inuse = 1; - xmmregs[xmmreg].type = XMMTYPE_GPRREG; - xmmregs[xmmreg].reg = gprreg; - xmmregs[xmmreg].mode = mode; - xmmregs[xmmreg].needed = 1; - xmmregs[xmmreg].counter = g_xmmAllocCounter++; + if (xmmreg == -1) + { + pxFailDev("*PCSX2*: XMM Reg Allocation Error in _allocGPRtoXMMreg()!"); + throw Exception::FailedToAllocateRegister(); + } + else + { + g_xmmtypes[xmmreg] = XMMT_INT; + xmmregs[xmmreg].inuse = 1; + xmmregs[xmmreg].type = XMMTYPE_GPRREG; + xmmregs[xmmreg].reg = gprreg; + xmmregs[xmmreg].mode = mode; + xmmregs[xmmreg].needed = 1; + xmmregs[xmmreg].counter = g_xmmAllocCounter++; + } if (mode & MODE_READ) {