Commit 7ebabc9e authored by natalie's avatar natalie 💜
Browse files

Scope cleanup

parent 5967fca2
......@@ -14,7 +14,7 @@
static const char* TAG = "Loader";
uint8_t Loader_CurLoop = 0;
static uint8_t Loader_CurLoop = 0;
EventGroupHandle_t Loader_Status;
StaticEventGroup_t Loader_StatusBuf;
......@@ -23,15 +23,15 @@ StaticEventGroup_t Loader_BufStatusBuf;
FILE *Loader_File;
FILE *Loader_PcmFile;
VgmInfoStruct_t *Loader_VgmInfo;
uint8_t Loader_VgmDataBlockIndex = 0;
static uint8_t Loader_VgmDataBlockIndex = 0;
volatile VgmDataBlockStruct_t Loader_VgmDataBlocks[MAX_REALTIME_DATABLOCKS+1];
bool Loader_RequestedDacStreamFindStart = false;
uint8_t Loader_VgmBuf[FREAD_LOCAL_BUF];
uint16_t Loader_VgmBufPos = FREAD_LOCAL_BUF;
IRAM_ATTR uint32_t Loader_VgmFilePos = 0;
static bool Loader_RequestedDacStreamFindStart = false;
static uint8_t Loader_VgmBuf[FREAD_LOCAL_BUF];
static uint16_t Loader_VgmBufPos = FREAD_LOCAL_BUF;
static IRAM_ATTR uint32_t Loader_VgmFilePos = 0;
volatile bool Loader_IgnoreZeroSampleLoops = true;
volatile bool Loader_FastOpnaUpload = false;
bool Loader_HitLoop = false;
static bool Loader_HitLoop = false;
static bool Loader_IsBad = false;
//local buffer thingie. big speedup
......@@ -102,9 +102,9 @@ bool Loader_Setup() {
return true;
}
IRAM_ATTR uint32_t Loader_PcmPos = 0;
IRAM_ATTR uint32_t Loader_PcmOff = 0;
uint32_t Loader_GetPcmOffset(uint32_t PcmPos) {
static IRAM_ATTR uint32_t Loader_PcmPos = 0;
static IRAM_ATTR uint32_t Loader_PcmOff = 0;
static uint32_t Loader_GetPcmOffset(uint32_t PcmPos) {
uint32_t consumed = 0;
for (uint8_t i=0;i<Loader_VgmDataBlockIndex;i++) {
if (Loader_VgmDataBlocks[i].Type == 0) { //0 = ym2612 pcm
......@@ -127,10 +127,10 @@ static void file_error() {
ESP_LOGE(TAG, "IO error");
}
IRAM_ATTR uint32_t Loader_Pending = 0;
bool Loader_EndReached = false;
uint8_t Loader_PcmBuf[FREAD_LOCAL_BUF];
uint16_t Loader_PcmBufUsed = FREAD_LOCAL_BUF;
static IRAM_ATTR uint32_t Loader_Pending = 0;
static bool Loader_EndReached = false;
static uint8_t Loader_PcmBuf[FREAD_LOCAL_BUF];
static uint16_t Loader_PcmBufUsed = FREAD_LOCAL_BUF;
static IRAM_ATTR uint32_t adjustedprio = false;
void Loader_Main() {
ESP_LOGI(TAG, "Task start");
......
......@@ -17,8 +17,8 @@
static const char* TAG = "OptionsMgr";
volatile bool OptionsMgr_Unsaved = false;
volatile uint8_t OptionsMgr_ShittyTimer = 0;
static volatile bool OptionsMgr_Unsaved = false;
static volatile uint8_t OptionsMgr_ShittyTimer = 0;
const char *OptionCatNames[OPTION_CATEGORY_COUNT] = {
"General",
......
......@@ -55,8 +55,6 @@ typedef struct {
extern const option_t Options[];
extern const char *OptionCatNames[];
extern volatile bool OptionsMgr_Unsaved;
void OptionsMgr_Setup();
void OptionsMgr_Main();
void OptionsMgr_Touch();
......
......@@ -83,7 +83,7 @@ FILE *Player_PcmFile;
FILE *Player_DsFindFile;
FILE *Player_DsFillFile;
VgmInfoStruct_t Player_Info;
IRAM_ATTR uint32_t notif = 0;
static IRAM_ATTR uint32_t notif = 0;
volatile uint8_t Player_LoopCount = 2;
volatile RepeatMode_t Player_RepeatMode = REPEAT_ALL;
......@@ -96,11 +96,12 @@ char Player_Gd3_Title[PLAYER_GD3_FIELD_SIZES+1];
char Player_Gd3_Game[PLAYER_GD3_FIELD_SIZES+1];
char Player_Gd3_Author[PLAYER_GD3_FIELD_SIZES+1];
bool stopped = true;
const static char* unvgztmp = "/sd/.mega/unvgz.tmp";
bool Player_NextTrk(bool UserSpecified) { //returns true if there is now a track playing
static bool Player_StartTrack(char *FilePath);
static bool Player_StopTrack();
static bool Player_NextTrk(bool UserSpecified) { //returns true if there is now a track playing
Player_StopTrack();
if (!UserSpecified && Player_RepeatMode == REPEAT_ONE) {
//nothing to do - just start the same track again
......@@ -121,7 +122,7 @@ bool Player_NextTrk(bool UserSpecified) { //returns true if there is now a track
return true;
}
bool Player_PrevTrk(bool UserSpecified) { //returns true if there is now a track playing
static bool Player_PrevTrk(bool UserSpecified) { //returns true if there is now a track playing
Player_StopTrack();
if (!UserSpecified && Player_RepeatMode == REPEAT_ONE) {
//nothing to do - just start the same track again
......@@ -357,7 +358,7 @@ static tinfl_status Player_Unvgz(char *FilePath, bool ReplaceOriginalFile) {
return status;
}
bool Player_StartTrack(char *FilePath) {
static bool Player_StartTrack(char *FilePath) {
const char *OpenFilePath = FilePath;
ESP_LOGI(TAG, "Checking file type of %s", FilePath);
......@@ -627,7 +628,7 @@ bool Player_StartTrack(char *FilePath) {
return true;
}
bool Player_StopTrack() {
static bool Player_StopTrack() {
Ui_NowPlaying_DataAvail = false;
ESP_LOGI(TAG, "Requesting driver stop...");
......
......@@ -41,8 +41,6 @@ extern volatile uint8_t Player_LoopCount;
extern volatile RepeatMode_t Player_RepeatMode;
extern volatile bool Player_UnvgzReplaceOriginal;
bool Player_StartTrack(char *FilePath);
bool Player_StopTrack();
void Player_Main();
bool Player_Setup();
......
......@@ -20,40 +20,38 @@
static const char* TAG = "Ui_FileBrowser";
static IRAM_ATTR lv_obj_t *container;
lv_style_t filestyle;
lv_style_t filestyle_sel;
lv_style_t filelabelstyle_dir;
lv_style_t filelabelstyle_aud;
lv_style_t filelabelstyle_other;
lv_style_t filelabelstyle_fw;
IRAM_ATTR lv_obj_t *files[10];
IRAM_ATTR lv_obj_t *labels[10];
IRAM_ATTR lv_obj_t *icons[10];
static lv_style_t filestyle;
static lv_style_t filestyle_sel;
static lv_style_t filelabelstyle_dir;
static lv_style_t filelabelstyle_aud;
static lv_style_t filelabelstyle_other;
static lv_style_t filelabelstyle_fw;
static IRAM_ATTR lv_obj_t *files[10];
static IRAM_ATTR lv_obj_t *labels[10];
static IRAM_ATTR lv_obj_t *icons[10];
static IRAM_ATTR lv_obj_t *preload;
IRAM_ATTR lv_obj_t *scrollbar;
lv_style_t scrollbarstyle;
static IRAM_ATTR lv_obj_t *scrollbar;
static lv_style_t scrollbarstyle;
uint16_t selectedfile = 0;
uint16_t selectedfile_last = 0xff;
uint16_t diroffset = 0;
static uint16_t selectedfile = 0;
static uint16_t selectedfile_last = 0xff;
static uint16_t diroffset = 0;
char startpath[] = "/sd";
char path[264];
char temppath[264];
DIR *dir;
struct dirent *ent;
static char startpath[] = "/sd";
static char path[264];
static char temppath[264];
static DIR *dir;
static struct dirent *ent;
static char direntry_cache[FILEBROWSER_CACHE_SIZE];
static IRAM_ATTR uint32_t direntry_offset[FILEBROWSER_CACHE_MAXENTRIES];
static uint16_t direntry_count = 0;
static volatile bool direntry_invalidated = false;
void openselection();
void redrawselection();
void redrawlist();
void startdir(bool docache);
void backdir();
static void openselection();
static void startdir(bool docache);
static void backdir();
static const char thumbsdb[] = "Thumbs.db";
static const char sysvolinfo[] = "System Volume Information";
......@@ -96,7 +94,7 @@ static int comp(const void *offset1, const void *offset2) {
}
}
void cachedir(char *dir_name) {
static void cachedir(char *dir_name) {
ESP_LOGI(TAG, "generating dir cache for %s...", dir_name);
uint32_t s = xthal_get_ccount();
dir = opendir(dir_name);
......@@ -133,7 +131,7 @@ void cachedir(char *dir_name) {
}
}
void savelast() {
static void savelast() {
FILE *last;
last = fopen("/sd/.mega/fbrowser.las", "w");
if (!last) {
......@@ -176,7 +174,7 @@ void savelast() {
ESP_LOGI(TAG, "dumped fbrowser.las");
}
bool loadhistory() {
static bool loadhistory() {
//this shit will ASPLODE if you're more than 8 dirs deep RIP
//could rewrite it to iterate forward through the dirs starting at root
FILE *last;
......@@ -295,7 +293,7 @@ static int32_t map(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, i
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void updatescrollbar() {
static void updatescrollbar() {
uint32_t toffset = diroffset + selectedfile;
uint32_t df = direntry_count;
if (df > 100) df = 100;
......@@ -434,7 +432,7 @@ void Ui_FileBrowser_Destroy() {
LcdDma_Mutex_Give();
}
void redrawlistsel(bool list, bool sel) {
static void redrawlistsel(bool list, bool sel) {
uint8_t u=0;
LcdDma_Mutex_Take(pdMS_TO_TICKS(1000));
for (uint16_t i=diroffset;i<diroffset+10;i++) {
......@@ -523,7 +521,7 @@ void redrawlistsel(bool list, bool sel) {
LcdDma_Mutex_Give();
}
void opendirectory() {
static void opendirectory() {
ESP_LOGI(TAG, "browser enter %s", path);
diroffset = 0;
......@@ -563,7 +561,7 @@ static uint32_t dumpm3u() {
return r;
}
void m3u2m3u() {
static void m3u2m3u() {
FILE *p;
p = fopen("/sd/.mega/temp.m3u", "w");
if (!p) {
......@@ -587,7 +585,7 @@ void m3u2m3u() {
fclose(p);
}
void openselection() {
static void openselection() {
char *name = direntry_cache + direntry_offset[diroffset + selectedfile];
unsigned char type = direntry_cache[direntry_offset[diroffset + selectedfile]-1];
if (type == DT_DIR) {
......@@ -649,7 +647,7 @@ void openselection() {
}
}
void backdir() {
static void backdir() {
uint16_t l = 0xffff;
for (uint16_t i=0;i<strlen(path);i++) {
if (path[i] == '/') l = i;
......@@ -671,7 +669,7 @@ void backdir() {
startdir(false);
}
void startdir(bool docache) {
static void startdir(bool docache) {
if (docache) cachedir(path);
redrawlistsel(true, true);
updatescrollbar();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment