# GUILTY GEAR Xrd -REVELATOR- -Sign- upk decrypter (0.1a) # original code by gdkchan and Altimor: # https://github.com/gdkchan/GGXrdRevelatorDec/blob/master/GGXrdRevelator/Program.cs # script for QuickBMS http://quickbms.aluigi.org get TEST long goto 0 if TEST == 0x9e2a83c1 print "Your file is NOT encrypted, you don't need this script" cleanexit endif putarray 10 -1 0 putarray 10 -1 0x72642a6f # -revel putarray 10 -1 0x43415046 # -sign putarray 10 -1 "" quickbmsver "0.8.1" # bms code is too slow so let's use the built-in C compiler set MEMORY_FILE10 string " typedef unsigned int uint; static int Index = 0; static const int MT_Length = 624; static uint MT[624] = {0}; MersenneTwister(uint Seed) { MT[0] = Seed; for (int i = 1; i < MT_Length; i++) { uint Prev = MT[i - 1]; MT[i] = (uint)(0x6c078965 * (Prev ^ (Prev >> 30)) + i); } Index = MT_Length; } void Twist() { for (int i = 0; i < MT_Length; i++) { uint Value = (MT[i] & 0x80000000) + (MT[(i + 1) % MT_Length] & 0x7fffffff); MT[i] = MT[(i + 397) % MT_Length] ^ (Value >> 1); if ((Value & 1) != 0) MT[i] ^= 0x9908b0df; } Index = 0; } uint GenRandomNumber() { if (Index >= MT_Length) Twist(); uint Value = MT[Index++]; Value ^= Value >> 11; Value ^= (Value << 7) & 0x9d2c5680; Value ^= (Value << 15) & 0xefc60000; Value ^= Value >> 18; return Value; } " get NAME filename string NAME u NAME strlen NAMESZ NAME math Seed = 0 for i = 0 < NAMESZ getvarchr Chr NAME i math Seed * 137 math Seed + Chr next i for TRY = 0 getarray OutVal 10 TRY if OutVal == "" print "Error: unavailable Seed for decryption" cleanexit endif math SIZE = 4 log MEMORY_FILE 0 SIZE callfunction DECRYPT 1 if OutVal == 0x9e2a83c1 break endif next TRY getarray OutVal 10 TRY print "Use OutVal %OutVal|x%" get SIZE asize log MEMORY_FILE 0 SIZE callfunction DECRYPT 1 get NAME basename get EXT extension string NAME + "_dec." string NAME + EXT log NAME 0 SIZE MEMORY_FILE startfunction DECRYPT #callfunction MersenneTwister 1 calldll MEMORY_FILE10 "MersenneTwister" "tcc" RET Seed math TMP_SIZE = SIZE math TMP_SIZE y 4 for OFFSET = 0 < TMP_SIZE #callfunction GenRandomNumber 1 calldll MEMORY_FILE10 "GenRandomNumber" "tcc" Value getvarchr Chr32 MEMORY_FILE OFFSET long math OutVal ^ Value math OutVal ^ Chr32 putvarchr MEMORY_FILE OFFSET OutVal long next OFFSET + 4 endfunction # the following code is unused, just for reference in case you need a bms-only Mersenne Twister startfunction MersenneTwister math MT_Length = 624 # array 0 is MT putarray 0 0 Seed putarray 0 MT_Length 0 for i = 0 < MT_Length getarray Prev 0 i math i + 1 xmath TMP "0x6c078965 * (Prev ^ (Prev >> 30)) + i" putarray 0 i TMP next math Index = MT_Length endfunction startfunction Twist for i = 0 < MT_Length getarray TMP 0 i xmath j "(i + 1) % MT_Length" getarray TMP1 0 j xmath Value "(TMP & 0x80000000) + (TMP1 & 0x7fffffff)" xmath j "(i + 397) % MT_Length" getarray TMP1 0 j xmath TMP "TMP1 ^ (Value >> 1)" putarray 0 i TMP if Value & 1 math TMP ^ 0x9908b0df; putarray 0 i TMP endif next i math Index = 0 endfunction startfunction GenRandomNumber if Index >= MT_Length callfunction Twist 1 endif getarray Value 0 Index math Index + 1 xmath Value "Value ^ Value >> 11" xmath Value "Value ^ (Value << 7) & 0x9d2c5680" xmath Value "Value ^ (Value << 15) & 0xefc60000" xmath Value "Value ^ Value >> 18" endfunction