From 32beadac7b7e1b20db137e655848b1bf3d5b360c Mon Sep 17 00:00:00 2001 From: NotImplementedLife Date: Mon, 16 May 2022 11:01:37 +0300 Subject: [PATCH] cleanup Tip: always check your emulator frame skip settings before worrying why your program runs way too fast than it should :)) --- arm9/include/info.h | 2 +- arm9/include/ppm_list.h | 2 ++ arm9/include/tabsystem.h | 2 +- arm9/include/vars.h | 7 ------- arm9/source/info.c | 12 ++++++------ arm9/source/main.c | 10 ++++++---- arm9/source/ppm_list.c | 5 +++++ arm9/source/tabsystem.c | 11 +++++++---- arm9/source/vars.c | 2 -- 9 files changed, 28 insertions(+), 25 deletions(-) diff --git a/arm9/include/info.h b/arm9/include/info.h index 502672d..683b3fd 100644 --- a/arm9/include/info.h +++ b/arm9/include/info.h @@ -22,7 +22,7 @@ void infoPrintSoundFrequency(); void infoPrintSoundSize(); -extern void (*InfoLine[INFO_COUNT])(); +extern const void (*InfoLine[INFO_COUNT])(); extern u8 InfoScrollPos; diff --git a/arm9/include/ppm_list.h b/arm9/include/ppm_list.h index c1e890b..91d8bdd 100644 --- a/arm9/include/ppm_list.h +++ b/arm9/include/ppm_list.h @@ -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; diff --git a/arm9/include/tabsystem.h b/arm9/include/tabsystem.h index 32d7c3b..adca49f 100644 --- a/arm9/include/tabsystem.h +++ b/arm9/include/tabsystem.h @@ -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); diff --git a/arm9/include/vars.h b/arm9/include/vars.h index c03b1cf..f8c43d8 100644 --- a/arm9/include/vars.h +++ b/arm9/include/vars.h @@ -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 @@ -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]; diff --git a/arm9/source/info.c b/arm9/source/info.c index d51e2a3..05e9e6c 100644 --- a/arm9/source/info.c +++ b/arm9/source/info.c @@ -3,6 +3,7 @@ #include "console.h" #include "vars.h" #include "filesystem.h" +#include "ppm_list.h" void noprint(u8 r) {} @@ -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() @@ -37,7 +37,7 @@ void InfoPrintLockState() void InfoPrintFramePlaybackSpeed() { - iprintf("Playback Speed : %d",ppm_FramePlaybackSpeed); + iprintf("Playback Speed : %d", ppm_FramePlaybackSpeed); } void InfoPrintRecordingFramePlaybackSpeed() @@ -57,7 +57,7 @@ void infoPrintSoundSize() iprintf("BGM Size : %s",szstr); } -void (*InfoLine[INFO_COUNT])()= +const void (*InfoLine[INFO_COUNT])()= { InfoPrintFileNameLabel, InfoPrintFileNameValue, diff --git a/arm9/source/main.c b/arm9/source/main.c index c150209..8a77df0 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -9,7 +9,7 @@ #include "ui_list.h" #include "ppm_list.h" -void run_dbg() +/*void run_dbg() { consoleDemoInit(); fsInit(); @@ -42,7 +42,7 @@ void run_dbg() } exit(0); -} +}*/ int main(int argc, char ** argv) { @@ -77,9 +77,9 @@ int main(int argc, char ** argv) playerSwapBuffers(); playerClear(); displayThumbnail(); - + while(1) - { + { swiWaitForVBlank(); scanKeys(); uint32 input=keysDown(); @@ -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) { diff --git a/arm9/source/ppm_list.c b/arm9/source/ppm_list.c index 5d9f1e9..d445ed5 100644 --- a/arm9/source/ppm_list.c +++ b/arm9/source/ppm_list.c @@ -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; diff --git a/arm9/source/tabsystem.c b/arm9/source/tabsystem.c index f76c7a5..ea32887 100644 --- a/arm9/source/tabsystem.c +++ b/arm9/source/tabsystem.c @@ -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("*"); @@ -69,7 +69,7 @@ void ppmwr(void* item, int listpos, int is_highlighted) iprintf("%p", (void*)fd->name); } return; -} +}*/ void nextPage() { @@ -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 { @@ -226,8 +230,7 @@ void PlayTabDrawing() } void PlayTabPlayButtonPressed() -{ - //s16 index=7*CurrentPage+PageSelection; +{ s16 index = get_selected_file_index(); if(PlayerLoadedFileIndex!=index) { diff --git a/arm9/source/vars.c b/arm9/source/vars.c index 6007756..c7e9b94 100644 --- a/arm9/source/vars.c +++ b/arm9/source/vars.c @@ -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];