Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Tip: always check your emulator frame skip settings before worrying why your program runs way too fast than it should :))
  • Loading branch information
NotImplementedLife committed May 16, 2022
1 parent bfed6c1 commit 32beada
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion arm9/include/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void infoPrintSoundFrequency();

void infoPrintSoundSize();

extern void (*InfoLine[INFO_COUNT])();
extern const void (*InfoLine[INFO_COUNT])();

extern u8 InfoScrollPos;

Expand Down
2 changes: 2 additions & 0 deletions arm9/include/ppm_list.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#pragma once

#include "ui_list.h"
#include "filesystem.h"

extern char* ppm_current_path;

char* get_selected_file_name();
int get_selected_file_index();
file_data* get_selected_file_data();

extern UiList ppm_list;
extern ListItemsSource ppm_source;
Expand Down
2 changes: 1 addition & 1 deletion arm9/include/tabsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ void PlayTabLeaving();
void initTabs();


void ppmwr(void* item, int listpos, int is_highlighted);
// void ppmwr(void* item, int listpos, int is_highlighted);
7 changes: 0 additions & 7 deletions arm9/include/vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

extern touchPosition touch;

#define MAXFILESCOUNT 1024
extern int filescount;
extern char files[MAXFILESCOUNT][29];
extern char sizes[MAXFILESCOUNT][7];

extern int PagesCount, PageSelection, CurrentPage;

/// PPM file data
Expand All @@ -34,8 +29,6 @@ extern u32 ppmMeta_Timestamp;
extern u8 ppm_FramePlaybackSpeed;
extern const u8 frameTime[9];

extern FILE* PPM_Current;

extern u16 ppmADat_0x6A6; // Flags
extern u32 ppm_OffsetTable[999];
extern u8 ppm_AnimationData[1<<20];
Expand Down
12 changes: 6 additions & 6 deletions arm9/source/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "console.h"
#include "vars.h"
#include "filesystem.h"
#include "ppm_list.h"

void noprint(u8 r) {}

Expand All @@ -18,10 +19,9 @@ void InfoPrintFileNameLabel()

void InfoPrintFileNameValue()
{
iprintf(" ");
char* fn = get_selected_file_name();
iprintf(fn);
free(fn);
iprintf(" ");
char* fn = get_selected_file_data()->name;
iprintf(fn);
}

void InfoPrintFramesCount()
Expand All @@ -37,7 +37,7 @@ void InfoPrintLockState()

void InfoPrintFramePlaybackSpeed()
{
iprintf("Playback Speed : %d",ppm_FramePlaybackSpeed);
iprintf("Playback Speed : %d", ppm_FramePlaybackSpeed);
}

void InfoPrintRecordingFramePlaybackSpeed()
Expand All @@ -57,7 +57,7 @@ void infoPrintSoundSize()
iprintf("BGM Size : %s",szstr);
}

void (*InfoLine[INFO_COUNT])()=
const void (*InfoLine[INFO_COUNT])()=
{
InfoPrintFileNameLabel,
InfoPrintFileNameValue,
Expand Down
10 changes: 6 additions & 4 deletions arm9/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "ui_list.h"
#include "ppm_list.h"

void run_dbg()
/*void run_dbg()
{
consoleDemoInit();
fsInit();
Expand Down Expand Up @@ -42,7 +42,7 @@ void run_dbg()
}
exit(0);
}
}*/

int main(int argc, char ** argv)
{
Expand Down Expand Up @@ -77,9 +77,9 @@ int main(int argc, char ** argv)
playerSwapBuffers();
playerClear();
displayThumbnail();

while(1)
{
{
swiWaitForVBlank();
scanKeys();
uint32 input=keysDown();
Expand Down Expand Up @@ -114,6 +114,8 @@ int main(int argc, char ** argv)

if(PlayerState==PLAYING)
{
//c_goto(0,0);
//iprintf("%i %i %i", ppm_FramePlaybackSpeed, frameTime[ppm_FramePlaybackSpeed], counter);
counter++;
if(counter==1)
{
Expand Down
5 changes: 5 additions & 0 deletions arm9/source/ppm_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ int get_selected_file_index()
return ppm_source.selected_index;
}

file_data* get_selected_file_data()
{
return (file_data*)lis_get_selected_item(&ppm_source);
}

UiList ppm_list;
ListItemsSource ppm_source;

Expand Down
11 changes: 7 additions & 4 deletions arm9/source/tabsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void ppm_write_entry(void* item, int listpos, int is_highlighted)
iprintf(fd->size_str);
}

void ppmwr(void* item, int listpos, int is_highlighted)
/*void ppmwr(void* item, int listpos, int is_highlighted)
{
c_goto(1+listpos,1);
if(is_highlighted) iprintf("*");
Expand All @@ -69,7 +69,7 @@ void ppmwr(void* item, int listpos, int is_highlighted)
iprintf("%p", (void*)fd->name);
}
return;
}
}*/

void nextPage()
{
Expand Down Expand Up @@ -203,6 +203,10 @@ void PlayTabLoading()
{
c_loadingBox();
loadFlipnote();
//c_goto(2,2);
//c_displayError("CHECKPOINT!\nYou need custom papers\n\n",false);
//iprintf("%i %i", ppm_FramePlaybackSpeed, frameTime[ppm_FramePlaybackSpeed]);
//while(1) { swiWaitForVBlank();}
}
else
{
Expand All @@ -226,8 +230,7 @@ void PlayTabDrawing()
}

void PlayTabPlayButtonPressed()
{
//s16 index=7*CurrentPage+PageSelection;
{
s16 index = get_selected_file_index();
if(PlayerLoadedFileIndex!=index)
{
Expand Down
2 changes: 0 additions & 2 deletions arm9/source/vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ u32 ppmMeta_Timestamp;
u8 ppm_FramePlaybackSpeed;
const u8 frameTime[9]= { 2, 120, 60, 30, 15, 10, 5, 3, 2 };

FILE* PPM_Current;

u16 ppmADat_0x6A6; // Flags
u32 ppm_OffsetTable[999];
u8 ppm_AnimationData[1<<20];
Expand Down

0 comments on commit 32beada

Please sign in to comment.