mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
fix wrong vag stream playing sometimes (#1608)
This commit is contained in:
parent
7084742a3d
commit
5de9547d07
|
@ -601,6 +601,12 @@ u32 ISOThread() {
|
||||||
StopVAG(in_progress_vag_command);
|
StopVAG(in_progress_vag_command);
|
||||||
ReleaseMessage(in_progress_vag_command);
|
ReleaseMessage(in_progress_vag_command);
|
||||||
in_progress_vag_command = nullptr;
|
in_progress_vag_command = nullptr;
|
||||||
|
// added. this variable seems to determine whether a vag stream is actually playing, and it is
|
||||||
|
// possible to get into a scenario where (for example) you want to unpause a vag stream but a
|
||||||
|
// different sound command hasn't run yet to correct this value, which makes the game either
|
||||||
|
// play the wrong sound or crash right away if no actual sound is to be played with the vag
|
||||||
|
// stream
|
||||||
|
unk = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
|
|
@ -157,7 +157,7 @@ void PlayVAGStream(FileRecord* file,
|
||||||
|
|
||||||
void SetVAGStreamVolume(s32 volume) {
|
void SetVAGStreamVolume(s32 volume) {
|
||||||
auto cmd = GetVAGCommand();
|
auto cmd = GetVAGCommand();
|
||||||
cmd->cmd_id = 1029;
|
cmd->cmd_id = SET_VAG_VOLUME;
|
||||||
cmd->messagebox_to_reply = 0;
|
cmd->messagebox_to_reply = 0;
|
||||||
cmd->thread_id = 0;
|
cmd->thread_id = 0;
|
||||||
cmd->volume = volume;
|
cmd->volume = volume;
|
||||||
|
@ -166,7 +166,7 @@ void SetVAGStreamVolume(s32 volume) {
|
||||||
|
|
||||||
void SetDialogVolume(s32 volume) {
|
void SetDialogVolume(s32 volume) {
|
||||||
auto cmd = GetVAGCommand();
|
auto cmd = GetVAGCommand();
|
||||||
cmd->cmd_id = 1030;
|
cmd->cmd_id = SET_DIALOG_VOLUME;
|
||||||
cmd->messagebox_to_reply = 0;
|
cmd->messagebox_to_reply = 0;
|
||||||
cmd->thread_id = 0;
|
cmd->thread_id = 0;
|
||||||
cmd->volume = volume;
|
cmd->volume = volume;
|
||||||
|
@ -186,7 +186,7 @@ void StopVAGStream(VagDirEntry* vag, u32 priority) {
|
||||||
|
|
||||||
void PauseVAGStream() {
|
void PauseVAGStream() {
|
||||||
auto cmd = GetVAGCommand();
|
auto cmd = GetVAGCommand();
|
||||||
cmd->cmd_id = 1027;
|
cmd->cmd_id = PAUSE_VAG_STREAM;
|
||||||
cmd->messagebox_to_reply = 0;
|
cmd->messagebox_to_reply = 0;
|
||||||
cmd->thread_id = 0;
|
cmd->thread_id = 0;
|
||||||
SendMbx(iso_mbx, cmd);
|
SendMbx(iso_mbx, cmd);
|
||||||
|
@ -194,7 +194,7 @@ void PauseVAGStream() {
|
||||||
|
|
||||||
void UnpauseVAGStream() {
|
void UnpauseVAGStream() {
|
||||||
auto cmd = GetVAGCommand();
|
auto cmd = GetVAGCommand();
|
||||||
cmd->cmd_id = 1028;
|
cmd->cmd_id = CONTINUE_VAG_STREAM;
|
||||||
cmd->messagebox_to_reply = 0;
|
cmd->messagebox_to_reply = 0;
|
||||||
cmd->thread_id = 0;
|
cmd->thread_id = 0;
|
||||||
SendMbx(iso_mbx, cmd);
|
SendMbx(iso_mbx, cmd);
|
||||||
|
|
|
@ -1560,18 +1560,15 @@
|
||||||
(toggle-pause)
|
(toggle-pause)
|
||||||
)
|
)
|
||||||
(when (or (not *progress-process*) (can-go-back? (-> *progress-process* 0)))
|
(when (or (not *progress-process*) (can-go-back? (-> *progress-process* 0)))
|
||||||
(if (or (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons select r3 start)) ;; push pause
|
(if (or (cpad-pressed? 0 select r3 start) ;; push pause
|
||||||
(and ;; controller lost
|
(and (logtest? (-> *cpad-list* cpads 0 valid) 128) ;; controller lost
|
||||||
(logtest? (-> *cpad-list* cpads 0 valid) 128)
|
|
||||||
(= *master-mode* 'game)
|
(= *master-mode* 'game)
|
||||||
(>= (the-as int (-> *display* base-frame-counter)) (the-as int (-> *game-info* blackout-time)))
|
(>= (-> *display* base-frame-counter) (-> *game-info* blackout-time))
|
||||||
;; this is a hack. this is initialized to #x493e0. It prevents controller-loss pause from
|
;; this is a hack. this is initialized to (seconds 1000). It prevents controller-loss pause from
|
||||||
;; triggering in the first few seconds of gameplay.
|
;; triggering in the first few seconds of gameplay.
|
||||||
(< (seconds 1003) (-> *display* real-frame-counter))
|
(< (seconds 1003) (-> *display* real-frame-counter))
|
||||||
)
|
)
|
||||||
(and (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r2)) ;; debug press
|
(and (cpad-pressed? 0 r2) (paused?)) ;; debug press
|
||||||
(paused?)
|
|
||||||
)
|
|
||||||
*pause-lock*
|
*pause-lock*
|
||||||
)
|
)
|
||||||
(toggle-pause)
|
(toggle-pause)
|
||||||
|
|
|
@ -562,16 +562,15 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(defmethod update external-art-control ((obj external-art-control) (debug-print symbol))
|
(defmethod update external-art-control ((obj external-art-control) (debug-print symbol))
|
||||||
"Update this external-art-control. This validates the spool buffers, sorts the spools, advances str-play-queue, and does some other things.
|
"Update this external-art-control. This validates the spool buffers, sorts the spools and queues the highest priority one, and does some other things.
|
||||||
If debug-print, also prints some text to the display console"
|
If debug-print, also prints some text to the display console"
|
||||||
|
|
||||||
;; if somebody wants a reserve buffer, they will set this to 1.
|
;; if somebody wants a reserve buffer, they will set this to 1.
|
||||||
(if (nonzero? (-> obj reserve-buffer-count))
|
(if (nonzero? (-> obj reserve-buffer-count))
|
||||||
(spool-push obj "reserved" 0 *dproc* (if (-> obj reserve-buffer)
|
(spool-push obj "reserved" 0 *dproc* (if (-> obj reserve-buffer)
|
||||||
-110.0
|
-110.0
|
||||||
-0.5)
|
-0.5
|
||||||
)
|
)))
|
||||||
)
|
|
||||||
|
|
||||||
;; frame-lock will get set to #t if something is assigned to this buffer in this update.
|
;; frame-lock will get set to #t if something is assigned to this buffer in this update.
|
||||||
(dotimes (v1-5 2)
|
(dotimes (v1-5 2)
|
||||||
|
@ -590,18 +589,17 @@
|
||||||
;; iterate over the two buffers
|
;; iterate over the two buffers
|
||||||
(dotimes (s2-0 2)
|
(dotimes (s2-0 2)
|
||||||
(when (and (file-status (-> obj buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) ;; this buffer holds the file for the rec
|
(when (and (file-status (-> obj buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) ;; this buffer holds the file for the rec
|
||||||
(not (-> obj buffer s2-0 frame-lock)) ;; and nothing has frame-locked this buffer
|
(not (-> obj buffer s2-0 frame-lock))) ;; and nothing has frame-locked this buffer
|
||||||
)
|
|
||||||
;; so we frame lock it to prevent it from being kicked out
|
;; so we frame lock it to prevent it from being kicked out
|
||||||
(set! (-> obj buffer s2-0 frame-lock) #t)
|
(set! (-> obj buffer s2-0 frame-lock) #t)
|
||||||
;; remember what buffer
|
;; remember what buffer
|
||||||
(set! (-> s3-0 buf2) (-> obj buffer s2-0))
|
(set! (-> s3-0 index) (the-as int (-> obj buffer s2-0)))
|
||||||
;; update owner and priority.
|
;; update owner and priority.
|
||||||
(set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner))
|
(set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner))
|
||||||
(set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner))
|
(set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner))
|
||||||
(set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority))
|
(set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority))
|
||||||
(set! (-> obj buffer s2-0 load-file-priority) (-> s3-0 priority))
|
(set! (-> obj buffer s2-0 load-file-priority) (-> s3-0 priority))
|
||||||
(goto cfg-24) ;; buffer found, move on.
|
(goto cfg-24)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -627,7 +625,7 @@
|
||||||
;; do the assignment!
|
;; do the assignment!
|
||||||
(set! (-> obj buffer s2-1 frame-lock) #t)
|
(set! (-> obj buffer s2-1 frame-lock) #t)
|
||||||
(set-pending-file (-> obj buffer s2-1) (-> s3-1 name) (-> s3-1 parts) (-> s3-1 owner) (-> s3-1 priority))
|
(set-pending-file (-> obj buffer s2-1) (-> s3-1 name) (-> s3-1 parts) (-> s3-1 owner) (-> s3-1 priority))
|
||||||
(set! (-> s3-1 buf2) (-> obj buffer s2-1))
|
(set! (-> s3-1 index) (the-as int (-> obj buffer s2-1)))
|
||||||
(goto cfg-46)
|
(goto cfg-46)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -657,20 +655,16 @@
|
||||||
;; sort spool anims.
|
;; sort spool anims.
|
||||||
(let ((s4-4 (the-as spool-anim #f)))
|
(let ((s4-4 (the-as spool-anim #f)))
|
||||||
(countdown (s3-2 3)
|
(countdown (s3-2 3)
|
||||||
(if (and (-> obj rec s3-2 name)
|
(if (and (-> obj rec s3-2 name) (not (name= (-> obj rec s3-2 name) (-> obj active-stream))))
|
||||||
(not (name= (-> obj rec s3-2 name) (-> obj active-stream)))
|
(set! s4-4 (the-as spool-anim (-> obj rec)))
|
||||||
)
|
|
||||||
(set! s4-4 (-> obj rec 0))
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if (and (-> obj preload-stream name)
|
(if (and (-> obj preload-stream name) (or (not s4-4) (< (-> obj preload-stream priority) (-> s4-4 priority))))
|
||||||
(or (not s4-4) (< (-> obj preload-stream priority) (-> s4-4 priority)))
|
|
||||||
)
|
|
||||||
(set! s4-4 (-> obj preload-stream))
|
(set! s4-4 (-> obj preload-stream))
|
||||||
)
|
)
|
||||||
(cond
|
(cond
|
||||||
(s4-4
|
(s4-4
|
||||||
(mem-copy! (&-> (-> obj last-preload-stream) type) (&-> s4-4 type) (size-of spool-anim))
|
(mem-copy! (&-> (-> obj last-preload-stream) type) (&-> s4-4 type) 44)
|
||||||
(str-play-queue (-> s4-4 name))
|
(str-play-queue (-> s4-4 name))
|
||||||
)
|
)
|
||||||
(else
|
(else
|
||||||
|
|
Loading…
Reference in a new issue