[questions] WRC 1 - DVD.[BIN/DAT]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

[questions] WRC 1 - DVD.[BIN/DAT]

Post by AnonBaiter »

okay, so i've already written a .bms script out of the DVD.[BIN/DAT] format as seen in WRC: World Rally Championship
the thing is, i want to apart the hashing algorithm as seen in the EVO_OPT4.IRX file into the .bms script - back when i did this i never knew i was pushing myself this hard just for this

Code: Select all

set test01 string "game_intro.str"
strlen name_size test01

log memory_file10 0 0
putct test01 string -1 memory_file10
goto 0 memory_file10

math hash_a_value == 0x7ab7
math hash_b_value == 0x6a2f
math hash == 0

for sb = 0 < name_size
   get string_byte byte memory_file10
   putarray 1 sb string_byte
next sb

for x = 0 < name_size
   getarray string_byte 1 x
   xmath hash1 "(((hash_a_value << 24) | (hash_b_value >> 24)) + string_byte) & 0x7fffffff"
   putarray 0 0 hash1
next x
here's said IRX file for anyone interested
also included is a part of said IRX file i'm trying to adapt into the .bms language
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [questions] WRC 1 - DVD.[BIN/DAT]

Post by aluigi »

Not sure if yours is a request about bms or reverse engineering, from the bms side you don't need to use memory files and array, just getvarchr.
You can even make a C function and calling it with the "tcc" prototype of calldll.

If you need help with reverse engineering I suggest you searching those constants on a search engine:
"31415" "27183"
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: [questions] WRC 1 - DVD.[BIN/DAT]

Post by AnonBaiter »

holy shit this is *SPAM* startling
they used the most basic shit you can ever find regarding hashing algorithms, i don't even think it's worth posting some random links for

anyway see if i'm getting close enough with this

Code: Select all

math alpha == 0x7ab7
math beta == 0x6a2f
math hash == 0
math table_size == 0x7fffffff

set test01 string "game_intro.str"
strlen name_size test01

for sb = 0 < name_size
   getvarchr string_byte test01 sb byte
   xmath hash "hash * alpha"
   xmath hash "((hash + string_byte) % table_size)"
   xmath alpha "(alpha * beta) % (table_size - 1)"
   putarray 0 0 hash
   putarray 1 0 alpha
next sb
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: [questions] WRC 1 - DVD.[BIN/DAT]

Post by AnonBaiter »

second try

Code: Select all

math alpha == 0x7ab7
math beta == 0x6a2f
math hash == 0
math table_size == 0x7fffffff

set test01 string "game_intro.str"
strlen name_size test01

for sb = 0 < name_size
   getvarchr string_byte test01 sb byte
   xmath alpha "(alpha * beta) % (table_size - 1)"
   xmath hash "((alpha * hash) + string_byte) % table_size"
   putarray 0 0 alpha
   putarray 1 0 hash
next sb
at this point i might be trying to pick off the MIPS code(hash_function.txt) to flesh this out
mtik333
Posts: 15
Joined: Thu Jul 26, 2018 5:15 am

Re: [questions] WRC 1 - DVD.[BIN/DAT]

Post by mtik333 »

Hi, sorry for "digging out" this thread after such time, but have you managed to achieve something here? I wanted to fetch game soundtrack from the archive file, but it seems that this is the only thread trying to solve mystery behind game files.