Skip to content

Instantly share code, notes, and snippets.

@lkraider
Created November 2, 2011 22:40
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkraider/1335175 to your computer and use it in GitHub Desktop.
Save lkraider/1335175 to your computer and use it in GitHub Desktop.
GTA Vice City ADF to MP3 audio converter
#!/usr/bin/env python
import sys
import os
def adf2mp3(input_path, output_path, buffer_size=1024*1024):
print 'Converting', output_path
input_file = open(input_path, 'rb')
output_file = open(output_path, 'wb')
for read_buffer in iter(lambda: input_file.read(buffer_size), ''):
output_buffer = (chr(ord(b) ^ 0x22) for b in read_buffer)
output_file.writelines(output_buffer)
sys.stdout.write('.')
sys.stdout.flush()
input_file.close()
output_file.close()
print '[Done]'
if __name__ == '__main__':
if len(sys.argv) <= 1:
print 'Usage: %s filename.adf' % sys.argv[0]
sys.exit(1)
adf_file = sys.argv[1]
mp3_file = os.path.splitext(adf_file)[0].lower() + '.mp3'
adf2mp3(adf_file, mp3_file)
@SiD-93
Copy link

SiD-93 commented Mar 26, 2017

This did wonders for me! I love the Emotion station from VC 😄

@GaboCapo
Copy link

GaboCapo commented May 25, 2018

Hello,
i am a Beginner and want to run this script.
How can i use it?
Thank you very much
UPDATE:
Ok it works. I install Python and run it with IDLE.
Now i have the problem, the converting Data show me 0 Bytes, what i am doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment