ShootersForever.com Forum Index

GoldenEye 007 Nintendo 64 Community, GoldenEye X, Nintendo 64 Games Discussion
GoldenEye Cheats, GoldenEye X Codes, Tips, Help, Nintendo 64 Gaming Community


Vice City .ADF audio files

 
Post new topic   Reply to topic    ShootersForever.com Forum Index -> Game-On!
View previous topic :: View next topic  
Kode-Z
Hacker
Hacker


Joined: 09 Nov 2007
Posts: 1142
Location: London, England

 PostPosted: Thu Aug 07, 2014 6:33 am    Post subject: Vice City .ADF audio files Reply with quote Back to top

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
 
View user's profile Send private message
acceptable67
007
007


Joined: 16 Jan 2010
Posts: 1738
Location: US

 PostPosted: Thu Aug 07, 2014 7:17 am    Post subject: Reply with quote Back to top

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.
 
View user's profile Send private message
Kode-Z
Hacker
Hacker


Joined: 09 Nov 2007
Posts: 1142
Location: London, England

 PostPosted: Thu Aug 07, 2014 7:37 am    Post subject: Reply with quote Back to top

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?
 
View user's profile Send private message
acceptable67
007
007


Joined: 16 Jan 2010
Posts: 1738
Location: US

 PostPosted: Thu Aug 07, 2014 7:44 am    Post subject: Reply with quote Back to top

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.
 
View user's profile Send private message
zoinkity
007
007


Joined: 24 Nov 2005
Posts: 1729

 PostPosted: Fri Aug 08, 2014 8:53 am    Post subject: Reply with quote Back to top

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!
 
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    ShootersForever.com Forum Index -> Game-On! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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

Cobalt 2.0 BB theme/template by Jakob Persson.
Copyright © 2002-2004 Jakob Persson


Powered by BB © 01, 02 BB Group

 


Please Visit My Other Sites: GoldenEyeForever.com | GrandTheftAutoForever.com

Got kids? Check out my Dora The Explorer site with games and coloring pages!

Our forums feature Nintendo 64 games, GoldenEye 007 N64 New Maps and Missions, GoldenEye Cheats, N64 Emulator, Gameshark, GoldenEye Multiplayer and more!

[ Privacy Policy ]