Previous 15994 Revisions Next

r9281 Wednesday 29th September, 2010 at 14:12:30 UTC by Barry Rodewald
[FMTOWNS] Added missing checks for VRAM boundaries in some setups. This fixes graphic corruption and crashes occuring in Metal Eye.
[src/mess/video]fmtowns.c

src/mess/video/fmtowns.c
r9280r9281
11661166   {
11671167      for(x=rect->min_x;x<rect->max_x;x++)
11681168      {
1169         if(state->video.towns_video_reg[0] & 0x10)
1170            off &= 0x3ffff;  // 2 layers
1171         else
1172            off &= 0x7ffff;  // 1 layer
11691173         colour = state->towns_gfxvram[off+(layer*0x40000)];
11701174         if(colour != 0)
11711175         {
r9280r9281
11821186   {  // x2 horizontal zoom
11831187      for(x=rect->min_x;x<rect->max_x;x+=2)
11841188      {
1189         if(state->video.towns_video_reg[0] & 0x10)
1190            off &= 0x3ffff;  // 2 layers
1191         else
1192            off &= 0x7ffff;  // 1 layer
11851193         colour = state->towns_gfxvram[off+(layer*0x40000)+1];
11861194         if(colour != 0)
11871195         {
r9280r9281
12021210   {  // x3 horizontal zoom
12031211      for(x=rect->min_x;x<rect->max_x;x+=3)
12041212      {
1213         if(state->video.towns_video_reg[0] & 0x10)
1214            off &= 0x3ffff;  // 2 layers
1215         else
1216            off &= 0x7ffff;  // 1 layer
12051217         colour = state->towns_gfxvram[off+(layer*0x40000)+1];
12061218         if(colour != 0)
12071219         {
r9280r9281
12261238   {  // x4 horizontal zoom
12271239      for(x=rect->min_x;x<rect->max_x;x+=4)
12281240      {
1241         if(state->video.towns_video_reg[0] & 0x10)
1242            off &= 0x3ffff;  // 2 layers
1243         else
1244            off &= 0x7ffff;  // 1 layer
12291245         colour = state->towns_gfxvram[off+(layer*0x40000)+1];
12301246         if(colour != 0)
12311247         {
r9280r9281
12541270   {  // x5 horizontal zoom
12551271      for(x=rect->min_x;x<rect->max_x;x+=5)
12561272      {
1273         if(state->video.towns_video_reg[0] & 0x10)
1274            off &= 0x3ffff;  // 2 layers
1275         else
1276            off &= 0x7ffff;  // 1 layer
12571277         colour = state->towns_gfxvram[off+(layer*0x40000)+1];
12581278         if(colour != 0)
12591279         {
r9280r9281
13371357   {
13381358      for(x=rect->min_x;x<rect->max_x;x+=2)
13391359      {
1360         if(state->video.towns_video_reg[0] & 0x10)
1361            off &= 0x3ffff;  // 2 layers
1362         else
1363            off &= 0x7ffff;  // 1 layer
13401364         colour = state->towns_gfxvram[off+(layer*0x40000)] >> 4;
13411365         if(colour != 0)
13421366         {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team