Tool to find duplicate tiles

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Tool to find duplicate tiles
by on (#160461)
Is there a program that takes the .chr file of an NES project and tells you where you have duplicate tiles?
Re: Tool to find duplicate tiles
by on (#160466)
NES Screen Tool will do this.

https://shiru.untergrund.net/software.shtml
Re: Tool to find duplicate tiles
by on (#160481)
It's a bit ancient now, but you can always re-compile the C source to my program: http://www.chrismcovell.com/charlie.html
Re: Tool to find duplicate tiles
by on (#160497)
DRW wrote:
Is there a program that takes the .chr file of an NES project and tells you where you have duplicate tiles?

I wrote an NES program that can do that.
Re: Tool to find duplicate tiles
by on (#160556)
Thanks for your help.

ccovell's tool is the one that works best for me. (Since I have Windows XP, I didn't even need to recompile the file.)

With shiru's tool, I didn't find a way to list all duplicates at once. I only found the version where I click one tile and it shows me the duplicates of this one tile.

tepples wrote:

If it's an NES program, how am I supposed to use an existing CHR file for a check?
Re: Tool to find duplicate tiles
by on (#160590)
It would be a very simple tool to write for yourself:
Code:
for (int t=0; t<256; ++t) // iterate over 256 16-byte tiles
{
   for (int u=0; u<t; ++u) // check every tile before this one
   {
      bool duplicate = true;
      for (int b=0; b<16; ++b)
      {
         if (chr[(t*16)+b] != chr[(u*16)+b])
         {
            duplicate = false;
            break;
         }
      }
      if (duplicate)
      {
         printf("Tile %02X duplicates tile %02X\n",t,u);
         break;
      }
   }
}