+ Reply to Thread
Page 6 of 6 FirstFirst ... 3 4 5 6
Results 76 to 82 of 82

Thread: CRC32 Model Recognition Tutorial

  1. #76
    Golden Dragon Macpunk's Avatar
    Join Date
    11th Jul 2004
    Location
    Small town, Texas
    Posts
    1,022
    so, what you're saying is that I could...have an int to have the beginning texture ID, and when I press a button, it would take int and add one to it, all the while coloring texture ID int a different color? As soon as I find what I'm looking for...like the player model colored differently, then I would hit a button, and it would log the current texture ID to a file? That would be cool if it worked like that...

    If that's what I need to do...i need to look up coloring player models differently :p.

    Thanks,
    Macpunk
    Ramblings of a Teenage Hacker
    RootContest.org
    Creator of the first Macintosh OpenGL hack. iOGL--MoH:AA/SH
    You a Macintosh cheater looking into creating your own hacks? PM ME!

  2. #77
    old-ass thread but thanks for this...worked in Q4 just for fun in about 3mins.

  3. #78
    i prefer this crc cheksume, a bit cleaner and you dont need an object.

    ( i dont like objects for such tiny stuff )

    btw. not by me, so i added the reference.
    Code:
    #ifndef _CRC_
    #define _CRC_
    // Quelle: http://www.geocities.com/malbrain/  Karl Malbrain
    // Usage : v32 = ~crc32_calc (msg, len, ~0U);
    /*
     *        calculate ccitt cyclic redundancy codes
     *
     *        actual Crc16 = x ^ 16 + x ^ 12 + x ^ 5 + 1
     *
     *        inverse Crc32 = x ^ 32 + x ^ 31 + x ^ 30 +
     *              x ^ 28 + x ^ 27 + x ^ 25 + x ^ 24 +
     *              x ^ 22 + x ^ 21 + x ^ 20 + x ^ 16 +
     *              x ^ 10 + x ^ 9 + x ^ 6 + 1
     *
     *        n.b. standard ANSI X3.66 crc-32 polynomial:
     *        x^0 + x^1 + x^2 + x^4 + x^5 + x^7 + x^8 + x^10 +
     *        x^11 + x^12 + x^16 + x^22 + x^23 + x^26 + x^32
     *
     *        Tables constructed so that entry 0x80 = inverse polynomial
     */
    
    unsigned short Crc16[] = {
    0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
    0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f
    };
    
    unsigned long Crc32[] = {
    0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
    0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
    0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
    0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
    };
    
    unsigned short crc16_calc (unsigned char *ptr, unsigned cnt, unsigned short crc)
    {
        while( cnt-- ) {
            crc = ( crc >> 4 ) ^ Crc16[(crc & 0xf) ^ (*ptr & 0xf)];
            crc = ( crc >> 4 ) ^ Crc16[(crc & 0xf) ^ (*ptr++ >> 4)];
        }
     
        return crc;
    }
    
    unsigned long crc32_calc (unsigned char *ptr, unsigned cnt, unsigned long crc)
    {
        while( cnt-- ) {
            crc = ( crc >> 4 ) ^ Crc32[(crc & 0xf) ^ (*ptr & 0xf)];
            crc = ( crc >> 4 ) ^ Crc32[(crc & 0xf) ^ (*ptr++ >> 4)];
        }
    
        return crc;
    }
    #endif _CRC_
    usage is in the code.

  4. #79
    LOL so old thread, would be useful if i can get the crc32.cpp and crc32.h. the link on the first page is broken. help

  5. #80
    Sweet Zombie Jesus! Golden Dragon Shard's Avatar
    Join Date
    16th Jul 2003
    Location
    UK
    Posts
    1,016
    Quote Originally Posted by irulehard View Post
    LOL so old thread, would be useful if i can get the crc32.cpp and crc32.h. the link on the first page is broken. help
    The post above yours has an alternative. Also, sorry to say I had very little idea what I was actually doing when I wrote this, it was just a compilation of what people had told me.

    There are much better and easier ways of doing checksum based texture recognition than what I described here. There are also better alternatives to using checksums at all, which were little known back then.

  6. #81
    Thanks for this I will try to use this.

  7. #82
    Perfect Shard !
    thx man

    ---------- Post added at 17:51 ---------- Previous post was at 17:50 ----------

    Perfect Shard !
    thx man

+ Reply to Thread
Page 6 of 6 FirstFirst ... 3 4 5 6

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts