Mercurial > otakunoraifu
diff system/file.cc @ 30:3fe3e5f184b5
* Added CLANNAD Full Voice's key
author | thib |
---|---|
date | Fri, 06 Mar 2009 21:25:42 +0000 |
parents | 3a6aaeab7b4e |
children | 2c574c3d50a9 |
line wrap: on
line diff
--- a/system/file.cc +++ b/system/file.cc @@ -599,6 +599,43 @@ int FILESEARCH::InitRoot(char* root) { return 0; } +void FILESEARCH::SetXorKey(char *key) +{ + unsigned short int i; + for (i=0; i < 16; i++) + xor_key[i] = key[i]; +} + +void FILESEARCH::GuessXorKey(char *regname) +{ + char key1[16] = { + 0xa8, 0x28, 0xfd, 0x66, + 0xa0, 0x23, 0x77, 0x69, + 0xf9, 0x45, 0xf8, 0x2c, + 0x7c, 0x00, 0xad, 0xf4 + }; + + char key2[16] = { + 0xAF, 0x2F, 0xFB, 0x6B, + 0xAF, 0x30, 0x77, 0x17, + 0x87, 0x48, 0xFE, 0x2C, + 0x68, 0x1A, 0xB9, 0xF0 + }; + + + if (strcmp(regname, "KEY\\CLANNAD_FV") == 0) { + SetXorKey(key2); + } + else { + SetXorKey(key1); + } +} + +const char * FILESEARCH::GetXorKey(void) +{ + return xor_key; +} + void FILESEARCH::SetFileInformation(FILETYPE tp, ARCTYPE is_arc, char* filename) { int type = tp; if (type < 0 || type >= TYPEMAX) return; @@ -1386,12 +1423,7 @@ char ARCINFO2k::decode_seed[256] ={ ,0x20 ,0x50 ,0x6a ,0x00 ,0xe8 ,0x47 ,0x28 ,0x01 ,0x00 ,0x8b ,0x7d ,0xe8 ,0x89 ,0x45 ,0xf4 ,0x8b ,0xf0 ,0xa1 ,0xe0 ,0x30 ,0x44 ,0x00 ,0x83 ,0xc4 ,0x08 ,0x85 ,0xc0 ,0x75 ,0x56 ,0x8b ,0x1d ,0xd0 ,0xb0 ,0x43 ,0x00 ,0x85 ,0xff ,0x76 ,0x49 ,0x81 ,0xff ,0x00 ,0x00 ,0x04 ,0x00 ,0x6a ,0x00 ,0x76}; -char ARCINFO2k::decode_seed2[16] = { - 0xa8, 0x28, 0xfd, 0x66, - 0xa0, 0x23, 0x77, 0x69, - 0xf9, 0x45, 0xf8, 0x2c, - 0x7c, 0x00, 0xad, 0xf4 -}; + bool ARCINFO2k::ExecExtract(void) { int i; @@ -1424,9 +1456,10 @@ bool ARCINFO2k::ExecExtract(void) { while(lzExtract(Extract_DataType_SCN2k(), char(), s, d, send, dend)) ; } if (read_little_endian_int(data+4) == 0x1adb2) { // Little Busters! + const char *decode_key = file_searcher.GetXorKey(); int header_size = info.private_data; for (i=0x100; i<=0x200 && header_size+i < info.filesize; i++) { - ret_data[header_size+i] ^= decode_seed2[i&0x0f]; + ret_data[header_size+i] ^= decode_key[i&0x0f]; } } delete[] decoded_data;