shithub: zelda3

Download patch

ref: 0dd77066d531120cebb648f5ad87a7389a128de7
parent: a66f08378a06f644658d7cd736dfa9caf479cbcd
author: Snesrev <snesrev@protonmail.com>
date: Sat Sep 3 20:09:28 EDT 2022

Silence some warnings

--- a/ancilla.c
+++ b/ancilla.c
@@ -3641,7 +3641,6 @@
     WriteTo4BPPBuffer_at_7F4000(kReceiveItem_Tab5[a]);
   }
   Point16U pt;
-endif_12:
   Ancilla_PrepAdjustedOamCoord(k, &pt);
   Ancilla_ReceiveItem_Draw(k, pt.x, pt.y);
 }
--- a/dungeon.c
+++ b/dungeon.c
@@ -1903,7 +1903,8 @@
         dung_hdr_bg2_properties = 0;
         goto stairs_wet;
       }
-      WORD(CGWSEL_copy) = 0x6202;
+      CGWSEL_copy = 2;
+      CGADSUB_copy = 0x62;
     }
     dung_stairs_table_2[dung_num_inroom_upsouth_stairs_water >> 1] = dsto;
     dung_num_inroom_upsouth_stairs_water += 2;
@@ -6854,8 +6855,6 @@
 }
 
 void Module07_06_FatInterRoomStairs() {  // 828c14
-  int j;
-
   if (subsubmodule_index >= 3)
     Dungeon_LoadAttribute_Selectable();
 
--- a/ending.c
+++ b/ending.c
@@ -135,7 +135,7 @@
   TM_copy = 16;
   TS_copy = 0;
   Intro_InitializeBackgroundSettings();
-  CGWSEL_copy = 32;
+  CGWSEL_copy = 0x20;
   zelda_ppu_write(OBSEL, 2);
   load_chr_halfslot_even_odd = 20;
   Graphics_LoadChrHalfSlot();
@@ -1367,7 +1367,7 @@
     if (sprite_delay_main[k])
       sprite_delay_main[k]--;
 
-  int i = submodule_index >> 1, k;
+  int i = submodule_index >> 1;
 
   link_x_vel = link_y_vel = 0;
   if (R16 >= 0x40 && !(R16 & 1)) {
@@ -2503,7 +2503,6 @@
     }
   }
 
-done:
   R16 += 0x20;
   if (!(R16 & 0x3ff))
     R16 = (R16 & 0x6800) ^ 0x800;
--- a/main.c
+++ b/main.c
@@ -449,7 +449,7 @@
 
   PatchRom(file);
 
-  bool result = snes_loadRom(snes, file, length);
+  bool result = snes_loadRom(snes, file, (int)length);
   free(file);
   return result;
 }
--- a/messaging.c
+++ b/messaging.c
@@ -769,7 +769,7 @@
     return;
   Death_InitializeGameOverLetters();
   IrisSpotlight_close();
-  WOBJSEL_copy = 48;
+  WOBJSEL_copy = 0x30;
   W34SEL_copy = 0;
   submodule_index++;
 }
@@ -1437,7 +1437,6 @@
     goto out;
 
   k = savegame_map_icons_indicator;
-  uint16 x;
 
   if (!OverworldMap_CheckForPendant(0) && !OverworldMap_CheckForCrystal(0) && !sign16(kOwMapCrystal0_x[k])) {
     link_x_coord_spexit = kOwMapCrystal0_x[k];
@@ -2979,7 +2978,8 @@
   BG2HOFS_copy2 = BG2VOFS_copy2 = 0;
   BG3HOFS_copy2 = BG3VOFS_copy2 = 0;
   mapbak_CGWSEL = WORD(CGWSEL_copy);
-  WORD(CGWSEL_copy) = 0x2002;
+  CGWSEL_copy = 0x02;
+  CGADSUB_copy = 0x20;
   for (int i = 0; i < 2048; i++)
     messaging_buf[i] = 0x300;
   sound_effect_2 = 16;
--- a/player.c
+++ b/player.c
@@ -3512,8 +3512,6 @@
 void Link_APress_PullObject() {  // 87b322
   link_direction &= ~0xf;
 
-  uint8 x;
-
   if (!(kGrabWallDirs[link_direction_facing >> 1] & joypad1H_last)) {
     link_var30d = 0;
     goto set;
--- a/sprite.c
+++ b/sprite.c
@@ -2881,7 +2881,7 @@
 
 // Returns the carry flag
 bool CheckIfHitBoxesOverlap(SpriteHitBox *hb) {  // 86f836
-  int t, u;
+  int t;
   uint8 r15, r12;
 
   if (hb->r8_xhi == 0x80 || hb->r10_spr_xhi == 0x80)
@@ -4377,7 +4377,7 @@
 
 int ReleaseFairy() {  // 9efe33
   SpriteSpawnInfo info;
-  int j = Sprite_SpawnDynamically(0, 0xe3, &info), i;
+  int j = Sprite_SpawnDynamically(0, 0xe3, &info);
   if (j >= 0) {
     sprite_floor[j] = link_is_on_lower_level;
     Sprite_SetX(j, link_x_coord + 8);
--- a/sprite_main.c
+++ b/sprite_main.c
@@ -8567,7 +8567,6 @@
 
 void Sprite_01_Vulture_bounce(int k) {  // 869473
   static const uint8 kVulture_Gfx[4] = {1, 2, 3, 2};
-  int j;
   sprite_obj_prio[k] |= 0x30;
   Vulture_Draw(k);
   if (Sprite_ReturnIfInactive(k))
@@ -22518,7 +22517,6 @@
 }
 
 void Sprite_8B_Gibdo(int k) {  // 9eb9a9
-  int j;
   Gibdo_Draw(k);
   if (Sprite_ReturnIfInactive(k))
     return;
@@ -24287,7 +24285,7 @@
   static const int8 kSpawnBee_XY[8] = {8, 2, -2, -8, 10, 5, -5, -10};
 
   SpriteSpawnInfo info;
-  int j = Sprite_SpawnDynamically(0, 0xb2, &info), i;
+  int j = Sprite_SpawnDynamically(0, 0xb2, &info);
   if (j >= 0) {
     sprite_floor[j] = link_is_on_lower_level;
     Sprite_SetX(j, link_x_coord + 8);
@@ -25119,7 +25117,7 @@
     return;
   Bully_HandleMessage(k);
   Sprite_MoveXYZ(k);
-  int t = Sprite_CheckTileCollision(k), j;
+  int t = Sprite_CheckTileCollision(k);
   if (t) {
     if (!(t & 3))
       sprite_y_vel[k] = -sprite_y_vel[k];
--- a/zelda_cpu_infra.c
+++ b/zelda_cpu_infra.c
@@ -441,7 +441,7 @@
   if (diff != 0) {
     sr->last_inputs = inputs;
     printf("0x%.4x %d: ", diff, sr->frames_since_last);
-    int lb = sr->log.size;
+    size_t lb = sr->log.size;
     for (int i = 0; i < 12; i++) {
       if ((diff >> i) & 1)
         StateRecorder_RecordCmd(sr, i << 4);
@@ -458,7 +458,7 @@
   assert(addr < 0x20000);
   
   printf("%d: PatchByte(0x%x, 0x%x. %d): ", sr->frames_since_last, addr, *value, num);
-  int lb = sr->log.size;
+  size_t lb = sr->log.size;
   int lq = (num - 1) <= 3 ? (num - 1) : 3;
   StateRecorder_RecordCmd(sr, 0xc0 | (addr & 0x10000 ? 2 : 0) | lq << 2);
   if (lq == 3)
@@ -533,11 +533,11 @@
 
   hdr[0] = 1;
   hdr[1] = sr->total_frames;
-  hdr[2] = sr->log.size;
+  hdr[2] = (uint32)sr->log.size;
   hdr[3] = sr->last_inputs;
   hdr[4] = sr->frames_since_last;
   hdr[5] = sr->base_snapshot.size ? 1 : 0;
-  hdr[6] = arr.size;
+  hdr[6] = (uint32)arr.size;
   // If saving while in replay mode, also need to persist
   // sr->replay_pos_last_complete and sr->replay_frame_counter
   // so the replaying can be resumed.
@@ -574,10 +574,10 @@
     if (sr->replay_next_cmd_at != 0xffffffff) {
       sr->replay_next_cmd_at -= old_frames_since_last;
       sr->frames_since_last = sr->replay_next_cmd_at;
-      sr->replay_pos_last_complete = sr->log.size;
+      sr->replay_pos_last_complete = (uint32)sr->log.size;
       StateRecorder_RecordCmd(sr, sr->replay_cmd);
       int old_replay_pos = sr->replay_pos;
-      sr->replay_pos = sr->log.size;
+      sr->replay_pos = (uint32)sr->log.size;
       ByteArray_AppendData(&sr->log, old_log.data + old_replay_pos, old_log.size - old_replay_pos);
     }
     sr->total_frames -= sr->replay_frame_counter;
@@ -746,7 +746,6 @@
     return turbo;
   }
 
-again:
   // Run orig version then snapshot
   snes->input1->currentState = input_state;
   RunEmulatedSnesFrame(snes, run_what);