Skip to content

Commit 332045c

Browse files
committed
Bump rvid version to 5, and add a "for GBA" flag
1 parent de644c2 commit 332045c

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

common/rvidHeader.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ bool rvidNativeRefreshRate = false;
3434
int rvidHRes = 0;
3535
int rvidVRes = 0;
3636
bool rvidInterlaced = false;
37+
#ifndef __GBA__
3738
bool rvidDualScreen = false;
39+
bool rvidForGba = false;
40+
#endif
3841
int rvidOver256Colors = 0;
3942
bool rvidHasSound = false;
4043
u16 rvidSampleRate = 0;
@@ -66,6 +69,8 @@ void readRvidHeader(
6669
return;
6770
}
6871
#else
72+
rvidForGba = false;
73+
6974
u32
7075
#endif
7176

@@ -116,8 +121,9 @@ void readRvidHeader(
116121
rvidHRes = width16;
117122
break;
118123
case 3:
124+
case 4:
119125
#endif
120-
case 4: {
126+
case 5: {
121127
rvidHeaderInfo4 rvidHeader4;
122128
#ifdef __GBA__
123129
tonccpy(&rvidHeader4, rvid, sizeof(rvidHeader4));
@@ -140,7 +146,13 @@ void readRvidHeader(
140146
}
141147
rvidVRes = rvidHeader4.vRes;
142148
rvidInterlaced = rvidHeader4.interlaced;
143-
rvidDualScreen = rvidHeader4.dualScreen;
149+
#ifndef __GBA__
150+
if (rvidHeaderCheck.ver > 4 && rvidHeader4.dualScreen == 2) {
151+
rvidForGba = true;
152+
} else {
153+
rvidDualScreen = (rvidHeader4.dualScreen == 1);
154+
}
155+
#endif
144156
rvidSampleRate = rvidHeader4.sampleRate;
145157
#ifndef __GBA__
146158
rvidAudioIs16bit = rvidHeader4.audioBitMode;

common/rvidHeader.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef RVIDHEADER_H
22
#define RVIDHEADER_H
33

4-
#define latestRvidVer 4
4+
#define latestRvidVer 5
55

66
typedef struct rvidHeaderCheckInfo {
77
u32 formatString; // "RVID" string
@@ -40,7 +40,7 @@ typedef struct rvidHeaderInfo4 {
4040
u8 fps; // Frames per second
4141
u8 vRes; // Vertical resolution
4242
u8 interlaced; // Is interlaced
43-
u8 dualScreen; // Is dual screen video
43+
u8 dualScreen; // Is dual screen video, 2 = Video is for GBA
4444
u16 sampleRate; // Audio sample rate
4545
u8 audioBitMode; // 0 = 8-bit, 1 = 16-bit
4646
u8 bmpMode; // 0 = 8 BPP (RGB565), 1 = 16 BPP (RGB555), 2 = 16 BPP (RGB565)
@@ -66,7 +66,10 @@ extern bool rvidNativeRefreshRate;
6666
extern int rvidHRes;
6767
extern int rvidVRes;
6868
extern bool rvidInterlaced;
69+
#ifndef __GBA__
6970
extern bool rvidDualScreen;
71+
extern bool rvidForGba;
72+
#endif
7073
extern int rvidOver256Colors;
7174
extern bool rvidHasSound;
7275
extern u16 rvidSampleRate;

gba/source/main.iwram.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ int main(void)
333333

334334
readRvidHeader((const void*)0x08002000);
335335

336-
if (rvidHeaderCheck.formatString != 0x44495652 || rvidHeaderCheck.ver < 4 || rvidDualScreen) { // Old versions and dual-screen videos are not supported
336+
if (rvidHeaderCheck.formatString != 0x44495652 || rvidHeaderCheck.ver < 5) { // Old versions are not supported
337337
SetMode( MODE_4 | BG2_ON );
338338

339339
*(vu16*)BG_PALETTE = 0x001F; // Red screen

nds/arm9/source/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,9 @@ int playRvid(const char* filename) {
827827

828828
readRvidHeader(rvid[0]);
829829

830-
if (isGbMacro && rvidDualScreen) {
830+
if (rvidForGba) {
831+
return 7;
832+
} else if (isGbMacro && rvidDualScreen) {
831833
return 6;
832834
} else if (rvidFps > 60 && is3DS) {
833835
return 5;
@@ -1597,7 +1599,10 @@ int main(int argc, char **argv) {
15971599
}
15981600
consoleClear();
15991601
}
1600-
if (err == 6) {
1602+
if (err == 7) {
1603+
printf("Videos made for GBA are\n"
1604+
"not compatible.\n");
1605+
} else if (err == 6) {
16011606
printf("Cannot play dual-screen\n"
16021607
"videos on a single screen.\n");
16031608
} else if (err == 5) {

0 commit comments

Comments
 (0)