| 1 | /* Mednafen - Multi-system Emulator |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 | */ |
| 17 | |
| 18 | #include "vb.h"cxx . . $ `<file>/mednafen/vb/vb.h`/ |
| 19 | #include "vip.h"cxx . . $ `<file>/mednafen/vb/vip.h`/ |
| 20 | #include <math.h> |
| 21 | |
| 22 | static inline void VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).(const char *format, ...) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | static uint8cxx . . $ uint8# FBcxx . . $ FB.[2][2][0x6000]; |
| 27 | static uint16cxx . . $ uint16# CHR_RAMcxx . . $ CHR_RAM.[0x8000 / sizeof(uint16cxx . . $ uint16#)]; |
| 28 | static uint16cxx . . $ uint16# DRAMcxx . . $ DRAM.[0x20000 / sizeof(uint16cxx . . $ uint16#)]; |
| 29 | |
| 30 | // Helper functions for the V810 VIP RAM read/write handlers. |
| 31 | // "Memory Array 16 (Write/Read) (16/8)" |
| 32 | #define VIP__GETP16cxx . . $ `mednafen/vb/vip.cpp:32:9`!(array, address) ( (uint16 *)&((uint8 *)(array))[(address)] ) |
| 33 | |
| 34 | #ifdef MSB_FIRST |
| 35 | #define VIP__GETP8(array, address) ( &((uint8 *)(array))[(address) ^ 1] ) |
| 36 | #else |
| 37 | #define VIP__GETP8cxx . . $ `mednafen/vb/vip.cpp:37:9`!(array, address) ( &((uint8 *)(array))[(address)] ) |
| 38 | #endif |
| 39 | |
| 40 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void VIP_MA16W16cxx . . $ VIP_MA16W16(f1e3642c05758293).(uint16cxx . . $ uint16# *array, const uint32cxx . . $ uint32# v810_address, const uint16cxx . . $ uint16# value) |
| 41 | { |
| 42 | *(VIP__GETP16cxx . . $ `mednafen/vb/vip.cpp:32:9`!(array, v810_address)) = value; |
| 43 | } |
| 44 | |
| 45 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint16cxx . . $ uint16# VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(uint16cxx . . $ uint16# *array, const uint32cxx . . $ uint32# v810_address) |
| 46 | { |
| 47 | return *(VIP__GETP16cxx . . $ `mednafen/vb/vip.cpp:32:9`!(array, v810_address)); |
| 48 | } |
| 49 | |
| 50 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void VIP_MA16W8cxx . . $ VIP_MA16W8(64cc85ef310d95e7).(uint16cxx . . $ uint16# *array, const uint32cxx . . $ uint32# v810_address, const uint8cxx . . $ uint8# value) |
| 51 | { |
| 52 | *(VIP__GETP8cxx . . $ `mednafen/vb/vip.cpp:37:9`!(array, v810_address)) = value; |
| 53 | } |
| 54 | |
| 55 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint8cxx . . $ uint8# VIP_MA16R8cxx . . $ VIP_MA16R8(3ecc0cc8372cfe5).(uint16cxx . . $ uint16# *array, const uint32cxx . . $ uint32# v810_address) |
| 56 | { |
| 57 | return *(VIP__GETP8cxx . . $ `mednafen/vb/vip.cpp:37:9`!(array, v810_address)); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | #define INT_SCAN_ERRcxx . . $ `mednafen/vb/vip.cpp:61:9`! 0x0001 |
| 62 | #define INT_LFB_ENDcxx . . $ `mednafen/vb/vip.cpp:62:9`! 0x0002 |
| 63 | #define INT_RFB_ENDcxx . . $ `mednafen/vb/vip.cpp:63:9`! 0x0004 |
| 64 | #define INT_GAME_STARTcxx . . $ `mednafen/vb/vip.cpp:64:9`! 0x0008 |
| 65 | #define INT_FRAME_STARTcxx . . $ `mednafen/vb/vip.cpp:65:9`! 0x0010 |
| 66 | |
| 67 | #define INT_SB_HITcxx . . $ `mednafen/vb/vip.cpp:67:9`! 0x2000 |
| 68 | #define INT_XP_ENDcxx . . $ `mednafen/vb/vip.cpp:68:9`! 0x4000 |
| 69 | #define INT_TIME_ERRcxx . . $ `mednafen/vb/vip.cpp:69:9`! 0x8000 |
| 70 | |
| 71 | static uint16cxx . . $ uint16# InterruptPendingcxx . . $ InterruptPending.; |
| 72 | static uint16cxx . . $ uint16# InterruptEnablecxx . . $ InterruptEnable.; |
| 73 | |
| 74 | static uint8cxx . . $ uint8# BRTAcxx . . $ BRTA., BRTBcxx . . $ BRTB., BRTCcxx . . $ BRTC., RESTcxx . . $ REST.; |
| 75 | static uint8cxx . . $ uint8# Repeatcxx . . $ Repeat.; |
| 76 | |
| 77 | static void CopyFBColumnToTarget_Anaglyphcxx . . $ CopyFBColumnToTarget_Anaglyph(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 78 | static void CopyFBColumnToTarget_AnaglyphSlowcxx . . $ CopyFBColumnToTarget_AnaglyphSlow(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 79 | static void CopyFBColumnToTarget_CScopecxx . . $ CopyFBColumnToTarget_CScope(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 80 | static void CopyFBColumnToTarget_SideBySidecxx . . $ CopyFBColumnToTarget_SideBySide(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 81 | static void CopyFBColumnToTarget_VLIcxx . . $ CopyFBColumnToTarget_VLI(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 82 | static void CopyFBColumnToTarget_HLIcxx . . $ CopyFBColumnToTarget_HLI(49f6e7a06ebc5aa8).(void) NO_INLINEcxx . . $ `mednafen/mednafen-types.h:22:11`!; |
| 83 | static void (*CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget.)(void) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 84 | static uint32cxx . . $ uint32# VB3DModecxx . . $ VB3DMode.; |
| 85 | static uint32cxx . . $ uint32# VB3DReversecxx . . $ VB3DReverse.; |
| 86 | static uint32cxx . . $ uint32# VBPrescalecxx . . $ VBPrescale.; |
| 87 | static uint32cxx . . $ uint32# VBSBS_Separationcxx . . $ VBSBS_Separation.; |
| 88 | static uint32cxx . . $ uint32# HLILUTcxx . . $ HLILUT.[256]; |
| 89 | static uint32cxx . . $ uint32# ColorLUTcxx . . $ ColorLUT.[2][256]; |
| 90 | static int32cxx . . $ int32# BrightnessCachecxx . . $ BrightnessCache.[4]; |
| 91 | static uint32cxx . . $ uint32# BrightCLUTcxx . . $ BrightCLUT.[2][4]; |
| 92 | |
| 93 | static double ColorLUTNoGCcxx . . $ ColorLUTNoGC.[2][256][3]; |
| 94 | static uint32cxx . . $ uint32# AnaSlowColorLUTcxx . . $ AnaSlowColorLUT.[256][256]; |
| 95 | |
| 96 | // A few settings: |
| 97 | static bool InstantDisplayHackcxx . . $ InstantDisplayHack.; |
| 98 | static bool AllowDrawSkipcxx . . $ AllowDrawSkip.; |
| 99 | |
| 100 | static bool VidSettingsDirtycxx . . $ VidSettingsDirty.; |
| 101 | static bool ParallaxDisabledcxx . . $ ParallaxDisabled.; |
| 102 | static uint32cxx . . $ uint32# Anaglyph_Colorscxx . . $ Anaglyph_Colors.[2]; |
| 103 | static uint32cxx . . $ uint32# Default_Colorcxx . . $ Default_Color.; |
| 104 | |
| 105 | static void MakeColorLUTcxx . . $ MakeColorLUT(3324b9708c1a4eec).(const MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# &format) |
| 106 | { |
| 107 | unsigned lr, i, l_b, r_b; |
| 108 | |
| 109 | for(lr = 0; lr < 2; lr++) |
| 110 | { |
| 111 | for(i = 0; i < 256; i++) |
| 112 | { |
| 113 | double r, g, b; |
| 114 | double r_prime, g_prime, b_prime; |
| 115 | r = g = b = (double)i / 255; |
| 116 | |
| 117 | // TODO: Use correct gamma curve, instead of approximation. |
| 118 | r_prime = powcxx . . $ pow(b71928d39fde4295).(r, 1.0 / 2.2); |
| 119 | g_prime = powcxx . . $ pow(b71928d39fde4295).(g, 1.0 / 2.2); |
| 120 | b_prime = powcxx . . $ pow(b71928d39fde4295).(b, 1.0 / 2.2); |
| 121 | |
| 122 | switch(VB3DModecxx . . $ VB3DMode.) |
| 123 | { |
| 124 | case VB3DMODE_ANAGLYPHcxx . . $ VB3DMODE_ANAGLYPH.: |
| 125 | r_prime = r_prime * ((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[lr ^ VB3DReversecxx . . $ VB3DReverse.] >> 16) & 0xFF) / 255; |
| 126 | g_prime = g_prime * ((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[lr ^ VB3DReversecxx . . $ VB3DReverse.] >> 8) & 0xFF) / 255; |
| 127 | b_prime = b_prime * ((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[lr ^ VB3DReversecxx . . $ VB3DReverse.] >> 0) & 0xFF) / 255; |
| 128 | break; |
| 129 | default: |
| 130 | r_prime = r_prime * ((Default_Colorcxx . . $ Default_Color. >> 16) & 0xFF) / 255; |
| 131 | g_prime = g_prime * ((Default_Colorcxx . . $ Default_Color. >> 8) & 0xFF) / 255; |
| 132 | b_prime = b_prime * ((Default_Colorcxx . . $ Default_Color. >> 0) & 0xFF) / 255; |
| 133 | break; |
| 134 | } |
| 135 | ColorLUTNoGCcxx . . $ ColorLUTNoGC.[lr][i][0] = powcxx . . $ pow(b71928d39fde4295).(r_prime, 2.2 / 1.0); |
| 136 | ColorLUTNoGCcxx . . $ ColorLUTNoGC.[lr][i][1] = powcxx . . $ pow(b71928d39fde4295).(g_prime, 2.2 / 1.0); |
| 137 | ColorLUTNoGCcxx . . $ ColorLUTNoGC.[lr][i][2] = powcxx . . $ pow(b71928d39fde4295).(b_prime, 2.2 / 1.0); |
| 138 | |
| 139 | ColorLUTcxx . . $ ColorLUT.[lr][i] = MAKECOLORcxx . . $ `mednafen/video/surface.h:9:9`!((int)(r_prime * 255), (int)(g_prime * 255), (int)(b_prime * 255), 0); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // Anaglyph slow-mode LUT calculation |
| 144 | for(l_b = 0; l_b < 256; l_b++) |
| 145 | { |
| 146 | for(r_b = 0; r_b < 256; r_b++) |
| 147 | { |
| 148 | double r_prime, g_prime, b_prime; |
| 149 | double r = ColorLUTNoGCcxx . . $ ColorLUTNoGC.[0][l_b][0] + ColorLUTNoGCcxx . . $ ColorLUTNoGC.[1][r_b][0]; |
| 150 | double g = ColorLUTNoGCcxx . . $ ColorLUTNoGC.[0][l_b][1] + ColorLUTNoGCcxx . . $ ColorLUTNoGC.[1][r_b][1]; |
| 151 | double b = ColorLUTNoGCcxx . . $ ColorLUTNoGC.[0][l_b][2] + ColorLUTNoGCcxx . . $ ColorLUTNoGC.[1][r_b][2]; |
| 152 | |
| 153 | if(r > 1.0) |
| 154 | r = 1.0; |
| 155 | if(g > 1.0) |
| 156 | g = 1.0; |
| 157 | if(b > 1.0) |
| 158 | b = 1.0; |
| 159 | |
| 160 | r_prime = powcxx . . $ pow(b71928d39fde4295).(r, 1.0 / 2.2); |
| 161 | g_prime = powcxx . . $ pow(b71928d39fde4295).(g, 1.0 / 2.2); |
| 162 | b_prime = powcxx . . $ pow(b71928d39fde4295).(b, 1.0 / 2.2); |
| 163 | |
| 164 | AnaSlowColorLUTcxx . . $ AnaSlowColorLUT.[l_b][r_b] = MAKECOLORcxx . . $ `mednafen/video/surface.h:9:9`!(((int)(r_prime * 255)), ((int)(g_prime * 255)), ((int)(b_prime * 255)), 0); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | static void RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(void) |
| 170 | { |
| 171 | unsigned i, lr; |
| 172 | //printf("BRTA: %d, BRTB: %d, BRTC: %d, Rest: %d\n", BRTA, BRTB, BRTC, REST); |
| 173 | int32cxx . . $ int32# CumulativeTime = (BRTAcxx . . $ BRTA. + 1 + BRTBcxx . . $ BRTB. + 1 + BRTCcxx . . $ BRTC. + 1 + RESTcxx . . $ REST. + 1) + 1; |
| 174 | int32cxx . . $ int32# MaxTime = 128; |
| 175 | |
| 176 | BrightnessCachecxx . . $ BrightnessCache.[0] = 0; |
| 177 | BrightnessCachecxx . . $ BrightnessCache.[1] = 0; |
| 178 | BrightnessCachecxx . . $ BrightnessCache.[2] = 0; |
| 179 | BrightnessCachecxx . . $ BrightnessCache.[3] = 0; |
| 180 | |
| 181 | for(i = 0; i < Repeatcxx . . $ Repeat. + 1; i++) |
| 182 | { |
| 183 | int32cxx . . $ int32# btemp[4]; |
| 184 | |
| 185 | if((i * CumulativeTime) >= MaxTime) |
| 186 | break; |
| 187 | |
| 188 | btemp[1] = (i * CumulativeTime) + BRTAcxx . . $ BRTA.; |
| 189 | if(btemp[1] > MaxTime) |
| 190 | btemp[1] = MaxTime; |
| 191 | btemp[1] -= (i * CumulativeTime); |
| 192 | if(btemp[1] < 0) |
| 193 | btemp[1] = 0; |
| 194 | |
| 195 | |
| 196 | btemp[2] = (i * CumulativeTime) + BRTAcxx . . $ BRTA. + 1 + BRTBcxx . . $ BRTB.; |
| 197 | if(btemp[2] > MaxTime) |
| 198 | btemp[2] = MaxTime; |
| 199 | btemp[2] -= (i * CumulativeTime) + BRTAcxx . . $ BRTA. + 1; |
| 200 | if(btemp[2] < 0) |
| 201 | btemp[2] = 0; |
| 202 | |
| 203 | //btemp[3] = (i * CumulativeTime) + BRTA + 1 + BRTB + 1 + BRTC; |
| 204 | //if(btemp[3] > MaxTime) |
| 205 | // btemp[3] = MaxTime; |
| 206 | //btemp[3] -= (i * CumulativeTime); |
| 207 | //if(btemp[3] < 0) |
| 208 | // btemp[3] = 0; |
| 209 | |
| 210 | btemp[3] = (i * CumulativeTime) + BRTAcxx . . $ BRTA. + BRTBcxx . . $ BRTB. + BRTCcxx . . $ BRTC. + 1; |
| 211 | if(btemp[3] > MaxTime) |
| 212 | btemp[3] = MaxTime; |
| 213 | btemp[3] -= (i * CumulativeTime) + 1; |
| 214 | if(btemp[3] < 0) |
| 215 | btemp[3] = 0; |
| 216 | |
| 217 | BrightnessCachecxx . . $ BrightnessCache.[1] += btemp[1]; |
| 218 | BrightnessCachecxx . . $ BrightnessCache.[2] += btemp[2]; |
| 219 | BrightnessCachecxx . . $ BrightnessCache.[3] += btemp[3]; |
| 220 | } |
| 221 | |
| 222 | //printf("BC: %d %d %d %d\n", BrightnessCache[0], BrightnessCache[1], BrightnessCache[2], BrightnessCache[3]); |
| 223 | |
| 224 | for(i = 0; i < 4; i++) |
| 225 | BrightnessCachecxx . . $ BrightnessCache.[i] = 255 * BrightnessCachecxx . . $ BrightnessCache.[i] / MaxTime; |
| 226 | |
| 227 | for(lr = 0; lr < 2; lr++) |
| 228 | for(i = 0; i < 4; i++) |
| 229 | BrightCLUTcxx . . $ BrightCLUT.[lr][i] = ColorLUTcxx . . $ ColorLUT.[lr][BrightnessCachecxx . . $ BrightnessCache.[i]]; |
| 230 | } |
| 231 | |
| 232 | static void Recalc3DModeStuffcxx . . $ Recalc3DModeStuff(b45ddcbc8423892c).(bool non_rgb_output = false) |
| 233 | { |
| 234 | switch(VB3DModecxx . . $ VB3DMode.) |
| 235 | { |
| 236 | default: |
| 237 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_Anaglyphcxx . . $ CopyFBColumnToTarget_Anaglyph(49f6e7a06ebc5aa8).; |
| 238 | if(((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[0] & 0xFF) && (Anaglyph_Colorscxx . . $ Anaglyph_Colors.[1] & 0xFF)) || |
| 239 | ((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[0] & 0xFF00) && (Anaglyph_Colorscxx . . $ Anaglyph_Colors.[1] & 0xFF00)) || |
| 240 | ((Anaglyph_Colorscxx . . $ Anaglyph_Colors.[0] & 0xFF0000) && (Anaglyph_Colorscxx . . $ Anaglyph_Colors.[1] & 0xFF0000)) || |
| 241 | non_rgb_output) |
| 242 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_AnaglyphSlowcxx . . $ CopyFBColumnToTarget_AnaglyphSlow(49f6e7a06ebc5aa8).; |
| 243 | break; |
| 244 | |
| 245 | case VB3DMODE_CSCOPEcxx . . $ VB3DMODE_CSCOPE.: |
| 246 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_CScopecxx . . $ CopyFBColumnToTarget_CScope(49f6e7a06ebc5aa8).; |
| 247 | break; |
| 248 | |
| 249 | case VB3DMODE_SIDEBYSIDEcxx . . $ VB3DMODE_SIDEBYSIDE.: |
| 250 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_SideBySidecxx . . $ CopyFBColumnToTarget_SideBySide(49f6e7a06ebc5aa8).; |
| 251 | break; |
| 252 | |
| 253 | case VB3DMODE_VLIcxx . . $ VB3DMODE_VLI.: |
| 254 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_VLIcxx . . $ CopyFBColumnToTarget_VLI(49f6e7a06ebc5aa8).; |
| 255 | break; |
| 256 | |
| 257 | case VB3DMODE_HLIcxx . . $ VB3DMODE_HLI.: |
| 258 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget. = CopyFBColumnToTarget_HLIcxx . . $ CopyFBColumnToTarget_HLI(49f6e7a06ebc5aa8).; |
| 259 | break; |
| 260 | } |
| 261 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 262 | } |
| 263 | |
| 264 | void VIP_Set3DModecxx . . $ VIP_Set3DMode(d9d0053e206adc11).(uint32cxx . . $ uint32# mode, bool reverse, uint32cxx . . $ uint32# prescale, uint32cxx . . $ uint32# sbs_separation) |
| 265 | { |
| 266 | uint32_tcxx . . $ uint32_t# p; |
| 267 | |
| 268 | VB3DModecxx . . $ VB3DMode. = mode; |
| 269 | VB3DReversecxx . . $ VB3DReverse. = reverse ? 1 : 0; |
| 270 | VBPrescalecxx . . $ VBPrescale. = prescale; |
| 271 | VBSBS_Separationcxx . . $ VBSBS_Separation. = sbs_separation; |
| 272 | |
| 273 | VidSettingsDirtycxx . . $ VidSettingsDirty. = true; |
| 274 | |
| 275 | for(p = 0; p < 256; p++) |
| 276 | { |
| 277 | unsigned i, ps, shifty; |
| 278 | uint8cxx . . $ uint8# s[4]; |
| 279 | uint32cxx . . $ uint32# v = 0; |
| 280 | |
| 281 | s[0] = (p >> 0) & 0x3; |
| 282 | s[1] = (p >> 2) & 0x3; |
| 283 | s[2] = (p >> 4) & 0x3; |
| 284 | s[3] = (p >> 6) & 0x3; |
| 285 | |
| 286 | for(i = 0, shifty = 0; i < 4; i++) |
| 287 | { |
| 288 | for(ps = 0; ps < prescale; ps++) |
| 289 | { |
| 290 | v |= s[i] << shifty; |
| 291 | shifty += 2; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | HLILUTcxx . . $ HLILUT.[p] = v; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | void VIP_SetParallaxDisablecxx . . $ VIP_SetParallaxDisable(b45ddcbc8423892c).(bool disabled) |
| 300 | { |
| 301 | ParallaxDisabledcxx . . $ ParallaxDisabled. = disabled; |
| 302 | } |
| 303 | |
| 304 | void VIP_SetDefaultColorcxx . . $ VIP_SetDefaultColor(cb2f890c2fdad230).(uint32cxx . . $ uint32# default_color) |
| 305 | { |
| 306 | Default_Colorcxx . . $ Default_Color. = default_color; |
| 307 | |
| 308 | VidSettingsDirtycxx . . $ VidSettingsDirty. = true; |
| 309 | } |
| 310 | |
| 311 | |
| 312 | void VIP_SetAnaglyphColorscxx . . $ VIP_SetAnaglyphColors(b4d55b1286ff73e8).(uint32cxx . . $ uint32# lcolor, uint32cxx . . $ uint32# rcolor) |
| 313 | { |
| 314 | Anaglyph_Colorscxx . . $ Anaglyph_Colors.[0] = lcolor; |
| 315 | Anaglyph_Colorscxx . . $ Anaglyph_Colors.[1] = rcolor; |
| 316 | |
| 317 | VidSettingsDirtycxx . . $ VidSettingsDirty. = true; |
| 318 | } |
| 319 | |
| 320 | void VIP_SetInstantDisplayHackcxx . . $ VIP_SetInstantDisplayHack(b45ddcbc8423892c).(bool val) |
| 321 | { |
| 322 | InstantDisplayHackcxx . . $ InstantDisplayHack. = val; |
| 323 | } |
| 324 | |
| 325 | void VIP_SetAllowDrawSkipcxx . . $ VIP_SetAllowDrawSkip(b45ddcbc8423892c).(bool val) |
| 326 | { |
| 327 | AllowDrawSkipcxx . . $ AllowDrawSkip. = val; |
| 328 | } |
| 329 | |
| 330 | |
| 331 | static uint16cxx . . $ uint16# FRMCYCcxx . . $ FRMCYC.; |
| 332 | |
| 333 | static uint16cxx . . $ uint16# DPCTRLcxx . . $ DPCTRL.; |
| 334 | static bool DisplayActivecxx . . $ DisplayActive.; |
| 335 | |
| 336 | #define XPCTRL_XP_RSTcxx . . $ `mednafen/vb/vip.cpp:336:9`! 0x0001 |
| 337 | #define XPCTRL_XP_ENcxx . . $ `mednafen/vb/vip.cpp:337:9`! 0x0002 |
| 338 | static uint16cxx . . $ uint16# XPCTRLcxx . . $ XPCTRL.; |
| 339 | static uint16cxx . . $ uint16# SBCMPcxx . . $ SBCMP.; // Derived from XPCTRL |
| 340 | |
| 341 | static uint16cxx . . $ uint16# SPTcxx . . $ SPT.[4]; // SPT0~SPT3, 5f848~5f84e |
| 342 | static uint16cxx . . $ uint16# GPLTcxx . . $ GPLT.[4]; |
| 343 | static uint8cxx . . $ uint8# GPLT_Cachecxx . . $ GPLT_Cache.[4][4]; |
| 344 | |
| 345 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void Recalc_GPLT_Cachecxx . . $ Recalc_GPLT_Cache(d4f767463ce0a6b3).(int which) |
| 346 | { |
| 347 | unsigned i; |
| 348 | for(i = 0; i < 4; i++) |
| 349 | GPLT_Cachecxx . . $ GPLT_Cache.[which][i] = (GPLTcxx . . $ GPLT.[which] >> (i * 2)) & 3; |
| 350 | } |
| 351 | |
| 352 | static uint16cxx . . $ uint16# JPLTcxx . . $ JPLT.[4]; |
| 353 | static uint8cxx . . $ uint8# JPLT_Cachecxx . . $ JPLT_Cache.[4][4]; |
| 354 | |
| 355 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void Recalc_JPLT_Cachecxx . . $ Recalc_JPLT_Cache(d4f767463ce0a6b3).(int which) |
| 356 | { |
| 357 | unsigned i; |
| 358 | for(i = 0; i < 4; i++) |
| 359 | JPLT_Cachecxx . . $ JPLT_Cache.[which][i] = (JPLTcxx . . $ JPLT.[which] >> (i * 2)) & 3; |
| 360 | } |
| 361 | |
| 362 | |
| 363 | static uint16cxx . . $ uint16# BKCOLcxx . . $ BKCOL.; |
| 364 | |
| 365 | static int32cxx . . $ int32# CalcNextEventcxx . . $ CalcNextEvent(b126dc7c1de90089).(void); |
| 366 | |
| 367 | static int32cxx . . $ int32# last_tscxx . . $ last_ts.; |
| 368 | |
| 369 | static int32cxx . . $ int32# Columncxx . . $ Column.; |
| 370 | static int32cxx . . $ int32# ColumnCountercxx . . $ ColumnCounter.; |
| 371 | |
| 372 | static int32cxx . . $ int32# DisplayRegioncxx . . $ DisplayRegion.; |
| 373 | static bool DisplayFBcxx . . $ DisplayFB.; |
| 374 | |
| 375 | static int32cxx . . $ int32# GameFrameCountercxx . . $ GameFrameCounter.; |
| 376 | |
| 377 | static int32cxx . . $ int32# DrawingCountercxx . . $ DrawingCounter.; |
| 378 | static bool DrawingActivecxx . . $ DrawingActive.; |
| 379 | static bool DrawingFBcxx . . $ DrawingFB.; |
| 380 | static uint32cxx . . $ uint32# DrawingBlockcxx . . $ DrawingBlock.; |
| 381 | static int32cxx . . $ int32# SB_Latchcxx . . $ SB_Latch.; |
| 382 | static int32cxx . . $ int32# SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime.; |
| 383 | |
| 384 | //static uint8 CTA_L, CTA_R; |
| 385 | |
| 386 | static void CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(void) |
| 387 | { |
| 388 | VBIRQ_Assertcxx . . $ VBIRQ_Assert(918ebd27a9ddbad3).(VBIRQ_SOURCE_VIPcxx . . $ `mednafen/vb/vb.h:32:9`!, (bool)(InterruptEnablecxx . . $ InterruptEnable. & InterruptPendingcxx . . $ InterruptPending.)); |
| 389 | |
| 390 | #if 0 |
| 391 | printf("%08x\n", InterruptEnable & InterruptPending); |
| 392 | if((bool)(InterruptEnable & InterruptPending)) |
| 393 | puts("IRQ asserted"); |
| 394 | else |
| 395 | puts("IRQ not asserted"); |
| 396 | #endif |
| 397 | } |
| 398 | |
| 399 | |
| 400 | bool VIP_Initcxx . . $ VIP_Init(c9857a73d68e59ba).(void) |
| 401 | { |
| 402 | InstantDisplayHackcxx . . $ InstantDisplayHack. = false; |
| 403 | AllowDrawSkipcxx . . $ AllowDrawSkip. = false; |
| 404 | ParallaxDisabledcxx . . $ ParallaxDisabled. = false; |
| 405 | Anaglyph_Colorscxx . . $ Anaglyph_Colors.[0] = 0xFF0000; |
| 406 | Anaglyph_Colorscxx . . $ Anaglyph_Colors.[1] = 0x0000FF; |
| 407 | VB3DModecxx . . $ VB3DMode. = VB3DMODE_ANAGLYPHcxx . . $ VB3DMODE_ANAGLYPH.; |
| 408 | Default_Colorcxx . . $ Default_Color. = 0xFFFFFF; |
| 409 | VB3DReversecxx . . $ VB3DReverse. = 0; |
| 410 | VBPrescalecxx . . $ VBPrescale. = 1; |
| 411 | VBSBS_Separationcxx . . $ VBSBS_Separation. = 0; |
| 412 | |
| 413 | VidSettingsDirtycxx . . $ VidSettingsDirty. = true; |
| 414 | |
| 415 | return(true); |
| 416 | } |
| 417 | |
| 418 | void VIP_Powercxx . . $ VIP_Power(49f6e7a06ebc5aa8).(void) |
| 419 | { |
| 420 | unsigned i; |
| 421 | |
| 422 | Repeatcxx . . $ Repeat. = 0; |
| 423 | SB_Latchcxx . . $ SB_Latch. = 0; |
| 424 | SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime. = -1; |
| 425 | last_tscxx . . $ last_ts. = 0; |
| 426 | |
| 427 | Columncxx . . $ Column. = 0; |
| 428 | ColumnCountercxx . . $ ColumnCounter. = 259; |
| 429 | |
| 430 | DisplayRegioncxx . . $ DisplayRegion. = 0; |
| 431 | DisplayFBcxx . . $ DisplayFB. = 0; |
| 432 | |
| 433 | GameFrameCountercxx . . $ GameFrameCounter. = 0; |
| 434 | |
| 435 | DrawingCountercxx . . $ DrawingCounter. = 0; |
| 436 | DrawingActivecxx . . $ DrawingActive. = false; |
| 437 | DrawingFBcxx . . $ DrawingFB. = 0; |
| 438 | DrawingBlockcxx . . $ DrawingBlock. = 0; |
| 439 | |
| 440 | DPCTRLcxx . . $ DPCTRL. = 2; |
| 441 | DisplayActivecxx . . $ DisplayActive. = false; |
| 442 | |
| 443 | |
| 444 | |
| 445 | memset(FBcxx . . $ FB., 0, 0x6000 * 2 * 2); |
| 446 | memset(CHR_RAMcxx . . $ CHR_RAM., 0, 0x8000); |
| 447 | memset(DRAMcxx . . $ DRAM., 0, 0x20000); |
| 448 | |
| 449 | InterruptPendingcxx . . $ InterruptPending. = 0; |
| 450 | InterruptEnablecxx . . $ InterruptEnable. = 0; |
| 451 | |
| 452 | BRTAcxx . . $ BRTA. = 0; |
| 453 | BRTBcxx . . $ BRTB. = 0; |
| 454 | BRTCcxx . . $ BRTC. = 0; |
| 455 | RESTcxx . . $ REST. = 0; |
| 456 | |
| 457 | FRMCYCcxx . . $ FRMCYC. = 0; |
| 458 | |
| 459 | XPCTRLcxx . . $ XPCTRL. = 0; |
| 460 | SBCMPcxx . . $ SBCMP. = 0; |
| 461 | |
| 462 | for(i = 0; i < 4; i++) |
| 463 | { |
| 464 | SPTcxx . . $ SPT.[i] = 0; |
| 465 | GPLTcxx . . $ GPLT.[i] = 0; |
| 466 | JPLTcxx . . $ JPLT.[i] = 0; |
| 467 | |
| 468 | Recalc_GPLT_Cachecxx . . $ Recalc_GPLT_Cache(d4f767463ce0a6b3).(i); |
| 469 | Recalc_JPLT_Cachecxx . . $ Recalc_JPLT_Cache(d4f767463ce0a6b3).(i); |
| 470 | } |
| 471 | |
| 472 | BKCOLcxx . . $ BKCOL. = 0; |
| 473 | } |
| 474 | |
| 475 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! uint16cxx . . $ uint16# ReadRegistercxx . . $ ReadRegister(6a3a2f833beb20d3).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A) |
| 476 | { |
| 477 | uint16_tcxx . . $ uint16_t# ret = 0; //0xFFFF; |
| 478 | |
| 479 | if(A & 1) |
| 480 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Misaligned VIP Read: %08x", A); |
| 481 | |
| 482 | switch(A & 0xFE) |
| 483 | { |
| 484 | default: |
| 485 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP register read: %08x", A); |
| 486 | break; |
| 487 | |
| 488 | case 0x00: |
| 489 | ret = InterruptPendingcxx . . $ InterruptPending.; |
| 490 | break; |
| 491 | |
| 492 | case 0x02: |
| 493 | ret = InterruptEnablecxx . . $ InterruptEnable.; |
| 494 | break; |
| 495 | |
| 496 | case 0x20: |
| 497 | //printf("Read DPSTTS at %d\n", timestamp); |
| 498 | ret = DPCTRLcxx . . $ DPCTRL. & 0x702; |
| 499 | if((DisplayRegioncxx . . $ DisplayRegion. & 1) && DisplayActivecxx . . $ DisplayActive.) |
| 500 | { |
| 501 | unsigned int DPBSY = 1 << ((DisplayRegioncxx . . $ DisplayRegion. >> 1) & 1); |
| 502 | |
| 503 | if(DisplayFBcxx . . $ DisplayFB.) |
| 504 | DPBSY <<= 2; |
| 505 | |
| 506 | ret |= DPBSY << 2; |
| 507 | } |
| 508 | //if(!(DisplayRegion & 1)) // FIXME? (Had to do it this way for Galactic Pinball...) |
| 509 | ret |= 1 << 6; |
| 510 | break; |
| 511 | |
| 512 | // Note: Upper bits of BRTA, BRTB, BRTC, and REST(?) are 0 when read(on real hardware) |
| 513 | case 0x24: |
| 514 | ret = BRTAcxx . . $ BRTA.; |
| 515 | break; |
| 516 | |
| 517 | case 0x26: |
| 518 | ret = BRTBcxx . . $ BRTB.; |
| 519 | break; |
| 520 | |
| 521 | case 0x28: |
| 522 | ret = BRTCcxx . . $ BRTC.; |
| 523 | break; |
| 524 | |
| 525 | case 0x2A: |
| 526 | ret = RESTcxx . . $ REST.; |
| 527 | break; |
| 528 | |
| 529 | case 0x30: |
| 530 | ret = 0xFFFF; |
| 531 | break; |
| 532 | |
| 533 | case 0x40: |
| 534 | ret = XPCTRLcxx . . $ XPCTRL. & 0x2; |
| 535 | if(DrawingActivecxx . . $ DrawingActive.) |
| 536 | { |
| 537 | ret |= (1 + DrawingFBcxx . . $ DrawingFB.) << 2; |
| 538 | } |
| 539 | if(timestamp < SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime.) |
| 540 | { |
| 541 | ret |= 0x8000; |
| 542 | ret |= /*DrawingBlock*/SB_Latchcxx . . $ SB_Latch. << 8; |
| 543 | } |
| 544 | break; // XPSTTS, read-only |
| 545 | |
| 546 | case 0x44: |
| 547 | ret = 2; // VIP version. 2 is a known valid version, while the validity of other numbers is unknown, so we'll just go with 2. |
| 548 | break; |
| 549 | |
| 550 | case 0x48: |
| 551 | case 0x4a: |
| 552 | case 0x4c: |
| 553 | case 0x4e: |
| 554 | ret = SPTcxx . . $ SPT.[(A >> 1) & 3]; |
| 555 | break; |
| 556 | |
| 557 | case 0x60: |
| 558 | case 0x62: |
| 559 | case 0x64: |
| 560 | case 0x66: |
| 561 | ret = GPLTcxx . . $ GPLT.[(A >> 1) & 3]; |
| 562 | break; |
| 563 | |
| 564 | case 0x68: |
| 565 | case 0x6a: |
| 566 | case 0x6c: |
| 567 | case 0x6e: |
| 568 | ret = JPLTcxx . . $ JPLT.[(A >> 1) & 3]; |
| 569 | break; |
| 570 | |
| 571 | case 0x70: |
| 572 | ret = BKCOLcxx . . $ BKCOL.; |
| 573 | break; |
| 574 | } |
| 575 | |
| 576 | return(ret); |
| 577 | } |
| 578 | |
| 579 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void WriteRegistercxx . . $ WriteRegister(f235d607a429c96e).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A, uint16cxx . . $ uint16# V) |
| 580 | { |
| 581 | if(A & 1) |
| 582 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Misaligned VIP Write: %08x %04x", A, V); |
| 583 | |
| 584 | switch(A & 0xFE) |
| 585 | { |
| 586 | default: |
| 587 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP register write: %08x %04x", A, V); |
| 588 | break; |
| 589 | case 0x00: |
| 590 | break; // Interrupt pending, read-only |
| 591 | case 0x02: |
| 592 | InterruptEnablecxx . . $ InterruptEnable. = V & 0xE01F; |
| 593 | |
| 594 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Interrupt Enable: %04x", V); |
| 595 | |
| 596 | if(V & 0x2000) |
| 597 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Warning: VIP SB Hit Interrupt enable: %04x\n", V); |
| 598 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 599 | break; |
| 600 | case 0x04: |
| 601 | InterruptPendingcxx . . $ InterruptPending. &= ~V; |
| 602 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 603 | break; |
| 604 | |
| 605 | case 0x20: |
| 606 | break; // Display control, read-only. |
| 607 | |
| 608 | case 0x22: |
| 609 | DPCTRLcxx . . $ DPCTRL. = V & (0x703); // Display-control, write-only |
| 610 | if(V & 1) |
| 611 | { |
| 612 | DisplayActivecxx . . $ DisplayActive. = false; |
| 613 | InterruptPendingcxx . . $ InterruptPending. &= ~(INT_TIME_ERRcxx . . $ `mednafen/vb/vip.cpp:69:9`! | INT_FRAME_STARTcxx . . $ `mednafen/vb/vip.cpp:65:9`! | INT_GAME_STARTcxx . . $ `mednafen/vb/vip.cpp:64:9`! | INT_RFB_ENDcxx . . $ `mednafen/vb/vip.cpp:63:9`! | INT_LFB_ENDcxx . . $ `mednafen/vb/vip.cpp:62:9`! | INT_SCAN_ERRcxx . . $ `mednafen/vb/vip.cpp:61:9`!); |
| 614 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 615 | } |
| 616 | break; |
| 617 | |
| 618 | case 0x24: |
| 619 | BRTAcxx . . $ BRTA. = V & 0xFF; // BRTA |
| 620 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 621 | break; |
| 622 | |
| 623 | case 0x26: |
| 624 | BRTBcxx . . $ BRTB. = V & 0xFF; // BRTB |
| 625 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 626 | break; |
| 627 | |
| 628 | case 0x28: |
| 629 | BRTCcxx . . $ BRTC. = V & 0xFF; // BRTC |
| 630 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 631 | break; |
| 632 | |
| 633 | case 0x2A: |
| 634 | RESTcxx . . $ REST. = V & 0xFF; // REST |
| 635 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 636 | break; |
| 637 | |
| 638 | case 0x2E: |
| 639 | FRMCYCcxx . . $ FRMCYC. = V & 0xF; // FRMCYC, write-only? |
| 640 | break; |
| 641 | |
| 642 | case 0x30: |
| 643 | break; // CTA, read-only( |
| 644 | |
| 645 | case 0x40: |
| 646 | break; // XPSTTS, read-only |
| 647 | |
| 648 | case 0x42: |
| 649 | XPCTRLcxx . . $ XPCTRL. = V & 0x0002; // XPCTRL, write-only |
| 650 | SBCMPcxx . . $ SBCMP. = (V >> 8) & 0x1F; |
| 651 | |
| 652 | if(V & 1) |
| 653 | { |
| 654 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("XPRST"); |
| 655 | DrawingActivecxx . . $ DrawingActive. = 0; |
| 656 | DrawingCountercxx . . $ DrawingCounter. = 0; |
| 657 | InterruptPendingcxx . . $ InterruptPending. &= ~(INT_SB_HITcxx . . $ `mednafen/vb/vip.cpp:67:9`! | INT_XP_ENDcxx . . $ `mednafen/vb/vip.cpp:68:9`! | INT_TIME_ERRcxx . . $ `mednafen/vb/vip.cpp:69:9`!); |
| 658 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 659 | } |
| 660 | break; |
| 661 | |
| 662 | case 0x44: |
| 663 | break; // Version Control, read-only? |
| 664 | |
| 665 | case 0x48: |
| 666 | case 0x4a: |
| 667 | case 0x4c: |
| 668 | case 0x4e: |
| 669 | SPTcxx . . $ SPT.[(A >> 1) & 3] = V & 0x3FF; |
| 670 | break; |
| 671 | |
| 672 | case 0x60: |
| 673 | case 0x62: |
| 674 | case 0x64: |
| 675 | case 0x66: |
| 676 | GPLTcxx . . $ GPLT.[(A >> 1) & 3] = V & 0xFC; |
| 677 | Recalc_GPLT_Cachecxx . . $ Recalc_GPLT_Cache(d4f767463ce0a6b3).((A >> 1) & 3); |
| 678 | break; |
| 679 | |
| 680 | case 0x68: |
| 681 | case 0x6a: |
| 682 | case 0x6c: |
| 683 | case 0x6e: |
| 684 | JPLTcxx . . $ JPLT.[(A >> 1) & 3] = V & 0xFC; |
| 685 | Recalc_JPLT_Cachecxx . . $ Recalc_JPLT_Cache(d4f767463ce0a6b3).((A >> 1) & 3); |
| 686 | break; |
| 687 | |
| 688 | case 0x70: |
| 689 | BKCOLcxx . . $ BKCOL. = V & 0x3; |
| 690 | break; |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | /* Don't update the VIP state on reads/writes, |
| 695 | * the event system will update it with enough precision |
| 696 | * as far as VB software cares. |
| 697 | */ |
| 698 | |
| 699 | uint8cxx . . $ uint8# VIP_Read8cxx . . $ VIP_Read8(30bc2cfa027d42f8).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A) |
| 700 | { |
| 701 | uint8_tcxx . . $ uint8_t# ret = 0; //0xFF; |
| 702 | |
| 703 | //VIP_Update(timestamp); |
| 704 | |
| 705 | switch(A >> 16) |
| 706 | { |
| 707 | case 0x0: |
| 708 | case 0x1: |
| 709 | if((A & 0x7FFF) >= 0x6000) |
| 710 | return VIP_MA16R8cxx . . $ VIP_MA16R8(3ecc0cc8372cfe5).(CHR_RAMcxx . . $ CHR_RAM., (A & 0x1FFF) | ((A >> 2) & 0x6000)); |
| 711 | return FBcxx . . $ FB.[(A >> 15) & 1][(A >> 16) & 1][A & 0x7FFF]; |
| 712 | case 0x2: |
| 713 | case 0x3: |
| 714 | return VIP_MA16R8cxx . . $ VIP_MA16R8(3ecc0cc8372cfe5).(DRAMcxx . . $ DRAM., A & 0x1FFFF); |
| 715 | case 0x4: |
| 716 | case 0x5: |
| 717 | if(A >= 0x5E000) |
| 718 | return ReadRegistercxx . . $ ReadRegister(6a3a2f833beb20d3).(timestamp, A); |
| 719 | break; |
| 720 | case 0x6: |
| 721 | break; |
| 722 | |
| 723 | case 0x7: |
| 724 | if(A >= 0x8000) |
| 725 | return VIP_MA16R8cxx . . $ VIP_MA16R8(3ecc0cc8372cfe5).(CHR_RAMcxx . . $ CHR_RAM., A & 0x7FFF); |
| 726 | break; |
| 727 | default: |
| 728 | break; |
| 729 | } |
| 730 | |
| 731 | //VB_SetEvent(VB_EVENT_VIP, timestamp + CalcNextEvent()); |
| 732 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Read: %08x", A); |
| 733 | |
| 734 | return 0; |
| 735 | } |
| 736 | |
| 737 | uint16cxx . . $ uint16# VIP_Read16cxx . . $ VIP_Read16(6a3a2f833beb20d3).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A) |
| 738 | { |
| 739 | //VIP_Update(timestamp); |
| 740 | |
| 741 | switch(A >> 16) |
| 742 | { |
| 743 | case 0x0: |
| 744 | case 0x1: |
| 745 | if((A & 0x7FFF) >= 0x6000) |
| 746 | return VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(CHR_RAMcxx . . $ CHR_RAM., (A & 0x1FFF) | ((A >> 2) & 0x6000)); |
| 747 | return LoadU16_LEcxx . . $ LoadU16_LE(7cce449bb1bc4dad).((uint16cxx . . $ uint16# *)&FBcxx . . $ FB.[(A >> 15) & 1][(A >> 16) & 1][A & 0x7FFF]); |
| 748 | case 0x2: |
| 749 | case 0x3: |
| 750 | return VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(DRAMcxx . . $ DRAM., A & 0x1FFFF); |
| 751 | case 0x4: |
| 752 | case 0x5: |
| 753 | if(A >= 0x5E000) |
| 754 | return ReadRegistercxx . . $ ReadRegister(6a3a2f833beb20d3).(timestamp, A); |
| 755 | break; |
| 756 | case 0x6: |
| 757 | break; |
| 758 | case 0x7: |
| 759 | if(A >= 0x8000) |
| 760 | return VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(CHR_RAMcxx . . $ CHR_RAM., A & 0x7FFF); |
| 761 | break; |
| 762 | default: |
| 763 | break; |
| 764 | } |
| 765 | |
| 766 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Read: %08x", A); |
| 767 | |
| 768 | //VB_SetEvent(VB_EVENT_VIP, timestamp + CalcNextEvent()); |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | void VIP_Write8cxx . . $ VIP_Write8(b1c7ce297c54e4c4).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A, uint8cxx . . $ uint8# V) |
| 773 | { |
| 774 | //VIP_Update(timestamp); |
| 775 | |
| 776 | //if(A >= 0x3DC00 && A < 0x3E000) |
| 777 | // printf("%08x %02x\n", A, V); |
| 778 | |
| 779 | switch(A >> 16) |
| 780 | { |
| 781 | case 0x0: |
| 782 | case 0x1: |
| 783 | if((A & 0x7FFF) >= 0x6000) |
| 784 | VIP_MA16W8cxx . . $ VIP_MA16W8(64cc85ef310d95e7).(CHR_RAMcxx . . $ CHR_RAM., (A & 0x1FFF) | ((A >> 2) & 0x6000), V); |
| 785 | else |
| 786 | FBcxx . . $ FB.[(A >> 15) & 1][(A >> 16) & 1][A & 0x7FFF] = V; |
| 787 | break; |
| 788 | |
| 789 | case 0x2: |
| 790 | case 0x3: |
| 791 | VIP_MA16W8cxx . . $ VIP_MA16W8(64cc85ef310d95e7).(DRAMcxx . . $ DRAM., A & 0x1FFFF, V); |
| 792 | break; |
| 793 | |
| 794 | case 0x4: |
| 795 | case 0x5: |
| 796 | if(A >= 0x5E000) |
| 797 | WriteRegistercxx . . $ WriteRegister(f235d607a429c96e).(timestamp, A, V); |
| 798 | else |
| 799 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %02x", A, V); |
| 800 | break; |
| 801 | |
| 802 | case 0x6: |
| 803 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %02x", A, V); |
| 804 | break; |
| 805 | |
| 806 | case 0x7: |
| 807 | if(A >= 0x8000) |
| 808 | VIP_MA16W8cxx . . $ VIP_MA16W8(64cc85ef310d95e7).(CHR_RAMcxx . . $ CHR_RAM., A & 0x7FFF, V); |
| 809 | else |
| 810 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %02x", A, V); |
| 811 | break; |
| 812 | |
| 813 | default: |
| 814 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %02x", A, V); |
| 815 | break; |
| 816 | } |
| 817 | |
| 818 | //VB_SetEvent(VB_EVENT_VIP, timestamp + CalcNextEvent()); |
| 819 | } |
| 820 | |
| 821 | void VIP_Write16cxx . . $ VIP_Write16(f235d607a429c96e).(int32cxx . . $ int32# ×tamp, uint32cxx . . $ uint32# A, uint16cxx . . $ uint16# V) |
| 822 | { |
| 823 | //VIP_Update(timestamp); |
| 824 | |
| 825 | //if(A >= 0x3DC00 && A < 0x3E000) |
| 826 | // printf("%08x %04x\n", A, V); |
| 827 | |
| 828 | switch(A >> 16) |
| 829 | { |
| 830 | case 0x0: |
| 831 | case 0x1: |
| 832 | if((A & 0x7FFF) >= 0x6000) |
| 833 | VIP_MA16W16cxx . . $ VIP_MA16W16(f1e3642c05758293).(CHR_RAMcxx . . $ CHR_RAM., (A & 0x1FFF) | ((A >> 2) & 0x6000), V); |
| 834 | else |
| 835 | StoreU16_LEcxx . . $ StoreU16_LE(9c42bc65687727f9).((uint16cxx . . $ uint16# *)&FBcxx . . $ FB.[(A >> 15) & 1][(A >> 16) & 1][A & 0x7FFF], V); |
| 836 | break; |
| 837 | |
| 838 | case 0x2: |
| 839 | case 0x3: |
| 840 | VIP_MA16W16cxx . . $ VIP_MA16W16(f1e3642c05758293).(DRAMcxx . . $ DRAM., A & 0x1FFFF, V); |
| 841 | break; |
| 842 | case 0x4: |
| 843 | case 0x5: |
| 844 | if(A >= 0x5E000) |
| 845 | WriteRegistercxx . . $ WriteRegister(f235d607a429c96e).(timestamp, A, V); |
| 846 | else |
| 847 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %04x", A, V); |
| 848 | break; |
| 849 | case 0x6: |
| 850 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %04x", A, V); |
| 851 | break; |
| 852 | case 0x7: |
| 853 | if(A >= 0x8000) |
| 854 | VIP_MA16W16cxx . . $ VIP_MA16W16(f1e3642c05758293).(CHR_RAMcxx . . $ CHR_RAM., A & 0x7FFF, V); |
| 855 | else |
| 856 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %04x", A, V); |
| 857 | break; |
| 858 | default: |
| 859 | VIP_DBGMSGcxx . . $ VIP_DBGMSG(326aeb464d16410c).("Unknown VIP Write: %08x %04x", A, V); |
| 860 | break; |
| 861 | } |
| 862 | |
| 863 | |
| 864 | //VB_SetEvent(VB_EVENT_VIP, timestamp + CalcNextEvent()); |
| 865 | } |
| 866 | |
| 867 | static MDFN_Surfacecxx . . $ MDFN_Surface# *surfacecxx . . $ surface.; |
| 868 | static bool skipcxx . . $ skip.; |
| 869 | |
| 870 | void VIP_StartFramecxx . . $ VIP_StartFrame(c2dd9660813a5292).(EmulateSpecStructcxx . . $ EmulateSpecStruct# *espec) |
| 871 | { |
| 872 | if(espec->VideoFormatChangedcxx . . $ $anonymous_type_643ef407c229d02_10#VideoFormatChanged. || VidSettingsDirtycxx . . $ VidSettingsDirty.) |
| 873 | { |
| 874 | MakeColorLUTcxx . . $ MakeColorLUT(3324b9708c1a4eec).(espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_10#surface.->formatcxx . . $ MDFN_Surface#format.); |
| 875 | Recalc3DModeStuffcxx . . $ Recalc3DModeStuff(b45ddcbc8423892c).(espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_10#surface.->formatcxx . . $ MDFN_Surface#format..colorspacecxx . . $ MDFN_PixelFormat#colorspace. != MDFN_COLORSPACE_RGBcxx . . $ MDFN_COLORSPACE_RGB.); |
| 876 | |
| 877 | VidSettingsDirtycxx . . $ VidSettingsDirty. = false; |
| 878 | } |
| 879 | |
| 880 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..xcxx . . $ $anonymous_type_d9695e4ae1560f11_0#x. = 0; |
| 881 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..ycxx . . $ $anonymous_type_d9695e4ae1560f11_0#y. = 0; |
| 882 | |
| 883 | switch(VB3DModecxx . . $ VB3DMode.) |
| 884 | { |
| 885 | default: |
| 886 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w. = 384; |
| 887 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h. = 224; |
| 888 | break; |
| 889 | |
| 890 | case VB3DMODE_VLIcxx . . $ VB3DMODE_VLI.: |
| 891 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w. = 768 * VBPrescalecxx . . $ VBPrescale.; |
| 892 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h. = 224; |
| 893 | break; |
| 894 | |
| 895 | case VB3DMODE_HLIcxx . . $ VB3DMODE_HLI.: |
| 896 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w. = 384; |
| 897 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h. = 448 * VBPrescalecxx . . $ VBPrescale.; |
| 898 | break; |
| 899 | |
| 900 | case VB3DMODE_CSCOPEcxx . . $ VB3DMODE_CSCOPE.: |
| 901 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w. = 512; |
| 902 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h. = 384; |
| 903 | break; |
| 904 | |
| 905 | case VB3DMODE_SIDEBYSIDEcxx . . $ VB3DMODE_SIDEBYSIDE.: |
| 906 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w. = 768 + VBSBS_Separationcxx . . $ VBSBS_Separation.; |
| 907 | espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_10#DisplayRect..hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h. = 224; |
| 908 | break; |
| 909 | } |
| 910 | |
| 911 | surfacecxx . . $ surface. = espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_10#surface.; |
| 912 | skipcxx . . $ skip. = espec->skipcxx . . $ $anonymous_type_643ef407c229d02_10#skip.; |
| 913 | } |
| 914 | |
| 915 | void VIP_ResetTScxx . . $ VIP_ResetTS(49f6e7a06ebc5aa8).(void) |
| 916 | { |
| 917 | if(SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime. >= 0) |
| 918 | SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime. -= last_tscxx . . $ last_ts.; |
| 919 | last_tscxx . . $ last_ts. = 0; |
| 920 | } |
| 921 | |
| 922 | static int32cxx . . $ int32# CalcNextEventcxx . . $ CalcNextEvent(b126dc7c1de90089).(void) |
| 923 | { |
| 924 | return(ColumnCountercxx . . $ ColumnCounter.); |
| 925 | } |
| 926 | |
| 927 | #include "vip_draw.inc"cxx . . $ `<file>/mednafen/vb/vip_draw.inc`/ |
| 928 | |
| 929 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CopyFBColumnToTarget_Anaglyph_BASEcxx . . $ CopyFBColumnToTarget_Anaglyph_BASE(b994e01f1c45a386).(const bool DisplayActive_arg, const int lr) |
| 930 | { |
| 931 | int y, y_sub; |
| 932 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 933 | |
| 934 | #if defined(WANT_8BPP) |
| 935 | uint8 *target = surface->pixels8 + Column; |
| 936 | #elif defined(WANT_16BPP) |
| 937 | uint16 *target = surface->pixels16 + Column; |
| 938 | #else |
| 939 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + Columncxx . . $ Column.; |
| 940 | #endif |
| 941 | const int32cxx . . $ int32# pitchinpix = surfacecxx . . $ surface.->pitchinpixcxx . . $ MDFN_Surface#$anonymous_type_5#pitchinpix.; |
| 942 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 943 | |
| 944 | for(y = 56; y; y--) |
| 945 | { |
| 946 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 947 | |
| 948 | for(y_sub = 4; y_sub; y_sub--) |
| 949 | { |
| 950 | uint32cxx . . $ uint32# pixel = BrightCLUTcxx . . $ BrightCLUT.[lr][source_bits & 3]; |
| 951 | |
| 952 | if(!DisplayActive_arg) |
| 953 | pixel = 0; |
| 954 | |
| 955 | if(lr) |
| 956 | *target |= pixel; |
| 957 | else |
| 958 | *target = pixel; |
| 959 | |
| 960 | source_bits >>= 2; |
| 961 | target += pitchinpix; |
| 962 | } |
| 963 | fb_source++; |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | static void CopyFBColumnToTarget_Anaglyphcxx . . $ CopyFBColumnToTarget_Anaglyph(49f6e7a06ebc5aa8).(void) |
| 968 | { |
| 969 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 970 | |
| 971 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 972 | { |
| 973 | if(!lr) |
| 974 | CopyFBColumnToTarget_Anaglyph_BASEcxx . . $ CopyFBColumnToTarget_Anaglyph_BASE(b994e01f1c45a386).(0, 0); |
| 975 | else |
| 976 | CopyFBColumnToTarget_Anaglyph_BASEcxx . . $ CopyFBColumnToTarget_Anaglyph_BASE(b994e01f1c45a386).(0, 1); |
| 977 | } |
| 978 | else |
| 979 | { |
| 980 | if(!lr) |
| 981 | CopyFBColumnToTarget_Anaglyph_BASEcxx . . $ CopyFBColumnToTarget_Anaglyph_BASE(b994e01f1c45a386).(1, 0); |
| 982 | else |
| 983 | CopyFBColumnToTarget_Anaglyph_BASEcxx . . $ CopyFBColumnToTarget_Anaglyph_BASE(b994e01f1c45a386).(1, 1); |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | static uint32cxx . . $ uint32# AnaSlowBufcxx . . $ AnaSlowBuf.[384][224]; |
| 988 | |
| 989 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CopyFBColumnToTarget_AnaglyphSlow_BASEcxx . . $ CopyFBColumnToTarget_AnaglyphSlow_BASE(b994e01f1c45a386).(const bool DisplayActive_arg, const int lr) |
| 990 | { |
| 991 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 992 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 993 | |
| 994 | if(!lr) |
| 995 | { |
| 996 | uint32cxx . . $ uint32# *target = AnaSlowBufcxx . . $ AnaSlowBuf.[Columncxx . . $ Column.]; |
| 997 | |
| 998 | for(int y = 56; y; y--) |
| 999 | { |
| 1000 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1001 | |
| 1002 | for(int y_sub = 4; y_sub; y_sub--) |
| 1003 | { |
| 1004 | uint32cxx . . $ uint32# pixel = BrightnessCachecxx . . $ BrightnessCache.[source_bits & 3]; |
| 1005 | |
| 1006 | if(!DisplayActive_arg) |
| 1007 | pixel = 0; |
| 1008 | |
| 1009 | *target = pixel; |
| 1010 | source_bits >>= 2; |
| 1011 | target++; |
| 1012 | } |
| 1013 | fb_source++; |
| 1014 | } |
| 1015 | |
| 1016 | } |
| 1017 | else |
| 1018 | { |
| 1019 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + Columncxx . . $ Column.; |
| 1020 | const uint32cxx . . $ uint32# *left_src = AnaSlowBufcxx . . $ AnaSlowBuf.[Columncxx . . $ Column.]; |
| 1021 | const int32cxx . . $ int32# pitch32 = surfacecxx . . $ surface.->pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; |
| 1022 | |
| 1023 | for(int y = 56; y; y--) |
| 1024 | { |
| 1025 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1026 | |
| 1027 | for(int y_sub = 4; y_sub; y_sub--) |
| 1028 | { |
| 1029 | uint32cxx . . $ uint32# pixel = AnaSlowColorLUTcxx . . $ AnaSlowColorLUT.[*left_src][DisplayActive_arg ? BrightnessCachecxx . . $ BrightnessCache.[source_bits & 3] : 0]; |
| 1030 | |
| 1031 | *target = pixel; |
| 1032 | |
| 1033 | source_bits >>= 2; |
| 1034 | target += pitch32; |
| 1035 | left_src++; |
| 1036 | } |
| 1037 | fb_source++; |
| 1038 | } |
| 1039 | } |
| 1040 | } |
| 1041 | |
| 1042 | static void CopyFBColumnToTarget_AnaglyphSlowcxx . . $ CopyFBColumnToTarget_AnaglyphSlow(49f6e7a06ebc5aa8).(void) |
| 1043 | { |
| 1044 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1045 | |
| 1046 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 1047 | { |
| 1048 | if(!lr) |
| 1049 | CopyFBColumnToTarget_AnaglyphSlow_BASEcxx . . $ CopyFBColumnToTarget_AnaglyphSlow_BASE(b994e01f1c45a386).(0, 0); |
| 1050 | else |
| 1051 | CopyFBColumnToTarget_AnaglyphSlow_BASEcxx . . $ CopyFBColumnToTarget_AnaglyphSlow_BASE(b994e01f1c45a386).(0, 1); |
| 1052 | } |
| 1053 | else |
| 1054 | { |
| 1055 | if(!lr) |
| 1056 | CopyFBColumnToTarget_AnaglyphSlow_BASEcxx . . $ CopyFBColumnToTarget_AnaglyphSlow_BASE(b994e01f1c45a386).(1, 0); |
| 1057 | else |
| 1058 | CopyFBColumnToTarget_AnaglyphSlow_BASEcxx . . $ CopyFBColumnToTarget_AnaglyphSlow_BASE(b994e01f1c45a386).(1, 1); |
| 1059 | } |
| 1060 | } |
| 1061 | |
| 1062 | |
| 1063 | static void CopyFBColumnToTarget_CScope_BASEcxx . . $ CopyFBColumnToTarget_CScope_BASE(1a003dd7b9dc2c5e).(const bool DisplayActive_arg, const int lr, const int dest_lr) |
| 1064 | { |
| 1065 | int y, y_sub; |
| 1066 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 1067 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + (dest_lr ? 512 - 16 - 1 : 16) + (dest_lr ? Columncxx . . $ Column. : 383 - Columncxx . . $ Column.) * surfacecxx . . $ surface.->pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; |
| 1068 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 1069 | |
| 1070 | for(y = 56; y; y--) |
| 1071 | { |
| 1072 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1073 | |
| 1074 | for(y_sub = 4; y_sub; y_sub--) |
| 1075 | { |
| 1076 | if(DisplayActive_arg) |
| 1077 | *target = BrightCLUTcxx . . $ BrightCLUT.[lr][source_bits & 3]; |
| 1078 | else |
| 1079 | *target = 0; |
| 1080 | |
| 1081 | source_bits >>= 2; |
| 1082 | if(dest_lr) |
| 1083 | target--; |
| 1084 | else |
| 1085 | target++; |
| 1086 | } |
| 1087 | fb_source++; |
| 1088 | } |
| 1089 | } |
| 1090 | |
| 1091 | static void CopyFBColumnToTarget_CScopecxx . . $ CopyFBColumnToTarget_CScope(49f6e7a06ebc5aa8).(void) |
| 1092 | { |
| 1093 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1094 | |
| 1095 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 1096 | { |
| 1097 | if(!lr) |
| 1098 | CopyFBColumnToTarget_CScope_BASEcxx . . $ CopyFBColumnToTarget_CScope_BASE(1a003dd7b9dc2c5e).(0, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1099 | else |
| 1100 | CopyFBColumnToTarget_CScope_BASEcxx . . $ CopyFBColumnToTarget_CScope_BASE(1a003dd7b9dc2c5e).(0, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1101 | } |
| 1102 | else |
| 1103 | { |
| 1104 | if(!lr) |
| 1105 | CopyFBColumnToTarget_CScope_BASEcxx . . $ CopyFBColumnToTarget_CScope_BASE(1a003dd7b9dc2c5e).(1, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1106 | else |
| 1107 | CopyFBColumnToTarget_CScope_BASEcxx . . $ CopyFBColumnToTarget_CScope_BASE(1a003dd7b9dc2c5e).(1, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | static void CopyFBColumnToTarget_SideBySide_BASEcxx . . $ CopyFBColumnToTarget_SideBySide_BASE(1a003dd7b9dc2c5e).(const bool DisplayActive_arg, const int lr, const int dest_lr) |
| 1112 | { |
| 1113 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 1114 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + Columncxx . . $ Column. + (dest_lr ? (384 + VBSBS_Separationcxx . . $ VBSBS_Separation.) : 0); |
| 1115 | const int32cxx . . $ int32# pitch32 = surfacecxx . . $ surface.->pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; |
| 1116 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 1117 | |
| 1118 | for(int y = 56; y; y--) |
| 1119 | { |
| 1120 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1121 | |
| 1122 | for(int y_sub = 4; y_sub; y_sub--) |
| 1123 | { |
| 1124 | if(DisplayActive_arg) |
| 1125 | *target = BrightCLUTcxx . . $ BrightCLUT.[lr][source_bits & 3]; |
| 1126 | else |
| 1127 | *target = 0; |
| 1128 | source_bits >>= 2; |
| 1129 | target += pitch32; |
| 1130 | } |
| 1131 | fb_source++; |
| 1132 | } |
| 1133 | } |
| 1134 | |
| 1135 | static void CopyFBColumnToTarget_SideBySidecxx . . $ CopyFBColumnToTarget_SideBySide(49f6e7a06ebc5aa8).(void) |
| 1136 | { |
| 1137 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1138 | |
| 1139 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 1140 | { |
| 1141 | if(!lr) |
| 1142 | CopyFBColumnToTarget_SideBySide_BASEcxx . . $ CopyFBColumnToTarget_SideBySide_BASE(1a003dd7b9dc2c5e).(0, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1143 | else |
| 1144 | CopyFBColumnToTarget_SideBySide_BASEcxx . . $ CopyFBColumnToTarget_SideBySide_BASE(1a003dd7b9dc2c5e).(0, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1145 | } |
| 1146 | else |
| 1147 | { |
| 1148 | if(!lr) |
| 1149 | CopyFBColumnToTarget_SideBySide_BASEcxx . . $ CopyFBColumnToTarget_SideBySide_BASE(1a003dd7b9dc2c5e).(1, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1150 | else |
| 1151 | CopyFBColumnToTarget_SideBySide_BASEcxx . . $ CopyFBColumnToTarget_SideBySide_BASE(1a003dd7b9dc2c5e).(1, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CopyFBColumnToTarget_VLI_BASEcxx . . $ CopyFBColumnToTarget_VLI_BASE(1a003dd7b9dc2c5e).(const bool DisplayActive_arg, const int lr, const int dest_lr) |
| 1156 | { |
| 1157 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 1158 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + Columncxx . . $ Column. * 2 * VBPrescalecxx . . $ VBPrescale. + dest_lr; |
| 1159 | const int32cxx . . $ int32# pitch32 = surfacecxx . . $ surface.->pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; |
| 1160 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 1161 | |
| 1162 | for(int y = 56; y; y--) |
| 1163 | { |
| 1164 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1165 | |
| 1166 | for(int y_sub = 4; y_sub; y_sub--) |
| 1167 | { |
| 1168 | uint32cxx . . $ uint32# tv; |
| 1169 | |
| 1170 | if(DisplayActive_arg) |
| 1171 | tv = BrightCLUTcxx . . $ BrightCLUT.[0][source_bits & 3]; |
| 1172 | else |
| 1173 | tv = 0; |
| 1174 | |
| 1175 | for(uint32cxx . . $ uint32# ps = 0; ps < VBPrescalecxx . . $ VBPrescale.; ps++) |
| 1176 | target[ps * 2] = tv; |
| 1177 | |
| 1178 | source_bits >>= 2; |
| 1179 | target += pitch32; |
| 1180 | } |
| 1181 | fb_source++; |
| 1182 | } |
| 1183 | } |
| 1184 | |
| 1185 | static void CopyFBColumnToTarget_VLIcxx . . $ CopyFBColumnToTarget_VLI(49f6e7a06ebc5aa8).(void) |
| 1186 | { |
| 1187 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1188 | |
| 1189 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 1190 | { |
| 1191 | if(!lr) |
| 1192 | CopyFBColumnToTarget_VLI_BASEcxx . . $ CopyFBColumnToTarget_VLI_BASE(1a003dd7b9dc2c5e).(0, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1193 | else |
| 1194 | CopyFBColumnToTarget_VLI_BASEcxx . . $ CopyFBColumnToTarget_VLI_BASE(1a003dd7b9dc2c5e).(0, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1195 | } |
| 1196 | else |
| 1197 | { |
| 1198 | if(!lr) |
| 1199 | CopyFBColumnToTarget_VLI_BASEcxx . . $ CopyFBColumnToTarget_VLI_BASE(1a003dd7b9dc2c5e).(1, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1200 | else |
| 1201 | CopyFBColumnToTarget_VLI_BASEcxx . . $ CopyFBColumnToTarget_VLI_BASE(1a003dd7b9dc2c5e).(1, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | static INLINEcxx . . $ `mednafen/mednafen-types.h:21:11`! void CopyFBColumnToTarget_HLI_BASEcxx . . $ CopyFBColumnToTarget_HLI_BASE(1a003dd7b9dc2c5e).(const bool DisplayActive_arg, const int lr, const int dest_lr) |
| 1206 | { |
| 1207 | const int fb = DisplayFBcxx . . $ DisplayFB.; |
| 1208 | const int32cxx . . $ int32# pitch32 = surfacecxx . . $ surface.->pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; |
| 1209 | uint32cxx . . $ uint32# *target = surfacecxx . . $ surface.->pixelscxx . . $ MDFN_Surface#pixels. + Columncxx . . $ Column. + dest_lr * pitch32; |
| 1210 | const uint8cxx . . $ uint8# *fb_source = &FBcxx . . $ FB.[fb][lr][64 * Columncxx . . $ Column.]; |
| 1211 | |
| 1212 | if(VBPrescalecxx . . $ VBPrescale. <= 4) |
| 1213 | for(int y = 56; y; y--) |
| 1214 | { |
| 1215 | uint32cxx . . $ uint32# source_bits = HLILUTcxx . . $ HLILUT.[*fb_source]; |
| 1216 | |
| 1217 | for(int y_sub = 4 * VBPrescalecxx . . $ VBPrescale.; y_sub; y_sub--) |
| 1218 | { |
| 1219 | if(DisplayActive_arg) |
| 1220 | *target = BrightCLUTcxx . . $ BrightCLUT.[0][source_bits & 3]; |
| 1221 | else |
| 1222 | *target = 0; |
| 1223 | |
| 1224 | target += pitch32 * 2; |
| 1225 | source_bits >>= 2; |
| 1226 | } |
| 1227 | fb_source++; |
| 1228 | } |
| 1229 | else |
| 1230 | for(int y = 56; y; y--) |
| 1231 | { |
| 1232 | uint32cxx . . $ uint32# source_bits = *fb_source; |
| 1233 | |
| 1234 | for(int y_sub = 4; y_sub; y_sub--) |
| 1235 | { |
| 1236 | for(uint32cxx . . $ uint32# ps = 0; ps < VBPrescalecxx . . $ VBPrescale.; ps++) |
| 1237 | { |
| 1238 | if(DisplayActive_arg) |
| 1239 | *target = BrightCLUTcxx . . $ BrightCLUT.[0][source_bits & 3]; |
| 1240 | else |
| 1241 | *target = 0; |
| 1242 | |
| 1243 | target += pitch32 * 2; |
| 1244 | } |
| 1245 | |
| 1246 | source_bits >>= 2; |
| 1247 | } |
| 1248 | fb_source++; |
| 1249 | } |
| 1250 | } |
| 1251 | |
| 1252 | static void CopyFBColumnToTarget_HLIcxx . . $ CopyFBColumnToTarget_HLI(49f6e7a06ebc5aa8).(void) |
| 1253 | { |
| 1254 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1255 | |
| 1256 | if(!DisplayActivecxx . . $ DisplayActive.) |
| 1257 | { |
| 1258 | if(!lr) |
| 1259 | CopyFBColumnToTarget_HLI_BASEcxx . . $ CopyFBColumnToTarget_HLI_BASE(1a003dd7b9dc2c5e).(0, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1260 | else |
| 1261 | CopyFBColumnToTarget_HLI_BASEcxx . . $ CopyFBColumnToTarget_HLI_BASE(1a003dd7b9dc2c5e).(0, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1262 | } |
| 1263 | else |
| 1264 | { |
| 1265 | if(!lr) |
| 1266 | CopyFBColumnToTarget_HLI_BASEcxx . . $ CopyFBColumnToTarget_HLI_BASE(1a003dd7b9dc2c5e).(1, 0, 0 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1267 | else |
| 1268 | CopyFBColumnToTarget_HLI_BASEcxx . . $ CopyFBColumnToTarget_HLI_BASE(1a003dd7b9dc2c5e).(1, 1, 1 ^ VB3DReversecxx . . $ VB3DReverse.); |
| 1269 | } |
| 1270 | } |
| 1271 | |
| 1272 | v810_timestamp_tcxx . . $ v810_timestamp_t# MDFN_FASTCALLcxx . . $ `mednafen/mednafen-types.h:27:13`! VIP_Updatecxx . . $ VIP_Update(7864480464b09eea).(const v810_timestamp_tcxx . . $ v810_timestamp_t# timestamp) |
| 1273 | { |
| 1274 | int32cxx . . $ int32# clocks = timestamp - last_tscxx . . $ last_ts.; |
| 1275 | int32cxx . . $ int32# running_timestamp = timestamp; |
| 1276 | |
| 1277 | while(clocks > 0) |
| 1278 | { |
| 1279 | int32cxx . . $ int32# chunk_clocks = clocks; |
| 1280 | |
| 1281 | if(DrawingCountercxx . . $ DrawingCounter. > 0 && chunk_clocks > DrawingCountercxx . . $ DrawingCounter.) |
| 1282 | chunk_clocks = DrawingCountercxx . . $ DrawingCounter.; |
| 1283 | if(chunk_clocks > ColumnCountercxx . . $ ColumnCounter.) |
| 1284 | chunk_clocks = ColumnCountercxx . . $ ColumnCounter.; |
| 1285 | |
| 1286 | running_timestamp += chunk_clocks; |
| 1287 | |
| 1288 | if(DrawingCountercxx . . $ DrawingCounter. > 0) |
| 1289 | { |
| 1290 | DrawingCountercxx . . $ DrawingCounter. -= chunk_clocks; |
| 1291 | if(DrawingCountercxx . . $ DrawingCounter. <= 0) |
| 1292 | { |
| 1293 | MDFN_ALIGNcxx . . $ `mednafen/mednafen-types.h:30:11`!(8) uint8cxx . . $ uint8# DrawingBuffers[2][512 * 8]; // Don't decrease this from 512 unless you adjust vip_draw.inc(including areas that draw off-visible >= 384 and >= -7 for speed reasons) |
| 1294 | |
| 1295 | if(skipcxx . . $ skip. && InstantDisplayHackcxx . . $ InstantDisplayHack. && AllowDrawSkipcxx . . $ AllowDrawSkip.) |
| 1296 | { |
| 1297 | #if 0 |
| 1298 | for(int lr = 0; lr < 2; lr++) |
| 1299 | { |
| 1300 | uint8 *FB_Target = FB[DrawingFB][lr] + DrawingBlock * 2; |
| 1301 | for(int x = 0; x < 384; x++) |
| 1302 | { |
| 1303 | FB_Target[64 * x + 0] = BKCOL; |
| 1304 | FB_Target[64 * x + 1] = BKCOL; |
| 1305 | } |
| 1306 | } |
| 1307 | #endif |
| 1308 | } |
| 1309 | else |
| 1310 | { |
| 1311 | VIP_DrawBlockcxx . . $ VIP_DrawBlock(80ea1796e70b5c29).(DrawingBlockcxx . . $ DrawingBlock., DrawingBuffers[0] + 8, DrawingBuffers[1] + 8); |
| 1312 | |
| 1313 | for(int lr = 0; lr < 2; lr++) |
| 1314 | { |
| 1315 | uint8cxx . . $ uint8# *FB_Target = FBcxx . . $ FB.[DrawingFBcxx . . $ DrawingFB.][lr] + DrawingBlockcxx . . $ DrawingBlock. * 2; |
| 1316 | |
| 1317 | for(int x = 0; x < 384; x++) |
| 1318 | { |
| 1319 | FB_Target[64 * x + 0] = (DrawingBuffers[lr][8 + x + 512 * 0] << 0) |
| 1320 | | (DrawingBuffers[lr][8 + x + 512 * 1] << 2) |
| 1321 | | (DrawingBuffers[lr][8 + x + 512 * 2] << 4) |
| 1322 | | (DrawingBuffers[lr][8 + x + 512 * 3] << 6); |
| 1323 | |
| 1324 | FB_Target[64 * x + 1] = (DrawingBuffers[lr][8 + x + 512 * 4] << 0) |
| 1325 | | (DrawingBuffers[lr][8 + x + 512 * 5] << 2) |
| 1326 | | (DrawingBuffers[lr][8 + x + 512 * 6] << 4) |
| 1327 | | (DrawingBuffers[lr][8 + x + 512 * 7] << 6); |
| 1328 | |
| 1329 | } |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | SBOUT_InactiveTimecxx . . $ SBOUT_InactiveTime. = running_timestamp + 1120; |
| 1334 | SB_Latchcxx . . $ SB_Latch. = DrawingBlockcxx . . $ DrawingBlock.; // Not exactly correct, but probably doesn't matter. |
| 1335 | |
| 1336 | DrawingBlockcxx . . $ DrawingBlock.++; |
| 1337 | if(DrawingBlockcxx . . $ DrawingBlock. == 28) |
| 1338 | { |
| 1339 | DrawingActivecxx . . $ DrawingActive. = false; |
| 1340 | |
| 1341 | InterruptPendingcxx . . $ InterruptPending. |= INT_XP_ENDcxx . . $ `mednafen/vb/vip.cpp:68:9`!; |
| 1342 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1343 | } |
| 1344 | else |
| 1345 | DrawingCountercxx . . $ DrawingCounter. += 1120 * 4; |
| 1346 | } |
| 1347 | } |
| 1348 | |
| 1349 | ColumnCountercxx . . $ ColumnCounter. -= chunk_clocks; |
| 1350 | if(ColumnCountercxx . . $ ColumnCounter. == 0) |
| 1351 | { |
| 1352 | if(DisplayRegioncxx . . $ DisplayRegion. & 1) |
| 1353 | { |
| 1354 | if(!(Columncxx . . $ Column. & 3)) |
| 1355 | { |
| 1356 | const int lr = (DisplayRegioncxx . . $ DisplayRegion. & 2) >> 1; |
| 1357 | uint16cxx . . $ uint16# ctdata = VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(DRAMcxx . . $ DRAM., 0x1DFFE - ((Columncxx . . $ Column. >> 2) * 2) - (lr ? 0 : 0x200)); |
| 1358 | |
| 1359 | if((ctdata >> 8) != Repeatcxx . . $ Repeat.) |
| 1360 | { |
| 1361 | Repeatcxx . . $ Repeat. = ctdata >> 8; |
| 1362 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1363 | } |
| 1364 | } |
| 1365 | if(!skipcxx . . $ skip. && !InstantDisplayHackcxx . . $ InstantDisplayHack.) |
| 1366 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget.(); |
| 1367 | } |
| 1368 | |
| 1369 | ColumnCountercxx . . $ ColumnCounter. = 259; |
| 1370 | Columncxx . . $ Column.++; |
| 1371 | if(Columncxx . . $ Column. == 384) |
| 1372 | { |
| 1373 | Columncxx . . $ Column. = 0; |
| 1374 | |
| 1375 | if(DisplayActivecxx . . $ DisplayActive.) |
| 1376 | { |
| 1377 | if(DisplayRegioncxx . . $ DisplayRegion. & 1) // Did we just finish displaying an active region? |
| 1378 | { |
| 1379 | if(DisplayRegioncxx . . $ DisplayRegion. & 2) // finished displaying right eye |
| 1380 | InterruptPendingcxx . . $ InterruptPending. |= INT_RFB_ENDcxx . . $ `mednafen/vb/vip.cpp:63:9`!; |
| 1381 | else // Otherwise, left eye |
| 1382 | InterruptPendingcxx . . $ InterruptPending. |= INT_LFB_ENDcxx . . $ `mednafen/vb/vip.cpp:62:9`!; |
| 1383 | |
| 1384 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1385 | } |
| 1386 | } |
| 1387 | |
| 1388 | DisplayRegioncxx . . $ DisplayRegion. = (DisplayRegioncxx . . $ DisplayRegion. + 1) & 3; |
| 1389 | |
| 1390 | if(DisplayRegioncxx . . $ DisplayRegion. == 0) // New frame start |
| 1391 | { |
| 1392 | DisplayActivecxx . . $ DisplayActive. = DPCTRLcxx . . $ DPCTRL. & 0x2; |
| 1393 | |
| 1394 | if(DisplayActivecxx . . $ DisplayActive.) |
| 1395 | { |
| 1396 | InterruptPendingcxx . . $ InterruptPending. |= INT_FRAME_STARTcxx . . $ `mednafen/vb/vip.cpp:65:9`!; |
| 1397 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1398 | } |
| 1399 | GameFrameCountercxx . . $ GameFrameCounter.++; |
| 1400 | if(GameFrameCountercxx . . $ GameFrameCounter. > FRMCYCcxx . . $ FRMCYC.) // New game frame start? |
| 1401 | { |
| 1402 | InterruptPendingcxx . . $ InterruptPending. |= INT_GAME_STARTcxx . . $ `mednafen/vb/vip.cpp:64:9`!; |
| 1403 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1404 | |
| 1405 | if(XPCTRLcxx . . $ XPCTRL. & XPCTRL_XP_ENcxx . . $ `mednafen/vb/vip.cpp:337:9`!) |
| 1406 | { |
| 1407 | DisplayFBcxx . . $ DisplayFB. ^= 1; |
| 1408 | |
| 1409 | DrawingBlockcxx . . $ DrawingBlock. = 0; |
| 1410 | DrawingActivecxx . . $ DrawingActive. = true; |
| 1411 | DrawingCountercxx . . $ DrawingCounter. = 1120 * 4; |
| 1412 | DrawingFBcxx . . $ DrawingFB. = DisplayFBcxx . . $ DisplayFB. ^ 1; |
| 1413 | } |
| 1414 | |
| 1415 | GameFrameCountercxx . . $ GameFrameCounter. = 0; |
| 1416 | } |
| 1417 | |
| 1418 | if(!skipcxx . . $ skip. && InstantDisplayHackcxx . . $ InstantDisplayHack.) |
| 1419 | { |
| 1420 | // Ugly kludge, fix in the future. |
| 1421 | int32cxx . . $ int32# save_DisplayRegion = DisplayRegioncxx . . $ DisplayRegion.; |
| 1422 | int32cxx . . $ int32# save_Column = Columncxx . . $ Column.; |
| 1423 | uint8cxx . . $ uint8# save_Repeat = Repeatcxx . . $ Repeat.; |
| 1424 | |
| 1425 | for(int lr = 0; lr < 2; lr++) |
| 1426 | { |
| 1427 | DisplayRegioncxx . . $ DisplayRegion. = lr << 1; |
| 1428 | for(Columncxx . . $ Column. = 0; Columncxx . . $ Column. < 384; Columncxx . . $ Column.++) |
| 1429 | { |
| 1430 | if(!(Columncxx . . $ Column. & 3)) |
| 1431 | { |
| 1432 | uint16cxx . . $ uint16# ctdata = VIP_MA16R16cxx . . $ VIP_MA16R16(16764624942c15b6).(DRAMcxx . . $ DRAM., 0x1DFFE - ((Columncxx . . $ Column. >> 2) * 2) - (lr ? 0 : 0x200)); |
| 1433 | |
| 1434 | if((ctdata >> 8) != Repeatcxx . . $ Repeat.) |
| 1435 | { |
| 1436 | Repeatcxx . . $ Repeat. = ctdata >> 8; |
| 1437 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | CopyFBColumnToTargetcxx . . $ CopyFBColumnToTarget.(); |
| 1442 | } |
| 1443 | } |
| 1444 | DisplayRegioncxx . . $ DisplayRegion. = save_DisplayRegion; |
| 1445 | Columncxx . . $ Column. = save_Column; |
| 1446 | Repeatcxx . . $ Repeat. = save_Repeat; |
| 1447 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1448 | } |
| 1449 | |
| 1450 | VB_ExitLoopcxx . . $ VB_ExitLoop(49f6e7a06ebc5aa8).(); |
| 1451 | } |
| 1452 | } |
| 1453 | } |
| 1454 | |
| 1455 | clocks -= chunk_clocks; |
| 1456 | } |
| 1457 | |
| 1458 | last_tscxx . . $ last_ts. = timestamp; |
| 1459 | |
| 1460 | return(timestamp + CalcNextEventcxx . . $ CalcNextEvent(b126dc7c1de90089).()); |
| 1461 | } |
| 1462 | |
| 1463 | int VIP_StateActioncxx . . $ VIP_StateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only) |
| 1464 | { |
| 1465 | SFORMATcxx . . $ SFORMAT# StateRegs[] = |
| 1466 | { |
| 1467 | SFARRAYcxx . . $ `mednafen/state.h:75:9`!(FB[0][0], 0x6000 * 2 * 2), |
| 1468 | SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(CHR_RAM, 0x8000 / sizeof(uint16)), |
| 1469 | SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(DRAM, 0x20000 / sizeof(uint16)), |
| 1470 | |
| 1471 | SFVARcxx . . $ `mednafen/state.h:72:9`!(InterruptPending), |
| 1472 | SFVARcxx . . $ `mednafen/state.h:72:9`!(InterruptEnable), |
| 1473 | |
| 1474 | SFVARcxx . . $ `mednafen/state.h:72:9`!(BRTA), |
| 1475 | SFVARcxx . . $ `mednafen/state.h:72:9`!(BRTB), |
| 1476 | SFVARcxx . . $ `mednafen/state.h:72:9`!(BRTC), |
| 1477 | SFVARcxx . . $ `mednafen/state.h:72:9`!(REST), |
| 1478 | |
| 1479 | SFVARcxx . . $ `mednafen/state.h:72:9`!(FRMCYC), |
| 1480 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DPCTRL), |
| 1481 | |
| 1482 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DisplayActive), |
| 1483 | |
| 1484 | SFVARcxx . . $ `mednafen/state.h:72:9`!(XPCTRL), |
| 1485 | SFVARcxx . . $ `mednafen/state.h:72:9`!(SBCMP), |
| 1486 | SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(SPT, 4), |
| 1487 | SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(GPLT, 4), // FIXME |
| 1488 | SFARRAY16cxx . . $ `mednafen/state.h:81:9`!(JPLT, 4), |
| 1489 | |
| 1490 | SFVARcxx . . $ `mednafen/state.h:72:9`!(BKCOL), |
| 1491 | |
| 1492 | SFVARcxx . . $ `mednafen/state.h:72:9`!(Column), |
| 1493 | SFVARcxx . . $ `mednafen/state.h:72:9`!(ColumnCounter), |
| 1494 | |
| 1495 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DisplayRegion), |
| 1496 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DisplayFB), |
| 1497 | |
| 1498 | SFVARcxx . . $ `mednafen/state.h:72:9`!(GameFrameCounter), |
| 1499 | |
| 1500 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DrawingCounter), |
| 1501 | |
| 1502 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DrawingActive), |
| 1503 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DrawingFB), |
| 1504 | SFVARcxx . . $ `mednafen/state.h:72:9`!(DrawingBlock), |
| 1505 | |
| 1506 | SFVARcxx . . $ `mednafen/state.h:72:9`!(SB_Latch), |
| 1507 | SFVARcxx . . $ `mednafen/state.h:72:9`!(SBOUT_InactiveTime), |
| 1508 | |
| 1509 | SFVARcxx . . $ `mednafen/state.h:72:9`!(Repeat), |
| 1510 | SFENDcxx . . $ `mednafen/state.h:96:9`! |
| 1511 | }; |
| 1512 | |
| 1513 | int ret = MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(sm, load, data_only, StateRegs, "VIP"); |
| 1514 | |
| 1515 | if(load) |
| 1516 | { |
| 1517 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1518 | for(int i = 0; i < 4; i++) |
| 1519 | { |
| 1520 | Recalc_GPLT_Cachecxx . . $ Recalc_GPLT_Cache(d4f767463ce0a6b3).(i); |
| 1521 | Recalc_JPLT_Cachecxx . . $ Recalc_JPLT_Cache(d4f767463ce0a6b3).(i); |
| 1522 | } |
| 1523 | } |
| 1524 | |
| 1525 | return(ret); |
| 1526 | } |
| 1527 | |
| 1528 | uint32cxx . . $ uint32# VIP_GetRegistercxx . . $ VIP_GetRegister(3ea512d07239c55b).(const unsigned int id, char *special, const uint32cxx . . $ uint32# special_len) |
| 1529 | { |
| 1530 | switch(id) |
| 1531 | { |
| 1532 | case VIP_GSREG_IPENDINGcxx . . $ VIP_GSREG_IPENDING.: |
| 1533 | return InterruptPendingcxx . . $ InterruptPending.; |
| 1534 | case VIP_GSREG_IENABLEcxx . . $ VIP_GSREG_IENABLE.: |
| 1535 | return InterruptEnablecxx . . $ InterruptEnable.; |
| 1536 | case VIP_GSREG_DPCTRLcxx . . $ VIP_GSREG_DPCTRL.: |
| 1537 | return DPCTRLcxx . . $ DPCTRL.; |
| 1538 | case VIP_GSREG_BRTAcxx . . $ VIP_GSREG_BRTA.: |
| 1539 | return BRTAcxx . . $ BRTA.; |
| 1540 | case VIP_GSREG_BRTBcxx . . $ VIP_GSREG_BRTB.: |
| 1541 | return BRTBcxx . . $ BRTB.; |
| 1542 | case VIP_GSREG_BRTCcxx . . $ VIP_GSREG_BRTC.: |
| 1543 | return BRTCcxx . . $ BRTC.; |
| 1544 | case VIP_GSREG_RESTcxx . . $ VIP_GSREG_REST.: |
| 1545 | return RESTcxx . . $ REST.; |
| 1546 | case VIP_GSREG_FRMCYCcxx . . $ VIP_GSREG_FRMCYC.: |
| 1547 | return FRMCYCcxx . . $ FRMCYC.; |
| 1548 | case VIP_GSREG_XPCTRLcxx . . $ VIP_GSREG_XPCTRL.: |
| 1549 | return XPCTRLcxx . . $ XPCTRL. | (SBCMPcxx . . $ SBCMP. << 8); |
| 1550 | case VIP_GSREG_SPT0cxx . . $ VIP_GSREG_SPT0.: |
| 1551 | case VIP_GSREG_SPT1cxx . . $ VIP_GSREG_SPT1.: |
| 1552 | case VIP_GSREG_SPT2cxx . . $ VIP_GSREG_SPT2.: |
| 1553 | case VIP_GSREG_SPT3cxx . . $ VIP_GSREG_SPT3.: |
| 1554 | return SPTcxx . . $ SPT.[id - VIP_GSREG_SPT0cxx . . $ VIP_GSREG_SPT0.]; |
| 1555 | case VIP_GSREG_GPLT0cxx . . $ VIP_GSREG_GPLT0.: |
| 1556 | case VIP_GSREG_GPLT1cxx . . $ VIP_GSREG_GPLT1.: |
| 1557 | case VIP_GSREG_GPLT2cxx . . $ VIP_GSREG_GPLT2.: |
| 1558 | case VIP_GSREG_GPLT3cxx . . $ VIP_GSREG_GPLT3.: |
| 1559 | return GPLTcxx . . $ GPLT.[id - VIP_GSREG_GPLT0cxx . . $ VIP_GSREG_GPLT0.]; |
| 1560 | case VIP_GSREG_JPLT0cxx . . $ VIP_GSREG_JPLT0.: |
| 1561 | case VIP_GSREG_JPLT1cxx . . $ VIP_GSREG_JPLT1.: |
| 1562 | case VIP_GSREG_JPLT2cxx . . $ VIP_GSREG_JPLT2.: |
| 1563 | case VIP_GSREG_JPLT3cxx . . $ VIP_GSREG_JPLT3.: |
| 1564 | return JPLTcxx . . $ JPLT.[id - VIP_GSREG_JPLT0cxx . . $ VIP_GSREG_JPLT0.]; |
| 1565 | case VIP_GSREG_BKCOLcxx . . $ VIP_GSREG_BKCOL.: |
| 1566 | return BKCOLcxx . . $ BKCOL.; |
| 1567 | } |
| 1568 | |
| 1569 | return 0xDEADBEEF; |
| 1570 | } |
| 1571 | |
| 1572 | void VIP_SetRegistercxx . . $ VIP_SetRegister(b4d55b1286ff73e8).(const unsigned int id, const uint32cxx . . $ uint32# value) |
| 1573 | { |
| 1574 | switch(id) |
| 1575 | { |
| 1576 | case VIP_GSREG_IPENDINGcxx . . $ VIP_GSREG_IPENDING.: |
| 1577 | InterruptPendingcxx . . $ InterruptPending. = value & 0xE01F; |
| 1578 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1579 | break; |
| 1580 | |
| 1581 | case VIP_GSREG_IENABLEcxx . . $ VIP_GSREG_IENABLE.: |
| 1582 | InterruptEnablecxx . . $ InterruptEnable. = value & 0xE01F; |
| 1583 | CheckIRQcxx . . $ CheckIRQ(49f6e7a06ebc5aa8).(); |
| 1584 | break; |
| 1585 | |
| 1586 | case VIP_GSREG_DPCTRLcxx . . $ VIP_GSREG_DPCTRL.: |
| 1587 | DPCTRLcxx . . $ DPCTRL. = value & 0x703; // FIXME(Lower bit?) |
| 1588 | break; |
| 1589 | |
| 1590 | case VIP_GSREG_BRTAcxx . . $ VIP_GSREG_BRTA.: |
| 1591 | BRTAcxx . . $ BRTA. = value & 0xFF; |
| 1592 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1593 | break; |
| 1594 | |
| 1595 | case VIP_GSREG_BRTBcxx . . $ VIP_GSREG_BRTB.: |
| 1596 | BRTBcxx . . $ BRTB. = value & 0xFF; |
| 1597 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1598 | break; |
| 1599 | |
| 1600 | case VIP_GSREG_BRTCcxx . . $ VIP_GSREG_BRTC.: |
| 1601 | BRTCcxx . . $ BRTC. = value & 0xFF; |
| 1602 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1603 | break; |
| 1604 | |
| 1605 | case VIP_GSREG_RESTcxx . . $ VIP_GSREG_REST.: |
| 1606 | RESTcxx . . $ REST. = value & 0xFF; |
| 1607 | RecalcBrightnessCachecxx . . $ RecalcBrightnessCache(49f6e7a06ebc5aa8).(); |
| 1608 | break; |
| 1609 | |
| 1610 | case VIP_GSREG_FRMCYCcxx . . $ VIP_GSREG_FRMCYC.: |
| 1611 | FRMCYCcxx . . $ FRMCYC. = value & 0xF; |
| 1612 | break; |
| 1613 | |
| 1614 | case VIP_GSREG_XPCTRLcxx . . $ VIP_GSREG_XPCTRL.: |
| 1615 | XPCTRLcxx . . $ XPCTRL. = value & 0x2; |
| 1616 | SBCMPcxx . . $ SBCMP. = (value >> 8) & 0x1f; |
| 1617 | break; |
| 1618 | |
| 1619 | case VIP_GSREG_SPT0cxx . . $ VIP_GSREG_SPT0.: |
| 1620 | case VIP_GSREG_SPT1cxx . . $ VIP_GSREG_SPT1.: |
| 1621 | case VIP_GSREG_SPT2cxx . . $ VIP_GSREG_SPT2.: |
| 1622 | case VIP_GSREG_SPT3cxx . . $ VIP_GSREG_SPT3.: |
| 1623 | SPTcxx . . $ SPT.[id - VIP_GSREG_SPT0cxx . . $ VIP_GSREG_SPT0.] = value & 0x3FF; |
| 1624 | break; |
| 1625 | |
| 1626 | case VIP_GSREG_GPLT0cxx . . $ VIP_GSREG_GPLT0.: |
| 1627 | case VIP_GSREG_GPLT1cxx . . $ VIP_GSREG_GPLT1.: |
| 1628 | case VIP_GSREG_GPLT2cxx . . $ VIP_GSREG_GPLT2.: |
| 1629 | case VIP_GSREG_GPLT3cxx . . $ VIP_GSREG_GPLT3.: |
| 1630 | GPLTcxx . . $ GPLT.[id - VIP_GSREG_GPLT0cxx . . $ VIP_GSREG_GPLT0.] = value & 0xFC; |
| 1631 | Recalc_GPLT_Cachecxx . . $ Recalc_GPLT_Cache(d4f767463ce0a6b3).(id - VIP_GSREG_GPLT0cxx . . $ VIP_GSREG_GPLT0.); |
| 1632 | break; |
| 1633 | |
| 1634 | case VIP_GSREG_JPLT0cxx . . $ VIP_GSREG_JPLT0.: |
| 1635 | case VIP_GSREG_JPLT1cxx . . $ VIP_GSREG_JPLT1.: |
| 1636 | case VIP_GSREG_JPLT2cxx . . $ VIP_GSREG_JPLT2.: |
| 1637 | case VIP_GSREG_JPLT3cxx . . $ VIP_GSREG_JPLT3.: |
| 1638 | JPLTcxx . . $ JPLT.[id - VIP_GSREG_JPLT0cxx . . $ VIP_GSREG_JPLT0.] = value & 0xFC; |
| 1639 | Recalc_JPLT_Cachecxx . . $ Recalc_JPLT_Cache(d4f767463ce0a6b3).(id - VIP_GSREG_JPLT0cxx . . $ VIP_GSREG_JPLT0.); |
| 1640 | break; |
| 1641 | |
| 1642 | case VIP_GSREG_BKCOLcxx . . $ VIP_GSREG_BKCOL.: |
| 1643 | BKCOLcxx . . $ BKCOL. = value & 0x03; |
| 1644 | break; |
| 1645 | } |
| 1646 | } |