Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2009 by Maurus Cuelenaere |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #include <stdio.h> |
| 22 | #include <stdarg.h> |
| 23 | #include "chinachip.h" |
| 24 | |
Dominik Riebeling | dfcb85e | 2011-12-15 18:45:00 +0000 | [diff] [blame^] | 25 | #ifndef VERSION /* allow setting version from outside for svn builds */ |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 26 | #define VERSION "0.1" |
Dominik Riebeling | dfcb85e | 2011-12-15 18:45:00 +0000 | [diff] [blame^] | 27 | #endif |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 28 | #define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__) |
| 29 | |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 30 | void usage(char* name) |
| 31 | { |
| 32 | PRINT("Usage:"); |
| 33 | PRINT(" %s <firmware> <bootloader> <firmware_output> [backup]", name); |
| 34 | PRINT("\nExample:"); |
| 35 | PRINT(" %s VX747.HXF bootloader.bin output.HXF ccpmp.bak", name); |
Dominik Riebeling | dfcb85e | 2011-12-15 18:45:00 +0000 | [diff] [blame^] | 36 | PRINT(" This will copy ccpmp.bin in VX747.HXF as ccpmp.old and replace it\n" |
| 37 | " with bootloader.bin, the output will get written to output.HXF.\n" |
| 38 | " The old ccpmp.bin will get written to ccpmp.bak.\n"); |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | int main(int argc, char* argv[]) |
| 42 | { |
| 43 | PRINT("ChinaChipPatcher v" VERSION " - (C) Maurus Cuelenaere 2009"); |
| 44 | PRINT("This is free software; see the source for copying conditions. There is NO"); |
Dominik Riebeling | dfcb85e | 2011-12-15 18:45:00 +0000 | [diff] [blame^] | 45 | PRINT("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 46 | |
| 47 | if(argc < 4) |
| 48 | { |
| 49 | usage(argv[0]); |
| 50 | return 1; |
| 51 | } |
| 52 | |
Dominik Riebeling | 059cb71 | 2011-12-03 09:41:44 +0000 | [diff] [blame] | 53 | return chinachip_patch(argv[1], argv[2], argv[3], argc > 4 ? argv[4] : NULL); |
Dominik Riebeling | 07da9ce | 2011-12-03 09:39:11 +0000 | [diff] [blame] | 54 | } |
| 55 | |