diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-23 13:08:54 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-23 13:08:54 +0000 |
commit | 593b12ed67cf27b69563afd2d12752c7ebfee683 (patch) | |
tree | 5c7c850f6950104e7e5aafa300035744fded470c /src/common/grfio.c | |
parent | 1b008a629ddb633d91a70e2c037924fab10e2d6c (diff) | |
download | hercules-593b12ed67cf27b69563afd2d12752c7ebfee683.tar.gz hercules-593b12ed67cf27b69563afd2d12752c7ebfee683.tar.bz2 hercules-593b12ed67cf27b69563afd2d12752c7ebfee683.tar.xz hercules-593b12ed67cf27b69563afd2d12752c7ebfee683.zip |
* Added some of Shinomori's fixes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@751 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/grfio.c')
-rw-r--r-- | src/common/grfio.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c index d27636d33..c8c021b8d 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -140,7 +140,11 @@ static unsigned char NibbleData[4][64]={ */ static unsigned int getlong(unsigned char *p) { - return *p+p[1]*256+(p[2]+p[3]*256)*65536; +// return *p+p[1]*256+(p[2]+p[3]*256)*65536; + return p[0] + | p[1] << 0x08 + | p[2] << 0x10 + | p[3] << 0x18; // Shinomori } /*========================================== @@ -158,15 +162,17 @@ static void BitConvert(BYTE *Src,char *BitSwapTable) { int lop,prm; BYTE tmp[8]; - *(DWORD*)tmp=*(DWORD*)(tmp+4)=0; +// *(DWORD*)tmp=*(DWORD*)(tmp+4)=0; + memset(tmp,0,8); for(lop=0;lop!=64;lop++) { prm = BitSwapTable[lop]-1; if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) { tmp[(lop >> 3) & 7] |= BitMaskTable[lop & 7]; } } - *(DWORD*)Src = *(DWORD*)tmp; - *(DWORD*)(Src+4) = *(DWORD*)(tmp+4); +// *(DWORD*)Src = *(DWORD*)tmp; +// *(DWORD*)(Src+4) = *(DWORD*)(tmp+4); + memcpy(Src,tmp,8); } static void BitConvert4(BYTE *Src) @@ -194,7 +200,11 @@ static void BitConvert4(BYTE *Src) tmp[(lop >> 3) + 4] |= BitMaskTable[lop & 7]; } } - *(DWORD*)Src ^= *(DWORD*)(tmp+4); +// *(DWORD*)Src ^= *(DWORD*)(tmp+4); + Src[0] ^= tmp[4]; + Src[1] ^= tmp[5]; + Src[2] ^= tmp[6]; + Src[3] ^= tmp[7]; } static void decode_des_etc(BYTE *buf,int len,int type,int cycle) |