📄 enhanced_selector_api_for_ape.c
字号:
{
PlaylistCurItem = ClassItemTotal + 1;
}
return playlistprev(filename);
}
break;
default:
return FALSE;
}//switch
}
else
return FALSE;
}
/********************************************************************************
* Description : get the next dir in playlist or class in common file system
*
* Arguments :
* groupname : output the prev groupname
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BOOL fselGetNextGroup(char *groupname)
{
BOOL iRet;
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) //common file system
{
iRet = fselNextDir( groupname ); //get next dir
groupname[11] = 0x00;
}
else if (fselPLOrCommonDir == FSEL_TYPE_PLAYLIST) // playlist file system
{
iRet = playlistclassNext( groupname ); //get the next class
}
return iRet;
}
/********************************************************************************
* Description : get the prev dir in playlist or class in common file system
*
* Arguments :
* groupname : output the prev groupname
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BOOL fselGetPrevGroup(char *groupname)
{
BOOL iRet;
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) //common file system
{
iRet = fselPrevDir(groupname);
groupname[11] = 0x00;
}
else if (fselPLOrCommonDir == FSEL_TYPE_PLAYLIST) //play list file system
{
iRet = playlistclassPrev(groupname);
}
return iRet;
}
/********************************************************************************
* Description : get the long group name in playlist or common file system
*
* Arguments :
* grouplongname : output the current groupname(long name)
iLen :the length of get group , it is invalid in playlist
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BOOL fselGetCurGroupL(char *grouplongname, WORD iLen)
{
char shortname[12];
bool iRet;
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) //common file system
{
if ( ToDirEntry(shortname,fselDirNo[fselDirLayer]) ) //in common fsel system , dir is the parent
{
memcpy(grouplongname, shortname, 12);
if ( FS_GetName(grouplongname, iLen) )
return TRUE;
else
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
else
return FALSE;
}
else if ( fselPLOrCommonDir == FSEL_TYPE_PLAYLIST ) //play list file system
{
iRet = getClassParam(grouplongname, iLen); //默认输入:全局变量PlaylistCurClass
return iRet;
}
else
return FALSE;
}
/********************************************************************************
* Description : del the file in playlist or common file system
*
* Arguments :
* type : file or dir
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BOOL fselDelFile( unsigned char type)
{
char strName[12];
char name[12];
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) // common dir
{
// report the exception case
if (( type == FSEL_DEL_FILE) &&( fselFileNo ==0)) //file no is valid
{
fselError = FSEL_ERR_EXCEPTION;
return FALSE;
}
if ((type == FSEL_DEL_DIRFILE)&&(fselDirNo[fselDirLayer] ==0)) //dir no is valid
{
fselError = FSEL_ERR_EXCEPTION;
return FALSE;
}
if (type > FSEL_DEL_DIRFILE) // other type is invalid
{
fselError = FSEL_ERR_EXCEPTION;
return FALSE;
}
//delete the file
if ( type == FSEL_DEL_FILE )
{
if ( fselGetByNO( strName, fselFileNo) )
{
/*if ( !ToDirEntry( name, fselDirNo[fselDirLayer]) ) //Enter the current directory
return FALSE;
FS_CD(name);*/
output8(REG4E_RTC_WATCH_DOG, input8(REG4E_RTC_WATCH_DOG) | 0x08);
#ifdef __APE_SUPPORT
if ( FS_FRemove(strName) ) //realy remove
{
fselFileNo=fselFileNo_APE-CurApe_TotalNo; //change the parament
fselTotal -=CurApe_TotalNo;
fselFileNo_APE = fselTotal;
CurApe_TotalNo = 0;
//FS_CD("\\");
return TRUE;
}
#endif
if ( FS_FRemove(strName) ) //realy remove
{
fselFileNo--; //change the parament
fselTotal --;
//FS_CD("\\");
return TRUE;
}
else
{
fselError = FSEL_ERR_FS;
//FS_CD("\\");
return FALSE;
}
}
}
//delete the dir
if (ToDirEntry( strName, fselDirNo[fselDirLayer]))
{
if ( FS_CD(strName) ) //enter it get the parament
{
if ( FS_Dir(name,IgnoreExt4,FS_DIR_DIR) || FS_Dir(name,IgnoreExt4,FS_DIR_FILE)) //Not Null
return FALSE;
if ( FS_CD("\\") ) //return parent dir , del it
{
output8(REG4E_RTC_WATCH_DOG, input8(REG4E_RTC_WATCH_DOG) | 0x08);
if ( FS_RemoveDir(strName) ) //realy remove
{
fselDirNo[fselDirLayer]--; //change the parament
if (fselDirNo[fselDirLayer] == 0) // in First , we will return the parent dir
{
if ( !fselRetParentDir(name) )
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
return TRUE;
}
else
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
else
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
else
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
else //Dir not match the dir number
{
fselError = FSEL_ERR_OUTOF;
return FALSE;
}
}
//delete the palylist file
if (fselPLOrCommonDir == FSEL_TYPE_PLAYLIST)
{
if ( type != FSEL_DEL_FILE) //playlist only delete the file
{
fselError = FSEL_ERR_EXCEPTION;
return FALSE;
}
if ( playlistdel(strName) ) //delete tag in the lst file
{
output8(REG4E_RTC_WATCH_DOG, input8(REG4E_RTC_WATCH_DOG) | 0x08);
if ( FS_FRemove(strName) ) //
{
//when we have changed the palylist , we need close the playlist
if ( fselPlayListEnt(PlayListFileName) )
{
getClassParam(NULL, 28); //只取ClassParam,不取class name
if ( fselGetNextFile(strName) )
return TRUE;
else
{
fselError = FSEL_ERR_PLAYLIST;
return FALSE;
}
}
}
else
{
fselError = FSEL_ERR_FS;
return FALSE;
}
}
else
return FALSE;
}
else
{
fselError = FSEL_ERR_EXCEPTION;
return FALSE;
}
}
/********************************************************************************
* Description : throgh the keeped values set the file selector parament
*
* Arguments :location :the keeped vlaues
*
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BYTE fselSetLocation(file_location_t *location)
{
char name[28];
BOOL bRet;
BYTE i,iRet;
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) //common file system
{
if (i = fselSetLocationC(location) )
{
if ( i>1)
{
if ( location->filename[0] != 0x00 )
{
if ( fselTotal == 0 )
return i;
else
return TRUE;
}
if ( fselGetNextFile(name) )
{
fselSetLocationC(location);
return TRUE;
}
else
fselError = FSEL_ERR_EMPTY;
}
return i;
}
else
return FALSE;
}
else if ( fselPLOrCommonDir == FSEL_TYPE_PLAYLIST ) //play list file system
{
memcpy( name, location->path , 12 ); //restore the playlist file name
memcpy( ItemFileName, location->filename, 12 );
if ( !fselPlayListEnt(name) )
{
return FALSE; //open the play list err
}
//ASSERT(PlaylistClassTotal != 0)
PlaylistCurClass = * (WORD *)&(location->DirNo[0]); //PlaylistCurClass <---------------
if ( !getClassParam(NULL, 28) ) //默认输入:PlaylistCurClass, 只取信息,不取class名字
{
return FALSE;
}
PlaylistCurItem = location->ClusterNo; //PlaylistCurItem <-----------------
if ( PlaylistCurItem != 0 )
{
if ( getplayItemparam(name) == 1 ) //默认输入:PlaylistCurItem 0: Fail list文件错误
{ //1: Successful, 2://歌曲不存在
return TRUE;
}
else
{
if ( playlistnext(name) )
{
return TRUE;
}
else
{
return FALSE;
}
}
}
else
{
return TRUE;
}
}
else
{
return FALSE;
}
}
/********************************************************************************
* Description : keep values of the file selector parament
*
* Arguments :location :the keeped vlaues
*
* Returns :
* TRUE: Successful,
* FALSE: Fail, detail information in fselError.
* Notes :
*
********************************************************************************/
BOOL fselGetLocation(file_location_t *location)
{
if (fselPLOrCommonDir == FSEL_TYPE_COMMONDIR) //comond file system
{
return fselGetLocationC(location);
}
else if (fselPLOrCommonDir == FSEL_TYPE_PLAYLIST) //play list file system
{
memcpy(location->path, PlayListFileName, 12); //keep the playlist file name
memcpy(location->filename, ItemFileName, 12); //keep the song file name
location->ClusterNo = PlaylistCurItem; //global variable, Initialized by 0
* (WORD *)&(location->DirNo[0]) = PlaylistCurClass; //keep the class no
return TRUE;
}
else
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -