annotate vm/vm.c @ 429:2e6f41e04ca1 src

Do not close file twice. There is another close further down that will always be reached. Patch by Reimar D«Óffinger ^Reimar&Doeffinger*gmx!de#
author rathann
date Thu, 03 Oct 2013 22:43:52 +0000
parents 3d942df13d3a
children 1c7c804e9c82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1 /*
390
ef8c0e834a14 Convert all ISO8859-1 sequences to proper UTF-8.
diego
parents: 389
diff changeset
2 * Copyright (C) 2000, 2001 HÃ¥kan Hjort
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
3 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
4 * 2002-2004 the dvdnav project
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
5 *
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
6 * This file is part of libdvdnav, a DVD navigation library. It is modified
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
7 * from a file originally part of the Ogle DVD player.
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
8 *
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
9 * libdvdnav is free software; you can redistribute it and/or modify
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
12 * (at your option) any later version.
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
13 *
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
14 * libdvdnav is distributed in the hope that it will be useful,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
17 * GNU General Public License for more details.
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
18 *
389
d3c273ced49c Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents: 388
diff changeset
19 * You should have received a copy of the GNU General Public License along
d3c273ced49c Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents: 388
diff changeset
20 * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
d3c273ced49c Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents: 388
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
22 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
23
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
25 #include "config.h"
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
26 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
27
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
28 #include <stdio.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
29 #include <string.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
30 #include <stdlib.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
31 #include <unistd.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
32 #include <inttypes.h>
294
2146ff691bcd include limits.h; it was included in the previous dvdnav_internal.h and without it players segfault
nicodvb
parents: 290
diff changeset
33 #include <limits.h>
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
34 #include <assert.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
35 #include <sys/types.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
36 #include <sys/stat.h>
290
54b6a000f6da decoder.h needs inclusion of sys/time.h
nicodvb
parents: 285
diff changeset
37 #include <sys/time.h>
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
38 #include <fcntl.h>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
39
386
579a3538d284 Sync with current libdvdread header location.
rathann
parents: 378
diff changeset
40 #include <dvdread/nav_types.h>
579a3538d284 Sync with current libdvdread header location.
rathann
parents: 378
diff changeset
41 #include <dvdread/ifo_types.h>
579a3538d284 Sync with current libdvdread header location.
rathann
parents: 378
diff changeset
42 #include <dvdread/ifo_read.h>
395
9c5aef10d165 Move dvd_types.h, dvdnav_events.h and dvdnav.h into a dvdnav directory.
reimar
parents: 394
diff changeset
43 #include "dvdnav/dvdnav.h"
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
44
285
52877d182e96 moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents: 260
diff changeset
45 #include "decoder.h"
52877d182e96 moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents: 260
diff changeset
46 #include "remap.h"
52877d182e96 moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents: 260
diff changeset
47 #include "vm.h"
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
48 #include "dvdnav_internal.h"
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
49
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
50 #ifdef _MSC_VER
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
51 #include <io.h> /* read() */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
52 #endif /* _MSC_VER */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
53
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
54 #ifdef __OS2__
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
55 #define INCL_DOS
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
56 #include <os2.h>
399
61edd6fa781b OS/2 portability fix
erik
parents: 397
diff changeset
57 #include <io.h> /* setmode() */
61edd6fa781b OS/2 portability fix
erik
parents: 397
diff changeset
58 #include <fcntl.h> /* O_BINARY */
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
59 #endif
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
60
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
61 /*
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
62 #define STRICT
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
63 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
64
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
65 /* Local prototypes */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
66
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
67 /* get_XYZ returns a value.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
68 * set_XYZ sets state using passed parameters.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
69 * returns success/failure.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
70 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
71
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
72 /* Play */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
73 static link_t play_PGC(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
74 static link_t play_PGC_PG(vm_t *vm, int pgN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
75 static link_t play_PGC_post(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
76 static link_t play_PG(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
77 static link_t play_Cell(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
78 static link_t play_Cell_post(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
79
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
80 /* Process link - returns 1 if a hop has been performed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
81 static int process_command(vm_t *vm,link_t link_values);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
82
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
83 /* Set */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
84 static int set_TT(vm_t *vm, int tt);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
85 static int set_PTT(vm_t *vm, int tt, int ptt);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
86 static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
87 static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part);
409
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
88 static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
89 static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
90 static int set_FP_PGC(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
91 static int set_MENU(vm_t *vm, int menu);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
92 static int set_PGCN(vm_t *vm, int pgcN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
93 static int set_PGN(vm_t *vm); /* Set PGN based on (vm->state).CellN */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
94 static void set_RSMinfo(vm_t *vm, int cellN, int blockN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
95
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
96 /* Get */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
97 static int get_TT(vm_t *vm, int vtsN, int vts_ttn);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
98 static int get_ID(vm_t *vm, int id);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
99 static int get_PGCN(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
100
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
101 static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
102 static pgcit_t* get_PGCIT(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
103
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
104
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
105 /* Helper functions */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
106
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
107 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
108 static void vm_print_current_domain_state(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
109 switch((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
110 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
111 fprintf(MSG_OUT, "libdvdnav: Video Title Domain: -\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
112 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
113
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
114 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
115 fprintf(MSG_OUT, "libdvdnav: Video Title Menu Domain: -\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
116 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
117
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
118 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
119 fprintf(MSG_OUT, "libdvdnav: Video Manager Menu Domain: -\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
120 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
121
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
122 case FP_DOMAIN:
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
123 fprintf(MSG_OUT, "libdvdnav: First Play Domain: -\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
124 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
125
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
126 default:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
127 fprintf(MSG_OUT, "libdvdnav: Unknown Domain: -\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
128 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
129 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
130 fprintf(MSG_OUT, "libdvdnav: VTS:%d PGC:%d PG:%u CELL:%u BLOCK:%u VTS_TTN:%u TTN:%u TT_PGCN:%u\n",
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
131 (vm->state).vtsN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
132 get_PGCN(vm),
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
133 (vm->state).pgN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
134 (vm->state).cellN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
135 (vm->state).blockN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
136 (vm->state).VTS_TTN_REG,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
137 (vm->state).TTN_REG,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
138 (vm->state).TT_PGCN_REG);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
139 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
140 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
141
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
142 #ifdef __OS2__
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
143 #define open os2_open
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
144
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
145 static int os2_open(const char *name, int oflag)
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
146 {
400
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
147 HFILE hfile;
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
148 ULONG ulAction;
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
149 ULONG rc;
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
150
400
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
151 rc = DosOpenL(name, &hfile, &ulAction, 0, FILE_NORMAL,
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
152 OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
153 OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
154 NULL);
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
155
400
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
156 if(rc)
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
157 return -1;
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
158
400
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
159 setmode(hfile, O_BINARY);
399
61edd6fa781b OS/2 portability fix
erik
parents: 397
diff changeset
160
400
3daa43270d2c Cosmetic change only - os2_open
erik
parents: 399
diff changeset
161 return (int)hfile;
394
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
162 }
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
163 #endif
0ac6f0d242bc OS/2 support by KO Myung-Hun, komh chollian net
diego
parents: 392
diff changeset
164
397
a70f79850e5f implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik
nicodvb
parents: 395
diff changeset
165 static void dvd_read_name(char *name, char *serial, const char *device) {
229
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
166 /* Because we are compiling with _FILE_OFFSET_BITS=64
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
167 * all off_t are 64bit.
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
168 */
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
169 off_t off;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
170 int fd, i;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
171 uint8_t data[DVD_VIDEO_LB_LEN];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
172
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
173 /* Read DVD name */
244
a27c81078c3c removing O_EXCL, since it does not work with DVD images
mroi
parents: 243
diff changeset
174 fd = open(device, O_RDONLY);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
175 if (fd > 0) {
229
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
176 off = lseek( fd, 32 * (off_t) DVD_VIDEO_LB_LEN, SEEK_SET );
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
177 if( off == ( 32 * (off_t) DVD_VIDEO_LB_LEN ) ) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
178 off = read( fd, data, DVD_VIDEO_LB_LEN );
229
8b5edf44e384 Remove all occurances to off64_t and lseek64
jcdutton
parents: 226
diff changeset
179 if (off == ( (off_t) DVD_VIDEO_LB_LEN )) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
180 fprintf(MSG_OUT, "libdvdnav: DVD Title: ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
181 for(i=25; i < 73; i++ ) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
182 if((data[i] == 0)) break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
183 if((data[i] > 32) && (data[i] < 127)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
184 fprintf(MSG_OUT, "%c", data[i]);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
185 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
186 fprintf(MSG_OUT, " ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
187 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
188 }
377
9a9d15ed0599 (char*) typecase to silence gcc; patch by Erik Hovland org
nicodvb
parents: 345
diff changeset
189 strncpy(name, (char*) &data[25], 48);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
190 name[48] = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
191 fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
192 for(i=73; i < 89; i++ ) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
193 if((data[i] == 0)) break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
194 if((data[i] > 32) && (data[i] < 127)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
195 fprintf(MSG_OUT, "%c", data[i]);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
196 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
197 fprintf(MSG_OUT, " ");
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
198 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
199 }
397
a70f79850e5f implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik
nicodvb
parents: 395
diff changeset
200 strncpy(serial, (char*) &data[73], (i-73));
a70f79850e5f implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik
nicodvb
parents: 395
diff changeset
201 serial[14] = 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
202 fprintf(MSG_OUT, "\nlibdvdnav: DVD Title (Alternative): ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
203 for(i=89; i < 128; i++ ) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
204 if((data[i] == 0)) break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
205 if((data[i] > 32) && (data[i] < 127)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
206 fprintf(MSG_OUT, "%c", data[i]);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
207 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
208 fprintf(MSG_OUT, " ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
209 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
210 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
211 fprintf(MSG_OUT, "\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
212 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
213 fprintf(MSG_OUT, "libdvdnav: Can't read name block. Probably not a DVD-ROM device.\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
214 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
215 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
216 fprintf(MSG_OUT, "libdvdnav: Can't seek to block %u\n", 32 );
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
217 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
218 close(fd);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
219 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
220 fprintf(MSG_OUT, "NAME OPEN FAILED\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
221 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
222 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
223
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
224 static int ifoOpenNewVTSI(vm_t *vm, dvd_reader_t *dvd, int vtsN) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
225 if((vm->state).vtsN == vtsN) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
226 return 1; /* We alread have it */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
227 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
228
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
229 if(vm->vtsi != NULL)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
230 ifoClose(vm->vtsi);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
231
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
232 vm->vtsi = ifoOpenVTSI(dvd, vtsN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
233 if(vm->vtsi == NULL) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
234 fprintf(MSG_OUT, "libdvdnav: ifoOpenVTSI failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
235 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
236 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
237 if(!ifoRead_VTS_PTT_SRPT(vm->vtsi)) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
238 fprintf(MSG_OUT, "libdvdnav: ifoRead_VTS_PTT_SRPT failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
239 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
240 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
241 if(!ifoRead_PGCIT(vm->vtsi)) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
242 fprintf(MSG_OUT, "libdvdnav: ifoRead_PGCIT failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
243 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
244 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
245 if(!ifoRead_PGCI_UT(vm->vtsi)) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
246 fprintf(MSG_OUT, "libdvdnav: ifoRead_PGCI_UT failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
247 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
248 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
249 if(!ifoRead_VOBU_ADMAP(vm->vtsi)) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
250 fprintf(MSG_OUT, "libdvdnav: ifoRead_VOBU_ADMAP vtsi failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
251 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
252 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
253 if(!ifoRead_TITLE_VOBU_ADMAP(vm->vtsi)) {
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
254 fprintf(MSG_OUT, "libdvdnav: ifoRead_TITLE_VOBU_ADMAP vtsi failed\n");
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
255 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
256 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
257 (vm->state).vtsN = vtsN;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
258
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
259 return 1;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
260 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
261
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
262
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
263 /* Initialisation & Destruction */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
264
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
265 vm_t* vm_new_vm() {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
266 return (vm_t*)calloc(sizeof(vm_t), sizeof(char));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
267 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
268
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
269 void vm_free_vm(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
270 vm_stop(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
271 free(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
272 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
273
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
274
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
275 /* IFO Access */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
276
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
277 ifo_handle_t *vm_get_vmgi(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
278 return vm->vmgi;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
279 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
280
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
281 ifo_handle_t *vm_get_vtsi(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
282 return vm->vtsi;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
283 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
284
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
285
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
286 /* Reader Access */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
287
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
288 dvd_reader_t *vm_get_dvd_reader(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
289 return vm->dvd;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
290 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
291
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
292
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
293 /* Basic Handling */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
294
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
295 int vm_start(vm_t *vm) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
296 /* Set pgc to FP (First Play) pgc */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
297 set_FP_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
298 process_command(vm, play_PGC(vm));
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
299 return !vm->stopped;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
300 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
301
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
302 void vm_stop(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
303 if(vm->vmgi) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
304 ifoClose(vm->vmgi);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
305 vm->vmgi=NULL;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
306 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
307 if(vm->vtsi) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
308 ifoClose(vm->vtsi);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
309 vm->vtsi=NULL;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
310 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
311 if(vm->dvd) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
312 DVDClose(vm->dvd);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
313 vm->dvd=NULL;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
314 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
315 vm->stopped = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
316 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
317
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
318 int vm_reset(vm_t *vm, const char *dvdroot) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
319 /* Setup State */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
320 memset((vm->state).registers.SPRM, 0, sizeof((vm->state).registers.SPRM));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
321 memset((vm->state).registers.GPRM, 0, sizeof((vm->state).registers.GPRM));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
322 memset((vm->state).registers.GPRM_mode, 0, sizeof((vm->state).registers.GPRM_mode));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
323 memset((vm->state).registers.GPRM_mode, 0, sizeof((vm->state).registers.GPRM_mode));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
324 memset((vm->state).registers.GPRM_time, 0, sizeof((vm->state).registers.GPRM_time));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
325 (vm->state).registers.SPRM[0] = ('e'<<8)|'n'; /* Player Menu Languange code */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
326 (vm->state).AST_REG = 15; /* 15 why? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
327 (vm->state).SPST_REG = 62; /* 62 why? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
328 (vm->state).AGL_REG = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
329 (vm->state).TTN_REG = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
330 (vm->state).VTS_TTN_REG = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
331 /* (vm->state).TT_PGCN_REG = 0 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
332 (vm->state).PTTN_REG = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
333 (vm->state).HL_BTNN_REG = 1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
334 (vm->state).PTL_REG = 15; /* Parental Level */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
335 (vm->state).registers.SPRM[12] = ('U'<<8)|'S'; /* Parental Management Country Code */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
336 (vm->state).registers.SPRM[16] = ('e'<<8)|'n'; /* Initial Language Code for Audio */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
337 (vm->state).registers.SPRM[18] = ('e'<<8)|'n'; /* Initial Language Code for Spu */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
338 (vm->state).registers.SPRM[20] = 0x1; /* Player Regional Code Mask. Region free! */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
339 (vm->state).registers.SPRM[14] = 0x100; /* Try Pan&Scan */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
340
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
341 (vm->state).pgN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
342 (vm->state).cellN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
343 (vm->state).cell_restart = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
344
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
345 (vm->state).domain = FP_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
346 (vm->state).rsm_vtsN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
347 (vm->state).rsm_cellN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
348 (vm->state).rsm_blockN = 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
349
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
350 (vm->state).vtsN = -1;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
351
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
352 if (vm->dvd && dvdroot) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
353 /* a new dvd device has been requested */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
354 vm_stop(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
355 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
356 if (!vm->dvd) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
357 vm->dvd = DVDOpen(dvdroot);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
358 if(!vm->dvd) {
260
97ad00b13609 fixing typos noticed by Jeff Smith
mroi
parents: 256
diff changeset
359 fprintf(MSG_OUT, "libdvdnav: vm: failed to open/read the DVD\n");
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
360 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
361 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
362 vm->vmgi = ifoOpenVMGI(vm->dvd);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
363 if(!vm->vmgi) {
260
97ad00b13609 fixing typos noticed by Jeff Smith
mroi
parents: 256
diff changeset
364 fprintf(MSG_OUT, "libdvdnav: vm: failed to read VIDEO_TS.IFO\n");
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
365 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
366 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
367 if(!ifoRead_FP_PGC(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
368 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_FP_PGC failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
369 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
370 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
371 if(!ifoRead_TT_SRPT(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
372 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_TT_SRPT failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
373 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
374 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
375 if(!ifoRead_PGCI_UT(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
376 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_PGCI_UT failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
377 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
378 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
379 if(!ifoRead_PTL_MAIT(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
380 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_PTL_MAIT failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
381 /* return 0; Not really used for now.. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
382 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
383 if(!ifoRead_VTS_ATRT(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
384 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_VTS_ATRT failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
385 /* return 0; Not really used for now.. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
386 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
387 if(!ifoRead_VOBU_ADMAP(vm->vmgi)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
388 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_VOBU_ADMAP vgmi failed\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
389 /* return 0; Not really used for now.. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
390 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
391 /* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
404
d16ee5945580 Prevent display of garbage volume label when the file being scanned is
nicodvb
parents: 403
diff changeset
392 dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
d16ee5945580 Prevent display of garbage volume label when the file being scanned is
nicodvb
parents: 403
diff changeset
393 vm->map = remap_loadmap(vm->dvd_name);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
394 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
395 if (vm->vmgi) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
396 int i, mask;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
397 fprintf(MSG_OUT, "libdvdnav: DVD disk reports itself with Region mask 0x%08x. Regions:",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
398 vm->vmgi->vmgi_mat->vmg_category);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
399 for (i = 1, mask = 1; i <= 8; i++, mask <<= 1)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
400 if (((vm->vmgi->vmgi_mat->vmg_category >> 16) & mask) == 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
401 fprintf(MSG_OUT, " %d", i);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
402 fprintf(MSG_OUT, "\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
403 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
404 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
405 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
406
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
407
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
408 /* copying and merging */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
409
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
410 vm_t *vm_new_copy(vm_t *source) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
411 vm_t *target = vm_new_vm();
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
412 int vtsN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
413 int pgcN = get_PGCN(source);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
414 int pgN = (source->state).pgN;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
415
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
416 assert(pgcN);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
417
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
418 memcpy(target, source, sizeof(vm_t));
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
419
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
420 /* open a new vtsi handle, because the copy might switch to another VTS */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
421 target->vtsi = NULL;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
422 vtsN = (target->state).vtsN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
423 if (vtsN > 0) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
424 (target->state).vtsN = 0;
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
425 if (!ifoOpenNewVTSI(target, target->dvd, vtsN))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
426 assert(0);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
427
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
428 /* restore pgc pointer into the new vtsi */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
429 if (!set_PGCN(target, pgcN))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
430 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
431 (target->state).pgN = pgN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
432 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
433
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
434 return target;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
435 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
436
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
437 void vm_merge(vm_t *target, vm_t *source) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
438 if(target->vtsi)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
439 ifoClose(target->vtsi);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
440 memcpy(target, source, sizeof(vm_t));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
441 memset(source, 0, sizeof(vm_t));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
442 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
443
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
444 void vm_free_copy(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
445 if(vm->vtsi)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
446 ifoClose(vm->vtsi);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
447 free(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
448 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
449
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
450
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
451 /* regular playback */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
452
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
453 void vm_position_get(vm_t *vm, vm_position_t *position) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
454 position->button = (vm->state).HL_BTNN_REG >> 10;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
455 position->vts = (vm->state).vtsN;
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
456 position->domain = (vm->state).domain;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
457 position->spu_channel = (vm->state).SPST_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
458 position->audio_channel = (vm->state).AST_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
459 position->angle_channel = (vm->state).AGL_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
460 position->hop_channel = vm->hop_channel; /* Increases by one on each hop */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
461 position->cell = (vm->state).cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
462 position->cell_restart = (vm->state).cell_restart;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
463 position->cell_start = (vm->state).pgc->cell_playback[(vm->state).cellN - 1].first_sector;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
464 position->still = (vm->state).pgc->cell_playback[(vm->state).cellN - 1].still_time;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
465 position->block = (vm->state).blockN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
466
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
467 /* handle PGC stills at PGC end */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
468 if ((vm->state).cellN == (vm->state).pgc->nr_of_cells)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
469 position->still += (vm->state).pgc->still_time;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
470 /* still already determined */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
471 if (position->still)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
472 return;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
473 /* This is a rough fix for some strange still situations on some strange DVDs.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
474 * There are discs (like the German "Back to the Future" RC2) where the only
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
475 * indication of a still is a cell playback time higher than the time the frames
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
476 * in this cell actually take to play (like 1 frame with 1 minute playback time).
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
477 * On the said BTTF disc, for these cells last_sector and last_vobu_start_sector
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
478 * are equal and the cells are very short, so we abuse these conditions to
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
479 * detect such discs. I consider these discs broken, so the fix is somewhat
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
480 * broken, too. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
481 if (((vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_sector ==
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
482 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_vobu_start_sector) &&
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
483 ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_sector -
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
484 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].first_sector < 1024)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
485 int time;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
486 int size = (vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_sector -
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
487 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].first_sector;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
488 time = ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.hour >> 4 ) * 36000;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
489 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.hour & 0x0f) * 3600;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
490 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.minute >> 4 ) * 600;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
491 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.minute & 0x0f) * 60;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
492 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.second >> 4 ) * 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
493 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.second & 0x0f) * 1;
246
0ba179301f71 division by zero fix reported by david huber
mroi
parents: 244
diff changeset
494 if (!time || size / time > 30)
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
495 /* datarate is too high, it might be a very short, but regular cell */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
496 return;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
497 if (time > 0xff) time = 0xff;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
498 position->still = time;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
499 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
500 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
501
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
502 void vm_get_next_cell(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
503 process_command(vm, play_Cell_post(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
504 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
505
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
506
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
507 /* Jumping */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
508
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
509 int vm_jump_pg(vm_t *vm, int pg) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
510 (vm->state).pgN = pg;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
511 process_command(vm, play_PG(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
512 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
513 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
514
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
515 int vm_jump_cell_block(vm_t *vm, int cell, int block) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
516 (vm->state).cellN = cell;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
517 process_command(vm, play_Cell(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
518 /* play_Cell can jump to a different cell in case of angles */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
519 if ((vm->state).cellN == cell)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
520 (vm->state).blockN = block;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
521 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
522 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
523
409
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
524 int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn) {
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
525 link_t link;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
526
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
527 if(!set_PROG(vm, title, pgcn, pgn))
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
528 return 0;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
529 /* Some DVDs do not want us to jump directly into a title and have
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
530 * PGC pre commands taking us back to some menu. Since we do not like that,
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
531 * we do not execute PGC pre commands that would do a jump. */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
532 /* process_command(vm, play_PGC_PG(vm, (vm->state).pgN)); */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
533 link = play_PGC_PG(vm, (vm->state).pgN);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
534 if (link.command != PlayThis)
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
535 /* jump occured -> ignore it and play the PG anyway */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
536 process_command(vm, play_PG(vm));
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
537 else
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
538 process_command(vm, link);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
539 return 1;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
540 }
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
541
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
542 int vm_jump_title_part(vm_t *vm, int title, int part) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
543 link_t link;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
544
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
545 if(!set_PTT(vm, title, part))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
546 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
547 /* Some DVDs do not want us to jump directly into a title and have
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
548 * PGC pre commands taking us back to some menu. Since we do not like that,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
549 * we do not execute PGC pre commands that would do a jump. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
550 /* process_command(vm, play_PGC_PG(vm, (vm->state).pgN)); */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
551 link = play_PGC_PG(vm, (vm->state).pgN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
552 if (link.command != PlayThis)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
553 /* jump occured -> ignore it and play the PG anyway */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
554 process_command(vm, play_PG(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
555 else
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
556 process_command(vm, link);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
557 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
558 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
559
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
560 int vm_jump_top_pg(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
561 process_command(vm, play_PG(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
562 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
563 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
564
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
565 int vm_jump_next_pg(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
566 if((vm->state).pgN >= (vm->state).pgc->nr_of_programs) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
567 /* last program -> move to TailPGC */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
568 process_command(vm, play_PGC_post(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
569 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
570 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
571 vm_jump_pg(vm, (vm->state).pgN + 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
572 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
573 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
574 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
575
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
576 int vm_jump_prev_pg(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
577 if ((vm->state).pgN <= 1) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
578 /* first program -> move to last program of previous PGC */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
579 if ((vm->state).pgc->prev_pgc_nr && set_PGCN(vm, (vm->state).pgc->prev_pgc_nr)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
580 process_command(vm, play_PGC(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
581 vm_jump_pg(vm, (vm->state).pgc->nr_of_programs);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
582 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
583 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
584 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
585 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
586 vm_jump_pg(vm, (vm->state).pgN - 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
587 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
588 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
589 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
590
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
591 int vm_jump_up(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
592 if((vm->state).pgc->goup_pgc_nr && set_PGCN(vm, (vm->state).pgc->goup_pgc_nr)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
593 process_command(vm, play_PGC(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
594 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
595 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
596 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
597 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
598
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
599 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
600 domain_t old_domain = (vm->state).domain;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
601
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
602 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
603 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
604 set_RSMinfo(vm, 0, (vm->state).blockN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
605 /* FALL THROUGH */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
606 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
607 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
608 switch(menuid) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
609 case DVD_MENU_Title:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
610 case DVD_MENU_Escape:
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
611 if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
612 return 0;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
613 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
614 (vm->state).domain = VMGM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
615 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
616 case DVD_MENU_Root:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
617 case DVD_MENU_Subpicture:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
618 case DVD_MENU_Audio:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
619 case DVD_MENU_Angle:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
620 case DVD_MENU_Part:
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
621 if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
622 return 0;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
623 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
624 (vm->state).domain = VTSM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
625 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
626 }
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
627 if(get_PGCIT(vm) && set_MENU(vm, menuid)) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
628 process_command(vm, play_PGC(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
629 return 1; /* Jump */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
630 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
631 (vm->state).domain = old_domain;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
632 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
633 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
634 case FP_DOMAIN: /* FIXME XXX $$$ What should we do here? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
635 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
636 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
637
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
638 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
639 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
640
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
641 int vm_jump_resume(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
642 link_t link_values = { LinkRSM, 0, 0, 0 };
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
643
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
644 if (!(vm->state).rsm_vtsN) /* Do we have resume info? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
645 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
646 if (!process_command(vm, link_values))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
647 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
648 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
649 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
650
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
651 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
652 link_t link_values;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
653
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
654 if(vmEval_CMD(cmd, 1, &(vm->state).registers, &link_values))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
655 return process_command(vm, link_values);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
656 else
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
657 return 0; /* It updated some state thats all... */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
658 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
659
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
660
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
661 /* getting information */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
662
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
663 int vm_get_current_menu(vm_t *vm, int *menuid) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
664 pgcit_t* pgcit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
665 int pgcn;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
666 pgcn = (vm->state).pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
667 pgcit = get_PGCIT(vm);
345
f051b111ef50 10l to me: in vm_get_current_menu() I forgot to attach
nicodvb
parents: 344
diff changeset
668 if(pgcit==NULL) return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
669 *menuid = pgcit->pgci_srp[pgcn - 1].entry_id & 0xf ;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
670 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
671 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
672
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
673 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
674 vts_ptt_srpt_t *vts_ptt_srpt;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
675 int title, part = 0, vts_ttn;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
676 int found;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
677 int16_t pgcN, pgN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
678
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
679 vts_ptt_srpt = vm->vtsi->vts_ptt_srpt;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
680 pgcN = get_PGCN(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
681 pgN = vm->state.pgN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
682
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
683 found = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
684 for (vts_ttn = 0; (vts_ttn < vts_ptt_srpt->nr_of_srpts) && !found; vts_ttn++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
685 for (part = 0; (part < vts_ptt_srpt->title[vts_ttn].nr_of_ptts) && !found; part++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
686 if (vts_ptt_srpt->title[vts_ttn].ptt[part].pgcn == pgcN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
687 if (vts_ptt_srpt->title[vts_ttn].ptt[part].pgn == pgN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
688 found = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
689 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
690 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
691 if (part > 0 && vts_ptt_srpt->title[vts_ttn].ptt[part].pgn > pgN &&
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
692 vts_ptt_srpt->title[vts_ttn].ptt[part - 1].pgn < pgN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
693 part--;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
694 found = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
695 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
696 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
697 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
698 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
699 if (found) break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
700 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
701 vts_ttn++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
702 part++;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
703
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
704 if (!found) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
705 fprintf(MSG_OUT, "libdvdnav: chapter NOT FOUND!\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
706 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
707 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
708
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
709 title = get_TT(vm, vm->state.vtsN, vts_ttn);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
710
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
711 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
712 if (title) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
713 fprintf(MSG_OUT, "libdvdnav: ************ this chapter FOUND!\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
714 fprintf(MSG_OUT, "libdvdnav: VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
715 title, part,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
716 vts_ptt_srpt->title[vts_ttn-1].ptt[part-1].pgcn ,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
717 vts_ptt_srpt->title[vts_ttn-1].ptt[part-1].pgn );
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
718 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
719 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
720 *title_result = title;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
721 *part_result = part;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
722 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
723 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
724
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
725 /* Return the substream id for 'logical' audio stream audioN.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
726 * 0 <= audioN < 8
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
727 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
728 int vm_get_audio_stream(vm_t *vm, int audioN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
729 int streamN = -1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
730
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
731 if((vm->state).domain != VTS_DOMAIN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
732 audioN = 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
733
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
734 if(audioN < 8) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
735 /* Is there any control info for this logical stream */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
736 if((vm->state).pgc->audio_control[audioN] & (1<<15)) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
737 streamN = ((vm->state).pgc->audio_control[audioN] >> 8) & 0x07;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
738 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
739 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
740
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
741 if((vm->state).domain != VTS_DOMAIN && streamN == -1)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
742 streamN = 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
743
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
744 /* FIXME: Should also check in vtsi/vmgi status what kind of stream
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
745 * it is (ac3/lpcm/dts/sdds...) to find the right (sub)stream id */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
746 return streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
747 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
748
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
749 /* Return the substream id for 'logical' subpicture stream subpN and given mode.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
750 * 0 <= subpN < 32
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
751 * mode == 0 - widescreen
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
752 * mode == 1 - letterbox
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
753 * mode == 2 - pan&scan
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
754 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
755 int vm_get_subp_stream(vm_t *vm, int subpN, int mode) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
756 int streamN = -1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
757 int source_aspect = vm_get_video_aspect(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
758
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
759 if((vm->state).domain != VTS_DOMAIN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
760 subpN = 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
761
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
762 if(subpN < 32) { /* a valid logical stream */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
763 /* Is this logical stream present */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
764 if((vm->state).pgc->subp_control[subpN] & (1<<31)) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
765 if(source_aspect == 0) /* 4:3 */
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
766 streamN = ((vm->state).pgc->subp_control[subpN] >> 24) & 0x1f;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
767 if(source_aspect == 3) /* 16:9 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
768 switch (mode) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
769 case 0:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
770 streamN = ((vm->state).pgc->subp_control[subpN] >> 16) & 0x1f;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
771 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
772 case 1:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
773 streamN = ((vm->state).pgc->subp_control[subpN] >> 8) & 0x1f;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
774 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
775 case 2:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
776 streamN = (vm->state).pgc->subp_control[subpN] & 0x1f;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
777 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
778 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
779 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
780
247
84f652524ecb small indentation fix
mroi
parents: 246
diff changeset
781 if((vm->state).domain != VTS_DOMAIN && streamN == -1)
84f652524ecb small indentation fix
mroi
parents: 246
diff changeset
782 streamN = 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
783
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
784 /* FIXME: Should also check in vtsi/vmgi status what kind of stream it is. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
785 return streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
786 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
787
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
788 int vm_get_audio_active_stream(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
789 int audioN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
790 int streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
791 audioN = (vm->state).AST_REG ;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
792 streamN = vm_get_audio_stream(vm, audioN);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
793
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
794 /* If no such stream, then select the first one that exists. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
795 if(streamN == -1) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
796 for(audioN = 0; audioN < 8; audioN++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
797 if((vm->state).pgc->audio_control[audioN] & (1<<15)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
798 if ((streamN = vm_get_audio_stream(vm, audioN)) >= 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
799 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
800 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
801 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
802 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
803
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
804 return streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
805 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
806
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
807 int vm_get_subp_active_stream(vm_t *vm, int mode) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
808 int subpN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
809 int streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
810 subpN = (vm->state).SPST_REG & ~0x40;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
811 streamN = vm_get_subp_stream(vm, subpN, mode);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
812
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
813 /* If no such stream, then select the first one that exists. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
814 if(streamN == -1) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
815 for(subpN = 0; subpN < 32; subpN++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
816 if((vm->state).pgc->subp_control[subpN] & (1<<31)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
817 if ((streamN = vm_get_subp_stream(vm, subpN, mode)) >= 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
818 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
819 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
820 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
821 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
822
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
823 if((vm->state).domain == VTS_DOMAIN && !((vm->state).SPST_REG & 0x40))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
824 /* Bit 7 set means hide, and only let Forced display show */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
825 return (streamN | 0x80);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
826 else
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
827 return streamN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
828 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
829
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
830 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
831 *num_avail = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
832 *current = 1;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
833
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
834 if((vm->state).domain == VTS_DOMAIN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
835 title_info_t *title;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
836 /* TTN_REG does not allways point to the correct title.. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
837 if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
838 return;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
839 title = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1];
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
840 if(title->title_set_nr != (vm->state).vtsN ||
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
841 title->vts_ttn != (vm->state).VTS_TTN_REG)
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
842 return;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
843 *num_avail = title->nr_of_angles;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
844 *current = (vm->state).AGL_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
845 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
846 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
847
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
848 #if 0
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
849 /* currently unused */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
850 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
851 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
852 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
853 *num_avail = vm->vtsi->vtsi_mat->nr_of_vts_audio_streams;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
854 *current = (vm->state).AST_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
855 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
856 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
857 *num_avail = vm->vtsi->vtsi_mat->nr_of_vtsm_audio_streams; /* 1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
858 *current = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
859 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
860 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
861 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
862 *num_avail = vm->vmgi->vmgi_mat->nr_of_vmgm_audio_streams; /* 1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
863 *current = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
864 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
865 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
866 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
867
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
868 /* currently unused */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
869 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
870 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
871 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
872 *num_avail = vm->vtsi->vtsi_mat->nr_of_vts_subp_streams;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
873 *current = (vm->state).SPST_REG;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
874 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
875 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
876 *num_avail = vm->vtsi->vtsi_mat->nr_of_vtsm_subp_streams; /* 1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
877 *current = 0x41;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
878 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
879 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
880 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
881 *num_avail = vm->vmgi->vmgi_mat->nr_of_vmgm_subp_streams; /* 1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
882 *current = 0x41;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
883 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
884 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
885 }
401
390fbf2a9602 Provide a way to retrieve video resolution.
rathann
parents: 400
diff changeset
886 #endif
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
887
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
888 void vm_get_video_res(vm_t *vm, int *width, int *height) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
889 video_attr_t attr = vm_get_video_attr(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
890
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
891 if(attr.video_format != 0)
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
892 *height = 576;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
893 else
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
894 *height = 480;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
895 switch(attr.picture_size) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
896 case 0:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
897 *width = 720;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
898 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
899 case 1:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
900 *width = 704;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
901 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
902 case 2:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
903 *width = 352;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
904 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
905 case 3:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
906 *width = 352;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
907 *height /= 2;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
908 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
909 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
910 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
911
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
912 int vm_get_video_aspect(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
913 int aspect = vm_get_video_attr(vm).display_aspect_ratio;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
914
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
915 assert(aspect == 0 || aspect == 3);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
916 (vm->state).registers.SPRM[14] &= ~(0x3 << 10);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
917 (vm->state).registers.SPRM[14] |= aspect << 10;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
918
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
919 return aspect;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
920 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
921
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
922 int vm_get_video_scale_permission(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
923 return vm_get_video_attr(vm).permitted_df;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
924 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
925
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
926 video_attr_t vm_get_video_attr(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
927 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
928 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
929 return vm->vtsi->vtsi_mat->vts_video_attr;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
930 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
931 return vm->vtsi->vtsi_mat->vtsm_video_attr;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
932 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
933 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
934 return vm->vmgi->vmgi_mat->vmgm_video_attr;
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
935 default:
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
936 abort();
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
937 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
938 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
939
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
940 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
941 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
942 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
943 return vm->vtsi->vtsi_mat->vts_audio_attr[streamN];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
944 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
945 return vm->vtsi->vtsi_mat->vtsm_audio_attr;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
946 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
947 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
948 return vm->vmgi->vmgi_mat->vmgm_audio_attr;
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
949 default:
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
950 abort();
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
951 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
952 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
953
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
954 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
955 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
956 case VTS_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
957 return vm->vtsi->vtsi_mat->vts_subp_attr[streamN];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
958 case VTSM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
959 return vm->vtsi->vtsi_mat->vtsm_subp_attr;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
960 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
961 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
962 return vm->vmgi->vmgi_mat->vmgm_subp_attr;
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
963 default:
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
964 abort();
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
965 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
966 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
967
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
968
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
969 /* Playback control */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
970
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
971 static link_t play_PGC(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
972 link_t link_values;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
973
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
974 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
975 fprintf(MSG_OUT, "libdvdnav: play_PGC:");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
976 if((vm->state).domain != FP_DOMAIN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
977 fprintf(MSG_OUT, " (vm->state).pgcN (%i)\n", get_PGCN(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
978 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
979 fprintf(MSG_OUT, " first_play_pgc\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
980 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
981 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
982
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
983 /* This must be set before the pre-commands are executed because they
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
984 * might contain a CallSS that will save resume state */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
985
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
986 /* FIXME: This may be only a temporary fix for something... */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
987 (vm->state).pgN = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
988 (vm->state).cellN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
989 (vm->state).blockN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
990
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
991 /* eval -> updates the state and returns either
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
992 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
993 - just play video i.e first PG
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
994 (This is what happens if you fall of the end of the pre_cmds)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
995 - or an error (are there more cases?) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
996 if((vm->state).pgc->command_tbl && (vm->state).pgc->command_tbl->nr_of_pre) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
997 if(vmEval_CMD((vm->state).pgc->command_tbl->pre_cmds,
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
998 (vm->state).pgc->command_tbl->nr_of_pre,
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
999 &(vm->state).registers, &link_values)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1000 /* link_values contains the 'jump' return value */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1001 return link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1002 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1003 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1004 fprintf(MSG_OUT, "libdvdnav: PGC pre commands didn't do a Jump, Link or Call\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1005 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1006 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1007 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1008 return play_PG(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1009 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1010
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1011 static link_t play_PGC_PG(vm_t *vm, int pgN) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1012 link_t link_values;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1013
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1014 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1015 fprintf(MSG_OUT, "libdvdnav: play_PGC_PG:");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1016 if((vm->state).domain != FP_DOMAIN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1017 fprintf(MSG_OUT, " (vm->state).pgcN (%i)\n", get_PGCN(vm));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1018 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1019 fprintf(MSG_OUT, " first_play_pgc\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1020 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1021 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1022
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1023 /* This must be set before the pre-commands are executed because they
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1024 * might contain a CallSS that will save resume state */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1025
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1026 /* FIXME: This may be only a temporary fix for something... */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1027 (vm->state).pgN = pgN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1028 (vm->state).cellN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1029 (vm->state).blockN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1030
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1031 /* eval -> updates the state and returns either
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1032 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1033 - just play video i.e first PG
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1034 (This is what happens if you fall of the end of the pre_cmds)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1035 - or an error (are there more cases?) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1036 if((vm->state).pgc->command_tbl && (vm->state).pgc->command_tbl->nr_of_pre) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1037 if(vmEval_CMD((vm->state).pgc->command_tbl->pre_cmds,
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1038 (vm->state).pgc->command_tbl->nr_of_pre,
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1039 &(vm->state).registers, &link_values)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1040 /* link_values contains the 'jump' return value */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1041 return link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1042 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1043 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1044 fprintf(MSG_OUT, "libdvdnav: PGC pre commands didn't do a Jump, Link or Call\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1045 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1046 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1047 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1048 return play_PG(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1049 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1050
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1051 static link_t play_PGC_post(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1052 link_t link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1053
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1054 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1055 fprintf(MSG_OUT, "libdvdnav: play_PGC_post:\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1056 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1057
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1058 /* eval -> updates the state and returns either
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1059 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1060 - just go to next PGC
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1061 (This is what happens if you fall of the end of the post_cmds)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1062 - or an error (are there more cases?) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1063 if((vm->state).pgc->command_tbl && (vm->state).pgc->command_tbl->nr_of_post &&
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1064 vmEval_CMD((vm->state).pgc->command_tbl->post_cmds,
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1065 (vm->state).pgc->command_tbl->nr_of_post,
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1066 &(vm->state).registers, &link_values)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1067 return link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1068 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1069
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1070 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1071 fprintf(MSG_OUT, "libdvdnav: ** Fell of the end of the pgc, continuing in NextPGC\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1072 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1073 /* Should end up in the STOP_DOMAIN if next_pgc is 0. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1074 if(!set_PGCN(vm, (vm->state).pgc->next_pgc_nr)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1075 link_values.command = Exit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1076 return link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1077 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1078 return play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1079 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1080
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1081 static link_t play_PG(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1082 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1083 fprintf(MSG_OUT, "libdvdnav: play_PG: (vm->state).pgN (%i)\n", (vm->state).pgN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1084 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1085
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1086 assert((vm->state).pgN > 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1087 if((vm->state).pgN > (vm->state).pgc->nr_of_programs) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1088 #ifdef TRACE
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1089 fprintf(MSG_OUT, "libdvdnav: play_PG: (vm->state).pgN (%i) > pgc->nr_of_programs (%i)\n",
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1090 (vm->state).pgN, (vm->state).pgc->nr_of_programs );
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1091 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1092 assert((vm->state).pgN == (vm->state).pgc->nr_of_programs + 1);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1093 return play_PGC_post(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1094 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1095
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1096 (vm->state).cellN = (vm->state).pgc->program_map[(vm->state).pgN - 1];
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1097
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1098 return play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1099 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1100
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1101 static link_t play_Cell(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1102 static const link_t play_this = {PlayThis, /* Block in Cell */ 0, 0, 0};
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1103
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1104 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1105 fprintf(MSG_OUT, "libdvdnav: play_Cell: (vm->state).cellN (%i)\n", (vm->state).cellN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1106 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1107
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1108 assert((vm->state).cellN > 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1109 if((vm->state).cellN > (vm->state).pgc->nr_of_cells) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1110 #ifdef TRACE
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1111 fprintf(MSG_OUT, "libdvdnav: (vm->state).cellN (%i) > pgc->nr_of_cells (%i)\n",
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1112 (vm->state).cellN, (vm->state).pgc->nr_of_cells );
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1113 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1114 assert((vm->state).cellN == (vm->state).pgc->nr_of_cells + 1);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1115 return play_PGC_post(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1116 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1117
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1118 /* Multi angle/Interleaved */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1119 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1120 case 0: /* Normal */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1121 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1122 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1123 case 1: /* The first cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1124 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1125 case 0: /* Not part of a block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1126 assert(0);
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
1127 break;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1128 case 1: /* Angle block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1129 /* Loop and check each cell instead? So we don't get outside the block? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1130 (vm->state).cellN += (vm->state).AGL_REG - 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1131 #ifdef STRICT
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1132 assert((vm->state).cellN <= (vm->state).pgc->nr_of_cells);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1133 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1134 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1135 #else
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1136 if (!((vm->state).cellN <= (vm->state).pgc->nr_of_cells) ||
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1137 !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0) ||
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1138 !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1139 fprintf(MSG_OUT, "libdvdnav: Invalid angle block\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1140 (vm->state).cellN -= (vm->state).AGL_REG - 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1141 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1142 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1143 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1144 case 2: /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1145 case 3: /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1146 default:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1147 fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1148 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1149 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1150 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1151 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1152 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1153 case 2: /* Cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1154 case 3: /* Last cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1155 /* These might perhaps happen for RSM or LinkC commands? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1156 default:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1157 fprintf(MSG_OUT, "libdvdnav: Cell is in block but did not enter at first cell!\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1158 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1159
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1160 /* Updates (vm->state).pgN and PTTN_REG */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1161 if(!set_PGN(vm)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1162 /* Should not happen */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1163 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1164 return play_PGC_post(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1165 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1166 (vm->state).cell_restart++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1167 (vm->state).blockN = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1168 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1169 fprintf(MSG_OUT, "libdvdnav: Cell should restart here\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1170 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1171 return play_this;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1172 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1173
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1174 static link_t play_Cell_post(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1175 cell_playback_t *cell;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1176
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1177 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1178 fprintf(MSG_OUT, "libdvdnav: play_Cell_post: (vm->state).cellN (%i)\n", (vm->state).cellN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1179 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1180
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1181 cell = &(vm->state).pgc->cell_playback[(vm->state).cellN - 1];
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1182
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1183 /* Still time is already taken care of before we get called. */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1184
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1185 /* Deal with a Cell command, if any */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1186 if(cell->cell_cmd_nr != 0) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1187 link_t link_values;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1188
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1189 /* These asserts are now not needed.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1190 * Some DVDs have no cell commands listed in the PGC,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1191 * but the Cell itself points to a cell command that does not exist.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1192 * For this situation, just ignore the cell command and continue.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1193 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1194 * assert((vm->state).pgc->command_tbl != NULL);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1195 * assert((vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1196 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1197
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1198 if ((vm->state).pgc->command_tbl != NULL &&
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1199 (vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1200 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1201 fprintf(MSG_OUT, "libdvdnav: Cell command present, executing\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1202 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1203 if(vmEval_CMD(&(vm->state).pgc->command_tbl->cell_cmds[cell->cell_cmd_nr - 1], 1,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1204 &(vm->state).registers, &link_values)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1205 return link_values;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1206 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1207 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1208 fprintf(MSG_OUT, "libdvdnav: Cell command didn't do a Jump, Link or Call\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1209 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1210 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1211 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1212 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1213 fprintf(MSG_OUT, "libdvdnav: Invalid Cell command\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1214 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1215 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1216 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1217
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1218 /* Where to continue after playing the cell... */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1219 /* Multi angle/Interleaved */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1220 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1221 case 0: /* Normal */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1222 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1223 (vm->state).cellN++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1224 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1225 case 1: /* The first cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1226 case 2: /* A cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1227 case 3: /* The last cell in the block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1228 default:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1229 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1230 case 0: /* Not part of a block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1231 assert(0);
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
1232 break;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1233 case 1: /* Angle block */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1234 /* Skip the 'other' angles */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1235 (vm->state).cellN++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1236 while((vm->state).cellN <= (vm->state).pgc->nr_of_cells &&
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1237 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode >= 2) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1238 (vm->state).cellN++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1239 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1240 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1241 case 2: /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1242 case 3: /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1243 default:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1244 fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1245 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1246 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1247 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1248 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1249 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1250 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1251
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1252 /* Figure out the correct pgN for the new cell */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1253 if(!set_PGN(vm)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1254 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1255 fprintf(MSG_OUT, "libdvdnav: last cell in this PGC\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1256 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1257 return play_PGC_post(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1258 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1259 return play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1260 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1261
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1262
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1263 /* link processing */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1264
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1265 static int process_command(vm_t *vm, link_t link_values) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1266
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1267 while(link_values.command != PlayThis) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1268
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1269 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1270 fprintf(MSG_OUT, "libdvdnav: Before printout starts:\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1271 vm_print_link(link_values);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1272 fprintf(MSG_OUT, "libdvdnav: Link values %i %i %i %i\n", link_values.command,
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1273 link_values.data1, link_values.data2, link_values.data3);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1274 vm_print_current_domain_state(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1275 fprintf(MSG_OUT, "libdvdnav: Before printout ends.\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1276 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1277
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1278 switch(link_values.command) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1279 case LinkNoLink:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1280 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1281 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1282 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1283 return 0; /* no actual jump */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1284
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1285 case LinkTopC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1286 /* Restart playing from the beginning of the current Cell. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1287 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1288 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1289 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1290 link_values = play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1291 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1292 case LinkNextC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1293 /* Link to Next Cell */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1294 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1295 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1296 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1297 (vm->state).cellN += 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1298 link_values = play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1299 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1300 case LinkPrevC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1301 /* Link to Previous Cell */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1302 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1303 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1304 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1305 assert((vm->state).cellN > 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1306 (vm->state).cellN -= 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1307 link_values = play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1308 break;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1309
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1310 case LinkTopPG:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1311 /* Link to Top of current Program */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1312 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1313 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1314 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1315 link_values = play_PG(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1316 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1317 case LinkNextPG:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1318 /* Link to Next Program */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1319 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1320 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1321 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1322 (vm->state).pgN += 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1323 link_values = play_PG(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1324 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1325 case LinkPrevPG:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1326 /* Link to Previous Program */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1327 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1328 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1329 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1330 assert((vm->state).pgN > 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1331 (vm->state).pgN -= 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1332 link_values = play_PG(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1333 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1334
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1335 case LinkTopPGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1336 /* Restart playing from beginning of current Program Chain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1337 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1338 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1339 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1340 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1341 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1342 case LinkNextPGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1343 /* Link to Next Program Chain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1344 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1345 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1346 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1347 assert((vm->state).pgc->next_pgc_nr != 0);
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1348 if(set_PGCN(vm, (vm->state).pgc->next_pgc_nr))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1349 link_values = play_PGC(vm);
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1350 else
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1351 link_values.command = Exit;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1352 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1353 case LinkPrevPGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1354 /* Link to Previous Program Chain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1355 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1356 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1357 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1358 assert((vm->state).pgc->prev_pgc_nr != 0);
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1359 if(set_PGCN(vm, (vm->state).pgc->prev_pgc_nr))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1360 link_values = play_PGC(vm);
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1361 else
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1362 link_values.command = Exit;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1363 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1364 case LinkGoUpPGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1365 /* Link to GoUp Program Chain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1366 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1367 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1368 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1369 assert((vm->state).pgc->goup_pgc_nr != 0);
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1370 if(set_PGCN(vm, (vm->state).pgc->goup_pgc_nr))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1371 link_values = play_PGC(vm);
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1372 else
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1373 link_values.command = Exit;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1374 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1375 case LinkTailPGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1376 /* Link to Tail of Program Chain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1377 /* BUTTON number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1378 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1379 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1380 link_values = play_PGC_post(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1381 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1382
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1383 case LinkRSM:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1384 {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1385 /* Link to Resume point */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1386 int i;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1387
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1388 /* Check and see if there is any rsm info!! */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1389 if (!(vm->state).rsm_vtsN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1390 fprintf(MSG_OUT, "libdvdnav: trying to resume without any resume info set\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1391 link_values.command = Exit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1392 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1393 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1394
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1395 (vm->state).domain = VTS_DOMAIN;
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1396 if (!ifoOpenNewVTSI(vm, vm->dvd, (vm->state).rsm_vtsN))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1397 assert(0);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1398 set_PGCN(vm, (vm->state).rsm_pgcN);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1399
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1400 /* These should never be set in SystemSpace and/or MenuSpace */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1401 /* (vm->state).TTN_REG = rsm_tt; ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1402 /* (vm->state).TT_PGCN_REG = (vm->state).rsm_pgcN; ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1403 for(i = 0; i < 5; i++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1404 (vm->state).registers.SPRM[4 + i] = (vm->state).rsm_regs[i];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1405 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1406
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1407 if(link_values.data1 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1408 (vm->state).HL_BTNN_REG = link_values.data1 << 10;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1409
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1410 if((vm->state).rsm_cellN == 0) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1411 assert((vm->state).cellN); /* Checking if this ever happens */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1412 (vm->state).pgN = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1413 link_values = play_PG(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1414 } else {
252
aee8af592d66 fix a long-standing problem: sometimes, hitting Escape in the movie and then
mroi
parents: 247
diff changeset
1415 /* (vm->state).pgN = ?? this gets the right value in set_PGN() below */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1416 (vm->state).cellN = (vm->state).rsm_cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1417 link_values.command = PlayThis;
252
aee8af592d66 fix a long-standing problem: sometimes, hitting Escape in the movie and then
mroi
parents: 247
diff changeset
1418 link_values.data1 = (vm->state).rsm_blockN & 0xffff;
aee8af592d66 fix a long-standing problem: sometimes, hitting Escape in the movie and then
mroi
parents: 247
diff changeset
1419 link_values.data2 = (vm->state).rsm_blockN >> 16;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1420 if(!set_PGN(vm)) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1421 /* Were at the end of the PGC, should not happen for a RSM */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1422 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1423 link_values.command = LinkTailPGC;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1424 link_values.data1 = 0; /* No button */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1425 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1426 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1427 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1428 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1429 case LinkPGCN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1430 /* Link to Program Chain Number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1431 if(!set_PGCN(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1432 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1433 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1434 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1435 case LinkPTTN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1436 /* Link to Part of current Title Number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1437 /* BUTTON number:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1438 /* PGC Pre-Commands are not executed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1439 assert((vm->state).domain == VTS_DOMAIN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1440 if(link_values.data2 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1441 (vm->state).HL_BTNN_REG = link_values.data2 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1442 if(!set_VTS_PTT(vm, (vm->state).vtsN, (vm->state).VTS_TTN_REG, link_values.data1))
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1443 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1444 else
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1445 link_values = play_PG(vm);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1446 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1447 case LinkPGN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1448 /* Link to Program Number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1449 /* BUTTON number:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1450 if(link_values.data2 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1451 (vm->state).HL_BTNN_REG = link_values.data2 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1452 /* Update any other state, PTTN perhaps? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1453 (vm->state).pgN = link_values.data1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1454 link_values = play_PG(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1455 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1456 case LinkCN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1457 /* Link to Cell Number:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1458 /* BUTTON number:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1459 if(link_values.data2 != 0)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1460 (vm->state).HL_BTNN_REG = link_values.data2 << 10;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1461 /* Update any other state, pgN, PTTN perhaps? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1462 (vm->state).cellN = link_values.data1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1463 link_values = play_Cell(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1464 break;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1465
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1466 case Exit:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1467 vm->stopped = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1468 return 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1469
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1470 case JumpTT:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1471 /* Jump to VTS Title Domain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1472 /* Only allowed from the First Play domain(PGC) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1473 /* or the Video Manager domain (VMG) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1474 /* Stop SPRM9 Timer */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1475 /* Set SPRM1 and SPRM2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1476 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1477 if(set_TT(vm, link_values.data1))
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1478 link_values = play_PGC(vm);
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1479 else
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1480 link_values.command = Exit;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1481 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1482 case JumpVTS_TT:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1483 /* Jump to Title:data1 in same VTS Title Domain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1484 /* Only allowed from the VTS Menu Domain(VTSM) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1485 /* or the Video Title Set Domain(VTS) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1486 /* Stop SPRM9 Timer */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1487 /* Set SPRM1 and SPRM2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1488 assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1489 if(!set_VTS_TT(vm, (vm->state).vtsN, link_values.data1))
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1490 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1491 else
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1492 link_values = play_PGC(vm);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1493 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1494 case JumpVTS_PTT:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1495 /* Jump to Part:data2 of Title:data1 in same VTS Title Domain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1496 /* Only allowed from the VTS Menu Domain(VTSM) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1497 /* or the Video Title Set Domain(VTS) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1498 /* Stop SPRM9 Timer */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1499 /* Set SPRM1 and SPRM2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1500 assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1501 if(!set_VTS_PTT(vm, (vm->state).vtsN, link_values.data1, link_values.data2))
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1502 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1503 else
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1504 link_values = play_PGC_PG(vm, (vm->state).pgN);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1505 break;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1506
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1507 case JumpSS_FP:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1508 /* Jump to First Play Domain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1509 /* Only allowed from the VTS Menu Domain(VTSM) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1510 /* or the Video Manager domain (VMG) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1511 /* Stop SPRM9 Timer and any GPRM counters */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1512 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == VTSM_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1513 if (!set_FP_PGC(vm))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1514 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1515 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1516 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1517 case JumpSS_VMGM_MENU:
410
799f85209145 Fix a spelling error in the comments
erik
parents: 409
diff changeset
1518 /* Jump to Video Manager domain - Title Menu:data1 or any PGC in VMG */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1519 /* Allowed from anywhere except the VTS Title domain */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1520 /* Stop SPRM9 Timer and any GPRM counters */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1521 assert((vm->state).domain != VTS_DOMAIN); /* ?? */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1522 if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1523 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1524 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1525 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1526 (vm->state).domain = VMGM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1527 if(!set_MENU(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1528 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1529 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1530 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1531 case JumpSS_VTSM:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1532 /* Jump to a menu in Video Title domain, */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1533 /* or to a Menu is the current VTS */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1534 /* Stop SPRM9 Timer and any GPRM counters */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1535 /* ifoOpenNewVTSI:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1536 /* VTS_TTN_REG:data2 */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1537 /* get_MENU:data3 */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1538 if(link_values.data1 != 0) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1539 if (link_values.data1 != (vm->state).vtsN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1540 /* the normal case */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1541 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1542 if (!ifoOpenNewVTSI(vm, vm->dvd, link_values.data1)) /* Also sets (vm->state).vtsN */
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1543 assert(0);
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1544 if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1545 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1546 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1547 }
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1548 (vm->state).domain = VTSM_DOMAIN;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1549 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1550 /* This happens on some discs like "Captain Scarlet & the Mysterons" or
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1551 * the German RC2 of "Anatomie" in VTSM. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1552 assert((vm->state).domain == VTSM_DOMAIN ||
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1553 (vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1554 if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1555 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1556 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1557 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1558 (vm->state).domain = VTSM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1559 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1560 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1561 /* This happens on 'The Fifth Element' region 2. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1562 assert((vm->state).domain == VTSM_DOMAIN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1563 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1564 /* I don't know what title is supposed to be used for. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1565 /* Alien or Aliens has this != 1, I think. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1566 /* assert(link_values.data2 == 1); */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1567 (vm->state).VTS_TTN_REG = link_values.data2;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1568 /* TTN_REG (SPRM4), VTS_TTN_REG (SPRM5), TT_PGCN_REG (SPRM6) are linked, */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1569 /* so if one changes, the others must change to match it. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1570 (vm->state).TTN_REG = get_TT(vm, (vm->state).vtsN, (vm->state).VTS_TTN_REG);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1571 if(!set_MENU(vm, link_values.data3))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1572 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1573 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1574 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1575 case JumpSS_VMGM_PGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1576 /* set_PGCN:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1577 /* Stop SPRM9 Timer and any GPRM counters */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1578 assert((vm->state).domain != VTS_DOMAIN); /* ?? */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1579 if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1580 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1581 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1582 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1583 (vm->state).domain = VMGM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1584 if(!set_PGCN(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1585 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1586 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1587 break;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1588
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1589 case CallSS_FP:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1590 /* set_RSMinfo:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1591 assert((vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1592 /* Must be called before domain is changed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1593 set_RSMinfo(vm, link_values.data1, /* We dont have block info */ 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1594 set_FP_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1595 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1596 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1597 case CallSS_VMGM_MENU:
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1598 /* set_MENU:data1 */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1599 /* set_RSMinfo:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1600 assert((vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1601 /* Must be called before domain is changed */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1602 if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1603 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1604 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1605 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1606 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1607 (vm->state).domain = VMGM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1608 if(!set_MENU(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1609 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1610 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1611 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1612 case CallSS_VTSM:
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1613 /* set_MENU:data1 */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1614 /* set_RSMinfo:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1615 assert((vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1616 /* Must be called before domain is changed */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1617 if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1618 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1619 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1620 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1621 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1622 (vm->state).domain = VTSM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1623 if(!set_MENU(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1624 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1625 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1626 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1627 case CallSS_VMGM_PGC:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1628 /* set_PGC:data1 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1629 /* set_RSMinfo:data2 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1630 assert((vm->state).domain == VTS_DOMAIN); /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1631 /* Must be called before domain is changed */
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1632 if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1633 link_values.command = Exit;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1634 break;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1635 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1636 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1637 (vm->state).domain = VMGM_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1638 if(!set_PGCN(vm, link_values.data1))
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1639 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1640 link_values = play_PGC(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1641 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1642 case PlayThis:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1643 /* Should never happen. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1644 assert(0);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1645 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1646 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1647
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1648 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1649 fprintf(MSG_OUT, "libdvdnav: After printout starts:\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1650 vm_print_current_domain_state(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1651 fprintf(MSG_OUT, "libdvdnav: After printout ends.\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1652 #endif
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1653
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1654 }
252
aee8af592d66 fix a long-standing problem: sometimes, hitting Escape in the movie and then
mroi
parents: 247
diff changeset
1655 (vm->state).blockN = link_values.data1 | (link_values.data2 << 16);
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1656 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1657 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1658
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1659
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1660 /* Set functions */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1661
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1662 static int set_TT(vm_t *vm, int tt) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1663 return set_PTT(vm, tt, 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1664 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1665
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1666 static int set_PTT(vm_t *vm, int tt, int ptt) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1667 assert(tt <= vm->vmgi->tt_srpt->nr_of_srpts);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1668 return set_VTS_PTT(vm, vm->vmgi->tt_srpt->title[tt - 1].title_set_nr,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1669 vm->vmgi->tt_srpt->title[tt - 1].vts_ttn, ptt);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1670 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1671
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1672 static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1673 return set_VTS_PTT(vm, vtsN, vts_ttn, 1);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1674 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1675
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1676 static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1677 int pgcN, pgN, res;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1678
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1679 (vm->state).domain = VTS_DOMAIN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1680
256
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1681 if (vtsN != (vm->state).vtsN)
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1682 if (!ifoOpenNewVTSI(vm, vm->dvd, vtsN)) /* Also sets (vm->state).vtsN */
6299ccea8a38 killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents: 254
diff changeset
1683 return 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1684
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1685 if ((vts_ttn < 1) || (vts_ttn > vm->vtsi->vts_ptt_srpt->nr_of_srpts) ||
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1686 (part < 1) || (part > vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].nr_of_ptts) ) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1687 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1688 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1689
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1690 pgcN = vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].ptt[part - 1].pgcn;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1691 pgN = vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].ptt[part - 1].pgn;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1692
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1693 (vm->state).TT_PGCN_REG = pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1694 (vm->state).PTTN_REG = part;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1695 (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
412
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1696 if( (vm->state.TTN_REG) == 0 )
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1697 return 0;
34e632fb6a39 Prevent abort if a menu doesn't exist.
erik
parents: 411
diff changeset
1698
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1699 (vm->state).VTS_TTN_REG = vts_ttn;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1700 (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1701 /* Any other registers? */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1702
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1703 res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1704 (vm->state).pgN = pgN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1705 return res;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1706 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1707
409
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1708 static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn) {
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1709 assert(tt <= vm->vmgi->tt_srpt->nr_of_srpts);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1710 return set_VTS_PROG(vm, vm->vmgi->tt_srpt->title[tt - 1].title_set_nr,
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1711 vm->vmgi->tt_srpt->title[tt - 1].vts_ttn, pgcn, pgn);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1712 }
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1713
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1714 static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn) {
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1715 int pgcN, pgN, res, title, part = 0;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1716
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1717 (vm->state).domain = VTS_DOMAIN;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1718
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1719 if (vtsN != (vm->state).vtsN)
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1720 if (!ifoOpenNewVTSI(vm, vm->dvd, vtsN)) /* Also sets (vm->state).vtsN */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1721 return 0;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1722
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1723 if ((vts_ttn < 1) || (vts_ttn > vm->vtsi->vts_ptt_srpt->nr_of_srpts)) {
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1724 return 0;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1725 }
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1726
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1727 pgcN = pgcn;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1728 pgN = pgn;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1729
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1730 (vm->state).TT_PGCN_REG = pgcN;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1731 (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1732 assert( (vm->state.TTN_REG) != 0 );
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1733 (vm->state).VTS_TTN_REG = vts_ttn;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1734 (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1735 /* Any other registers? */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1736
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1737 res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1738 (vm->state).pgN = pgN;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1739 vm_get_current_title_part(vm, &title, &part);
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1740 (vm->state).PTTN_REG = part;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1741 return res;
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1742 }
9b8bfc56a7fe Add dvdnav_program_play & dvdnav_current_title_program
erik
parents: 408
diff changeset
1743
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1744 static int set_FP_PGC(vm_t *vm) {
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1745 (vm->state).domain = FP_DOMAIN;
254
f78669338b49 Fix segfault if the DVD does not contain a FP_PGC.
jcdutton
parents: 252
diff changeset
1746 if (!vm->vmgi->first_play_pgc) {
f78669338b49 Fix segfault if the DVD does not contain a FP_PGC.
jcdutton
parents: 252
diff changeset
1747 return set_PGCN(vm, 1);
f78669338b49 Fix segfault if the DVD does not contain a FP_PGC.
jcdutton
parents: 252
diff changeset
1748 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1749 (vm->state).pgc = vm->vmgi->first_play_pgc;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1750 (vm->state).pgcN = vm->vmgi->vmgi_mat->first_play_pgc;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1751 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1752 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1753
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1754
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1755 static int set_MENU(vm_t *vm, int menu) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1756 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == VTSM_DOMAIN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1757 return set_PGCN(vm, get_ID(vm, menu));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1758 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1759
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1760 static int set_PGCN(vm_t *vm, int pgcN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1761 pgcit_t *pgcit;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1762
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1763 pgcit = get_PGCIT(vm);
422
3d942df13d3a Unbreak playback of DVDs with menus, broken by r1245.
rathann
parents: 418
diff changeset
1764 if (pgcit == NULL)
418
fe65a31e707a Fix failed assertion when there's no menu.
rathann
parents: 412
diff changeset
1765 return 0;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1766
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1767 if(pgcN < 1 || pgcN > pgcit->nr_of_pgci_srp) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1768 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1769 fprintf(MSG_OUT, "libdvdnav: ** No such pgcN = %d\n", pgcN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1770 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1771 return 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1772 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1773
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1774 (vm->state).pgc = pgcit->pgci_srp[pgcN - 1].pgc;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1775 (vm->state).pgcN = pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1776 (vm->state).pgN = 1;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1777
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1778 if((vm->state).domain == VTS_DOMAIN)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1779 (vm->state).TT_PGCN_REG = pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1780
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1781 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1782 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1783
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1784 /* Figure out the correct pgN from the cell and update (vm->state). */
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1785 static int set_PGN(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1786 int new_pgN = 0;
408
7923e813ec61 Make sure part is initialized
erik
parents: 404
diff changeset
1787 int dummy, part = 0;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1788
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1789 while(new_pgN < (vm->state).pgc->nr_of_programs
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1790 && (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN])
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1791 new_pgN++;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1792
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1793 if(new_pgN == (vm->state).pgc->nr_of_programs) /* We are at the last program */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1794 if((vm->state).cellN > (vm->state).pgc->nr_of_cells)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1795 return 0; /* We are past the last cell */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1796
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1797 (vm->state).pgN = new_pgN;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1798
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1799 if((vm->state).domain == VTS_DOMAIN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1800 playback_type_t *pb_ty;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1801 if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1802 return 0; /* ?? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1803 pb_ty = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1].pb_ty;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1804 vm_get_current_title_part(vm, &dummy, &part);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1805 (vm->state).PTTN_REG = part;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1806 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1807 return 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1808 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1809
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1810 /* Must be called before domain is changed (set_PGCN()) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1811 static void set_RSMinfo(vm_t *vm, int cellN, int blockN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1812 int i;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1813
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1814 if(cellN) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1815 (vm->state).rsm_cellN = cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1816 (vm->state).rsm_blockN = blockN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1817 } else {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1818 (vm->state).rsm_cellN = (vm->state).cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1819 (vm->state).rsm_blockN = blockN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1820 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1821 (vm->state).rsm_vtsN = (vm->state).vtsN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1822 (vm->state).rsm_pgcN = get_PGCN(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1823
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1824 /* assert((vm->state).rsm_pgcN == (vm->state).TT_PGCN_REG); for VTS_DOMAIN */
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1825
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1826 for(i = 0; i < 5; i++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1827 (vm->state).rsm_regs[i] = (vm->state).registers.SPRM[4 + i];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1828 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1829 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1830
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1831
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1832 /* Get functions */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1833
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1834 /* Searches the TT tables, to find the current TT.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1835 * returns the current TT.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1836 * returns 0 if not found.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1837 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1838 static int get_TT(vm_t *vm, int vtsN, int vts_ttn) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1839 int i;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1840 int tt=0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1841
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1842 for(i = 1; i <= vm->vmgi->tt_srpt->nr_of_srpts; i++) {
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1843 if( vm->vmgi->tt_srpt->title[i - 1].title_set_nr == vtsN &&
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1844 vm->vmgi->tt_srpt->title[i - 1].vts_ttn == vts_ttn) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1845 tt=i;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1846 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1847 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1848 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1849 return tt;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1850 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1851
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1852 /* Search for entry_id match of the PGC Category in the current VTS PGCIT table.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1853 * Return pgcN based on entry_id match.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1854 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1855 static int get_ID(vm_t *vm, int id) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1856 int pgcN, i;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1857 pgcit_t *pgcit;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1858
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1859 /* Relies on state to get the correct pgcit. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1860 pgcit = get_PGCIT(vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1861 assert(pgcit != NULL);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1862 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1863 fprintf(MSG_OUT, "libdvdnav: ** Searching for menu (0x%x) entry PGC\n", id);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1864 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1865
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1866 /* Force high bit set. */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1867 id |=0x80;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1868
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1869 /* Get menu/title */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1870 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1871 if( (pgcit->pgci_srp[i].entry_id) == id) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1872 pgcN = i + 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1873 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1874 fprintf(MSG_OUT, "libdvdnav: Found menu.\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1875 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1876 return pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1877 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1878 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1879 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1880 fprintf(MSG_OUT, "libdvdnav: ** No such id/menu (0x%02x) entry PGC\n", id & 0x7f);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1881 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1882 if ( (pgcit->pgci_srp[i].entry_id & 0x80) == 0x80) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1883 fprintf(MSG_OUT, "libdvdnav: Available menus: 0x%x\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1884 pgcit->pgci_srp[i].entry_id & 0x7f);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1885 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1886 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1887 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1888 return 0; /* error */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1889 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1890
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1891 /* FIXME: we have a pgcN member in the vm's state now, so this should be obsolete */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1892 static int get_PGCN(vm_t *vm) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1893 pgcit_t *pgcit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1894 int pgcN = 1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1895
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1896 pgcit = get_PGCIT(vm);
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1897
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1898 if (pgcit) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1899 while(pgcN <= pgcit->nr_of_pgci_srp) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1900 if(pgcit->pgci_srp[pgcN - 1].pgc == (vm->state).pgc) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1901 assert((vm->state).pgcN == pgcN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1902 return pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1903 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1904 pgcN++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1905 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1906 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1907 fprintf(MSG_OUT, "libdvdnav: get_PGCN failed. Was trying to find pgcN in domain %d\n",
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1908 (vm->state).domain);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1909 return 0; /* error */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1910 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1911
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1912 static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1913 int i;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1914
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1915 if(h == NULL || h->pgci_ut == NULL) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1916 fprintf(MSG_OUT, "libdvdnav: *** pgci_ut handle is NULL ***\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1917 return NULL; /* error? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1918 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1919
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1920 i = 0;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1921 while(i < h->pgci_ut->nr_of_lus
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1922 && h->pgci_ut->lu[i].lang_code != lang)
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1923 i++;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1924 if(i == h->pgci_ut->nr_of_lus) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1925 fprintf(MSG_OUT, "libdvdnav: Language '%c%c' not found, using '%c%c' instead\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1926 (char)(lang >> 8), (char)(lang & 0xff),
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1927 (char)(h->pgci_ut->lu[0].lang_code >> 8),
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1928 (char)(h->pgci_ut->lu[0].lang_code & 0xff));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1929 fprintf(MSG_OUT, "libdvdnav: Menu Languages available: ");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1930 for(i = 0; i < h->pgci_ut->nr_of_lus; i++) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1931 fprintf(MSG_OUT, "%c%c ",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1932 (char)(h->pgci_ut->lu[i].lang_code >> 8),
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1933 (char)(h->pgci_ut->lu[i].lang_code & 0xff));
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1934 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1935 fprintf(MSG_OUT, "\n");
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1936 i = 0; /* error? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1937 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1938
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1939 return h->pgci_ut->lu[i].pgcit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1940 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1941
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1942 /* Uses state to decide what to return */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1943 static pgcit_t* get_PGCIT(vm_t *vm) {
344
fb2fbd4cfbf6 in get_PGCIT() check the validity of vm->vtsi before risking to dereference NULL;
nicodvb
parents: 332
diff changeset
1944 pgcit_t *pgcit = NULL;
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1945
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1946 switch ((vm->state).domain) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1947 case VTS_DOMAIN:
344
fb2fbd4cfbf6 in get_PGCIT() check the validity of vm->vtsi before risking to dereference NULL;
nicodvb
parents: 332
diff changeset
1948 if(!vm->vtsi) return NULL;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1949 pgcit = vm->vtsi->vts_pgcit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1950 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1951 case VTSM_DOMAIN:
344
fb2fbd4cfbf6 in get_PGCIT() check the validity of vm->vtsi before risking to dereference NULL;
nicodvb
parents: 332
diff changeset
1952 if(!vm->vtsi) return NULL;
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1953 pgcit = get_MENU_PGCIT(vm, vm->vtsi, (vm->state).registers.SPRM[0]);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1954 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1955 case VMGM_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1956 case FP_DOMAIN:
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1957 pgcit = get_MENU_PGCIT(vm, vm->vmgi, (vm->state).registers.SPRM[0]);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1958 break;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1959 default:
243
e75c52894630 * assert(0) does not always and the program (see NDEBUG)
mroi
parents: 229
diff changeset
1960 abort();
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1961 }
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1962
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1963 return pgcit;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1964 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1965
388
90ca650854e0 Remove all trailing whitespace,
rathann
parents: 386
diff changeset
1966 //return the ifo_handle_t describing required title, used to
312
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1967 //identify chapters
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1968 ifo_handle_t *vm_get_title_ifo(vm_t *vm, uint32_t title)
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1969 {
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1970 ifo_handle_t *ifo = NULL;
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1971 uint8_t titleset_nr;
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1972 if((title < 1) || (title > vm->vmgi->tt_srpt->nr_of_srpts))
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1973 return NULL;
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1974 titleset_nr = vm->vmgi->tt_srpt->title[title-1].title_set_nr;
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1975 ifo = ifoOpen(vm->dvd, titleset_nr);
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1976 return ifo;
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1977 }
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1978
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1979 void vm_ifo_close(ifo_handle_t *ifo)
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1980 {
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1981 ifoClose(ifo);
fdbfb58d2735 added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents: 294
diff changeset
1982 }
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1983
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1984 /* Debug functions */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1985
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1986 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1987 void vm_position_print(vm_t *vm, vm_position_t *position) {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1988 fprintf(MSG_OUT, "libdvdnav: But=%x Spu=%x Aud=%x Ang=%x Hop=%x vts=%x dom=%x cell=%x cell_restart=%x cell_start=%x still=%x block=%x\n",
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1989 position->button,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1990 position->spu_channel,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1991 position->audio_channel,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1992 position->angle_channel,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1993 position->hop_channel,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1994 position->vts,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1995 position->domain,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1996 position->cell,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1997 position->cell_restart,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1998 position->cell_start,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1999 position->still,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
2000 position->block);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
2001 }
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
2002 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
2003