Commit 7b854581 authored by jsgh's avatar jsgh Committed by Jean-Baptiste Kempf

Handle random playback mode by choosing our initial program number

randomly - some discs end up jumping to nowhere if you always choose
the first cell.
parent 320b88d3
Pipeline #8854 failed with stage
in 2 minutes and 2 seconds
......@@ -63,6 +63,21 @@ link_t play_PGC(vm_t *vm) {
(vm->state).cellN = 0;
(vm->state).blockN = 0;
/* Handle random playback mode by choosing our initial program
* number randomly - some discs end up jumping to nowhere if you
* always choose the first cell.
*/
if ((vm->state).pgc->pg_playback_mode!=0 &&
((vm->state).pgc->pg_playback_mode & 0x80)==0) {
int pgCnt = ((vm->state).pgc->pg_playback_mode & 0x7f) + 1;
if (pgCnt > (vm->state).pgc->nr_of_programs) {
pgCnt = (vm->state).pgc->nr_of_programs;
}
if (pgCnt>1) {
(vm->state).pgN = 1 + ((int) ((float) pgCnt * rand()/(RAND_MAX+1.0)));
}
}
/* eval -> updates the state and returns either
- some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN)
- just play video i.e first PG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment