Snes9x - Fix more warnings. (#1055)

This commit is contained in:
bladeoner 2023-03-15 17:28:20 +01:00 committed by GitHub
parent b68b198070
commit c0103d65de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 55 deletions

View File

@ -332,14 +332,12 @@ static void DoGunLatch (int x, int y)
if (x > 295) if (x > 295)
x = 295; x = 295;
else else if (x < 40)
if (x < 40)
x = 40; x = 40;
if (y > PPU.ScreenHeight - 1) if (y > PPU.ScreenHeight - 1)
y = PPU.ScreenHeight - 1; y = PPU.ScreenHeight - 1;
else else if (y < 0)
if (y < 0)
y = 0; y = 0;
PPU.GunVLatch = (uint16) (y + 1); PPU.GunVLatch = (uint16) (y + 1);
@ -1168,8 +1166,7 @@ s9xcommand_t S9xGetCommandT (const char *name)
if (!strcmp(name, "None")) if (!strcmp(name, "None"))
cmd.type = S9xNoMapping; cmd.type = S9xNoMapping;
else else if (!strncmp(name, "Joypad", 6))
if (!strncmp(name, "Joypad", 6))
{ {
if (name[6] < '1' || name[6] > '8' || name[7] != ' ') if (name[6] < '1' || name[6] > '8' || name[7] != ' ')
return (cmd); return (cmd);
@ -1180,24 +1177,15 @@ s9xcommand_t S9xGetCommandT (const char *name)
s = name + 13; s = name + 13;
if (!strncmp(s, "Left/Right ", 11)) { j = 0; i = 0; s += 11; } if (!strncmp(s, "Left/Right ", 11)) { j = 0; i = 0; s += 11; }
else else if (!strncmp(s, "Right/Left ", 11)) { j = 0; i = 1; s += 11; }
if (!strncmp(s, "Right/Left ", 11)) { j = 0; i = 1; s += 11; } else if (!strncmp(s, "Up/Down ", 8)) { j = 1; i = 0; s += 8; }
else else if (!strncmp(s, "Down/Up ", 8)) { j = 1; i = 1; s += 8; }
if (!strncmp(s, "Up/Down ", 8)) { j = 1; i = 0; s += 8; } else if (!strncmp(s, "Y/A ", 4)) { j = 2; i = 0; s += 4; }
else else if (!strncmp(s, "A/Y ", 4)) { j = 2; i = 1; s += 4; }
if (!strncmp(s, "Down/Up ", 8)) { j = 1; i = 1; s += 8; } else if (!strncmp(s, "X/B ", 4)) { j = 3; i = 0; s += 4; }
else else if (!strncmp(s, "B/X ", 4)) { j = 3; i = 1; s += 4; }
if (!strncmp(s, "Y/A ", 4)) { j = 2; i = 0; s += 4; } else if (!strncmp(s, "L/R ", 4)) { j = 4; i = 0; s += 4; }
else else if (!strncmp(s, "R/L ", 4)) { j = 4; i = 1; s += 4; }
if (!strncmp(s, "A/Y ", 4)) { j = 2; i = 1; s += 4; }
else
if (!strncmp(s, "X/B ", 4)) { j = 3; i = 0; s += 4; }
else
if (!strncmp(s, "B/X ", 4)) { j = 3; i = 1; s += 4; }
else
if (!strncmp(s, "L/R ", 4)) { j = 4; i = 0; s += 4; }
else
if (!strncmp(s, "R/L ", 4)) { j = 4; i = 1; s += 4; }
else else
return (cmd); return (cmd);
@ -1378,8 +1366,7 @@ s9xcommand_t S9xGetCommandT (const char *name)
if (*s == 'h') if (*s == 'h')
cmd.axis.pointer.HV = 0; cmd.axis.pointer.HV = 0;
else else if (*s == 'v')
if (*s == 'v')
cmd.axis.pointer.HV = 1; cmd.axis.pointer.HV = 1;
else else
return (cmd); return (cmd);
@ -1527,8 +1514,7 @@ s9xcommand_t S9xGetCommandT (const char *name)
j = i; j = i;
} }
else else if (name[i] == ',')
if (name[i] == ',')
{ {
free(c); free(c);
return (cmd); return (cmd);
@ -1541,8 +1527,7 @@ s9xcommand_t S9xGetCommandT (const char *name)
{ {
if (name[i] == '+') if (name[i] == '+')
press = 1; press = 1;
else else if (name[i] == '-')
if (name[i] == '-')
press = 2; press = 2;
else else
{ {
@ -2011,14 +1996,12 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
uint16 x = r; r = st; st = x; uint16 x = r; r = st; st = x;
x = s; s = t; t = x; x = s; s = t; t = x;
} }
else else if (cmd.button.joypad.turbo)
if (cmd.button.joypad.turbo)
{ {
uint16 x = r; r = t; t = x; uint16 x = r; r = t; t = x;
x = s; s = st; st = x; x = s; s = st; st = x;
} }
else else if (cmd.button.joypad.sticky)
if (cmd.button.joypad.sticky)
{ {
uint16 x = r; r = s; s = x; uint16 x = r; r = s; s = x;
x = t; t = st; st = x; x = t; t = st; st = x;
@ -2771,14 +2754,12 @@ static void UpdatePolledMouse (int i)
mouse[i - MOUSE0].delta_x = 0xff; mouse[i - MOUSE0].delta_x = 0xff;
mouse[i - MOUSE0].old_x -= 127; mouse[i - MOUSE0].old_x -= 127;
} }
else else if (j < 0)
if (j < 0)
{ {
mouse[i - MOUSE0].delta_x = 0x80 | -j; mouse[i - MOUSE0].delta_x = 0x80 | -j;
mouse[i - MOUSE0].old_x = mouse[i - MOUSE0].cur_x; mouse[i - MOUSE0].old_x = mouse[i - MOUSE0].cur_x;
} }
else else if (j > 127)
if (j > 127)
{ {
mouse[i - MOUSE0].delta_x = 0x7f; mouse[i - MOUSE0].delta_x = 0x7f;
mouse[i - MOUSE0].old_x += 127; mouse[i - MOUSE0].old_x += 127;
@ -2796,14 +2777,12 @@ static void UpdatePolledMouse (int i)
mouse[i - MOUSE0].delta_y = 0xff; mouse[i - MOUSE0].delta_y = 0xff;
mouse[i - MOUSE0].old_y -= 127; mouse[i - MOUSE0].old_y -= 127;
} }
else else if (j < 0)
if (j < 0)
{ {
mouse[i - MOUSE0].delta_y = 0x80 | -j; mouse[i - MOUSE0].delta_y = 0x80 | -j;
mouse[i - MOUSE0].old_y = mouse[i - MOUSE0].cur_y; mouse[i - MOUSE0].old_y = mouse[i - MOUSE0].cur_y;
} }
else else if (j > 127)
if (j > 127)
{ {
mouse[i - MOUSE0].delta_y = 0x7f; mouse[i - MOUSE0].delta_y = 0x7f;
mouse[i - MOUSE0].old_y += 127; mouse[i - MOUSE0].old_y += 127;
@ -3274,8 +3253,7 @@ void S9xControlEOF (void)
pseudopointer[n].x += pseudopointer[n].H_adj; pseudopointer[n].x += pseudopointer[n].H_adj;
if (pseudopointer[n].x < 0) if (pseudopointer[n].x < 0)
pseudopointer[n].x = 0; pseudopointer[n].x = 0;
else else if (pseudopointer[n].x > 255)
if (pseudopointer[n].x > 255)
pseudopointer[n].x = 255; pseudopointer[n].x = 255;
if (pseudopointer[n].H_var) if (pseudopointer[n].H_var)
@ -3298,8 +3276,7 @@ void S9xControlEOF (void)
pseudopointer[n].y += pseudopointer[n].V_adj; pseudopointer[n].y += pseudopointer[n].V_adj;
if (pseudopointer[n].y < 0) if (pseudopointer[n].y < 0)
pseudopointer[n].y = 0; pseudopointer[n].y = 0;
else else if (pseudopointer[n].y > PPU.ScreenHeight - 1)
if (pseudopointer[n].y > PPU.ScreenHeight - 1)
pseudopointer[n].y = PPU.ScreenHeight - 1; pseudopointer[n].y = PPU.ScreenHeight - 1;
if (pseudopointer[n].V_var) if (pseudopointer[n].V_var)

View File

@ -642,8 +642,7 @@ static void SetupOBJ (void)
{ {
if (HPos < 0) if (HPos < 0)
GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3; GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3;
else else if (HPos + GFX.OBJWidths[S] > 255)
if (HPos + GFX.OBJWidths[S] > 255)
GFX.OBJVisibleTiles[S] = (256 - HPos + 7) >> 3; GFX.OBJVisibleTiles[S] = (256 - HPos + 7) >> 3;
else else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3; GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
@ -714,8 +713,7 @@ static void SetupOBJ (void)
{ {
if (HPos < 0) if (HPos < 0)
GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3; GFX.OBJVisibleTiles[S] = (GFX.OBJWidths[S] + HPos + 7) >> 3;
else else if (HPos + GFX.OBJWidths[S] >= 257)
if (HPos + GFX.OBJWidths[S] >= 257)
GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3; GFX.OBJVisibleTiles[S] = (257 - HPos + 7) >> 3;
else else
GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3; GFX.OBJVisibleTiles[S] = GFX.OBJWidths[S] >> 3;
@ -2019,7 +2017,7 @@ static void DisplayWatchedAddresses (void)
break; break;
int32 displayNumber = 0; int32 displayNumber = 0;
char buf[32]; char buf[64];
for (int r = 0; r < watches[i].size; r++) for (int r = 0; r < watches[i].size; r++)
displayNumber += (Cheat.CWatchRAM[(watches[i].address - 0x7E0000) + r]) << (8 * r); displayNumber += (Cheat.CWatchRAM[(watches[i].address - 0x7E0000) + r]) << (8 * r);
@ -2033,11 +2031,9 @@ static void DisplayWatchedAddresses (void)
{ {
if (watches[i].size == 1) if (watches[i].size == 1)
displayNumber = (int32) ((int8) displayNumber); displayNumber = (int32) ((int8) displayNumber);
else else if (watches[i].size == 2)
if (watches[i].size == 2)
displayNumber = (int32) ((int16) displayNumber); displayNumber = (int32) ((int16) displayNumber);
else else if (watches[i].size == 3)
if (watches[i].size == 3)
if (displayNumber >= 8388608) if (displayNumber >= 8388608)
displayNumber -= 16777216; displayNumber -= 16777216;