sub_function2.i

来自「MP3 整个 SDK」· I 代码 · 共 3,117 行 · 第 1/4 页

I
3,117
字号
int title;
int min;
int max;
int value;
int step; 
 unsigned char  string_id;
}slider_t;
















typedef struct
{

const  unsigned short  *strid;
int total;
int active;
int headid;

 unsigned char  string_id;
}pop_up_list_t;

int ui_menuhead (menuhead_t *menuhead, int string_id);

int ui_popup_list(pop_up_list_t *list, const void (*callback)(int value));





int ui_err_msg (int msgID, int typeID, int string_id);
int ui_show_msg (int msgID, int typeID, int string_id);



int ui_menu (function_menu_t *menu , const void (*callback)(int value));



int ui_menu2 (function_menu_t *menu , const void (*callback)(int value));

int ui_show_progress(const progress_t *progress, int string_id);
void ui_show_guage(int step, unsigned char  para);




int ui_filelist(file_location_t *location, int type, int string_id);
int ui_explore(file_location_t *location, int type, int string_id);







extern char file_name[12];
extern char dir_name[30];



int rm_dir_from_buf(int n);







extern  unsigned char  read_idm_data(char *name, int count);
extern  unsigned char  write_idm_data(char *name, int count);
extern void init_dir_buf();
extern  unsigned char  get_dir_name(char *file,  unsigned short  num);
extern void get_dir_name2(char *file, int num);
extern int init_sel_dir_buf(void);
extern  unsigned char  del_all_my_file(int type,  unsigned char  string_id);
extern void reinit_idm_buf(int top, int bottom, int total_dir, int string_id);
void show_active_list(int old_active, int active, int top);
 unsigned char  show_popup_list(int string_id);
int ui_explore_sub(file_location_t *location, int type, int string_id);
int init_active(int string_id);
int init_active_dironly(file_location_t *location);
void reset_cur_list_bg_color(int i, int tmp);
void get_dir_long_name(file_location_t *location, int string_id);
void redraw_window(void);
void Clearexplore(void);
void ui_show_data(char *buf,  unsigned char  x,  unsigned char  y);






















































































typedef struct
{
char magic[4]; 
 unsigned short  counts; 
char reserved[10];
}res_head_t;


typedef struct
{
long offset; 
 unsigned short  length; 
 unsigned char  type; 
char name[9]; 
}res_entry_t;






























extern SD_FILE *res_fp;
extern  unsigned char  ui_auto_update; 
extern  unsigned char  ui_auto_select; 
extern  unsigned char  ui_run_realtime; 
extern region_t res_region;
extern const char mychar[]; 
extern const char menu_pos[6];
extern const char music_ext[][4];
extern const char voice_ext[][4];
extern const char pic_ext[][4];
extern const char txt_ext[][4];
extern  unsigned char  charge_flag; 




SD_FILE *ResOpen(const char * filename);
void ResClose(const SD_FILE *fp_res);
int ResShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);



int main_ResShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);


int ResShowString( unsigned short  id,  unsigned char  x,  unsigned char  y); 
int ResShowMultiString( unsigned short  id,  unsigned char  string_id,  unsigned char  x,  unsigned char  y); 



int ResInvertShowPic( unsigned short  id,  unsigned char  x,  unsigned char  y);
void ap_message_init(const comval_t *comval);
non_banked char ap_get_message(void);


non_banked char ap_handle_hotkey(char key);
char ap_sleep(int half_sec); 

void ap_set_event( unsigned short  event);
 unsigned short  ap_get_event( unsigned short  event,  unsigned short  condition);
void ap_del_event( unsigned short  event);







char *itoa_1( unsigned char  i, char *buf); 
char *itoa_2( unsigned char  i, char *buf); 
char *itoa_3( unsigned short  i, char *buf); 
char *itoa_4( unsigned short  i, char *buf); 

int get_text_width(const char *string);
int get_large_text_width(const char *string);


void ui_show_a( unsigned short  id);
void ui_show_b( unsigned short  id);
void ui_show_c( unsigned short  id);
void ui_show_d(const char *string);
void ui_show_d2(const char *string); 
void ui_show_cd(const char *string,  unsigned char  part);
void ui_show_d_pic( unsigned short  id); 
void ui_show_e( unsigned short  id);
void ui_show_f(const char *string );
void ui_show_ef(const char *string,  unsigned char  part);
void ui_show_batt(int value, char batt_type, unsigned char  fmflag); 
void ui_show_g(const char *string);
void ui_show_h(const char *string);

int ui_delete(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_delete_all(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_deleteplaylist(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_directory(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_playlist(file_location_t *location,  unsigned char  type, unsigned char  string_id);
int ui_function_menu(function_menu_t *menu, const void (*callback)(int res_id));
int ui_slider(slider_t *slider, const void (*callback)(int res_id));

char ui_show_lock(char islock);
void ui_show_vol( unsigned char  volume);
















typedef struct{
unsigned char LcmWidth; 
unsigned char LcmHeigh; 
unsigned char RScale; 
unsigned char GScale; 
unsigned char BScale; 
unsigned char RGBOrder; 

} ColorLcmInfor;


typedef struct {
long AmvFileFLashDot; 
unsigned char TimeSec; 
unsigned char TimeMin; 
unsigned char TimeHou; 
unsigned char Reserve; 
} AmvFileBreakPntInfor;






extern unsigned char AmvViewOrder; 


 unsigned char  AmvDecSetCMD( unsigned char  cmd,int param);
char AmvDecStart(ColorLcmInfor *PicInfor, unsigned int  fp,AmvFileBreakPntInfor *BreakInfor); 
signed char AmvDecModPolling(void);

non_banked void AmvViewInit( unsigned int  fp);


non_banked void AmvViewInit( unsigned int  fp);
non_banked void AMVPicSetParament(ColorLcmInfor *infor);
non_banked void AmvViewExit(void);
non_banked void DscDecoderMsg(void);
non_banked void ReadOnePageFromDisk(void);












typedef enum
{
StopSta, 
PauseSta, 
PlaySta, 
FFPlaySta, 
FBPlaySta, 
NextPlaySta, 
PrevPlaySta, 
HotkeyPlaysta 
}Play_status_t;

typedef enum
{
LoopNor, 
LoopOne, 
LoopOneDir, 
LoopDir, 
LoopAll, 
Random, 
Intro, 
MaxRepeatMod
}Repeat_Mode_t;

typedef enum
{
Music_NON,
Music_MP3,
Music_WMA,
Music_ASF,
Music_WMV,
Music_MTV
}Music_type_t;

typedef enum
{
Stop_key,
Play_play,
Play_key
}Music_sel_mod_t;



typedef struct
{
 unsigned short  magic; 
char volume; 
Repeat_Mode_t repeat_mode; 
eq_t eq_type; 




file_location_t location; 


AmvFileBreakPntInfor amvfilebreakpoint;
}amv_vars_t;








extern amv_vars_t g_amv_vars;
extern comval_t g_comval;
extern Play_status_t PlayStatus;
extern int g_result; 
extern function_menu_t menu;
extern slider_t slider;
extern  unsigned char  g_currentMusicType;
extern  unsigned char  g_musicamount;
extern  unsigned char  g_musicsequence;
extern  unsigned char  BufferFullFlag;
extern  unsigned char  BufferStart;
extern  unsigned short  g_2HZ_CNT;
extern  unsigned char  g_2HZFlag;
extern char g_TagInfoBuf[66];
extern char g_TagInfoBuf1[]; 
extern region_t mainscreensize;
extern  unsigned char  need_draw;
extern  unsigned char  g_volume;
extern  unsigned char  g_introCntMode;
extern  unsigned char  g_OldSecTempBackup;
extern  unsigned char  g_introCNT;
extern char temp_buffer[9];
extern const region_t region_msg;
extern  unsigned char  g_PAOpenFlag;


extern  unsigned char  g_langid ;
extern  unsigned char  g_BatteryType;

extern time_t Totaltime;
extern  unsigned int  fp;

extern int Total_time;
extern int Current_time;
extern  unsigned char  g_changevolume;







void read_var( void );
void openDAC(void);


int ui_stop( void );
int ui_play( void );
int ui_stop_menu( void );
int ui_loop_menu( void );



extern int InitFileSelector(void);
extern UpdateFileSelector(void);
int RealDisplay( void );
void ShowNowTime( unsigned char  para);
void RefreshMainScreen( void );
void Scroll( char *,  unsigned char , char ); 
void Show_Bitrate( void ); 
void DisplayErrMsg(int ErrMsg);
void Show_MusicType(void);



Music_type_t CheckMusicType( char * filename );
int ToNextMusic( Music_sel_mod_t mod );
int GetInformation( void );
int GetInformation1( void );
 unsigned char  ChangeMusic(  unsigned char  Direct, Music_sel_mod_t mod );
void SelectCurMusic(void);
 unsigned char  musicpSendCommand( unsigned char , int);
 unsigned char  DealErrCase( void );
int DealMusicFileEnd( char DisMod );
int PrevMusicInPlay(void);
void ClearTimePara(void); 
void openPA(char volume);
int show_volume( unsigned char  set_hardware);
void vol_callback(int value);
void ui_show_t(const char *string,  unsigned char  part);








char g_fileheadinfo[512]; 


extern SD_FILE* g_Resfp_Sav;
extern  unsigned char  ActiveDriveOK;
 unsigned int  fp;

extern  unsigned char  fselDirNo[8];
extern  unsigned short  fselFileNo;

void MY_DUMP(char *string, int value)
{
char dump_buf[6];
dump_buf[0] = ',';
SetTextPos(0, 16);
PutS((string), -1);
itoa4((value), &dump_buf[1]);
dump_buf[5] = '>';

PutS(dump_buf, 6);
UpdateScreen( 0 );
while( ap_get_message() != ( 0x01 |  0x20 )) {;}
}

void DUMP_TEST(char *string)
{
char str[9];
char i;
for(i = 0; i<8;i++)
{
str[i] = string[i] + 0x30;
}
str[8] = 0;
SetTextPos(0, 16);
PutS((str), -1);
UpdateScreen( 0 );
while( ap_get_message() != ( 0x01 |  0x20 )) {;}
}

Music_type_t CheckMusicType( char * filename )
{

}


void make_dirname(void)
{
int result;
char Backbuf[32];
fselGetLocation(&g_amv_vars.location);
if(g_amv_vars.location.path[0]==':')
{
strcpy(dir_name,"ROOT");
}
else
{

FS_Backup(Backbuf, 2 ,0);

dir_name[0] = ':';
FS_CD(dir_name);
memcpy(dir_name, g_amv_vars.location.path, 12);
result = FS_GetName(dir_name, 14); 
if (result != 0)
{
unitochar(dir_name, sizeof(dir_name), g_langid);
}
else
{
memcpy(dir_name, g_amv_vars.location.path, 12);
dir_name[8]=0;
dir_name[9]=0;
}
FS_Restore(Backbuf, 2 ,0);
}


}

void read_var( void )
{
int result;




result = VMRead(& g_comval,  0x0200 , sizeof(g_comval));
 ;


if (g_comval.magic !=  0xdead )
{
GetDefaultComval(&g_comval);
}

g_langid = g_comval.langid;
g_BatteryType = g_comval.BatteryType;

ap_message_init(& g_comval);


result = VMRead(& g_amv_vars,  0x4800 , sizeof(g_amv_vars));
 ;


if (g_amv_vars.magic !=  0x616d )
{

g_amv_vars.magic =  0x616d ;
g_amv_vars.volume = 24;
g_amv_vars.repeat_mode =  0 ;
g_amv_vars.location.disk = 'C';

strcpy(g_amv_vars.location.path,  ":" );
ClearTimePara();
}


}

 unsigned char  DealErrCase( void )
{

 unsigned char  id;


id =  fselGetErrID ();
while( ap_get_message() !=  0  );
switch (id)
{
case  2 :
ui_show_msg ( 402 ,  402 , g_langid);
ap_sleep(4);
break;

case  21 :
case  22 :
ui_show_msg ( 393 ,  393 , g_langid);
ap_sleep(4);
break;

default:
break;
}

ResClose(g_Resfp_Sav);
return 0;

}


void openDAC(void)
{
dac_t dacattr;
output8(0x5,0xf7); 
output8(0x4e,input8(0x4e)|0x8);

dacattr.dacselect = 0;
dacattr.rate = 22;
EnableDAC(&dacattr);

}

void ClearTimePara(void)
{
 unsigned char  i;
g_amv_vars.amvfilebreakpoint.AmvFileFLashDot=0;
g_amv_vars.amvfilebreakpoint.TimeSec=0;
g_amv_vars.amvfilebreakpoint.TimeMin=0;
g_amv_vars.amvfilebreakpoint.TimeHou=0;


}




int GetInformation1( void )
{
int result;
memcpy(g_TagInfoBuf, g_amv_vars.location.filename, 12);
result = FS_GetName(g_TagInfoBuf, 31); 
if (result != 0)
{
unitochar(g_TagInfoBuf, sizeof(g_TagInfoBuf), g_langid);
}
else
{
memcpy(g_TagInfoBuf, g_amv_vars.location.filename, 12);
g_TagInfoBuf[8]=0;
g_TagInfoBuf[9]=0; 
}

output8( 0x4e , input8( 0x4e ) | 0x08);
}


int GetInformation( void )
{
int result;

memcpy(g_TagInfoBuf, g_amv_vars.location.filename, 12);
result = FS_GetName(g_TagInfoBuf, 32); 
if (result != 0)
{
unitochar(g_TagInfoBuf, sizeof(g_TagInfoBuf), g_langid);
}
else
{
memcpy(g_TagInfoBuf, g_amv_vars.location.filename, 12);
}

fp=FS_FOpen( g_amv_vars.location.filename,  0x0  );
FS_FSeek( 0, 0, fp );
FS_FRead(&g_fileheadinfo[0], 1 ,fp );
FS_FClose(fp);
Totaltime.second=g_fileheadinfo[84];
Totaltime.minute=g_fileheadinfo[85];
Totaltime.hour=g_fileheadinfo[86]; 
output8(0x4e,input8(0x4e)|0x08);
return 0;
}




void openPA(char volume)
{
int i;
pa_t paattr;

g_PAOpenFlag =  1 ;
paattr.pa_in.dacin = 1;
paattr.pa_in.fmin = 0;
paattr.pa_in.linein = 0;
paattr.pa_in.micin = 0;
paattr.volume = volume;
EnablePA(& paattr);
SetPAVolume(volume);
}




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?