Mercurial > mplayer.hg
annotate libdvdread/cmd_print.c @ 27945:2c8417164a90
Make description of the option more clear as suggested by
Reimar D«Óffinger.
author | bircoph |
---|---|
date | Sat, 22 Nov 2008 13:31:55 +0000 |
parents | ea01824701a5 |
children |
rev | line source |
---|---|
27466
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
1 /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
2 /* |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
3 * Copyright (C) 2000, 2001, 2002, 2003 Martin Norbäck, Håkan Hjort |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
4 * |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
8 * (at your option) any later version. |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
9 * |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
14 * |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
18 */ |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
19 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
20 #include "config.h" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
21 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
22 #include <stdio.h> |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
23 #include <ctype.h> |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
24 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
25 #if defined(HAVE_INTTYPES_H) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
26 #include <inttypes.h> |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
27 #elif defined(HAVE_STDINT_H) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
28 #include <stdint.h> |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
29 #endif |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
30 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
31 #include "cmd_print.h" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
32 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
33 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
34 typedef struct |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
35 { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
36 uint8_t bits[8]; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
37 uint8_t examined[8]; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
38 } cmd_t; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
39 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
40 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
41 static const char *cmp_op_table[] = { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
42 NULL, "&", "==", "!=", ">=", ">", "<=", "<" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
43 }; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
44 static const char *set_op_table[] = { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
45 NULL, "=", "<->", "+=", "-=", "*=", "/=", "%=", "rnd", "&=", "|=", "^=" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
46 }; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
47 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
48 static const char *link_table[] = { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
49 "LinkNoLink", "LinkTopC", "LinkNextC", "LinkPrevC", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
50 NULL, "LinkTopPG", "LinkNextPG", "LinkPrevPG", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
51 NULL, "LinkTopPGC", "LinkNextPGC", "LinkPrevPGC", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
52 "LinkGoUpPGC", "LinkTailPGC", NULL, NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
53 "RSM" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
54 }; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
55 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
56 static const char *system_reg_table[] = { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
57 "Menu Description Language Code", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
58 "Audio Stream Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
59 "Sub-picture Stream Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
60 "Angle Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
61 "Title Track Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
62 "VTS Title Track Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
63 "VTS PGC Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
64 "PTT Number for One_Sequential_PGC_Title", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
65 "Highlighted Button Number", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
66 "Navigation Timer", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
67 "Title PGC Number for Navigation Timer", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
68 "Audio Mixing Mode for Karaoke", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
69 "Country Code for Parental Management", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
70 "Parental Level", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
71 "Player Configurations for Video", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
72 "Player Configurations for Audio", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
73 "Initial Language Code for Audio", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
74 "Initial Language Code Extension for Audio", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
75 "Initial Language Code for Sub-picture", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
76 "Initial Language Code Extension for Sub-picture", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
77 "Player Regional Code", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
78 "Reserved 21", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
79 "Reserved 22", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
80 "Reserved 23" |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
81 }; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
82 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
83 static const char *system_reg_abbr_table[] = { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
84 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
85 "ASTN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
86 "SPSTN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
87 "AGLN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
88 "TTN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
89 "VTS_TTN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
90 "TT_PGCN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
91 "PTTN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
92 "HL_BTNN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
93 "NVTMR", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
94 "NV_PGCN", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
95 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
96 "CC_PLT", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
97 "PLT", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
98 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
99 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
100 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
101 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
102 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
103 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
104 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
105 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
106 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
107 NULL, |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
108 }; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
109 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
110 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
111 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
112 static unsigned int bits(cmd_t *cmd, int byte, int bit, int count) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
113 unsigned int val = 0; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
114 unsigned int bit_mask; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
115 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
116 while(count--) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
117 if(bit > 7) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
118 bit = 0; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
119 byte++; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
120 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
121 bit_mask = 0x01 << (7-bit); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
122 val <<= 1; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
123 if((cmd->bits[byte]) & bit_mask) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
124 val |= 1; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
125 cmd->examined[byte] |= bit_mask; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
126 bit++; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
127 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
128 return val; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
129 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
130 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
131 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
132 static void print_system_reg(unsigned int reg) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
133 if(reg < sizeof(system_reg_abbr_table) / sizeof(char *)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
134 fprintf(stdout, system_reg_table[reg]); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
135 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
136 fprintf(stdout, " WARNING: Unknown system register "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
137 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
138 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
139 static void print_reg(unsigned int reg) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
140 if(reg & 0x80) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
141 print_system_reg(reg & 0x7f); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
142 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
143 if(reg < 16) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
144 fprintf(stdout, "g[%u]", reg); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
145 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
146 fprintf(stdout, " WARNING: Unknown general register "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
147 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
148 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
149 static void print_cmp_op(unsigned int op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
150 if(op < sizeof(cmp_op_table) / sizeof(char *) && cmp_op_table[op] != NULL) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
151 fprintf(stdout, " %s ", cmp_op_table[op]); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
152 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
153 fprintf(stdout, " WARNING: Unknown compare op "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
154 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
155 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
156 static void print_set_op(unsigned int op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
157 if(op < sizeof(set_op_table) / sizeof(char *) && set_op_table[op] != NULL) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
158 fprintf(stdout, " %s ", set_op_table[op]); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
159 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
160 fprintf(stdout, " WARNING: Unknown set op "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
161 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
162 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
163 static void print_reg_or_data(cmd_t *cmd, unsigned int immediate, int byte) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
164 if(immediate) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
165 int i = bits(cmd,byte,0,16); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
166 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
167 fprintf(stdout, "0x%x", i); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
168 if(isprint(i & 0xff) && isprint((i>>8) & 0xff)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
169 fprintf(stdout, " (\"%c%c\")", (char)((i>>8) & 0xff), (char)(i & 0xff)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
170 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
171 print_reg(bits(cmd,byte + 1,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
172 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
173 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
174 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
175 static void print_reg_or_data_2(cmd_t *cmd, unsigned int immediate, int byte) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
176 if(immediate) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
177 fprintf(stdout, "0x%x", bits(cmd,byte,1,7)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
178 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
179 fprintf(stdout, "g[%u]", bits(cmd,byte,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
180 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
181 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
182 static void print_if_version_1(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
183 unsigned int op = bits(cmd,1,1,3); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
184 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
185 if(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
186 fprintf(stdout, "if ("); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
187 print_reg(bits(cmd,3,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
188 print_cmp_op(op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
189 print_reg_or_data(cmd,bits(cmd,1,0,1), 4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
190 fprintf(stdout, ") "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
191 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
192 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
193 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
194 static void print_if_version_2(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
195 unsigned int op = bits(cmd,1,1,3); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
196 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
197 if(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
198 fprintf(stdout, "if ("); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
199 print_reg(bits(cmd,6,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
200 print_cmp_op(op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
201 print_reg(bits(cmd,7,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
202 fprintf(stdout, ") "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
203 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
204 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
205 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
206 static void print_if_version_3(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
207 unsigned int op = bits(cmd,1,1,3); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
208 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
209 if(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
210 fprintf(stdout, "if ("); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
211 print_reg(bits(cmd,2,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
212 print_cmp_op(op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
213 print_reg_or_data(cmd,bits(cmd,1,0,1), 6); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
214 fprintf(stdout, ") "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
215 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
216 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
217 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
218 static void print_if_version_4(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
219 unsigned int op = bits(cmd,1,1,3); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
220 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
221 if(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
222 fprintf(stdout, "if ("); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
223 print_reg(bits(cmd,1,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
224 print_cmp_op(op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
225 print_reg_or_data(cmd,bits(cmd,1,0,1), 4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
226 fprintf(stdout, ") "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
227 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
228 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
229 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
230 static void print_if_version_5(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
231 unsigned int op = bits(cmd,1,1,3); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
232 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
233 if(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
234 fprintf(stdout, "if ("); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
235 print_reg(bits(cmd,4,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
236 print_cmp_op(op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
237 print_reg(bits(cmd,5,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
238 fprintf(stdout, ") "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
239 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
240 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
241 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
242 static void print_special_instruction(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
243 unsigned int op = bits(cmd,1,4,4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
244 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
245 switch(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
246 case 0: // NOP |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
247 fprintf(stdout, "Nop"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
248 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
249 case 1: // Goto line |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
250 fprintf(stdout, "Goto %u", bits(cmd,7,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
251 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
252 case 2: // Break |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
253 fprintf(stdout, "Break"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
254 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
255 case 3: // Parental level |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
256 fprintf(stdout, "SetTmpPML %u, Goto %u", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
257 bits(cmd,6,4,4), bits(cmd,7,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
258 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
259 default: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
260 fprintf(stdout, "WARNING: Unknown special instruction (%u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
261 bits(cmd,1,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
262 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
263 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
264 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
265 static void print_linksub_instruction(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
266 unsigned int linkop = bits(cmd,7,3,5); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
267 unsigned int button = bits(cmd,6,0,6); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
268 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
269 if(linkop < sizeof(link_table)/sizeof(char *) && link_table[linkop] != NULL) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
270 fprintf(stdout, "%s (button %u)", link_table[linkop], button); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
271 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
272 fprintf(stdout, "WARNING: Unknown linksub instruction (%u)", linkop); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
273 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
274 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
275 static void print_link_instruction(cmd_t *cmd, int optional) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
276 unsigned int op = bits(cmd,1,4,4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
277 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
278 if(optional && op) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
279 fprintf(stdout, ", "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
280 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
281 switch(op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
282 case 0: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
283 if(!optional) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
284 fprintf(stdout, "WARNING: NOP (link)!"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
285 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
286 case 1: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
287 print_linksub_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
288 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
289 case 4: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
290 fprintf(stdout, "LinkPGCN %u", bits(cmd,6,1,15)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
291 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
292 case 5: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
293 fprintf(stdout, "LinkPTT %u (button %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
294 bits(cmd,6,6,10), bits(cmd,6,0,6)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
295 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
296 case 6: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
297 fprintf(stdout, "LinkPGN %u (button %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
298 bits(cmd,7,1,7), bits(cmd,6,0,6)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
299 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
300 case 7: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
301 fprintf(stdout, "LinkCN %u (button %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
302 bits(cmd,7,0,8), bits(cmd,6,0,6)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
303 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
304 default: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
305 fprintf(stdout, "WARNING: Unknown link instruction"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
306 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
307 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
308 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
309 static void print_jump_instruction(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
310 switch(bits(cmd,1,4,4)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
311 case 1: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
312 fprintf(stdout, "Exit"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
313 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
314 case 2: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
315 fprintf(stdout, "JumpTT %u", bits(cmd,5,1,7)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
316 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
317 case 3: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
318 fprintf(stdout, "JumpVTS_TT %u", bits(cmd,5,1,7)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
319 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
320 case 5: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
321 fprintf(stdout, "JumpVTS_PTT %u:%u", bits(cmd,5,1,7), bits(cmd,2,6,10)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
322 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
323 case 6: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
324 switch(bits(cmd,5,0,2)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
325 case 0: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
326 fprintf(stdout, "JumpSS FP"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
327 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
328 case 1: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
329 fprintf(stdout, "JumpSS VMGM (menu %u)", bits(cmd,5,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
330 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
331 case 2: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
332 fprintf(stdout, "JumpSS VTSM (vts %u, title %u, menu %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
333 bits(cmd,4,0,8), bits(cmd,3,0,8), bits(cmd,5,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
334 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
335 case 3: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
336 fprintf(stdout, "JumpSS VMGM (pgc %u)", bits(cmd,2,1,15)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
337 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
338 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
339 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
340 case 8: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
341 switch(bits(cmd,5,0,2)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
342 case 0: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
343 fprintf(stdout, "CallSS FP (rsm_cell %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
344 bits(cmd,4,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
345 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
346 case 1: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
347 fprintf(stdout, "CallSS VMGM (menu %u, rsm_cell %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
348 bits(cmd,5,4,4), bits(cmd,4,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
349 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
350 case 2: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
351 fprintf(stdout, "CallSS VTSM (menu %u, rsm_cell %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
352 bits(cmd,5,4,4), bits(cmd,4,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
353 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
354 case 3: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
355 fprintf(stdout, "CallSS VMGM (pgc %u, rsm_cell %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
356 bits(cmd,2,1,15), bits(cmd,4,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
357 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
358 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
359 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
360 default: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
361 fprintf(stdout, "WARNING: Unknown Jump/Call instruction"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
362 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
363 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
364 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
365 static void print_system_set(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
366 int i; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
367 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
368 switch(bits(cmd,0,4,4)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
369 case 1: // Set system reg 1 &| 2 &| 3 (Audio, Subp. Angle) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
370 for(i = 1; i <= 3; i++) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
371 if(bits(cmd,2+i,0,1)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
372 print_system_reg((unsigned int)i); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
373 fprintf(stdout, " = "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
374 print_reg_or_data_2(cmd,bits(cmd,0,3,1), 2 + i); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
375 fprintf(stdout, " "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
376 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
377 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
378 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
379 case 2: // Set system reg 9 & 10 (Navigation timer, Title PGC number) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
380 print_system_reg(9); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
381 fprintf(stdout, " = "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
382 print_reg_or_data(cmd,bits(cmd,0,3,1), 2); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
383 fprintf(stdout, " "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
384 print_system_reg(10); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
385 fprintf(stdout, " = %u", bits(cmd,5,0,8)); // ?? |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
386 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
387 case 3: // Mode: Counter / Register + Set |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
388 fprintf(stdout, "SetMode "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
389 if(bits(cmd,5,0,1)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
390 fprintf(stdout, "Counter "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
391 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
392 fprintf(stdout, "Register "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
393 print_reg(bits(cmd,5,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
394 print_set_op(0x1); // '=' |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
395 print_reg_or_data(cmd,bits(cmd,0,3,1), 2); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
396 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
397 case 6: // Set system reg 8 (Highlighted button) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
398 print_system_reg(8); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
399 if(bits(cmd,0,3,1)) // immediate |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
400 fprintf(stdout, " = 0x%x (button no %u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
401 bits(cmd,4,0,16), bits(cmd,4,0,6)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
402 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
403 fprintf(stdout, " = g[%u]", bits(cmd,5,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
404 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
405 default: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
406 fprintf(stdout, "WARNING: Unknown system set instruction (%u)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
407 bits(cmd,0,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
408 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
409 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
410 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
411 static void print_set_version_1(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
412 unsigned int set_op = bits(cmd,0,4,4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
413 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
414 if(set_op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
415 print_reg(bits(cmd,3,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
416 print_set_op(set_op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
417 print_reg_or_data(cmd,bits(cmd,0,3,1), 4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
418 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
419 fprintf(stdout, "NOP"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
420 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
421 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
422 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
423 static void print_set_version_2(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
424 unsigned int set_op = bits(cmd,0,4,4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
425 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
426 if(set_op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
427 print_reg(bits(cmd,1,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
428 print_set_op(set_op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
429 print_reg_or_data(cmd,bits(cmd,0,3,1), 2); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
430 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
431 fprintf(stdout, "NOP"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
432 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
433 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
434 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
435 static void print_set_version_3(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
436 unsigned int set_op = bits(cmd,0,4,4); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
437 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
438 if(set_op) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
439 print_reg(bits(cmd,1,4,4)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
440 print_set_op(set_op); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
441 if(bits(cmd,0,3,1)) { // print_reg_or_data |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
442 unsigned int i = bits(cmd,2,0,16); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
443 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
444 fprintf(stdout, "0x%x", i); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
445 if(isprint(i & 0xff) && isprint((i>>8) & 0xff)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
446 fprintf(stdout, " (\"%c%c\")", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
447 (char)((i>>8) & 0xff), (char)(i & 0xff)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
448 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
449 print_reg(bits(cmd,2,0,8)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
450 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
451 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
452 fprintf(stdout, "NOP"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
453 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
454 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
455 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
456 static void print_command(cmd_t *cmd) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
457 switch(bits(cmd,0,0,3)) { /* three first bits */ |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
458 case 0: // Special instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
459 print_if_version_1(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
460 print_special_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
461 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
462 case 1: // Jump/Call or Link instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
463 if(bits(cmd,0,3,1)) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
464 print_if_version_2(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
465 print_jump_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
466 } else { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
467 print_if_version_1(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
468 print_link_instruction(cmd,0); // must be pressent |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
469 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
470 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
471 case 2: // Set System Parameters instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
472 print_if_version_2(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
473 print_system_set(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
474 print_link_instruction(cmd,1); // either 'if' or 'link' |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
475 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
476 case 3: // Set General Parameters instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
477 print_if_version_3(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
478 print_set_version_1(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
479 print_link_instruction(cmd,1); // either 'if' or 'link' |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
480 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
481 case 4: // Set, Compare -> LinkSub instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
482 print_set_version_2(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
483 fprintf(stdout, ", "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
484 print_if_version_4(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
485 print_linksub_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
486 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
487 case 5: // Compare -> (Set and LinkSub) instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
488 if(bits(cmd,0,3,1)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
489 print_if_version_5(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
490 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
491 print_if_version_1(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
492 fprintf(stdout, "{ "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
493 print_set_version_3(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
494 fprintf(stdout, ", "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
495 print_linksub_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
496 fprintf(stdout, " }"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
497 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
498 case 6: // Compare -> Set, always LinkSub instructions |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
499 if(bits(cmd,0,3,1)) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
500 print_if_version_5(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
501 else |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
502 print_if_version_1(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
503 fprintf(stdout, "{ "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
504 print_set_version_3(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
505 fprintf(stdout, " } "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
506 print_linksub_instruction(cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
507 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
508 default: |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
509 fprintf(stdout, "WARNING: Unknown instruction type (%i)", |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
510 bits(cmd,0,0,3)); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
511 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
512 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
513 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
514 void cmdPrint_mnemonic(vm_cmd_t *command) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
515 int i, extra_bits; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
516 cmd_t cmd; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
517 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
518 for(i = 0; i < 8; i++) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
519 cmd.bits[i] = command->bytes[i]; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
520 cmd.examined[i] = 0; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
521 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
522 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
523 print_command(&cmd); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
524 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
525 // Check if there still are bits set that were not examined |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
526 extra_bits = 0; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
527 for(i = 0; i < 8; i++) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
528 if(cmd.bits[i] & ~ cmd.examined[i]) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
529 extra_bits = 1; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
530 break; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
531 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
532 if(extra_bits) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
533 fprintf(stdout, " [WARNING, unknown bits:"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
534 for(i = 0; i < 8; i++) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
535 fprintf(stdout, " %02x", cmd.bits[i] & ~ cmd.examined[i]); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
536 fprintf(stdout, "]"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
537 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
538 } |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
539 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
540 void cmdPrint_CMD(int row, vm_cmd_t *command) { |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
541 int i; |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
542 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
543 fprintf(stdout, "(%03d) ", row + 1); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
544 for(i = 0; i < 8; i++) |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
545 fprintf(stdout, "%02x ", command->bytes[i]); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
546 fprintf(stdout, "| "); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
547 |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
548 cmdPrint_mnemonic(command); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
549 fprintf(stdout, "\n"); |
ea01824701a5
Rename internal libdvdread fork from dvdread to libdvdread
rathann
parents:
diff
changeset
|
550 } |