Skip to content

Commit 5796253

Browse files
author
Niko
committed
MM_Video progress
1 parent cd47fa9 commit 5796253

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

decompile/General/230/230_51_MM_TrackSelect_Video_SetDefaults.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ void DECOMP_MM_TrackSelect_Video_SetDefaults(void)
1818
// Data is not allocated for TrackSel videos
1919
D230.trackSel_video_boolAllocated = 0;
2020

21-
D230.trackSel_video_state = 1;
22-
D230.trackSel_unk = 1;
21+
D230.trackSel_videoStateCurr = 1;
22+
D230.trackSel_videoStatePrev = 1;
2323
}

decompile/General/230/230_52_MM_TrackSelect_Video_State.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ void DECOMP_MM_TrackSelect_Video_State(int state)
99
D230.trackSel_video_frameCount = 0;
1010

1111
// player sees a track icon (not video)
12-
D230.trackSel_video_state = 1;
12+
D230.trackSel_videoStateCurr = 1;
1313

1414
return;
1515
}
16+
17+
#ifdef USE_PCDRV
18+
// dont start video
19+
// can also enable this for no$psx
20+
return;
21+
#endif
1622

1723
// if player sees a track icon
18-
if (D230.trackSel_video_state == 1)
24+
if (D230.trackSel_videoStateCurr == 1)
1925
{
2026
// wait 20 frames
2127
D230.trackSel_video_frameCount++;
2228
if(D230.trackSel_video_frameCount > FPS_DOUBLE(20))
2329
{
2430
// allocate video memory, prepare to play video
25-
D230.trackSel_video_state = 2;
31+
D230.trackSel_videoStateCurr = 2;
2632
}
2733
}
2834
}

decompile/General/230/230_53_MM_TrackSelect_Video_Draw.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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(

decompile/General/230/D230.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,8 +994,8 @@ struct OverlayDATA_230 D230 =
994994
.trackSel_transitionFrames = 0,
995995
.trackSel_video_frameCount = 0,
996996
.trackSel_video_boolAllocated = 0,
997-
.trackSel_video_state = 0,
998-
.trackSel_unk = 0,
997+
.trackSel_videoStateCurr = 0,
998+
.trackSel_videoStatePrev = 0,
999999

10001000
// CUP SELECT DYN
10011001
.cupSel_transitionState = 0,

include/ovr_230.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,10 @@ struct OverlayDATA_230
848848
// Also used in HighScore menu
849849
// 800b59b8 - UsaRetail
850850
// 800b625c - EurRetail
851-
short trackSel_video_state;
851+
short trackSel_videoStateCurr;
852852
// 800b59ba - UsaRetail
853853
// 800b625e - EurRetail
854-
short trackSel_unk;
854+
short trackSel_videoStatePrev;
855855

856856
// ============== Cup Select DYN ========================
857857

0 commit comments

Comments
 (0)