Tracer Tutorial, Part 2

The Title Menu Pre Commands

When you click Step again, the command area will change to the following:

1: if r0 == 0 then GoTo Line 4
2: Set Button 2
3: GoTo Line 5
4: Set Button 1
5: Set r0 = 0

These are the Pre Commands for the Title Menu. If you press the Show button, DVDAfterEdit will highlight VMG PGC 1 in the left pane of the main window, and if you click on it, you will see "entry PGC yes" in the right pane . This is the VMG entry PGC, which will always be executed when the viewer presses the Menu Call Title Key in the remote.

center,VMG entry PGC

The video preview still has not changed. Try stepping backwards to the beginning of the First Play, and then forwards again to these Pre Commands. You should be starting to get the idea of how DVD navigation works. A DVD is split up into "Domains," and the commands are quite flexible within the current domain but somewhat limited on how they can travel to different domains. So far we have started in the First Play domain, jumped to the Title Domain to play half a second of black video, then called back to the Video Manager domain in order to eventually display the Main Menu.

The primary function of the above Pre Commands is to determine which button will be set to highlight upon arrival at the Main Menu. Now look at the General Parameters; notice that since GPRM0 (r0) is still 0, navigation will skip over lines 2 and 3 to Pre Command line 4, where Button 1 will be set to highlight. Line 5 will ensure that r0 is set to 0 again, so the next time navigation returns to this PGC, the DVD player will highlight button 1 unless r0 is changed somewhere else. This is a case of the author (Ben) trying to make things easy for the viewer by having the DVD player highlight the last button activated from the Main Menu (such behavior is, of course, up to the author to decide).

Now Step again; Tracer leaves the Pre Commands, and displays the video for VMG PGC 1, which is the Main Menu.

center,main menu

The status line displays "Waiting for Remote Key...," which means that the Tracer is waiting for the user to activate a remote button. The Button Highlight pane to the left of the Preview pane shows the hot spot borders of all visible buttons contained within the current PGC. Notice the solid white box in the same relative position as the words "PLAY MOVIE" in the image; this indicates that the "PLAY MOVIE" button is currently selected.

Interestingly, if we were to go back to the First Play and start over, clicking Run this time instead of Step, you will see all of the above navigation take place without stopping (except to fetch data from the disk and build a QuickTime preview) at a speed determined by the setting of the Trace Speed slider. For still menus like the one in this example, the player will stop when input is required from the viewer. For motion menus, Tracer will continue playing the video as instructed by the programming, while permitting you to select and activate the buttons.

Selecting Buttons in the Title (Main) Menu

Inside the Remote pane you will see the Enter button surrounded by four directional keys. The arrow and enter keys on the keyboard are shortcuts for these, and are also available from the Tracer menu. When you press the up or down arrows, the button highlight pane will change to show the newly selected button as a solid white box. The right and left arrows are not active for this PGC, which is representative of the way Ben authored the DVD.

If you return to VMG PGC 1 in the left pane of the main window and drill down through the DVD structural levels to the (only) Nav Pack, you will see entries for Button Navigation 1 and Button Navigation 2. When expanded, you will see the button navigation information, including which button is selected when each of the four directional buttons is pressed. If you wish, you may change the entries for "Button no. to select if 'Left' pressed", etc., and when you switch back to the Tracer window the behavior will be changed.

Activating the PLAY MOVIE button

From the Main Menu of the sample project, make sure that the top button is selected, then press the Enter button found in the Remote pane. This will activate the button, just like a normal DVD player, causing the associated button command to execute. In this example, the entire movie will play through its four chapters. You may adjust the preview speed at any time by dragging the Preview slider, or by clicking on the <- Scan and Scan -> keys in the remote pane.

center,drag Preview slider

In Tracer, the QuickTime movie controller at the bottom of the Preview pane (see image above) is always set to show the duration of the current PGC. For this project, the main movie resides in VTS 1 and consists of a one-sequential PGC. This PGC is broken into four parts, and each part is, at the same time, a Part of Title (PTT), a Program (PG), and a Cell. This type of simple DVD structure is common, though sometimes Programs are are not PTTs, and Programs can have more than one Cell.

As the video begins to play, you will notice that one fourth of the controller's location slider is drawn in dark gray and the rest in light gray. When the first chapter finishes, the dark portion changes to the next one-fourth of the controller length. Tracer subdivides each PGC into its unique sections contained within, all the way down to the Cell level, and even to each group of Nav Packs with similar button highlight information. This enables the user to control playback and tracing to the lowest structural level of the DVD specification.

Setting a Breakpoint

To see how the this DVD navigates from the Main Menu to the Scene Selection Menu, let's look at the commands in the Main Menu PGC and its one and only Nav Pack. When the movie has been played, the DVD navigates to the Main Menu, highlighting the first button. Now press the Show Trace button; this highlights VMG PGC 1 in the left pane of the main window (we did this earlier when examining the Title Menu Pre Commands).

Option-click on the VMG PGC 1 disclosure triangle, then click on Nav Pack 1 in order to select it. In the Button Navigation section in the right pane, you will see two Button Commands (click on the disclosure triangles if they are hidden):

1: Jump TT 1 2: Link TailPGC

These Button Commands correspond to the two Main Menu buttons. Control-click on command 2 (for button 2) and choose "Set Breakpoint" from the contextual menu. The disclosure triangle will change to red, which means that Tracer will stop if this command is encountered while emulating the DVD.

Go back to the Tracer window, and click on the down arrow found in the Remote pane (or use the arrow key). You will see the button selection change from the PLAY MOVIE button (button 1) to the SCENE SELECTION button (button 2) in the Button Highlight pane. Now press the Enter remote button. Tracer displays the following image:

center,choose scene selection

Notice how Tracer stops playback at the "Set Breakpoint" location and the command-line cursor is now red. The Link TailPGC Button Command navigates to the Post Command area of the current PGC. Press the 'S' key (or click Step) and you will see the following commands in the Command pane:

1: Set r0 = 1 2: Set r1 = 0 3: Jump VTS 1 Menu Root

You may Step (or Stride) through these commands, which will navigate to the Pre Command area of VTS 1 Menu Root (VTSM PGC 1). The following commands are displayed (values are in hexadecimal notation):

1: if r0 == 1 then GoTo Line 3
2: Jump VMG PGC 1
3: if r1 != 0 then GoTo Line 6
4: Set r1 = $400
5: GoTo Line 13
6: if r1 != 5 then GoTo Line 9
7: Set r1 = 4
8: GoTo Line 11
9: Set r1 = Part title
10: if r1 < 3 then GoTo Line 12
11: Link PGC 2
12: Set r1 *= $400
13: Set Button r1

Selecting the Scene Menu and the Button to Highlight

As explained in Ben's article (http://www.dvdafteredit.com/public/107.cfm), these commands decide which of the two scene selection menus to display and which button is set to be selected. Since this is the first time we have navigated to the Scene Selection Menu, we would expect to display the first Scene Selection Menu with the first button selected, and indeed that is what happens:

center, display the first Scene Selection Menu

Conclusion

You should now have enough familiarity with Tracer to navigate through the remainder of the paths in this relatively simple DVD. Experiment and observe how the logic works. If you have little experience in this kind of scripting/programming, please refer to Ben's explanations in the original article for further help. If these concepts are new to you, it is much easier to understand them when you can see how things happen step-by-step with Tracer.

One difficult aspect of DVD commands is the limitation built in to each command, particularly how they navigate from one domain to another. Examining the various types of commands listed in the popups while working in the right pane of the main project window can be quite instructive in that regard, since the popups will only show those options that are valid in the relative context being viewed. For example, commands that may be part of the DVD Specification in a VTSM PGC but are not relevant to a VMG PGC are not displayed. We will also be adding more explanations and examples to the site to further assist users. Stay tuned!