Skip to content

Instantly share code, notes, and snippets.

@Tomfox91
Created August 14, 2014 19:59
Show Gist options
  • Save Tomfox91/41a8f5df77a2e8b0463a to your computer and use it in GitHub Desktop.
Save Tomfox91/41a8f5df77a2e8b0463a to your computer and use it in GitHub Desktop.
Converter for .BR3, .BR4, .BR5 files produced by BMW music backups. Simply negates all bites. See http://www.1erforum.de/hifi-navi/konvertieren-von-br4-br5-mp3-22678.html.
import std.file;
int main(char[][] args) {
if (args.length != 2) return 101;
auto filename = args[1];
auto basename = filename[0 .. $-4];
auto extension = filename[$-3 .. $];
if (!exists(filename)) return 102;
char[] outpname;
switch (extension) {
case "BR3":
outpname = basename ~ "." ~ "mp4";
break;
case "BR4":
outpname = basename ~ "." ~ "mp3";
break;
case "BR5":
outpname = basename ~ "." ~ "wma";
break;
default:
return 103;
}
char[] file = cast(char[]) read(filename);
foreach (int i, char c; file) {
file[i] = c ^ cast(char) 0xFF;
}
write(outpname, file);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment