Skip to content

Commit 582ad1f

Browse files
info scrollable & player load bug repaired
1 parent f3299b0 commit 582ad1f

6 files changed

Lines changed: 38 additions & 20 deletions

File tree

FSPDS.cbp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<Unit filename="arm9/Makefile" />
4444
<Unit filename="arm9/include/console.h" />
4545
<Unit filename="arm9/include/filesystem.h" />
46+
<Unit filename="arm9/include/info.h" />
4647
<Unit filename="arm9/include/player.h" />
4748
<Unit filename="arm9/include/ppm.h" />
4849
<Unit filename="arm9/include/tabsystem.h" />

arm9/include/info.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
#ifndef FSPDS_INFO_H_INCLUDED
22
#define FSPDS_INFO_H_INCLUDED
33

4-
#define INFO_COUNT 7
4+
#define INFO_COUNT 9
55

66
void noprint(u8 r) {}
77

8-
void InfoPrintSeparatorLine(u8 r)
8+
void InfoPrintSeparatorLine()
99
{
10-
c_goto(r,1);
1110
for(u8 i=0;i<10;i++) iprintf("---");
1211
}
1312

14-
void InfoPrintFileNameLabel(u8 r)
13+
void InfoPrintFileNameLabel()
1514
{
16-
c_goto(r,1);
1715
iprintf("File name:");
1816
}
1917

20-
void InfoPrintFileNameValue(u8 r)
18+
void InfoPrintFileNameValue()
2119
{
22-
c_goto(r,2);
20+
iprintf(" ");
2321
iprintf(files[7*CurrentPage+PageSelection]);
2422
}
2523

26-
void InfoPrintFramesCount(u8 r)
24+
void InfoPrintFramesCount()
2725
{
28-
c_goto(r,1);
2926
iprintf("Frames count: %u",ppmHead_FrameCount);
3027
}
3128

32-
void InfoPrintLockState(u8 r)
29+
void InfoPrintLockState()
3330
{
34-
c_goto(r,1);
3531
iprintf("Locked : ");
3632
iprintf(ppmMeta_Lock?"YES":"NO ");
3733
}
3834

35+
void InfoPrintFramePlaybackSpeed()
36+
{
37+
iprintf("Playback Speed : %d",ppm_FramePlaybackSpeed);
38+
}
39+
3940
void (*InfoLine[INFO_COUNT])()=
4041
{
4142
InfoPrintFileNameLabel,
@@ -44,19 +45,26 @@ void (*InfoLine[INFO_COUNT])()=
4445
InfoPrintFramesCount,
4546
InfoPrintSeparatorLine,
4647
InfoPrintLockState,
47-
InfoPrintSeparatorLine
48+
InfoPrintSeparatorLine,
49+
InfoPrintFramePlaybackSpeed,
50+
InfoPrintSeparatorLine,
4851
};
4952

5053
u8 InfoScrollPos=0;
5154

5255
void InfoDisplay()
5356
{
57+
consoleSetWindow(&consoleFG,1,1,30,22);
58+
consoleClear();
59+
c_goto(0,0);
5460
for(u8 i=1,p=InfoScrollPos;i<31;i++)
5561
{
5662
if(p>=INFO_COUNT)
5763
break;
5864
InfoLine[p++](i);
65+
iprintf("\n");
5966
}
67+
consoleSetWindow(&consoleFG,0,0,32,24);
6068
}
6169

6270

arm9/include/player.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ void playerNextFrame()
183183
if(x-tX>=256) break;
184184
u8 dx=(x-tX);
185185
layer[BL+c]^= ((bool)(layerA[BA+(dx>>3)]&(1<<(dx&0x7))))<<b;
186-
187186
}
188187
}
189188
}
@@ -205,9 +204,9 @@ void playerNextFrame()
205204
layer1Color=FlipnoteColors[layer1Color];
206205
layer2Color=FlipnoteColors[layer2Color];
207206

208-
for(u16 y=0;y<192;y++)
207+
for(u16 y=0,yy=0;y<192;y++)
209208
{
210-
u16 yy=(y<<5);
209+
//u16 yy=(y<<5);
211210
for(u8 c=32;c--;yy++)
212211
{
213212
for(u8 b=0;b<8;b++)

arm9/include/ppm.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ void ppm_loadMetadata()
2727
fseek(fp,36,SEEK_CUR); // skip filenames - redundant data
2828
fread(ppmMeta_RootAuthorId,8,1,fp);
2929
fread(&ppmMeta_Timestamp,sizeof(u32),1,fp);
30+
31+
// Jump to frame playback speed
32+
fseek(fp,-ppmHead_SoundDataSize-0xA0,SEEK_END);
33+
fread(&ppm_FramePlaybackSpeed,1,1, fp);
34+
ppm_FramePlaybackSpeed=8-ppm_FramePlaybackSpeed;
3035
fclose(fp);
3136
}
3237

@@ -42,9 +47,6 @@ void ppm_loadAnimationData()
4247
ppmHead_FrameCount++;
4348
/// Assume size of frame offset table is 4*FrameCount, we don't need that
4449
/// Jump directly to flags
45-
//fseek(PPM_Current,0x6A0,SEEK_SET);
46-
//fread(&ppmADat_0x6A0,2,1,PPM_Current);
47-
//fseek(PPM_Current,4,SEEK_CUR);
4850
fseek(PPM_Current,0x6A6,SEEK_SET);
4951
fread(&ppmADat_0x6A6,2,1,PPM_Current);
5052
// read offset table

arm9/include/tabsystem.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ void InfoTabKeyDown(u32 input)
8080
if(InfoScrollPos<INFO_COUNT-1)
8181
{
8282
InfoScrollPos++;
83-
InfoTabDrawing(); // ! expensive
83+
InfoDisplay();
8484
}
8585
}
8686
else if(input & KEY_UP)
8787
{
8888
if(InfoScrollPos>0)
8989
{
9090
InfoScrollPos--;
91-
InfoTabDrawing();
91+
InfoDisplay();
9292
}
9393
}
9494
}
@@ -103,6 +103,10 @@ void PlayTabLoading()
103103
PlayerForceAnimationReload=false;
104104
PlayerLoadedFileIndex=7*CurrentPage+PageSelection;
105105
}
106+
else
107+
{
108+
109+
}
106110
}
107111

108112
const char* PlayButton="\033[10;14H\026\027 \033[11;14H\002\002\026\027\033[12;14H\002\002\x18\x19\033[13;14H\x18\x19 ";
@@ -127,7 +131,9 @@ void PlayTabPlayButtonPressed()
127131
{
128132
c_goto(18,10);
129133
iprintf("Loading...");
134+
PlayerFrameIndex=0;
130135
ppm_loadAnimationData();
136+
PlayerLoadedFileIndex=7*CurrentPage+PageSelection;
131137
c_goto(18,10);
132138
iprintf(" ");
133139
PlayerLoadedFileIndex=index;

arm9/include/vars.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ u8 ppmMeta_CurrentAuthorId[8];
2727
u8 ppmMeta_RootAuthorId[8];
2828
u32 ppmMeta_Timestamp;
2929

30+
u8 ppm_FramePlaybackSpeed;
31+
3032
FILE* PPM_Current;
3133

3234
///u16 ppmADat_0x6A0; // Size of frame offset table

0 commit comments

Comments
 (0)