diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-22 08:22:20 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-22 08:22:20 +0000 |
commit | 81ba38e4a1b83a86dd775eebb0d1b63ae0cd4395 (patch) | |
tree | 38520de34911aef95b37afe6deaf7cb60c2c6a26 | |
parent | 2a2df2857bf7e4e469a4f49249d1f1d2e2fa3c01 (diff) | |
download | rockbox-81ba38e4a1b83a86dd775eebb0d1b63ae0cd4395.tar.gz rockbox-81ba38e4a1b83a86dd775eebb0d1b63ae0cd4395.zip |
Theme Editor: Wrote buildtargetdb.php to automatically generate a targetdb file from the target config files in /firmware/export/config. All that remains is to fill out the names of the targets and run the script to build the db
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27516 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-x | utils/themeeditor/buildtargetdb.php | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/utils/themeeditor/buildtargetdb.php b/utils/themeeditor/buildtargetdb.php new file mode 100755 index 0000000000..be372e1489 --- /dev/null +++ b/utils/themeeditor/buildtargetdb.php | |||
@@ -0,0 +1,131 @@ | |||
1 | #!/usr/bin/php -q | ||
2 | <?php | ||
3 | /*************************************************************************** | ||
4 | * __________ __ ___. | ||
5 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
6 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
7 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
8 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
9 | * \/ \/ \/ \/ \/ | ||
10 | * $Id$ | ||
11 | * | ||
12 | * Copyright (C) 2010 Robert Bieber | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | // This is the array of targets, with the target id as the key and the | ||
25 | // plaintext name of the target as the value | ||
26 | $targets = array( 'ipod1g2g' => 'iPod 1st/2nd Gen', | ||
27 | 'ipodcolor' => 'iPod Color', | ||
28 | 'ipodmini2g' => 'iPod Mini 2nd Gen', | ||
29 | 'mrobe500' => 'm%:robe 500' | ||
30 | ); | ||
31 | |||
32 | // Looping through all the targets | ||
33 | foreach($targets as $target => $plaintext) | ||
34 | { | ||
35 | // Opening a cpp process | ||
36 | $configfile = '../../firmware/export/config/' . $target . '.h'; | ||
37 | $descriptor = array( 0 => array("pipe", "r"), //stdin | ||
38 | 1 => array("pipe", "w") //stdout | ||
39 | ); | ||
40 | |||
41 | $proc = proc_open('cpp', $descriptor, $pipes); | ||
42 | |||
43 | if($proc == false) | ||
44 | die("Failed to open process"); | ||
45 | |||
46 | // Feeding the input to cpp | ||
47 | $input = "#include \"$configfile\"\n"; | ||
48 | $input .= <<<STR | ||
49 | lcd | ||
50 | LCD_WIDTH | ||
51 | LCD_HEIGHT | ||
52 | LCD_DEPTH | ||
53 | remote | ||
54 | #ifdef HAVE_REMOTE_LCD | ||
55 | LCD_REMOTE_WIDTH | ||
56 | LCD_REMOTE_HEIGHT | ||
57 | LCD_REMOTE_DEPTH | ||
58 | #endif | ||
59 | tuner | ||
60 | #ifdef CONFIG_TUNER | ||
61 | yes | ||
62 | #endif | ||
63 | recording | ||
64 | #ifdef HAVE_RECORDING | ||
65 | yes | ||
66 | #endif | ||
67 | unused | ||
68 | STR; | ||
69 | |||
70 | fwrite($pipes[0], $input); | ||
71 | fclose($pipes[0]); | ||
72 | |||
73 | $results = stream_get_contents($pipes[1]); | ||
74 | fclose($pipes[1]); | ||
75 | $results = explode("\n", $results); | ||
76 | |||
77 | // Header for the target | ||
78 | echo $target . "\n{\n"; | ||
79 | echo ' name : ' . $plaintext . "\n"; | ||
80 | |||
81 | // Writing the LCD dimensions | ||
82 | echo ' screen : ' . $results[7] . ' x ' . $results[8] . ' @ '; | ||
83 | if($results[9] == 1) | ||
84 | echo 'mono'; | ||
85 | else if($results[10] == 2) | ||
86 | echo 'grey'; | ||
87 | else | ||
88 | echo 'rgb'; | ||
89 | echo "\n"; | ||
90 | |||
91 | // Writing the remote dimensions if necessary | ||
92 | echo ' remote : '; | ||
93 | if($results[12] == 0) | ||
94 | { | ||
95 | echo 'no'; | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | echo $results[12] . ' x ' .$results[13] . ' @ '; | ||
100 | if($results[14] == 1) | ||
101 | echo 'mono'; | ||
102 | else if($results[14] == 2) | ||
103 | echo 'grey'; | ||
104 | else | ||
105 | echo 'rgb'; | ||
106 | } | ||
107 | echo "\n"; | ||
108 | |||
109 | // Writing FM capability | ||
110 | echo ' fm : '; | ||
111 | if($results[18] == 'yes') | ||
112 | echo 'yes'; | ||
113 | else | ||
114 | echo 'no'; | ||
115 | echo "\n"; | ||
116 | |||
117 | // Writing record capability | ||
118 | echo ' record : '; | ||
119 | if($results[22] == 'yes') | ||
120 | echo 'yes'; | ||
121 | else | ||
122 | echo 'no'; | ||
123 | echo "\n"; | ||
124 | |||
125 | // Closing the target | ||
126 | echo "}\n\n"; | ||
127 | |||
128 | proc_close($proc); | ||
129 | } | ||
130 | |||
131 | ?> | ||