From 97105b26f2194dcfb50addf0a421db9debd797d5 Mon Sep 17 00:00:00 2001 From: iCatButler Date: Mon, 4 Jul 2016 11:48:00 +0100 Subject: Change "valid" flag to multiple bit flags Validity of a pgxp value can now be set for any of four components using individual bit flags. This also allows the potential expansion of more flag data for each component. --- libpcsxcore/pgxp_value.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libpcsxcore/pgxp_value.c') diff --git a/libpcsxcore/pgxp_value.c b/libpcsxcore/pgxp_value.c index 5d29097d..5c46a7d4 100644 --- a/libpcsxcore/pgxp_value.c +++ b/libpcsxcore/pgxp_value.c @@ -5,12 +5,12 @@ void MakeValid(PGXP_value *pV, u32 psxV) { psx_value psx; psx.d = psxV; - if (!pV->valid) + if (VALID_01 != (pV->flags & VALID_01)) { pV->x = psx.sw.l; pV->y = psx.sw.h; pV->z = 1.f; - pV->valid = 1; + pV->flags |= VALID_ALL; pV->value = psx.d; } } @@ -18,11 +18,11 @@ void MakeValid(PGXP_value *pV, u32 psxV) void Validate(PGXP_value *pV, u32 psxV) { // assume pV is not NULL - pV->valid = (pV->valid) && (pV->value == psxV); + pV->flags &= pV->value == psxV ? ALL : INV_VALID_ALL; } -void MaskValidate(PGXP_value *pV, u32 psxV, u32 mask) +void MaskValidate(PGXP_value *pV, u32 psxV, u32 mask, u32 validMask) { // assume pV is not NULL - pV->valid = (pV->valid) && ((pV->value & mask) == (psxV & mask)); + pV->flags &= ((pV->value & mask) == (psxV & mask)) ? ALL : (ALL ^ (validMask)); } \ No newline at end of file -- cgit v1.2.3