 |
 |
GoldenEye 007 Nintendo 64 Community, GoldenEye X, Nintendo 64 Games Discussion GoldenEye Cheats, GoldenEye X Codes, Tips, Help, Nintendo 64 Gaming Community
|
 |
 |
 |
 |
|
 |
 |
 |
 |
 |
Kode-Z Hacker

Joined: 09 Nov 2007 Posts: 1142 Location: London, England  |
Posted: Thu Aug 07, 2014 6:33 am Post subject: Vice City .ADF audio files |
 |
|
I came across a guide that explains how to XOR them to .MP3 and vice versa, but how would I go about actually doing it? I can't get my head around the process! Any help wpuld be appreciated!
http://www.gtamodding.com/index.php?title=ADF |
|
|
|
|
|
 |
 |
 |
 |
 |
acceptable67 007


Joined: 16 Jan 2010 Posts: 1738 Location: US  |
Posted: Thu Aug 07, 2014 7:17 am Post subject: |
 |
|
I can't think of a way doing it in a hex-editor but this could definitely be done in C by parsing each byte in file to buffer then running through a loop and storing each new byte in a new array
Here is a small example I put together that would do the trick:
Code: | char *fBuffer;
char *nBuffer;
char* fileName = "file.adf";
char* outFileName = "file.mp3";
FILE *fP;
size_t fileLength;
fP = fopen(fileName, "rb");
fseek(fP, 0, SEEK_END);
fileLength = ftell(fP);
fseek(fP, 0, SEEK_SET);
fBuffer = (char*)malloc(fileLength);
nBuffer = (char*)malloc(fileLength);
fread(fBuffer, 1, fileLength, fP);
fclose(fP);
for (int i = 0; i < fileLength; i++)
{
nBuffer[i] = fBuffer[i] ^ 0x22; //This is Bitwise XOR, does all the magic
printf("%2x -> %2x\n", fBuffer[i], nBuffer[i]);
}
FILE* fPO;
fPO = fopen(outFileName, "wb");
fwrite(nBuffer, 1, fileLength, fPO);
fclose(fPO);
|
I'm also going off the assumption the output will have a proper MP3 header. _________________
Rare wrote: | Perfect Dark Forever. |
|
|
|
|
|
|
 |
 |
 |
 |
 |
Kode-Z Hacker

Joined: 09 Nov 2007 Posts: 1142 Location: London, England  |
Posted: Thu Aug 07, 2014 7:37 am Post subject: |
 |
|
Thanks!
I have a Mac as opposed to a PC, so I don't know how it can be done! My knowledge in the field is next to none. I have a hex editor, but wouldn't know where to start, or if it can even be done in the editor!
Can it be done via Xcode? |
|
|
|
|
|
 |
 |
 |
 |
 |
acceptable67 007


Joined: 16 Jan 2010 Posts: 1738 Location: US  |
Posted: Thu Aug 07, 2014 7:44 am Post subject: |
 |
|
I believe it can be done in Xcode if you're willing to try that, but I have no experience in the IDE itself so you may have to make some tweaks to the source to prevent potential errors (as well as adding file handling checks). I assume you'll be able to pick it up from there. I would build you a command line executable to save hassle but you're on a different operating system and I'm not going to go about fiddling with a cross-compiler. _________________
Rare wrote: | Perfect Dark Forever. |
|
|
|
|
|
|
 |
 |
 |
 |
 |
zoinkity 007


Joined: 24 Nov 2005 Posts: 1729
 |
Posted: Fri Aug 08, 2014 8:53 am Post subject: |
 |
|
Unfortunately most of the (useful) tools out there are either Windows or Linux. For instance, HexEdit can do bitwise operations over a range of bytes and, for more complicated stuff, run a macro some given number of times. Won't help a mac user of course.
You might have a scripting language installed. Python 3, same as what was below:
Code: | with open('filename.adf', 'rb') as f:
fin = f.read()
with open('filename.mp3', 'wb') as f:
f.write(bytes([i^0x22 for i in fin]))
|
(Well, probably. Didn't actually test it or anything.) _________________ (\_/) Beware
(O.o) ze
(> <) Hoppentruppen! |
|
|
|
|
|
 |
 |
 |
 |
 |
|
 |
 |
 |
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
 |