Multiple Menus with GPRM based button jumps
By Hal MacLean
Download the project files here
Following a recent thread on the Apple discussion forums for DVD Studio Pro, it seems useful to combine a system that allows you to get back to the last menu used and combine GPRM based button jumps with it. In order to make this successfully there is only one main caveat… *don’t* use prescripts!
Pre-scripts are fine if you are simply ‘tagging’ a menu with some information, but won’t allow you to use GPRM based button jumps. If you do try it, the result will be as if the GPRM jump doesn’t work – it gets bypassed and you end up on the default menu button. Instead, you need to use ‘free standing’ scripts – exactly the same, but not set as pre-scripts.
The problem addressed in this tutorial is simple. The user has a number of menus to access the same track (albeit at different points) and each menu has a number of buttons. When they activate a button and watch some footage they want to get back to the menu they were last on AND the button they were last on to save them cycling through all of the others.
Fortunately, the answer is not too hard either. There are two principles to combine. Firstly, identifying the menu that the user is on by changing a value in a GPRM, and secondly identifying the button they were on by using the DVD player’s in-built system registers (SPRMs). In this example we want to use SPRM8, which tracks the buttons selected on each menu. One quirk to remember is that the button numbering starts at 1024 and increments in jumps of 1024 each time. Hence, button 2 has a value of 2048 and so on. To match the SPRM value with the menu button we need to divide SPRM8 by 1024 so we end up with simple values such as 1, 2 or 3 etc.
What do the scripts look like?
With each menu you have to change a value. When the disc starts up (assuming you are going directly to a menu and not playing an intro track first) you need to identify menu1. So create a script, set it as ‘First Play’ and add the following two lines:
mov GPRM0, 1 Jump Menu1
On that menu you will have a button that goes to menu 2, no doubt. Instead of making it go directly to the menu, send it to your second script, where you change the value in GPRM0:
mov GPRM0, 2 Jump Menu2
Fair enough… moving between the menus changes a value and we can rely on that later on.
The project files in this tutorial have a single track with three chapters in it. Each chapter has an end jump to go back to the right menu (via a script) and there is a single story to act as a ‘Play All’ option. The main menu has two buttons for the ‘play all’ – simply to illustrate the return to the correct button. You would normally only have one!

So, a user should be able to play all of the clips in turn or play a single clip from the track. These options are spread over two menus to help demonstrate the effect we are after.
The end jumps for the chapters, story and track and the menu call for these all need to point to a single short script. The ‘Title’ button could also point here if you wish, but that is better to point at your top level menu. The script looks like this:
mov GPRM1, SPRM8 div GPRM1, 1024 Jump Menu1 [GPRM1] If (GPRM0 = 1) Jump Menu2 [GPRM1] If (GPRM0 = 2) Jump Menu1
Let’s break this down and see what’s happening.
Line 1 gets the value of the last button chosen on a menu and places it in to GPRM1. Line 2 reduces this to a number we can use in our jumps. Lines 3 and 4 are the actual jumps, but there are two structures on each. Apart from the Jump command the square brackets indicate the GPRM based button jump, and the ‘If’ statement looks to see which menu we came from originally (this is where the value in GPRM0 was set earlier).
What exactly is a GPRM based jump?
You could write out a line for every possible button on your menu so that the script becomes very long. This will work, for sure, but it is tedious to do and not necessary (erm… unless you use pre-scripts? – Ed). The GPRM based jump lodges the button number into a memory slot and then adds it in to the jump statement automatically. So, if you were on button 2 then the line in the script would read “go to the menu and jump to button 2″. It is a really useful feature!
What is the last line all about? Well, that’s a safety net. there really isn’t any need to have it there other than paranoia! If you think that you *might* get an error then this line will send the user to a menu instead of stalling the playback. This is general good practice, but one of those things that could easily be left off and for 99% of the time not be an issue. It is the 1% that gets you, every time… I add these in, but don’t feel obliged to as it should work (this isn’t a complex disc).
And there you have it – multiple menus and GPRM based button jumps in one project. You should experiment with this over larger numbers of menus and see how it can save your bacon when each menu accesses a single track.
