Log in

View Full Version : Everything you need to know about GPRMs but were afraid to ask..


Surf
10th February 2005, 18:04
:D .

Take it away boyz.

Pretend I'm Charlton Heston/Matt Damon, whose spaceship went into some kind of space time warp.....

mpucoder
10th February 2005, 18:10
They are just a collection of 16-bit registers that you can use any way you like.

Surf
10th February 2005, 18:49
Sorry, I shouldn't be that vague.:o

By now you all must be knowing that I'm no programmer....

This is what I know so far from this addictive forum: there are 16 registers, 0 to 15. I compare them to switches, faucets, taps, bypass valves, kitchen sink...lol, I'm no plumber either. Tried miserably at dvd-replica site without success.

So, when I load a movie in PGCedit, I see them registers doing their IFs, THENs and SETs routing. So far I haven't been able to decipher which is assigned to do this and that. I don't suppose IFOedit would tell me that (example) GPRM(5) is chosen to control the movie, GPRM(4) for THX, and so on and so on. In other words, I suppose there is no such "template" for a movie that one can glance and know which is allocated to do what? This is the bottleneck so far.

Irrelevant background: built the 1st puter since Cyrix 224MMX :D . Pin 1 to Pin 1. :D

mpucoder
10th February 2005, 19:42
They are general purpose registers (GPR = General Purpose Register). They have no assignments to do anything special. ie they are used however the programmer wanted to use them to store whatever values needed by the programming.
And by programming I mean the program contained on that specific DVD that executes in the virtual machine.
SPRMs have defined meanings.

Surf
10th February 2005, 20:59
Thanks for your response, mpucoder. I always thought there's a map in how a particular movie is authored.

All of you geniuses seem to know what the below example mean, I was hoping to join the crowd...

3 Set gprm(0) =(mov) 1
4 Set gprm(1) =(mov) 0
5 Set gprm(4) =(mov) 255
6 Set gprm(6) =(mov) 0
7 Set gprm(7) =(mov) 0
8 Set gprm(8) =(mov) 0
9 Set gprm(9) =(mov) 200
10 Set gprm(10) =(mov) 0
11 Set gprm(11) =(mov) 0
12 Set gprm(12) =(mov) 100
13 Set gprm(13) =(mov) 0
14 Set gprm(15) =(mov) 2
(pilfered & made up from Jeanl's guide)

Line 3 is to let the DVD virtual machine know that gprm0 has been played and is indicated by mov(1).....? That's how I have been assuming... Mov(0) and mov(1) seem to be the on-off switch. Then there are others....

Should have completed that night school from the back of the matchbook.... KIDS! STAY IN SCHOOL! DON'T DO DRUGS! :p

2COOL
10th February 2005, 21:49
Here's my extra inputs about GPRMs:

All GPRMs are defaulted at zero upon DVD insert.

If a GPRM is used to hold a snapshot value of SPRM 8 (Highlighted button number), it must also be a multiple of 1024 and no greater than 36864. This is in regards to DVD specs of a maximum of 36 buttons can be used.


Just because a GPRM is set to 1 or 0, doesn't mean you always treat it like a binary value. It's not always a "on and off" thing. You can easily used a single GPRM to decide between playing two versions (fullscreen and widescreen).

blutach
11th February 2005, 01:27
@surf

A gprm can not be "played". It just holds a number - any number from 0 to 65535 (subject to 2COOL's earlier comment). "mov" is the same a move the number (or the contents of another gprm, for example) into the gprm.

If you want to know a bit more about this look here (http://www.dvd-replica.com/DVD/setgprm.php).

Regards

2COOL
11th February 2005, 01:50
Originally posted by blutach
"mov" is the same a move the number (or the contents of another gprm, for example) into the gprm. To clarify what blutach mentions here. It's more of copying instead of moving. Some newbies out here might get the impression of cutting, where you "move" a value and place in another GPRM.

M7S
11th February 2005, 07:58
I'm curios what set gprm in register mode (SetGPRMMD) means. Afaik the counter mode means the gprm is increased by one every second. Is registermode the default, none-counting method or is it something else?

I have an DVD that only uses SetGPRMMD and no normal Set, but that's an odd DVD that has menues in titledomain and a clumsy structure.

mpucoder
11th February 2005, 15:43
yes, the registers are initially in register mode. But once in counting mode you can use that command again to stop the count.

M7S
11th February 2005, 21:24
Thanks for confirming, mpucoder

Surf
18th February 2005, 19:58
Below is one of the reasons for being curious about the workings of GPRMs.
Empire Strikes Back: 3 sets of menus. FBI pgc is embedded with 3(+1 NOP) unaccessible buttons which I suspect is the spot of when/how to display a particular menu(theme) set. I am pasting 2 sets below.

Menu A:

------> Entering VTSM 4 , LU 1 (en) , 11 (0:18)
-- pre 1 : if ( gprm(5) > 0 ) then { Goto line 3 }
if ( 0 > 0 ) : false.
-- pre 2 : Set gprm(5) ?=(rnd) 6
-> gprm(5) = 6 (0x0006)
-- pre 3 : if ( gprm(10) != 555 ) then { Goto line 5 }
if ( 0 != 555 ) : true.
-- pre 5 : NOP
-- pre 6 : Set gprm(3) =(mov) 1000
-> gprm(3) = 1000 (0x03E8)
-- pre 7 : if ( gprm(5) == 1 ) then { LinkPGCN PGC 42 }
if ( 6 == 1 ) : false.
-- pre 8 : if ( gprm(5) == 2 ) then { LinkPGCN PGC 12 }
if ( 6 == 2 ) : false.
-- pre 9 : if ( gprm(5) == 3 ) then { LinkPGCN PGC 72 }
if ( 6 == 3 ) : false.
-- pre 10 : if ( gprm(5) == 4 ) then { LinkPGCN PGC 42 }
if ( 6 == 4 ) : false.
-- pre 11 : if ( gprm(5) == 5 ) then { LinkPGCN PGC 12 }
if ( 6 == 5 ) : false.
-- pre 12 : if ( gprm(5) == 6 ) then { LinkPGCN PGC 72 }
if ( 6 == 6 ) : true.
------> Entering VTSM 4 , LU 1 (en) , 72 (0:32) 4b.


Menu B:

------> Entering VTSM 4 , LU 1 (en) , 11 (0:18)
-- pre 1 : if ( gprm(5) > 0 ) then { Goto line 3 }
if ( 0 > 0 ) : false.
-- pre 2 : Set gprm(5) ?=(rnd) 6
-> gprm(5) = 5 (0x0005)
-- pre 3 : if ( gprm(10) != 555 ) then { Goto line 5 }
if ( 0 != 555 ) : true.
-- pre 5 : NOP
-- pre 6 : Set gprm(3) =(mov) 1000
-> gprm(3) = 1000 (0x03E8)
-- pre 7 : if ( gprm(5) == 1 ) then { LinkPGCN PGC 42 }
if ( 5 == 1 ) : false.
-- pre 8 : if ( gprm(5) == 2 ) then { LinkPGCN PGC 12 }
if ( 5 == 2 ) : false.
-- pre 9 : if ( gprm(5) == 3 ) then { LinkPGCN PGC 72 }
if ( 5 == 3 ) : false.
-- pre 10 : if ( gprm(5) == 4 ) then { LinkPGCN PGC 42 }
if ( 5 == 4 ) : false.
-- pre 11 : if ( gprm(5) == 5 ) then { LinkPGCN PGC 12 }
if ( 5 == 5 ) : true.
------> Entering VTSM 4 , LU 1 (en) , 12 (0:29) 4b.

The trace on both are identical until entering the VTSM 4. The question is: what triggers the 1st example to choose PGC 72 and the 2nd to PGC 12 ?

2COOL
18th February 2005, 20:07
Notice Pre command 2? It has a "rnd" operator which means random. It's like using the shuffle feature on your CD player. You'll never know what you get next.

Menu A

pre 2 : Set gprm(5) ?=(rnd) 6
-> gprm(5) = 6 (0x0006)

Menu B

pre 2 : Set gprm(5) ?=(rnd) 6
-> gprm(5) = 5 (0x0005)
So basically, your possible range of random numbers are from 0 to 6, according to command above. ;)

reference (http://www.mediachance.com/dvdlab/Helppro/vm_operators.htm)

Surf
18th February 2005, 20:43
You're one kewl dude, 2COOL.

I think Lamster(?)'s looking for this(solution) as he's battling in Episode 6 which is identical to #5.

Removing the (rnd) with PGCedit would prevent this randomness?

2COOL
18th February 2005, 20:47
Originally posted by Surf
Removing the (rnd) with PGCedit would prevent this randomness? Oh, I wouldn't go about removing the whole command, just edit it so that gprm(0) is set to hold a constant value.

I found lamster's post (http://forum.doom9.org/showthread.php?s=&postid=611168#post611168).

Surf
18th February 2005, 20:57
lol, I wouldn't do that, removing the whole line.

Menu A is the desired target, so editing from:

pre 2 : Set gprm(5) ?=(rnd) 6

to

pre 2 : Set gprm(5)== 6


would do the trick? It is just for enlightenment purpose for I have already successfully used your JUMP2PGC to achieve the desired result.

2COOL
18th February 2005, 21:04
Yuppers! if that value leads you to your preferred menu. I'm glad Jump2PGC works for you. It started out as a personal project to get jeanl's guide to work faster for me and then realized that it could benefit the community.

blutach
18th February 2005, 22:44
Originally posted by 2COOL
So basically, your possible range of random numbers are from 0 to 6, according to command above. ;) In fact, the random numbers are 1-6

This is simply a way to get the DVD to pick a random menu (1 of 6, I suppose) and enure the watcher is tantalized with a different menu each time he/she puts the disk in.

I experienced this first with The Alamo R4, which enabled me to trim the menu heaps.

Regards

2COOL
18th February 2005, 22:55
Originally posted by blutach
In fact, the random numbers are 1-6

This is simply a way to get the DVD to pick a random menu (1 of 6, I suppose) and enure the watcher is tantalized with a different menu each time he/she puts the disk in.

I experienced this first with The Alamo R4, which enabled me to trim the menu heaps.

Regards

thanks for the correction, blu

blutach
18th February 2005, 22:58
@2COOL - first time ever, mate!

Looks like mediachance is as reliable as DVD-Replica :)

Regards