mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Added ID3 database support. Still very early.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5575 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fc53fd708f
commit
8a5de5fec9
8 changed files with 1386 additions and 812 deletions
|
@ -24,6 +24,8 @@ sound_menu.c
|
||||||
status.c
|
status.c
|
||||||
talk.c
|
talk.c
|
||||||
tree.c
|
tree.c
|
||||||
|
dbtree.c
|
||||||
|
filetree.c
|
||||||
wps-display.c
|
wps-display.c
|
||||||
wps.c
|
wps.c
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
|
343
apps/dbtree.c
Normal file
343
apps/dbtree.c
Normal file
|
@ -0,0 +1,343 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "file.h"
|
||||||
|
#include "screens.h"
|
||||||
|
#include "kernel.h"
|
||||||
|
#include "tree.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "icons.h"
|
||||||
|
#include "status.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "button.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "main_menu.h"
|
||||||
|
#include "mpeg.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "ata.h"
|
||||||
|
#include "wps.h"
|
||||||
|
#include "filetypes.h"
|
||||||
|
#include "applimits.h"
|
||||||
|
#include "dbtree.h"
|
||||||
|
#include "icons.h"
|
||||||
|
|
||||||
|
#ifdef LITTLE_ENDIAN
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#define BE32(_x_) htonl(_x_)
|
||||||
|
#else
|
||||||
|
#define BE32(_x_) _x_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int fd;
|
||||||
|
|
||||||
|
static int
|
||||||
|
songstart, albumstart, artiststart,
|
||||||
|
songcount, albumcount, artistcount,
|
||||||
|
songlen, songarraylen,
|
||||||
|
albumlen, albumarraylen,
|
||||||
|
artistlen;
|
||||||
|
|
||||||
|
int db_init(void)
|
||||||
|
{
|
||||||
|
unsigned int version;
|
||||||
|
unsigned int buf[12];
|
||||||
|
|
||||||
|
fd = open(ROCKBOX_DIR "/rockbox.id3db", O_RDONLY);
|
||||||
|
if (fd < 0) {
|
||||||
|
DEBUGF("Failed opening database\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
read(fd, buf, 48);
|
||||||
|
|
||||||
|
version = BE32(buf[0]) & 0xff;
|
||||||
|
DEBUGF("Version: RDB%d\n", version);
|
||||||
|
|
||||||
|
songstart = BE32(buf[1]);
|
||||||
|
songcount = BE32(buf[2]);
|
||||||
|
songlen = BE32(buf[3]);
|
||||||
|
DEBUGF("Number of songs: %d\n", songcount);
|
||||||
|
DEBUGF("Songstart: %x\n", songstart);
|
||||||
|
DEBUGF("Songlen: %d\n", songlen);
|
||||||
|
|
||||||
|
albumstart = BE32(buf[4]);
|
||||||
|
albumcount = BE32(buf[5]);
|
||||||
|
albumlen = BE32(buf[6]);
|
||||||
|
songarraylen = BE32(buf[7]);
|
||||||
|
DEBUGF("Number of albums: %d\n", albumcount);
|
||||||
|
DEBUGF("Albumstart: %x\n", albumstart);
|
||||||
|
DEBUGF("Albumlen: %d\n", albumlen);
|
||||||
|
|
||||||
|
artiststart = BE32(buf[8]);
|
||||||
|
artistcount = BE32(buf[9]);
|
||||||
|
artistlen = BE32(buf[10]);
|
||||||
|
albumarraylen = BE32(buf[11]);
|
||||||
|
DEBUGF("Number of artists: %d\n", artistcount);
|
||||||
|
DEBUGF("Artiststart: %x\n", artiststart);
|
||||||
|
DEBUGF("Artistlen: %d\n", artistlen);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int db_load(struct tree_context* c, bool* dir_buffer_full)
|
||||||
|
{
|
||||||
|
int i, offset, len, rc;
|
||||||
|
int dcachesize = global_settings.max_files_in_dir * sizeof(struct entry);
|
||||||
|
int max_items, itemcount, stringlen;
|
||||||
|
unsigned int* nptr = (void*) c->name_buffer;
|
||||||
|
unsigned int* dptr = c->dircache;
|
||||||
|
unsigned int* safeplace = NULL;
|
||||||
|
|
||||||
|
int table = c->currtable;
|
||||||
|
int extra = c->currextra;
|
||||||
|
c->dentry_size = 2 * sizeof(int);
|
||||||
|
|
||||||
|
DEBUGF("db_load(%d, %x)\n", table, extra);
|
||||||
|
|
||||||
|
if (!table) {
|
||||||
|
table = allartists;
|
||||||
|
c->currtable = table;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (table) {
|
||||||
|
case allsongs:
|
||||||
|
offset = songstart;
|
||||||
|
itemcount = songcount;
|
||||||
|
stringlen = songlen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case allalbums:
|
||||||
|
offset = albumstart;
|
||||||
|
itemcount = albumcount;
|
||||||
|
stringlen = albumlen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case allartists:
|
||||||
|
offset = artiststart;
|
||||||
|
itemcount = artistcount;
|
||||||
|
stringlen = artistlen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case albums:
|
||||||
|
/* 'extra' is offset to the artist */
|
||||||
|
len = albumarraylen * 4;
|
||||||
|
safeplace = (void*)(c->name_buffer + c->name_buffer_size - len);
|
||||||
|
//DEBUGF("Seeking to %x\n", extra + artistlen);
|
||||||
|
lseek(fd, extra + artistlen, SEEK_SET);
|
||||||
|
rc = read(fd, safeplace, len);
|
||||||
|
if (rc < len)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
#ifdef LITTLE_ENDIAN
|
||||||
|
for (i=0; i<albumarraylen; i++)
|
||||||
|
safeplace[i] = BE32(safeplace[i]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
offset = safeplace[0];
|
||||||
|
itemcount = albumarraylen;
|
||||||
|
stringlen = albumlen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case songs:
|
||||||
|
/* 'extra' is offset to the album */
|
||||||
|
len = songarraylen * 4;
|
||||||
|
safeplace = (void*)(c->name_buffer + c->name_buffer_size - len);
|
||||||
|
//DEBUGF("Seeking to %x\n", extra + albumlen + 4);
|
||||||
|
lseek(fd, extra + albumlen + 4, SEEK_SET);
|
||||||
|
rc = read(fd, safeplace, len);
|
||||||
|
if (rc < len)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
#ifdef LITTLE_ENDIAN
|
||||||
|
for (i=0; i<songarraylen; i++)
|
||||||
|
safeplace[i] = BE32(safeplace[i]);
|
||||||
|
#endif
|
||||||
|
offset = safeplace[0];
|
||||||
|
itemcount = songarraylen;
|
||||||
|
stringlen = songlen;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DEBUGF("Unsupported table %d\n", table);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
max_items = dcachesize / c->dentry_size;
|
||||||
|
|
||||||
|
if (!safeplace) {
|
||||||
|
//DEBUGF("Seeking to %x\n", offset);
|
||||||
|
lseek(fd, offset, SEEK_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* name_buffer (nptr) contains only names, null terminated.
|
||||||
|
the first word of dcache (dptr) is a pointer to the name,
|
||||||
|
the rest is table specific. see below. */
|
||||||
|
|
||||||
|
if (itemcount > max_items)
|
||||||
|
if (dir_buffer_full)
|
||||||
|
*dir_buffer_full = true;
|
||||||
|
|
||||||
|
if (max_items > itemcount) {
|
||||||
|
max_items = itemcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i=0; i < max_items; i++ ) {
|
||||||
|
int rc, skip=0;
|
||||||
|
|
||||||
|
if (safeplace) {
|
||||||
|
if (!safeplace[i])
|
||||||
|
break;
|
||||||
|
//DEBUGF("Seeking to %x\n", safeplace[i]);
|
||||||
|
lseek(fd, safeplace[i], SEEK_SET);
|
||||||
|
offset = safeplace[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read name */
|
||||||
|
rc = read(fd, nptr, stringlen);
|
||||||
|
if (rc < stringlen)
|
||||||
|
{
|
||||||
|
DEBUGF("%d read(%d) returned %d\n", i, stringlen, rc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* store name pointer in dir cache */
|
||||||
|
dptr[0] = (unsigned int)nptr;
|
||||||
|
|
||||||
|
switch (table) {
|
||||||
|
case songs:
|
||||||
|
case allsongs:
|
||||||
|
/* save offset of this song */
|
||||||
|
skip = 12;
|
||||||
|
dptr[1] = offset;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case allalbums:
|
||||||
|
case albums:
|
||||||
|
/* save offset of this album */
|
||||||
|
skip = songarraylen * 4 + 4;
|
||||||
|
dptr[1] = offset;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case allartists:
|
||||||
|
/* save offset of this artist */
|
||||||
|
skip = albumarraylen * 4;
|
||||||
|
dptr[1] = offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DEBUGF("%x: %s\n", dptr[1], dptr[0]);
|
||||||
|
|
||||||
|
if (skip)
|
||||||
|
lseek(fd, skip, SEEK_CUR);
|
||||||
|
|
||||||
|
/* next name is stored immediately after this */
|
||||||
|
nptr = (void*)nptr + strlen((char*)nptr) + 1;
|
||||||
|
if ((void*)nptr > (void*)c->name_buffer + c->name_buffer_size) {
|
||||||
|
DEBUGF("Name buffer overflow (%d)\n",i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dptr = (void*)dptr + c->dentry_size;
|
||||||
|
|
||||||
|
if (!safeplace)
|
||||||
|
offset += stringlen + skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->filesindir = i;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void db_enter(struct tree_context* c)
|
||||||
|
{
|
||||||
|
switch (c->currtable) {
|
||||||
|
case allartists:
|
||||||
|
case albums:
|
||||||
|
c->dirpos[c->dirlevel] = c->dirstart;
|
||||||
|
c->cursorpos[c->dirlevel] = c->dircursor;
|
||||||
|
c->table_history[c->dirlevel] = c->currtable;
|
||||||
|
c->extra_history[c->dirlevel] = c->currextra;
|
||||||
|
c->dirlevel++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (c->currtable) {
|
||||||
|
case allartists:
|
||||||
|
c->currtable = albums;
|
||||||
|
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case albums:
|
||||||
|
c->currtable = songs;
|
||||||
|
c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case songs:
|
||||||
|
splash(HZ,true,"No playing implemented yet");
|
||||||
|
#if 0
|
||||||
|
/* find filenames, build playlist, play */
|
||||||
|
playlist_create(NULL,NULL);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->dirstart = c->dircursor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void db_exit(struct tree_context* c)
|
||||||
|
{
|
||||||
|
c->dirlevel--;
|
||||||
|
c->dirstart = c->dirpos[c->dirlevel];
|
||||||
|
c->dircursor = c->cursorpos[c->dirlevel];
|
||||||
|
c->currtable = c->table_history[c->dirlevel];
|
||||||
|
c->currextra = c->extra_history[c->dirlevel];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
const char* db_get_icon(struct tree_context* c)
|
||||||
|
{
|
||||||
|
int icon;
|
||||||
|
|
||||||
|
switch (c->currtable)
|
||||||
|
{
|
||||||
|
case allsongs:
|
||||||
|
case songs:
|
||||||
|
icon = File;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
icon = Folder;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap_icons_6x8[icon];
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int db_get_icon(struct tree_context* c)
|
||||||
|
{
|
||||||
|
(void)c;
|
||||||
|
return Folder;
|
||||||
|
}
|
||||||
|
#endif
|
39
apps/dbtree.h
Normal file
39
apps/dbtree.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef DBTREE_H
|
||||||
|
#define DBTREE_H
|
||||||
|
|
||||||
|
#include "tree.h"
|
||||||
|
|
||||||
|
enum table { invalid, allsongs, allalbums, allartists, albums, songs };
|
||||||
|
|
||||||
|
int db_init(void);
|
||||||
|
void db_enter(struct tree_context* c);
|
||||||
|
void db_exit(struct tree_context* c);
|
||||||
|
int db_load(struct tree_context* c,
|
||||||
|
bool* dir_buffer_full);
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
const char* db_get_icon(struct tree_context* c);
|
||||||
|
#else
|
||||||
|
int db_get_icon(struct tree_context* c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
509
apps/filetree.c
Normal file
509
apps/filetree.c
Normal file
|
@ -0,0 +1,509 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <file.h>
|
||||||
|
#include <dir.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <kernel.h>
|
||||||
|
#include <lcd.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <font.h>
|
||||||
|
#include "bookmark.h"
|
||||||
|
#include "tree.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "filetypes.h"
|
||||||
|
#include "talk.h"
|
||||||
|
#include "playlist.h"
|
||||||
|
#include "wps-display.h"
|
||||||
|
#include "lang.h"
|
||||||
|
#include "language.h"
|
||||||
|
#include "screens.h"
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "rolo.h"
|
||||||
|
|
||||||
|
static int boot_size = 0;
|
||||||
|
static int boot_cluster;
|
||||||
|
extern bool boot_changed;
|
||||||
|
|
||||||
|
int ft_build_playlist(struct tree_context* c, int start_index)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int start=start_index;
|
||||||
|
|
||||||
|
struct entry *dircache = c->dircache;
|
||||||
|
|
||||||
|
for(i = 0;i < c->filesindir;i++)
|
||||||
|
{
|
||||||
|
if((dircache[i].attr & TREE_ATTR_MASK) == TREE_ATTR_MPA)
|
||||||
|
{
|
||||||
|
DEBUGF("Adding %s\n", dircache[i].name);
|
||||||
|
if (playlist_add(dircache[i].name) < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Adjust the start index when se skip non-MP3 entries */
|
||||||
|
if(i < start)
|
||||||
|
start_index--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return start_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* walk a directory and check all dircache entries if a .talk file exists */
|
||||||
|
static void check_file_thumbnails(struct tree_context* c)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct dirent *entry;
|
||||||
|
struct entry* dircache = c->dircache;
|
||||||
|
DIR *dir;
|
||||||
|
|
||||||
|
dir = opendir(c->currdir);
|
||||||
|
if(!dir)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i=0; i < c->filesindir; i++) /* mark all files as non talking, except the .talk ones */
|
||||||
|
{
|
||||||
|
if (dircache[i].attr & ATTR_DIRECTORY)
|
||||||
|
continue; /* we're not touching directories */
|
||||||
|
|
||||||
|
if (strcasecmp(file_thumbnail_ext,
|
||||||
|
&dircache[i].name[strlen(dircache[i].name)
|
||||||
|
- strlen(file_thumbnail_ext)]))
|
||||||
|
{ /* no .talk file */
|
||||||
|
dircache[i].attr &= ~TREE_ATTR_THUMBNAIL; /* clear */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ /* .talk file, we later let them speak themselves */
|
||||||
|
dircache[i].attr |= TREE_ATTR_THUMBNAIL; /* set */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while((entry = readdir(dir)) != 0) /* walk directory */
|
||||||
|
{
|
||||||
|
int ext_pos;
|
||||||
|
|
||||||
|
ext_pos = strlen(entry->d_name) - strlen(file_thumbnail_ext);
|
||||||
|
if (ext_pos <= 0 /* too short to carry ".talk" */
|
||||||
|
|| (entry->attribute & ATTR_DIRECTORY) /* no file */
|
||||||
|
|| strcasecmp(&entry->d_name[ext_pos], file_thumbnail_ext))
|
||||||
|
{ /* or doesn't end with ".talk", no candidate */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* terminate the (disposable) name in dir buffer,
|
||||||
|
this truncates off the ".talk" without needing an extra buffer */
|
||||||
|
entry->d_name[ext_pos] = '\0';
|
||||||
|
|
||||||
|
/* search corresponding file in dir cache */
|
||||||
|
for (i=0; i < c->filesindir; i++)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(dircache[i].name, entry->d_name))
|
||||||
|
{ /* match */
|
||||||
|
dircache[i].attr |= TREE_ATTR_THUMBNAIL; /* set the flag */
|
||||||
|
break; /* exit search loop, because we found it */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* support function for qsort() */
|
||||||
|
static int compare(const void* p1, const void* p2)
|
||||||
|
{
|
||||||
|
struct entry* e1 = (struct entry*)p1;
|
||||||
|
struct entry* e2 = (struct entry*)p2;
|
||||||
|
int criteria;
|
||||||
|
|
||||||
|
if (e1->attr & ATTR_DIRECTORY && e2->attr & ATTR_DIRECTORY)
|
||||||
|
{ /* two directories */
|
||||||
|
criteria = global_settings.sort_dir;
|
||||||
|
}
|
||||||
|
else if (!(e1->attr & ATTR_DIRECTORY) && !(e2->attr & ATTR_DIRECTORY))
|
||||||
|
{ /* two files */
|
||||||
|
criteria = global_settings.sort_file;
|
||||||
|
}
|
||||||
|
else /* dir and file, dir goes first */
|
||||||
|
return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY );
|
||||||
|
|
||||||
|
switch(criteria)
|
||||||
|
{
|
||||||
|
case 3: /* sort type */
|
||||||
|
{
|
||||||
|
int t1 = e1->attr & TREE_ATTR_MASK;
|
||||||
|
int t2 = e2->attr & TREE_ATTR_MASK;
|
||||||
|
|
||||||
|
if (!t1) /* unknown type */
|
||||||
|
t1 = 0x7FFFFFFF; /* gets a high number, to sort after known */
|
||||||
|
if (!t2) /* unknown type */
|
||||||
|
t2 = 0x7FFFFFFF; /* gets a high number, to sort after known */
|
||||||
|
|
||||||
|
if (t1 - t2) /* if different */
|
||||||
|
return t1 - t2;
|
||||||
|
/* else fall through to alphabetical sorting */
|
||||||
|
}
|
||||||
|
case 0: /* sort alphabetically */
|
||||||
|
if (global_settings.sort_case)
|
||||||
|
return strncmp(e1->name, e2->name, MAX_PATH);
|
||||||
|
else
|
||||||
|
return strncasecmp(e1->name, e2->name, MAX_PATH);
|
||||||
|
|
||||||
|
case 1: /* sort date */
|
||||||
|
return e1->time_write - e2->time_write;
|
||||||
|
|
||||||
|
case 2: /* sort date, newest first */
|
||||||
|
return e2->time_write - e1->time_write;
|
||||||
|
}
|
||||||
|
return 0; /* never reached */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load and sort directory into dircache. returns NULL on failure. */
|
||||||
|
int ft_load(struct tree_context* c, bool *buffer_full)
|
||||||
|
{
|
||||||
|
extern char lastdir[]; /* from tree.c */
|
||||||
|
int i;
|
||||||
|
DIR *dir = opendir(c->currdir);
|
||||||
|
if(!dir)
|
||||||
|
return -1; /* not a directory */
|
||||||
|
|
||||||
|
int name_buffer_used = 0;
|
||||||
|
c->dirsindir = 0;
|
||||||
|
if (buffer_full)
|
||||||
|
*buffer_full = false;
|
||||||
|
|
||||||
|
for ( i=0; i < global_settings.max_files_in_dir; i++ ) {
|
||||||
|
int len;
|
||||||
|
struct dirent *entry = readdir(dir);
|
||||||
|
struct entry* dptr = (struct entry*)(c->dircache + i * sizeof(struct entry));
|
||||||
|
if (!entry)
|
||||||
|
break;
|
||||||
|
|
||||||
|
len = strlen(entry->d_name);
|
||||||
|
|
||||||
|
/* skip directories . and .. */
|
||||||
|
if ((entry->attribute & ATTR_DIRECTORY) &&
|
||||||
|
(((len == 1) &&
|
||||||
|
(!strncmp(entry->d_name, ".", 1))) ||
|
||||||
|
((len == 2) &&
|
||||||
|
(!strncmp(entry->d_name, "..", 2))))) {
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip FAT volume ID */
|
||||||
|
if (entry->attribute & ATTR_VOLUME_ID) {
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* filter out dotfiles and hidden files */
|
||||||
|
if (*c->dirfilter != SHOW_ALL &&
|
||||||
|
((entry->d_name[0]=='.') ||
|
||||||
|
(entry->attribute & ATTR_HIDDEN))) {
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
dptr->attr = entry->attribute;
|
||||||
|
|
||||||
|
/* check for known file types */
|
||||||
|
if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) )
|
||||||
|
dptr->attr |= filetype_get_attr(entry->d_name);
|
||||||
|
|
||||||
|
/* memorize/compare details about the boot file */
|
||||||
|
if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) {
|
||||||
|
if (boot_size) {
|
||||||
|
if ((entry->size != boot_size) ||
|
||||||
|
(entry->startcluster != boot_cluster))
|
||||||
|
boot_changed = true;
|
||||||
|
}
|
||||||
|
boot_size = entry->size;
|
||||||
|
boot_cluster = entry->startcluster;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* filter out non-visible files */
|
||||||
|
if (!(dptr->attr & ATTR_DIRECTORY) && (
|
||||||
|
(*c->dirfilter == SHOW_PLAYLIST &&
|
||||||
|
(dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_M3U) ||
|
||||||
|
((*c->dirfilter == SHOW_MUSIC &&
|
||||||
|
(dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_MPA) &&
|
||||||
|
(dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_M3U) ||
|
||||||
|
(*c->dirfilter == SHOW_SUPPORTED && !filetype_supported(dptr->attr)) ||
|
||||||
|
(*c->dirfilter == SHOW_WPS && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_WPS) ||
|
||||||
|
(*c->dirfilter == SHOW_CFG && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_CFG) ||
|
||||||
|
(*c->dirfilter == SHOW_LNG && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_LNG) ||
|
||||||
|
(*c->dirfilter == SHOW_MOD && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_MOD) ||
|
||||||
|
(*c->dirfilter == SHOW_FONT && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_FONT) ||
|
||||||
|
(*c->dirfilter == SHOW_PLUGINS && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_ROCK)))
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len > c->name_buffer_size - name_buffer_used - 1) {
|
||||||
|
/* Tell the world that we ran out of buffer space */
|
||||||
|
if (buffer_full)
|
||||||
|
*buffer_full = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dptr->name = &c->name_buffer[name_buffer_used];
|
||||||
|
dptr->time_write = entry->wrtdate<<16 | entry->wrttime; /* in one # */
|
||||||
|
strcpy(dptr->name,entry->d_name);
|
||||||
|
name_buffer_used += len + 1;
|
||||||
|
|
||||||
|
if (dptr->attr & ATTR_DIRECTORY) /* count the remaining dirs */
|
||||||
|
c->dirsindir++;
|
||||||
|
}
|
||||||
|
c->filesindir = i;
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
|
strcpy(lastdir, c->currdir);
|
||||||
|
|
||||||
|
qsort(c->dircache,i,sizeof(struct entry),compare);
|
||||||
|
|
||||||
|
/* If thumbnail talking is enabled, make an extra run to mark files with
|
||||||
|
associated thumbnails, so we don't do unsuccessful spinups later. */
|
||||||
|
if (global_settings.talk_file == 3)
|
||||||
|
check_file_thumbnails(c); /* map .talk to ours */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ft_enter(struct tree_context* c)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
struct entry *dircache = c->dircache;
|
||||||
|
struct entry* file = &dircache[c->dircursor + c->dirstart];
|
||||||
|
bool reload_root = false;
|
||||||
|
bool reload_dir = false;
|
||||||
|
bool start_wps = false;
|
||||||
|
bool exit_func = false;
|
||||||
|
|
||||||
|
if (c->currdir[1])
|
||||||
|
snprintf(buf,sizeof(buf),"%s/%s",c->currdir, file->name);
|
||||||
|
else
|
||||||
|
snprintf(buf,sizeof(buf),"/%s",file->name);
|
||||||
|
|
||||||
|
if (file->attr & ATTR_DIRECTORY) {
|
||||||
|
memcpy(c->currdir, buf, sizeof(c->currdir));
|
||||||
|
if ( c->dirlevel < MAX_DIR_LEVELS ) {
|
||||||
|
c->dirpos[c->dirlevel] = c->dirstart;
|
||||||
|
c->cursorpos[c->dirlevel] = c->dircursor;
|
||||||
|
}
|
||||||
|
c->dirlevel++;
|
||||||
|
c->dircursor=0;
|
||||||
|
c->dirstart=0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int seed = current_tick;
|
||||||
|
bool play = false;
|
||||||
|
int start_index=0;
|
||||||
|
|
||||||
|
lcd_stop_scroll();
|
||||||
|
switch ( file->attr & TREE_ATTR_MASK ) {
|
||||||
|
case TREE_ATTR_M3U:
|
||||||
|
if (bookmark_autoload(buf))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (playlist_create(c->currdir, file->name) != -1)
|
||||||
|
{
|
||||||
|
if (global_settings.playlist_shuffle)
|
||||||
|
playlist_shuffle(seed, -1);
|
||||||
|
start_index = 0;
|
||||||
|
playlist_start(start_index,0);
|
||||||
|
play = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TREE_ATTR_MPA:
|
||||||
|
if (bookmark_autoload(c->currdir))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (playlist_create(c->currdir, NULL) != -1)
|
||||||
|
{
|
||||||
|
start_index =
|
||||||
|
ft_build_playlist(c, c->dircursor + c->dirstart);
|
||||||
|
if (global_settings.playlist_shuffle)
|
||||||
|
{
|
||||||
|
start_index = playlist_shuffle(seed, start_index);
|
||||||
|
|
||||||
|
/* when shuffling dir.: play all files
|
||||||
|
even if the file selected by user is
|
||||||
|
not the first one */
|
||||||
|
if (!global_settings.play_selected)
|
||||||
|
start_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
playlist_start(start_index, 0);
|
||||||
|
play = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* wps config file */
|
||||||
|
case TREE_ATTR_WPS:
|
||||||
|
wps_load(buf,true);
|
||||||
|
set_file(buf, global_settings.wps_file,
|
||||||
|
MAX_FILENAME);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TREE_ATTR_CFG:
|
||||||
|
if (!settings_load_config(buf))
|
||||||
|
break;
|
||||||
|
lcd_clear_display();
|
||||||
|
lcd_puts(0,0,str(LANG_SETTINGS_LOADED1));
|
||||||
|
lcd_puts(0,1,str(LANG_SETTINGS_LOADED2));
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
lcd_update();
|
||||||
|
#endif
|
||||||
|
sleep(HZ/2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TREE_ATTR_BMARK:
|
||||||
|
bookmark_load(buf, false);
|
||||||
|
reload_dir = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TREE_ATTR_LNG:
|
||||||
|
if(!lang_load(buf)) {
|
||||||
|
extern bool language_changed; /* from settings_menu.c */
|
||||||
|
|
||||||
|
set_file(buf, global_settings.lang_file,
|
||||||
|
MAX_FILENAME);
|
||||||
|
talk_init(); /* use voice of same language */
|
||||||
|
splash(HZ, true, str(LANG_LANGUAGE_LOADED));
|
||||||
|
language_changed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
case TREE_ATTR_FONT:
|
||||||
|
font_load(buf);
|
||||||
|
set_file(buf, global_settings.font_file, MAX_FILENAME);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
/* firmware file */
|
||||||
|
case TREE_ATTR_MOD:
|
||||||
|
rolo_load(buf);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* plugin file */
|
||||||
|
case TREE_ATTR_ROCK:
|
||||||
|
if (plugin_load(buf,NULL) == PLUGIN_USB_CONNECTED)
|
||||||
|
{
|
||||||
|
if(*c->dirfilter > NUM_FILTER_MODES)
|
||||||
|
/* leave sub-browsers after usb, doing
|
||||||
|
otherwise might be confusing to the user */
|
||||||
|
exit_func = true;
|
||||||
|
else
|
||||||
|
reload_root = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
char* plugin = filetype_get_plugin(file);
|
||||||
|
if (plugin)
|
||||||
|
{
|
||||||
|
if (plugin_load(plugin,buf) == PLUGIN_USB_CONNECTED)
|
||||||
|
reload_root = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( play ) {
|
||||||
|
if ( global_settings.resume ) {
|
||||||
|
/* the resume_index must always be the index in the
|
||||||
|
shuffled list in case shuffle is enabled */
|
||||||
|
global_settings.resume_index = start_index;
|
||||||
|
global_settings.resume_offset = 0;
|
||||||
|
settings_save();
|
||||||
|
}
|
||||||
|
|
||||||
|
start_wps = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (*c->dirfilter > NUM_FILTER_MODES &&
|
||||||
|
*c->dirfilter != SHOW_FONT &&
|
||||||
|
*c->dirfilter != SHOW_PLUGINS)
|
||||||
|
{
|
||||||
|
exit_func = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reload_dir)
|
||||||
|
rc = 1;
|
||||||
|
if (reload_root)
|
||||||
|
rc = 2;
|
||||||
|
if (start_wps)
|
||||||
|
rc = 3;
|
||||||
|
if (exit_func)
|
||||||
|
rc = 4;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ft_exit(struct tree_context* c)
|
||||||
|
{
|
||||||
|
extern char lastfile[]; /* from tree.c */
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
int rc = 0;
|
||||||
|
bool exit_func = false;
|
||||||
|
|
||||||
|
int i = strlen(c->currdir);
|
||||||
|
if (i>1) {
|
||||||
|
while (c->currdir[i-1]!='/')
|
||||||
|
i--;
|
||||||
|
strcpy(buf,&c->currdir[i]);
|
||||||
|
if (i==1)
|
||||||
|
c->currdir[i]=0;
|
||||||
|
else
|
||||||
|
c->currdir[i-1]=0;
|
||||||
|
|
||||||
|
if (*c->dirfilter > NUM_FILTER_MODES && c->dirlevel < 1)
|
||||||
|
exit_func = true;
|
||||||
|
|
||||||
|
c->dirlevel--;
|
||||||
|
if ( c->dirlevel < MAX_DIR_LEVELS ) {
|
||||||
|
c->dirstart = c->dirpos[c->dirlevel];
|
||||||
|
c->dircursor = c->cursorpos[c->dirlevel];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c->dirstart = c->dircursor = 0;
|
||||||
|
|
||||||
|
if (c->dirstart == -1)
|
||||||
|
strcpy(lastfile, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*c->dirfilter > NUM_FILTER_MODES && c->dirlevel < 1)
|
||||||
|
exit_func = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exit_func)
|
||||||
|
rc = 4;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
31
apps/filetree.h
Normal file
31
apps/filetree.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef FILETREE_H
|
||||||
|
#define FILETREE_H
|
||||||
|
#include "tree.h"
|
||||||
|
|
||||||
|
int ft_load(struct tree_context* c, bool *buffer_full);
|
||||||
|
int ft_play_filenumber(int pos, int attr);
|
||||||
|
int ft_play_dirname(int start_index);
|
||||||
|
void ft_play_filename(char *dir, char *file);
|
||||||
|
int ft_enter(struct tree_context* c);
|
||||||
|
int ft_exit(struct tree_context* c);
|
||||||
|
int ft_build_playlist(struct tree_context* c, int start_index);
|
||||||
|
|
||||||
|
#endif
|
|
@ -84,7 +84,7 @@
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "tree.h"
|
#include "filetree.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "widgets.h"
|
#include "widgets.h"
|
||||||
|
@ -537,16 +537,18 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
|
||||||
char *count_str;
|
char *count_str;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int num_files = 0;
|
int num_files = 0;
|
||||||
bool buffer_full = false;
|
|
||||||
int i;
|
int i;
|
||||||
int dirfilter = SHOW_ALL;
|
int dirfilter = global_settings.dirfilter;
|
||||||
struct entry *files;
|
struct entry *files;
|
||||||
|
|
||||||
/* use the tree browser dircache to load files */
|
/* use the tree browser dircache to load files */
|
||||||
files = load_and_sort_directory(dirname, &dirfilter, &num_files,
|
global_settings.dirfilter = SHOW_ALL;
|
||||||
&buffer_full);
|
struct tree_context* tc = tree_get_context();
|
||||||
|
strncpy(tc->currdir, dirname, sizeof(tc->currdir));
|
||||||
|
num_files = ft_load(tc, NULL);
|
||||||
|
files = (struct entry*) tc->dircache;
|
||||||
|
|
||||||
if(!files)
|
if(!num_files)
|
||||||
{
|
{
|
||||||
splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -582,9 +584,10 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* we now need to reload our current directory */
|
/* we now need to reload our current directory */
|
||||||
files = load_and_sort_directory(dirname, &dirfilter, &num_files,
|
strncpy(tc->currdir, dirname, sizeof(tc->currdir));
|
||||||
&buffer_full);
|
num_files = ft_load(tc, NULL);
|
||||||
if (!files)
|
files = (struct entry*) tc->dircache;
|
||||||
|
if (!num_files)
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -627,6 +630,9 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* restore dirfilter */
|
||||||
|
global_settings.dirfilter = dirfilter;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1217
apps/tree.c
1217
apps/tree.c
File diff suppressed because it is too large
Load diff
33
apps/tree.h
33
apps/tree.h
|
@ -20,6 +20,8 @@
|
||||||
#define _TREE_H_
|
#define _TREE_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <applimits.h>
|
||||||
|
#include <file.h>
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
#define TREE_NEXT BUTTON_DOWN
|
#define TREE_NEXT BUTTON_DOWN
|
||||||
|
@ -95,6 +97,12 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
#define BOOTFILE "ajbrec.ajz"
|
||||||
|
#else
|
||||||
|
#define BOOTFILE "archos.mod"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct entry {
|
struct entry {
|
||||||
short attr; /* FAT attributes + file type flags */
|
short attr; /* FAT attributes + file type flags */
|
||||||
unsigned long time_write; /* Last write time */
|
unsigned long time_write; /* Last write time */
|
||||||
|
@ -108,6 +116,28 @@ struct filetype {
|
||||||
int voiceclip;
|
int voiceclip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* browser context for file or db */
|
||||||
|
struct tree_context {
|
||||||
|
int dirlevel;
|
||||||
|
int dircursor;
|
||||||
|
int dirstart;
|
||||||
|
int dirpos[MAX_DIR_LEVELS];
|
||||||
|
int cursorpos[MAX_DIR_LEVELS];
|
||||||
|
char currdir[MAX_PATH]; /* file use */
|
||||||
|
int *dirfilter; /* file use */
|
||||||
|
int filesindir;
|
||||||
|
int dirsindir; /* file use */
|
||||||
|
int table_history[MAX_DIR_LEVELS]; /* db use */
|
||||||
|
int extra_history[MAX_DIR_LEVELS]; /* db use */
|
||||||
|
int currtable; /* db use */
|
||||||
|
int currextra; /* db use */
|
||||||
|
|
||||||
|
void* dircache;
|
||||||
|
int dircache_size;
|
||||||
|
char* name_buffer;
|
||||||
|
int name_buffer_size;
|
||||||
|
int dentry_size;
|
||||||
|
};
|
||||||
|
|
||||||
/* using attribute bits not used by FAT (FAT uses lower 7) */
|
/* using attribute bits not used by FAT (FAT uses lower 7) */
|
||||||
|
|
||||||
|
@ -134,8 +164,7 @@ bool create_playlist(void);
|
||||||
void resume_directory(const char *dir);
|
void resume_directory(const char *dir);
|
||||||
char *getcwd(char *buf, int size);
|
char *getcwd(char *buf, int size);
|
||||||
void reload_directory(void);
|
void reload_directory(void);
|
||||||
struct entry* load_and_sort_directory(const char *dirname, const int *dirfilter,
|
|
||||||
int *num_files, bool *buffer_full);
|
|
||||||
bool check_rockboxdir(void);
|
bool check_rockboxdir(void);
|
||||||
|
struct tree_context* tree_get_context(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue