@@ -12,10 +12,6 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
1212
1313 selectMenu = & selectMenu [trackIndex ];
1414 videoID = selectMenu -> videoID ;
15-
16- #ifdef USE_PCDRV
17- return ;
18- #endif
1915
2016 if (
2117 (entry [videoID ].size == 0 ) ||
@@ -28,16 +24,16 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
2824 )
2925 {
3026 // draw icon
31- D230 .trackSel_video_state = 1 ;
27+ D230 .trackSel_videoStateCurr = 1 ;
3228 }
3329
3430#ifndef REBUILD_PS1
3531 else
3632 {
37- // Lock D230.trackSel_video_state to zero to prevent allocation,
33+ // Lock D230.trackSel_videoStateCurr to zero to prevent allocation,
3834 // which helps the Oxide efforts
3935
40- if ((D230 .trackSel_video_state == 2 ) && (D230 .trackSel_unk == 1 ))
36+ if ((D230 .trackSel_videoStateCurr == 2 ) && (D230 .trackSel_videoStatePrev == 1 ))
4137 {
4238
4339 // If you have not allocated memory for video yet
@@ -47,17 +43,14 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
4743 MM_Video_AllocMem (0xb0 , 0x4b , 4 , 0 , 0 );
4844
4945 // You have now allocated the memory
50- D230 .trackSel_video_boolAllocated = D230 .trackSel_unk ;
46+ D230 .trackSel_video_boolAllocated = D230 .trackSel_videoStatePrev ;
5147 }
5248
53- // no$psx crashes here, disable if needed
54- #if 1
5549 // CD position of video, and numFrames
5650 MM_Video_StartStream (bh -> cdpos + entry [videoID ].offset , selectMenu -> videoLength );
57- #endif
5851 }
5952
60- if (((D230 .trackSel_unk == 3 ) || (D230 .trackSel_video_state == 3 )) || (D230 .trackSel_video_state == 2 ))
53+ if (((D230 .trackSel_videoStatePrev == 3 ) || (D230 .trackSel_videoStateCurr == 3 )) || (D230 .trackSel_videoStateCurr == 2 ))
6154 {
6255 tpage = gGT -> ptrIcons [0x3f ]-> texLayout .tpage ;
6356 u0 = gGT -> ptrIcons [0x3f ]-> texLayout .u0 ;
@@ -71,11 +64,11 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
7164 #endif
7265 ret = MM_Video_DecodeFrame (512 , 0 );
7366
74- if ((ret == 1 ) && (D230 .trackSel_video_state == 2 ))
67+ if ((ret == 1 ) && (D230 .trackSel_videoStateCurr == 2 ))
7568 {
76- D230 .trackSel_video_state = 3 ;
69+ D230 .trackSel_videoStateCurr = 3 ;
7770 }
78- if (D230 .trackSel_unk == 3 )
71+ if (D230 .trackSel_videoStatePrev == 3 )
7972 {
8073 // RECT position (x,y)
8174 sdata -> videoSTR_src_vramRect .x = (u_short )u0 + (tpage & 0xf ) * 0x40 + 3 ;
@@ -97,7 +90,7 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
9790#endif
9891
9992 // if not playing video, draw icon
100- if (D230 .trackSel_video_state != 3 )
93+ if (D230 .trackSel_videoStateCurr != 3 )
10194 {
10295 // Draw Video icon
10396 DECOMP_RECTMENU_DrawPolyGT4 (
@@ -113,20 +106,26 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
113106 }
114107
115108#ifndef REBUILD_PS1
116- if (D230 .trackSel_unk == 1 )
109+ if (D230 .trackSel_videoStatePrev == 1 )
117110 {
118111 // disable video copy
119112 MainFrame_InitVideoSTR (0 , 0 , 0 , 0 );
120113 }
121114
115+ // First frame to start video
122116 if ((param_4 == 1 ) && (D230 .trackSel_video_boolAllocated == 1 ))
123117 {
124- D230 .trackSel_video_state = 1 ;
118+ D230 .trackSel_videoStateCurr = 1 ;
125119 }
126- if ((D230 .trackSel_video_state == 1 ) && (D230 .trackSel_unk != 1 ))
120+
121+ // First frame to stop video
122+ if ((D230 .trackSel_videoStateCurr == 1 ) && (D230 .trackSel_videoStatePrev != 1 ))
127123 {
128124 MM_Video_StopStream ();
129125 }
126+
127+ // First frame to start video,
128+ // but this time after stopping video safely
130129 if ((param_4 == 1 ) && (D230 .trackSel_video_boolAllocated == 1 ))
131130 {
132131 MM_Video_ClearMem ();
@@ -135,7 +134,7 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
135134 }
136135#endif
137136
138- D230 .trackSel_unk = D230 .trackSel_video_state ;
137+ D230 .trackSel_videoStatePrev = D230 .trackSel_videoStateCurr ;
139138
140139 // Draw 2D Menu rectangle background
141140 DECOMP_RECTMENU_DrawInnerRect (
0 commit comments