summaryrefslogtreecommitdiff
path: root/libpcsxcore/pgxp_value.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpcsxcore/pgxp_value.c')
-rw-r--r--libpcsxcore/pgxp_value.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libpcsxcore/pgxp_value.c b/libpcsxcore/pgxp_value.c
new file mode 100644
index 00000000..5d29097d
--- /dev/null
+++ b/libpcsxcore/pgxp_value.c
@@ -0,0 +1,28 @@
+#include "pgxp_value.h"
+
+
+void MakeValid(PGXP_value *pV, u32 psxV)
+{
+ psx_value psx;
+ psx.d = psxV;
+ if (!pV->valid)
+ {
+ pV->x = psx.sw.l;
+ pV->y = psx.sw.h;
+ pV->z = 1.f;
+ pV->valid = 1;
+ pV->value = psx.d;
+ }
+}
+
+void Validate(PGXP_value *pV, u32 psxV)
+{
+ // assume pV is not NULL
+ pV->valid = (pV->valid) && (pV->value == psxV);
+}
+
+void MaskValidate(PGXP_value *pV, u32 psxV, u32 mask)
+{
+ // assume pV is not NULL
+ pV->valid = (pV->valid) && ((pV->value & mask) == (psxV & mask));
+} \ No newline at end of file