| 1 | /* Cygne |
| 2 | * |
| 3 | * Copyright notice for this file: |
| 4 | * Copyright (C) 2002 Dox [email protected] |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <string.h> |
| 22 | |
| 23 | #include "wswan.h"cxx . . $ `<file>/mednafen/wswan/wswan.h`/ |
| 24 | #include "gfx.h"cxx . . $ `<file>/mednafen/wswan/gfx.h`/ |
| 25 | #include "interrupt.h"cxx . . $ `<file>/mednafen/wswan/interrupt.h`/ |
| 26 | #include "wswan-memory.h"cxx . . $ `<file>/mednafen/wswan/wswan-memory.h`/ |
| 27 | #include "v30mz.h"cxx . . $ `<file>/mednafen/wswan/v30mz.h`/ |
| 28 | #include "rtc.h"cxx . . $ `<file>/mednafen/wswan/rtc.h`/ |
| 29 | #include "../video.h"cxx . . $ `<file>/mednafen/video.h`/ |
| 30 | #include "../state_inline.h"cxx . . $ `<file>/mednafen/state_inline.h`/ |
| 31 | |
| 32 | static uint32cxx . . $ uint32# wsMonoPalcxx . . $ wsMonoPal.[16][4]; |
| 33 | static uint32cxx . . $ uint32# wsColorscxx . . $ wsColors.[8]; |
| 34 | static uint32cxx . . $ uint32# wsColscxx . . $ wsCols.[16][16]; |
| 35 | |
| 36 | static uint32cxx . . $ uint32# ColorMapGcxx . . $ ColorMapG.[16]; |
| 37 | static uint32cxx . . $ uint32# ColorMapcxx . . $ ColorMap.[4096]; |
| 38 | static uint32cxx . . $ uint32# LayerEnabledcxx . . $ LayerEnabled.; |
| 39 | |
| 40 | static uint8cxx . . $ uint8# wsLinecxx . . $ wsLine.; /*current scanline*/ |
| 41 | |
| 42 | static uint8cxx . . $ uint8# SpriteTablecxx . . $ SpriteTable.[2][0x80][4]; |
| 43 | static uint32cxx . . $ uint32# SpriteCountCachecxx . . $ SpriteCountCache.[2]; |
| 44 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! FrameWhichActivecxx . . $ FrameWhichActive.; |
| 45 | static uint8cxx . . $ uint8# DispControlcxx . . $ DispControl.; |
| 46 | static uint8cxx . . $ uint8# BGColorcxx . . $ BGColor.; |
| 47 | static uint8cxx . . $ uint8# LineComparecxx . . $ LineCompare.; |
| 48 | static uint8cxx . . $ uint8# SPRBasecxx . . $ SPRBase.; |
| 49 | static uint8cxx . . $ uint8# SpriteStartcxx . . $ SpriteStart., SpriteCountcxx . . $ SpriteCount.; |
| 50 | static uint8cxx . . $ uint8# FGBGLoccxx . . $ FGBGLoc.; |
| 51 | static uint8cxx . . $ uint8# FGx0cxx . . $ FGx0., FGy0cxx . . $ FGy0., FGx1cxx . . $ FGx1., FGy1cxx . . $ FGy1.; |
| 52 | static uint8cxx . . $ uint8# SPRx0cxx . . $ SPRx0., SPRy0cxx . . $ SPRy0., SPRx1cxx . . $ SPRx1., SPRy1cxx . . $ SPRy1.; |
| 53 | |
| 54 | static uint8cxx . . $ uint8# BGXScrollcxx . . $ BGXScroll., BGYScrollcxx . . $ BGYScroll.; |
| 55 | static uint8cxx . . $ uint8# FGXScrollcxx . . $ FGXScroll., FGYScrollcxx . . $ FGYScroll.; |
| 56 | static uint8cxx . . $ uint8# LCDControlcxx . . $ LCDControl., LCDIconscxx . . $ LCDIcons.; |
| 57 | static uint8cxx . . $ uint8# LCDVtotalcxx . . $ LCDVtotal.; |
| 58 | |
| 59 | static uint8cxx . . $ uint8# BTimerControlcxx . . $ BTimerControl.; |
| 60 | static uint16cxx . . $ uint16# HBTimerPeriodcxx . . $ HBTimerPeriod.; |
| 61 | static uint16cxx . . $ uint16# VBTimerPeriodcxx . . $ VBTimerPeriod.; |
| 62 | |
| 63 | static uint16cxx . . $ uint16# HBCountercxx . . $ HBCounter., VBCountercxx . . $ VBCounter.; |
| 64 | static uint8cxx . . $ uint8# VideoModecxx . . $ VideoMode.; |
| 65 | |
| 66 | void WSwan_GfxInitcxx . . $ WSwan_GfxInit(49f6e7a06ebc5aa8).(void) |
| 67 | { |
| 68 | LayerEnabledcxx . . $ LayerEnabled. = 7; /* BG, FG, sprites */ |
| 69 | } |
| 70 | |
| 71 | void WSwan_GfxWSCPaletteRAMWritecxx . . $ WSwan_GfxWSCPaletteRAMWrite(cc289a6b3dfc48da).(uint32cxx . . $ uint32# ws_offset, uint8cxx . . $ uint8# data) |
| 72 | { |
| 73 | ws_offset=(ws_offset&0xfffe)-0xfe00; |
| 74 | wsColscxx . . $ wsCols.[(ws_offset>>1)>>4][(ws_offset>>1)&15] = wsRAMcxx . . $ wsRAM.[ws_offset+0xfe00] | ((wsRAMcxx . . $ wsRAM.[ws_offset+0xfe01]&0x0f) << 8); |
| 75 | } |
| 76 | |
| 77 | void WSwan_GfxWritecxx . . $ WSwan_GfxWrite(cc289a6b3dfc48da).(uint32cxx . . $ uint32# A, uint8cxx . . $ uint8# V) |
| 78 | { |
| 79 | if(A >= 0x1C && A <= 0x1F) |
| 80 | { |
| 81 | wsColorscxx . . $ wsColors.[(A - 0x1C) * 2 + 0] = 0xF - (V & 0xf); |
| 82 | wsColorscxx . . $ wsColors.[(A - 0x1C) * 2 + 1] = 0xF - (V >> 4); |
| 83 | } |
| 84 | else if(A >= 0x20 && A <= 0x3F) |
| 85 | { |
| 86 | wsMonoPalcxx . . $ wsMonoPal.[(A - 0x20) >> 1][((A & 0x1) << 1) + 0] = V&7; |
| 87 | wsMonoPalcxx . . $ wsMonoPal.[(A - 0x20) >> 1][((A & 0x1) << 1) | 1] = (V>>4)&7; |
| 88 | } |
| 89 | else switch(A) |
| 90 | { |
| 91 | case 0x00: DispControlcxx . . $ DispControl. = V; break; |
| 92 | case 0x01: BGColorcxx . . $ BGColor. = V; break; |
| 93 | case 0x03: LineComparecxx . . $ LineCompare. = V; break; |
| 94 | case 0x04: SPRBasecxx . . $ SPRBase. = V & 0x3F; break; |
| 95 | case 0x05: SpriteStartcxx . . $ SpriteStart. = V; break; |
| 96 | case 0x06: SpriteCountcxx . . $ SpriteCount. = V; break; |
| 97 | case 0x07: FGBGLoccxx . . $ FGBGLoc. = V; break; |
| 98 | case 0x08: FGx0cxx . . $ FGx0. = V; break; |
| 99 | case 0x09: FGy0cxx . . $ FGy0. = V; break; |
| 100 | case 0x0A: FGx1cxx . . $ FGx1. = V; break; |
| 101 | case 0x0B: FGy1cxx . . $ FGy1. = V; break; |
| 102 | case 0x0C: SPRx0cxx . . $ SPRx0. = V; break; |
| 103 | case 0x0D: SPRy0cxx . . $ SPRy0. = V; break; |
| 104 | case 0x0E: SPRx1cxx . . $ SPRx1. = V; break; |
| 105 | case 0x0F: SPRy1cxx . . $ SPRy1. = V; break; |
| 106 | case 0x10: BGXScrollcxx . . $ BGXScroll. = V; break; |
| 107 | case 0x11: BGYScrollcxx . . $ BGYScroll. = V; break; |
| 108 | case 0x12: FGXScrollcxx . . $ FGXScroll. = V; break; |
| 109 | case 0x13: FGYScrollcxx . . $ FGYScroll. = V; break; |
| 110 | |
| 111 | case 0x14: LCDControlcxx . . $ LCDControl. = V; break; |
| 112 | case 0x15: LCDIconscxx . . $ LCDIcons. = V; break; |
| 113 | case 0x16: LCDVtotalcxx . . $ LCDVtotal. = V; break; |
| 114 | case 0x60: VideoModecxx . . $ VideoMode. = V; wsSetVideocxx . . $ wsSetVideo(918ebd27a9ddbad3).(V>>5, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); break; |
| 115 | |
| 116 | case 0xa2: BTimerControlcxx . . $ BTimerControl. = V; break; |
| 117 | case 0xa4: HBTimerPeriodcxx . . $ HBTimerPeriod. &= 0xFF00; HBTimerPeriodcxx . . $ HBTimerPeriod. |= (V << 0); break; |
| 118 | case 0xa5: HBTimerPeriodcxx . . $ HBTimerPeriod. &= 0x00FF; HBTimerPeriodcxx . . $ HBTimerPeriod. |= (V << 8); HBCountercxx . . $ HBCounter. = HBTimerPeriodcxx . . $ HBTimerPeriod.; break; |
| 119 | case 0xa6: VBTimerPeriodcxx . . $ VBTimerPeriod. &= 0xFF00; VBTimerPeriodcxx . . $ VBTimerPeriod. |= (V << 0); break; |
| 120 | case 0xa7: VBTimerPeriodcxx . . $ VBTimerPeriod. &= 0x00FF; VBTimerPeriodcxx . . $ VBTimerPeriod. |= (V << 8); VBCountercxx . . $ VBCounter. = VBTimerPeriodcxx . . $ VBTimerPeriod.; break; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | uint8cxx . . $ uint8# WSwan_GfxReadcxx . . $ WSwan_GfxRead(32407b39b2dfce37).(uint32cxx . . $ uint32# A) |
| 125 | { |
| 126 | if(A >= 0x1C && A <= 0x1F) |
| 127 | { |
| 128 | uint8cxx . . $ uint8# ret = 0; |
| 129 | |
| 130 | ret |= 0xF - wsColorscxx . . $ wsColors.[(A - 0x1C) * 2 + 0]; |
| 131 | ret |= (0xF - wsColorscxx . . $ wsColors.[(A - 0x1C) * 2 + 1]) << 4; |
| 132 | |
| 133 | return(ret); |
| 134 | } |
| 135 | else if(A >= 0x20 && A <= 0x3F) |
| 136 | return wsMonoPalcxx . . $ wsMonoPal.[(A - 0x20) >> 1][((A & 0x1) << 1) + 0] | (wsMonoPalcxx . . $ wsMonoPal.[(A - 0x20) >> 1][((A & 0x1) << 1) | 1] << 4); |
| 137 | else switch(A) |
| 138 | { |
| 139 | case 0x00: return(DispControlcxx . . $ DispControl.); |
| 140 | case 0x01: return(BGColorcxx . . $ BGColor.); |
| 141 | case 0x02: return(wsLinecxx . . $ wsLine.); |
| 142 | case 0x03: return(LineComparecxx . . $ LineCompare.); |
| 143 | case 0x04: return(SPRBasecxx . . $ SPRBase.); |
| 144 | case 0x05: return(SpriteStartcxx . . $ SpriteStart.); |
| 145 | case 0x06: return(SpriteCountcxx . . $ SpriteCount.); |
| 146 | case 0x07: return(FGBGLoccxx . . $ FGBGLoc.); |
| 147 | case 0x08: return(FGx0cxx . . $ FGx0.); |
| 148 | case 0x09: return(FGy0cxx . . $ FGy0.); |
| 149 | case 0x0A: return(FGx1cxx . . $ FGx1.); |
| 150 | case 0x0B: return(FGy1cxx . . $ FGy1.); |
| 151 | case 0x0C: return(SPRx0cxx . . $ SPRx0.); |
| 152 | case 0x0D: return(SPRy0cxx . . $ SPRy0.); |
| 153 | case 0x0E: return(SPRx1cxx . . $ SPRx1.); |
| 154 | case 0x0F: return(SPRy1cxx . . $ SPRy1.); |
| 155 | case 0x10: return(BGXScrollcxx . . $ BGXScroll.); |
| 156 | case 0x11: return(BGYScrollcxx . . $ BGYScroll.); |
| 157 | case 0x12: return(FGXScrollcxx . . $ FGXScroll.); |
| 158 | case 0x13: return(FGYScrollcxx . . $ FGYScroll.); |
| 159 | case 0x14: return(LCDControlcxx . . $ LCDControl.); |
| 160 | case 0x15: return(LCDIconscxx . . $ LCDIcons.); |
| 161 | case 0x16: return(LCDVtotalcxx . . $ LCDVtotal.); |
| 162 | case 0x60: return(VideoModecxx . . $ VideoMode.); |
| 163 | case 0xa0: return(wsccxx . . $ wsc. ? 0x87 : 0x86); |
| 164 | case 0xa2: return(BTimerControlcxx . . $ BTimerControl.); |
| 165 | case 0xa4: return((HBTimerPeriodcxx . . $ HBTimerPeriod. >> 0) & 0xFF); |
| 166 | case 0xa5: return((HBTimerPeriodcxx . . $ HBTimerPeriod. >> 8) & 0xFF); |
| 167 | case 0xa6: return((VBTimerPeriodcxx . . $ VBTimerPeriod. >> 0) & 0xFF); |
| 168 | case 0xa7: return((VBTimerPeriodcxx . . $ VBTimerPeriod. >> 8) & 0xFF); |
| 169 | case 0xa8: return((HBCountercxx . . $ HBCounter. >> 0) & 0xFF); |
| 170 | case 0xa9: return((HBCountercxx . . $ HBCounter. >> 8) & 0xFF); |
| 171 | case 0xaa: return((VBCountercxx . . $ VBCounter. >> 0) & 0xFF); |
| 172 | case 0xab: return((VBCountercxx . . $ VBCounter. >> 8) & 0xFF); |
| 173 | default: break; |
| 174 | } |
| 175 | |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! wsExecuteLinecxx . . $ wsExecuteLine(2bff9fec511e2efe).(MDFN_Surfacecxx . . $ MDFN_Surface# *surface, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! skip) |
| 180 | { |
| 181 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ret = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 182 | |
| 183 | if(wsLinecxx . . $ wsLine. < 144) |
| 184 | { |
| 185 | if(!skip) |
| 186 | { |
| 187 | switch(surface->depthcxx . . $ $anonymous_type_37d9811fbae164eb_2#depth.) |
| 188 | { |
| 189 | case 15: |
| 190 | case 16: |
| 191 | wsScanlinecxx . . $ wsScanline(9ead97ff5579f406).(surface->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels. + wsLinecxx . . $ wsLine. * surface->pitchcxx . . $ $anonymous_type_37d9811fbae164eb_2#pitch., surface->depthcxx . . $ $anonymous_type_37d9811fbae164eb_2#depth.); |
| 192 | break; |
| 193 | |
| 194 | case 24: |
| 195 | wsScanlinecxx . . $ wsScanline(9ead97ff5579f406).(surface->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels. + wsLinecxx . . $ wsLine. * surface->pitchcxx . . $ $anonymous_type_37d9811fbae164eb_2#pitch. * 2, surface->depthcxx . . $ $anonymous_type_37d9811fbae164eb_2#depth.); |
| 196 | break; |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | WSwan_CheckSoundDMAcxx . . $ WSwan_CheckSoundDMA(49f6e7a06ebc5aa8).(); |
| 202 | |
| 203 | /* Update sprite data table |
| 204 | * Note: it's at 142 actually |
| 205 | * but it doesn't "update" until next frame */ |
| 206 | if(wsLinecxx . . $ wsLine. == 142) |
| 207 | { |
| 208 | SpriteCountCachecxx . . $ SpriteCountCache.[!FrameWhichActivecxx . . $ FrameWhichActive.] = SpriteCountcxx . . $ SpriteCount.; |
| 209 | |
| 210 | if(SpriteCountCachecxx . . $ SpriteCountCache.[!FrameWhichActivecxx . . $ FrameWhichActive.] > 0x80) |
| 211 | SpriteCountCachecxx . . $ SpriteCountCache.[!FrameWhichActivecxx . . $ FrameWhichActive.] = 0x80; |
| 212 | |
| 213 | memcpycxx . . $ memcpy(cc817cb175f282d).(SpriteTablecxx . . $ SpriteTable.[!FrameWhichActivecxx . . $ FrameWhichActive.], &wsRAMcxx . . $ wsRAM.[(SPRBasecxx . . $ SPRBase. << 9) + (SpriteStartcxx . . $ SpriteStart. << 2)], SpriteCountCachecxx . . $ SpriteCountCache.[!FrameWhichActivecxx . . $ FrameWhichActive.] << 2); |
| 214 | } |
| 215 | |
| 216 | else if(wsLinecxx . . $ wsLine. == 144) |
| 217 | { |
| 218 | FrameWhichActivecxx . . $ FrameWhichActive. = !FrameWhichActivecxx . . $ FrameWhichActive.; |
| 219 | ret = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 220 | WSwan_Interruptcxx . . $ WSwan_Interrupt(d4f767463ce0a6b3).(WSINT_VBLANKcxx . . $ WSINT_VBLANK.); |
| 221 | |
| 222 | if(VBCountercxx . . $ VBCounter. && (BTimerControlcxx . . $ BTimerControl. & 0x04)) |
| 223 | { |
| 224 | VBCountercxx . . $ VBCounter.--; |
| 225 | if(!VBCountercxx . . $ VBCounter.) |
| 226 | { |
| 227 | if(BTimerControlcxx . . $ BTimerControl. & 0x08) /* loop */ |
| 228 | VBCountercxx . . $ VBCounter. = VBTimerPeriodcxx . . $ VBTimerPeriod.; |
| 229 | WSwan_Interruptcxx . . $ WSwan_Interrupt(d4f767463ce0a6b3).(WSINT_VBLANK_TIMERcxx . . $ WSINT_VBLANK_TIMER.); |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | |
| 235 | if(HBCountercxx . . $ HBCounter. && (BTimerControlcxx . . $ BTimerControl. & 0x01)) |
| 236 | { |
| 237 | HBCountercxx . . $ HBCounter.--; |
| 238 | if(!HBCountercxx . . $ HBCounter.) |
| 239 | { |
| 240 | /* Loop mode? */ |
| 241 | if(BTimerControlcxx . . $ BTimerControl. & 0x02) |
| 242 | HBCountercxx . . $ HBCounter. = HBTimerPeriodcxx . . $ HBTimerPeriod.; |
| 243 | WSwan_Interruptcxx . . $ WSwan_Interrupt(d4f767463ce0a6b3).(WSINT_HBLANK_TIMERcxx . . $ WSINT_HBLANK_TIMER.); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | v30mz_executecxx . . $ v30mz_execute(d4f767463ce0a6b3).(128); |
| 248 | WSwan_CheckSoundDMAcxx . . $ WSwan_CheckSoundDMA(49f6e7a06ebc5aa8).(); |
| 249 | |
| 250 | |
| 251 | #define MAXcxx . . $ `mednafen/wswan/gfx.c:251:9`!(a,b) ((a >= b) ? a : b) |
| 252 | |
| 253 | |
| 254 | v30mz_executecxx . . $ v30mz_execute(d4f767463ce0a6b3).(96); |
| 255 | wsLinecxx . . $ wsLine. = (wsLinecxx . . $ wsLine. + 1) % (MAXcxx . . $ `mednafen/wswan/gfx.c:251:9`!(144, LCDVtotal) + 1); |
| 256 | if(wsLinecxx . . $ wsLine. == LineComparecxx . . $ LineCompare.) |
| 257 | WSwan_Interruptcxx . . $ WSwan_Interrupt(d4f767463ce0a6b3).(WSINT_LINE_HITcxx . . $ WSINT_LINE_HIT.); |
| 258 | |
| 259 | v30mz_executecxx . . $ v30mz_execute(d4f767463ce0a6b3).(32); |
| 260 | WSwan_RTCClockcxx . . $ WSwan_RTCClock(cb2f890c2fdad230).(256); |
| 261 | |
| 262 | return(ret); |
| 263 | } |
| 264 | |
| 265 | void WSwan_SetLayerEnableMaskcxx . . $ WSwan_SetLayerEnableMask(2c44cd906ae4e829).(uint64cxx . . $ uint64# mask) |
| 266 | { |
| 267 | LayerEnabledcxx . . $ LayerEnabled. = mask; |
| 268 | } |
| 269 | |
| 270 | #define LERP_MONO_PALETTE_COLORcxx . . $ `mednafen/wswan/gfx.c:270:9`!(start, end, offset) (uint32)(((float)(((15 - offset) * start) + (offset * end)) / 15.0f) + 0.5f) |
| 271 | |
| 272 | void WSwan_SetMonoPalettecxx . . $ WSwan_SetMonoPalette(2029de666eaec704).(int depth, uint32cxx . . $ uint32# mono_start, uint32cxx . . $ uint32# mono_end) |
| 273 | { |
| 274 | unsigned i; |
| 275 | |
| 276 | uint32cxx . . $ uint32# r_start = (mono_start >> 16) & 0xFF; |
| 277 | uint32cxx . . $ uint32# g_start = (mono_start >> 8) & 0xFF; |
| 278 | uint32cxx . . $ uint32# b_start = (mono_start ) & 0xFF; |
| 279 | |
| 280 | uint32cxx . . $ uint32# r_end = (mono_end >> 16) & 0xFF; |
| 281 | uint32cxx . . $ uint32# g_end = (mono_end >> 8) & 0xFF; |
| 282 | uint32cxx . . $ uint32# b_end = (mono_end ) & 0xFF; |
| 283 | |
| 284 | for(i = 0; i < 16; i++) |
| 285 | { |
| 286 | uint32cxx . . $ uint32# neo_r = LERP_MONO_PALETTE_COLORcxx . . $ `mednafen/wswan/gfx.c:270:9`!(r_start, r_end, i); |
| 287 | uint32cxx . . $ uint32# neo_g = LERP_MONO_PALETTE_COLORcxx . . $ `mednafen/wswan/gfx.c:270:9`!(g_start, g_end, i); |
| 288 | uint32cxx . . $ uint32# neo_b = LERP_MONO_PALETTE_COLORcxx . . $ `mednafen/wswan/gfx.c:270:9`!(b_start, b_end, i); |
| 289 | |
| 290 | switch(depth) |
| 291 | { |
| 292 | case 15: ColorMapGcxx . . $ ColorMapG.[i] = MAKECOLOR_15cxx . . $ `mednafen/video.h:29:9`!(neo_r, neo_g, neo_b, 0); break; |
| 293 | #if defined(ABGR1555) |
| 294 | case 16: ColorMapG[i] = MAKECOLOR_15_1(neo_r, neo_g, neo_b, 0); break; |
| 295 | #else |
| 296 | case 16: ColorMapGcxx . . $ ColorMapG.[i] = MAKECOLOR_16cxx . . $ `mednafen/video.h:20:9`!(neo_r, neo_g, neo_b, 0); break; |
| 297 | #endif |
| 298 | case 24: ColorMapGcxx . . $ ColorMapG.[i] = MAKECOLOR_24cxx . . $ `mednafen/video.h:11:9`!(neo_r, neo_g, neo_b, 0); break; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | void WSwan_SetPixelFormatcxx . . $ WSwan_SetPixelFormat(2029de666eaec704).(int depth, uint32cxx . . $ uint32# mono_start, uint32cxx . . $ uint32# mono_end) |
| 304 | { |
| 305 | unsigned r, g, b; |
| 306 | for(r = 0; r < 16; r++) |
| 307 | for(g = 0; g < 16; g++) |
| 308 | for(b = 0; b < 16; b++) |
| 309 | { |
| 310 | uint32cxx . . $ uint32# neo_r, neo_g, neo_b; |
| 311 | |
| 312 | neo_r = r * 17; |
| 313 | neo_g = g * 17; |
| 314 | neo_b = b * 17; |
| 315 | |
| 316 | switch(depth) |
| 317 | { |
| 318 | case 15: ColorMapcxx . . $ ColorMap.[(r << 8) | (g << 4) | (b << 0)] = MAKECOLOR_15cxx . . $ `mednafen/video.h:29:9`!(neo_r, neo_g, neo_b, 0); break; |
| 319 | #if defined(ABGR1555) |
| 320 | case 16: ColorMap[(r << 8) | (g << 4) | (b << 0)] = MAKECOLOR_15_1(neo_r, neo_g, neo_b, 0); break; |
| 321 | #else |
| 322 | case 16: ColorMapcxx . . $ ColorMap.[(r << 8) | (g << 4) | (b << 0)] = MAKECOLOR_16cxx . . $ `mednafen/video.h:20:9`!(neo_r, neo_g, neo_b, 0); break; |
| 323 | #endif |
| 324 | case 24: ColorMapcxx . . $ ColorMap.[(r << 8) | (g << 4) | (b << 0)] = MAKECOLOR_24cxx . . $ `mednafen/video.h:11:9`!(neo_r, neo_g, neo_b, 0); break; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | WSwan_SetMonoPalettecxx . . $ WSwan_SetMonoPalette(2029de666eaec704).(depth, mono_start, mono_end); |
| 329 | } |
| 330 | |
| 331 | void wsScanlinecxx . . $ wsScanline(9ead97ff5579f406).(uint16cxx . . $ uint16# *target, int depth) |
| 332 | { |
| 333 | uint32cxx . . $ uint32# start_tile_n,map_a,startindex,adrbuf,b1,b2,j,t,l; |
| 334 | uint8cxx . . $ uint8# b_bg[256]; |
| 335 | uint8cxx . . $ uint8# b_bg_pal[256]; |
| 336 | |
| 337 | if(!wsVModecxx . . $ wsVMode.) |
| 338 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(b_bg, wsColorscxx . . $ wsColors.[BGColorcxx . . $ BGColor.&0xF]&0xF, 256); |
| 339 | else |
| 340 | { |
| 341 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&b_bg[0], BGColorcxx . . $ BGColor. & 0xF, 256); |
| 342 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&b_bg_pal[0], (BGColorcxx . . $ BGColor.>>4) & 0xF, 256); |
| 343 | } |
| 344 | start_tile_n=(wsLinecxx . . $ wsLine.+BGYScrollcxx . . $ BGYScroll.)&0xff;/*First line*/ |
| 345 | map_a=(((uint32cxx . . $ uint32#)(FGBGLoccxx . . $ FGBGLoc.&0xF))<<11)+((start_tile_n&0xfff8)<<3); |
| 346 | startindex = BGXScrollcxx . . $ BGXScroll. >> 3; /*First tile in row*/ |
| 347 | adrbuf = 7-(BGXScrollcxx . . $ BGXScroll.&7); /*Pixel in tile*/ |
| 348 | |
| 349 | if((DispControlcxx . . $ DispControl. & 0x01) && (LayerEnabledcxx . . $ LayerEnabled. & 0x01)) /*BG layer*/ |
| 350 | { |
| 351 | for(t=0;t<29;t++) |
| 352 | { |
| 353 | uint32cxx . . $ uint32# palette; |
| 354 | b1=wsRAMcxx . . $ wsRAM.[map_a+(startindex<<1)]; |
| 355 | b2=wsRAMcxx . . $ wsRAM.[map_a+(startindex<<1)+1]; |
| 356 | palette=(b2>>1)&15; |
| 357 | b2=(b2<<8)|b1; |
| 358 | wsGetTilecxx . . $ wsGetTile(b565df6bee9b73e5).(b2&0x1ff,start_tile_n&7,b2&0x8000,b2&0x4000,b2&0x2000); |
| 359 | |
| 360 | if(wsVModecxx . . $ wsVMode.) |
| 361 | { |
| 362 | if(wsVModecxx . . $ wsVMode. & 0x2) |
| 363 | { |
| 364 | int x; |
| 365 | for(x = 0; x < 8; x++) |
| 366 | if(wsTileRowcxx . . $ wsTileRow.[x]) |
| 367 | { |
| 368 | b_bg[adrbuf + x] = wsTileRowcxx . . $ wsTileRow.[x]; |
| 369 | b_bg_pal[adrbuf + x] = palette; |
| 370 | } |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | int x; |
| 375 | for(x = 0; x < 8; x++) |
| 376 | if(wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 0x4)) |
| 377 | { |
| 378 | b_bg[adrbuf + x] = wsTileRowcxx . . $ wsTileRow.[x]; |
| 379 | b_bg_pal[adrbuf + x] = palette; |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | int x; |
| 386 | for(x = 0; x < 8; x++) |
| 387 | if(wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 4)) |
| 388 | { |
| 389 | b_bg[adrbuf + x] = wsColorscxx . . $ wsColors.[wsMonoPalcxx . . $ wsMonoPal.[palette][wsTileRowcxx . . $ wsTileRow.[x]]]; |
| 390 | } |
| 391 | } |
| 392 | adrbuf += 8; |
| 393 | startindex=(startindex + 1)&31; |
| 394 | } /* end for(t = 0 ... */ |
| 395 | } /* End BG layer drawing */ |
| 396 | |
| 397 | if((DispControlcxx . . $ DispControl. & 0x02) && (LayerEnabledcxx . . $ LayerEnabled. & 0x02))/*FG layer*/ |
| 398 | { |
| 399 | uint8cxx . . $ uint8# windowtype = DispControlcxx . . $ DispControl.&0x30; |
| 400 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! in_window[256 + 8*2]; |
| 401 | |
| 402 | if(windowtype) |
| 403 | { |
| 404 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(in_window, 0, sizeof(in_window)); |
| 405 | |
| 406 | if(windowtype == 0x20) /* Display FG only inside window */ |
| 407 | { |
| 408 | if((wsLinecxx . . $ wsLine. >= FGy0cxx . . $ FGy0.) && (wsLinecxx . . $ wsLine. <= FGy1cxx . . $ FGy1.)) |
| 409 | for(j = FGx0cxx . . $ FGx0.; j <= FGx1cxx . . $ FGx1. && j < 224; j++) |
| 410 | in_window[7 + j] = 1; |
| 411 | } |
| 412 | else if(windowtype == 0x30) /* Display FG only outside window */ |
| 413 | { |
| 414 | for(j = 0; j < 224; j++) |
| 415 | { |
| 416 | if(!(j >= FGx0cxx . . $ FGx0. && j <= FGx1cxx . . $ FGx1.) || !((wsLinecxx . . $ wsLine. >= FGy0cxx . . $ FGy0.) && (wsLinecxx . . $ wsLine. < FGy1cxx . . $ FGy1.))) |
| 417 | in_window[7 + j] = 1; |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | else |
| 422 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(in_window, 1, sizeof(in_window)); |
| 423 | |
| 424 | start_tile_n=(wsLinecxx . . $ wsLine.+FGYScrollcxx . . $ FGYScroll.)&0xff; |
| 425 | map_a=(((uint32cxx . . $ uint32#)((FGBGLoccxx . . $ FGBGLoc.>>4)&0xF))<<11)+((start_tile_n>>3)<<6); |
| 426 | startindex = FGXScrollcxx . . $ FGXScroll. >> 3; |
| 427 | adrbuf = 7-(FGXScrollcxx . . $ FGXScroll.&7); |
| 428 | |
| 429 | for(t=0; t<29; t++) |
| 430 | { |
| 431 | uint32cxx . . $ uint32# palette; |
| 432 | b1=wsRAMcxx . . $ wsRAM.[map_a+(startindex<<1)]; |
| 433 | b2=wsRAMcxx . . $ wsRAM.[map_a+(startindex<<1)+1]; |
| 434 | palette=(b2>>1)&15; |
| 435 | b2=(b2<<8)|b1; |
| 436 | wsGetTilecxx . . $ wsGetTile(b565df6bee9b73e5).(b2&0x1ff,start_tile_n&7,b2&0x8000,b2&0x4000,b2&0x2000); |
| 437 | |
| 438 | if(wsVModecxx . . $ wsVMode.) |
| 439 | { |
| 440 | if(wsVModecxx . . $ wsVMode. & 0x2) |
| 441 | { |
| 442 | int x; |
| 443 | for(x = 0; x < 8; x++) |
| 444 | { |
| 445 | if(wsTileRowcxx . . $ wsTileRow.[x] && in_window[adrbuf + x]) |
| 446 | { |
| 447 | b_bg[adrbuf + x] = wsTileRowcxx . . $ wsTileRow.[x] | 0x10; |
| 448 | b_bg_pal[adrbuf + x] = palette; |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | else |
| 453 | { |
| 454 | int x; |
| 455 | for(x = 0; x < 8; x++) |
| 456 | { |
| 457 | if((wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 0x4)) && in_window[adrbuf + x]) |
| 458 | { |
| 459 | b_bg[adrbuf + x] = wsTileRowcxx . . $ wsTileRow.[x] | 0x10; |
| 460 | b_bg_pal[adrbuf + x] = palette; |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | else |
| 466 | { |
| 467 | int x; |
| 468 | for(x = 0; x < 8; x++) |
| 469 | if((wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 4)) && in_window[adrbuf + x]) |
| 470 | { |
| 471 | b_bg[adrbuf + x] = wsColorscxx . . $ wsColors.[wsMonoPalcxx . . $ wsMonoPal.[palette][wsTileRowcxx . . $ wsTileRow.[x]]] | 0x10; |
| 472 | } |
| 473 | } |
| 474 | adrbuf += 8; |
| 475 | startindex=(startindex + 1)&31; |
| 476 | } /* end for(t = 0 ... */ |
| 477 | |
| 478 | } /* end FG drawing */ |
| 479 | |
| 480 | if((DispControlcxx . . $ DispControl. & 0x04) && SpriteCountCachecxx . . $ SpriteCountCache.[FrameWhichActivecxx . . $ FrameWhichActive.] && (LayerEnabledcxx . . $ LayerEnabled. & 0x04))/* Sprites */ |
| 481 | { |
| 482 | int xs,ts,as,ys,ysx,h; |
| 483 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! in_window[256 + 8*2]; |
| 484 | |
| 485 | if(DispControlcxx . . $ DispControl. & 0x08) |
| 486 | { |
| 487 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(in_window, 0, sizeof(in_window)); |
| 488 | if((wsLinecxx . . $ wsLine. >= SPRy0cxx . . $ SPRy0.) && (wsLinecxx . . $ wsLine. <= SPRy1cxx . . $ SPRy1.)) |
| 489 | for(j = SPRx0cxx . . $ SPRx0.; j <= SPRx1cxx . . $ SPRx1. && j < 256; j++) |
| 490 | in_window[7 + j] = 1; |
| 491 | } |
| 492 | else |
| 493 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(in_window, 1, sizeof(in_window)); |
| 494 | |
| 495 | for(h = SpriteCountCachecxx . . $ SpriteCountCache.[FrameWhichActivecxx . . $ FrameWhichActive.] - 1; h >= 0; h--) |
| 496 | { |
| 497 | ts = SpriteTablecxx . . $ SpriteTable.[FrameWhichActivecxx . . $ FrameWhichActive.][h][0]; |
| 498 | as = SpriteTablecxx . . $ SpriteTable.[FrameWhichActivecxx . . $ FrameWhichActive.][h][1]; |
| 499 | ysx = SpriteTablecxx . . $ SpriteTable.[FrameWhichActivecxx . . $ FrameWhichActive.][h][2]; |
| 500 | xs = SpriteTablecxx . . $ SpriteTable.[FrameWhichActivecxx . . $ FrameWhichActive.][h][3]; |
| 501 | |
| 502 | if(xs >= 249) xs -= 256; |
| 503 | |
| 504 | if(ysx > 150) |
| 505 | ys = (int8cxx . . $ int8#)ysx; |
| 506 | else |
| 507 | ys = ysx; |
| 508 | |
| 509 | ys = wsLinecxx . . $ wsLine. - ys; |
| 510 | |
| 511 | if(ys >= 0 && ys < 8 && xs < 224) |
| 512 | { |
| 513 | uint32cxx . . $ uint32# palette = ((as >> 1) & 0x7); |
| 514 | |
| 515 | ts |= (as&1) << 8; |
| 516 | wsGetTilecxx . . $ wsGetTile(b565df6bee9b73e5).(ts, ys, as & 0x80, as & 0x40, 0); |
| 517 | |
| 518 | if(wsVModecxx . . $ wsVMode.) |
| 519 | { |
| 520 | if(wsVModecxx . . $ wsVMode. & 0x2) |
| 521 | { |
| 522 | int x; |
| 523 | for(x = 0; x < 8; x++) |
| 524 | if(wsTileRowcxx . . $ wsTileRow.[x]) |
| 525 | { |
| 526 | if((as & 0x20) || !(b_bg[xs + x + 7] & 0x10)) |
| 527 | { |
| 528 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! drawthis = 0; |
| 529 | |
| 530 | if(!(DispControlcxx . . $ DispControl. & 0x08)) |
| 531 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 532 | else if((as & 0x10) && !in_window[7 + xs + x]) |
| 533 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 534 | else if(!(as & 0x10) && in_window[7 + xs + x]) |
| 535 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 536 | |
| 537 | if(drawthis) |
| 538 | { |
| 539 | b_bg[xs + x + 7] = wsTileRowcxx . . $ wsTileRow.[x] | (b_bg[xs + x + 7] & 0x10); |
| 540 | b_bg_pal[xs + x + 7] = 8 + palette; |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | } |
| 545 | else |
| 546 | { |
| 547 | int x; |
| 548 | for(x = 0; x < 8; x++) |
| 549 | if(wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 0x4)) |
| 550 | { |
| 551 | if((as & 0x20) || !(b_bg[xs + x + 7] & 0x10)) |
| 552 | { |
| 553 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! drawthis = 0; |
| 554 | |
| 555 | if(!(DispControlcxx . . $ DispControl. & 0x08)) |
| 556 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 557 | else if((as & 0x10) && !in_window[7 + xs + x]) |
| 558 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 559 | else if(!(as & 0x10) && in_window[7 + xs + x]) |
| 560 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 561 | |
| 562 | if(drawthis) |
| 563 | { |
| 564 | b_bg[xs + x + 7] = wsTileRowcxx . . $ wsTileRow.[x] | (b_bg[xs + x + 7] & 0x10); |
| 565 | b_bg_pal[xs + x + 7] = 8 + palette; |
| 566 | } |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | } |
| 571 | |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | int x; |
| 576 | for(x = 0; x < 8; x++) |
| 577 | if(wsTileRowcxx . . $ wsTileRow.[x] || !(palette & 4)) |
| 578 | { |
| 579 | if((as & 0x20) || !(b_bg[xs + x + 7] & 0x10)) |
| 580 | { |
| 581 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! drawthis = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 582 | |
| 583 | if(!(DispControlcxx . . $ DispControl. & 0x08)) |
| 584 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 585 | else if((as & 0x10) && !in_window[7 + xs + x]) |
| 586 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 587 | else if(!(as & 0x10) && in_window[7 + xs + x]) |
| 588 | drawthis = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 589 | |
| 590 | if(drawthis) |
| 591 | b_bg[xs + x + 7] = wsColorscxx . . $ wsColors.[wsMonoPalcxx . . $ wsMonoPal.[8 + palette][wsTileRowcxx . . $ wsTileRow.[x]]] | (b_bg[xs + x + 7] & 0x10); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | } /* End sprite drawing */ |
| 600 | |
| 601 | if(wsVModecxx . . $ wsVMode.) |
| 602 | { |
| 603 | switch(depth) |
| 604 | { |
| 605 | case 15: |
| 606 | case 16: { |
| 607 | for(l=0;l<224;l++) |
| 608 | target[l] = ColorMapcxx . . $ ColorMap.[wsColscxx . . $ wsCols.[b_bg_pal[l+7]][b_bg[(l+7)]&0xf]]; |
| 609 | } break; |
| 610 | |
| 611 | case 24: { |
| 612 | for(l=0;l<224;l++) |
| 613 | ((uint32_tcxx . . $ uint32_t#*)target)[l] = ColorMapcxx . . $ ColorMap.[wsColscxx . . $ wsCols.[b_bg_pal[l+7]][b_bg[(l+7)]&0xf]]; |
| 614 | } break; |
| 615 | } |
| 616 | } |
| 617 | else |
| 618 | { |
| 619 | switch(depth) |
| 620 | { |
| 621 | case 15: |
| 622 | case 16: { |
| 623 | for(l=0;l<224;l++) |
| 624 | target[l] = ColorMapGcxx . . $ ColorMapG.[(b_bg[l+7])&15]; |
| 625 | } break; |
| 626 | |
| 627 | case 24: { |
| 628 | for(l=0;l<224;l++) |
| 629 | ((uint32_tcxx . . $ uint32_t#*)target)[l] = ColorMapGcxx . . $ ColorMapG.[(b_bg[l+7])&15]; |
| 630 | } break; |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | |
| 636 | void WSwan_GfxResetcxx . . $ WSwan_GfxReset(49f6e7a06ebc5aa8).(void) |
| 637 | { |
| 638 | unsigned u0, u1; |
| 639 | |
| 640 | wsLinecxx . . $ wsLine.=0; |
| 641 | wsSetVideocxx . . $ wsSetVideo(918ebd27a9ddbad3).(0,truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 642 | |
| 643 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(SpriteTablecxx . . $ SpriteTable., 0, sizeof(SpriteTablecxx . . $ SpriteTable.)); |
| 644 | SpriteCountCachecxx . . $ SpriteCountCache.[0] = SpriteCountCachecxx . . $ SpriteCountCache.[1] = 0; |
| 645 | FrameWhichActivecxx . . $ FrameWhichActive. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 646 | DispControlcxx . . $ DispControl. = 0; |
| 647 | BGColorcxx . . $ BGColor. = 0; |
| 648 | LineComparecxx . . $ LineCompare. = 0xBB; |
| 649 | SPRBasecxx . . $ SPRBase. = 0; |
| 650 | |
| 651 | SpriteStartcxx . . $ SpriteStart. = 0; |
| 652 | SpriteCountcxx . . $ SpriteCount. = 0; |
| 653 | FGBGLoccxx . . $ FGBGLoc. = 0; |
| 654 | |
| 655 | FGx0cxx . . $ FGx0. = 0; |
| 656 | FGy0cxx . . $ FGy0. = 0; |
| 657 | FGx1cxx . . $ FGx1. = 0; |
| 658 | FGy1cxx . . $ FGy1. = 0; |
| 659 | SPRx0cxx . . $ SPRx0. = 0; |
| 660 | SPRy0cxx . . $ SPRy0. = 0; |
| 661 | SPRx1cxx . . $ SPRx1. = 0; |
| 662 | SPRy1cxx . . $ SPRy1. = 0; |
| 663 | |
| 664 | BGXScrollcxx . . $ BGXScroll. = BGYScrollcxx . . $ BGYScroll. = 0; |
| 665 | FGXScrollcxx . . $ FGXScroll. = FGYScrollcxx . . $ FGYScroll. = 0; |
| 666 | LCDControlcxx . . $ LCDControl. = 0; |
| 667 | LCDIconscxx . . $ LCDIcons. = 0; |
| 668 | LCDVtotalcxx . . $ LCDVtotal. = 158; |
| 669 | |
| 670 | BTimerControlcxx . . $ BTimerControl. = 0; |
| 671 | HBTimerPeriodcxx . . $ HBTimerPeriod. = 0; |
| 672 | VBTimerPeriodcxx . . $ VBTimerPeriod. = 0; |
| 673 | |
| 674 | HBCountercxx . . $ HBCounter. = 0; |
| 675 | VBCountercxx . . $ VBCounter. = 0; |
| 676 | |
| 677 | |
| 678 | for(u0=0;u0<16;u0++) |
| 679 | for(u1=0;u1<16;u1++) |
| 680 | wsColscxx . . $ wsCols.[u0][u1]=0; |
| 681 | |
| 682 | } |
| 683 | |
| 684 | int WSwan_GfxStateActioncxx . . $ WSwan_GfxStateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only) |
| 685 | { |
| 686 | SFORMATcxx . . $ SFORMAT# StateRegs[] = |
| 687 | { |
| 688 | SFARRAY32Ncxx . . $ `mednafen/state_inline.h:14:9`!(&wsMonoPal[0][0], 16 * 4, "wsMonoPal"), |
| 689 | SFARRAY32cxx . . $ `mednafen/state_inline.h:15:9`!(wsColors, 8), |
| 690 | |
| 691 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(wsLine), |
| 692 | |
| 693 | SFARRAYNcxx . . $ `mednafen/state_inline.h:8:9`!(&SpriteTable[0][0][0], 2 * 0x80 * 4, "SpriteTable"), |
| 694 | SFARRAY32Ncxx . . $ `mednafen/state_inline.h:14:9`!(&SpriteCountCache[0], 2 * 1, "SpriteCountCache"), |
| 695 | SFVARN_BOOLcxx . . $ `mednafen/state_inline.h:4:9`!(FrameWhichActive, "FrameWhichActive"), |
| 696 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(DispControl), |
| 697 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(BGColor), |
| 698 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(LineCompare), |
| 699 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SPRBase), |
| 700 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SpriteStart), |
| 701 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SpriteCount), |
| 702 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGBGLoc), |
| 703 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGx0), |
| 704 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGy0), |
| 705 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGx1), |
| 706 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGy1), |
| 707 | |
| 708 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SPRx0), |
| 709 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SPRy0), |
| 710 | |
| 711 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SPRx1), |
| 712 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(SPRy1), |
| 713 | |
| 714 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(BGXScroll), |
| 715 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(BGYScroll), |
| 716 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGXScroll), |
| 717 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(FGYScroll), |
| 718 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(LCDControl), |
| 719 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(LCDIcons), |
| 720 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(LCDVtotal), |
| 721 | |
| 722 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(BTimerControl), |
| 723 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(HBTimerPeriod), |
| 724 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(VBTimerPeriod), |
| 725 | |
| 726 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(HBCounter), |
| 727 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(VBCounter), |
| 728 | |
| 729 | SFVARcxx . . $ `mednafen/state_inline.h:6:9`!(VideoMode), |
| 730 | SFENDcxx . . $ `mednafen/state_inline.h:20:9`! |
| 731 | }; |
| 732 | |
| 733 | if(!MDFNSS_StateActioncxx . . $ MDFNSS_StateAction(3f628545d3b0df83).(sm, load, data_only, StateRegs, "GFX", falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)) |
| 734 | return(0); |
| 735 | |
| 736 | if(load) |
| 737 | { |
| 738 | unsigned i, j; |
| 739 | for(i = 0; i < 2; i++) |
| 740 | { |
| 741 | if(SpriteCountCachecxx . . $ SpriteCountCache.[i] > 0x80) |
| 742 | SpriteCountCachecxx . . $ SpriteCountCache.[i] = 0x80; |
| 743 | } |
| 744 | |
| 745 | for(i = 0; i < 16; i++) |
| 746 | for(j = 0; j < 4; j++) |
| 747 | wsMonoPalcxx . . $ wsMonoPal.[i][j] &= 0x7; |
| 748 | |
| 749 | wsSetVideocxx . . $ wsSetVideo(918ebd27a9ddbad3).(VideoModecxx . . $ VideoMode. >> 5, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 750 | } |
| 751 | |
| 752 | return(1); |
| 753 | } |