hdd_gui.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:28k
源码类别:

DVD

开发平台:

C/C++

  1. #include "user_init.h"
  2. #include "global.h"
  3. #include "func.h" 
  4. #include "memmap.h"
  5. #include "util.h" 
  6. #include "graph.h"
  7. #include "framebuf.h"
  8. #include "macro.h"
  9. #include "stc.h"
  10. #include "cfont.h"
  11. #include "vfdfunc.h"
  12. #include "osd.h"
  13. #include "image.h"
  14. #include "nesinit.h"
  15. #include "fs96602.h"
  16. #include "fsNAV.h"
  17. #include "fsGUI.h"
  18. #include "fsGUI1.h"
  19. #include "user_if.h"
  20. #include "user_init.h"
  21. #ifdef SUPPORT_HDD_ACCESS
  22. //MIKEY
  23. #define D printf("INFO: __%d__(%s:%s)n",__LINE__,__FILE__,__FUNCTION__);
  24. char *strcpy();
  25. //IOP IR control interface
  26. //register mapping of RISC register
  27. #define IR_PORT 5
  28. //control flag
  29. #define IR_RDY (1<<15)
  30. #define IR_REPEAT (1<<14)
  31. #define IR_REPLACE (1<<13)
  32. extern const BYTE ir_mapcode[256];
  33. #include "ircode.h"
  34. #ifdef HDD_MODIFY_INDEX_TEST
  35. #include "fsMidiUI.h" 
  36. #include "alpha.h"
  37. #define SUPPORT_PINYIN_INPUT
  38. extern void osd_Clear_Region(BYTE , BYTE );
  39. #endif//#ifdef HDD_MODIFY_INDEX_TEST
  40. UINT32 ir_rx_empty()
  41. {
  42. UINT32 rx;
  43. rx = regs0->iop_data[IR_PORT];
  44. if (rx & IR_RDY)
  45. return 0;
  46. return 1;
  47. }
  48. UINT32 ir_getch()
  49. {
  50. UINT32 rx;
  51. rx = regs0->iop_data[IR_PORT];
  52. if (rx & IR_RDY) {
  53. regs0->iop_data[IR_PORT]=rx & ~IR_RDY;
  54.          rx = reverse_fun(rx);
  55.          rx = ir_mapcode[(BYTE) rx];
  56. printf("INFO: IR[%x]n",rx);
  57. return rx; //OK
  58. }
  59. return IRC_NULL; // ERROR
  60. }
  61. #define CD_FP iso9660_file[pFsJpeg->file_array[pFsJpeg->file_will]]
  62. #define STARTX (5)
  63. #define LINEONE (236+5)
  64. #define LINEONE_UL (LINEONE+3)
  65. #define LINETWO (LINEONE+15)
  66. #define LINETWO_UL (LINETWO+3)
  67. int do_copy(UINT8 *name)
  68. {
  69. extern UINT8 f_do_copy_vcd;
  70. extern UINT8 f_vcd;
  71. extern int copy_cd_to_hdd();
  72. UINT8 states[10]={0, FS_STATE_MP3, FS_STATE_JPEG, FS_STATE_OTHER, 0};
  73. int state=0;
  74. if(CD_FP.type<=4)
  75. state = states[CD_FP.type];
  76. printf("nINFO: COPY this file[%s]->[%s] msf[%x] len(%d) type(%d)->(%d)n",CD_FP.name,name, CD_FP.loc, CD_FP.size, CD_FP.type, state);
  77. if(f_vcd) { // vcd/svcd
  78. UINT32 newvcdsize;
  79. f_do_copy_vcd=1;
  80. newvcdsize = ((CD_FP.size+2048-1)/2048) * 2352;
  81. printf("MIKEY: VCD: sz(%ld) -> newvcdsize(%ld)n", CD_FP.size, newvcdsize);
  82. copy_cd_to_hdd(name, CD_FP.loc, newvcdsize, state);
  83. }
  84. else 
  85. copy_cd_to_hdd(name, CD_FP.loc, CD_FP.size, state);
  86. CD_FP.name[0]='<'; // FILE COPY MARK
  87. return 0;
  88. }
  89. int do_rm()
  90. {
  91. extern UINT32 rm_file_from_hdd();
  92. UINT8 states[10]={0, FS_STATE_MP3, FS_STATE_JPEG, FS_STATE_OTHER, 0};
  93. int state=0;
  94. if(CD_FP.type<=4)
  95. state = states[CD_FP.type];
  96. printf("nINFO: del this file[%s] msf[%x] len(%d) type(%d)->(%d)n",CD_FP.name, CD_FP.loc, CD_FP.size, CD_FP.type, state);
  97. rm_file_from_hdd(CD_FP.name, CD_FP.loc, CD_FP.size, state);
  98. CD_FP.name[0]='/'; // FILE COPY MARK
  99. return 0;
  100. }
  101. int do_rename(UINT8 *newname)
  102. {
  103. extern UINT32 rename_file_from_hdd();
  104. UINT8 states[10]={0, FS_STATE_MP3, FS_STATE_JPEG, FS_STATE_OTHER, 0};
  105. int state=0;
  106. if(CD_FP.type<=4)
  107. state = states[CD_FP.type];
  108. printf("nINFO: rename this file[%s] msf[%x] len(%d) type(%d)->(%d)n",CD_FP.name, CD_FP.loc, CD_FP.size, CD_FP.type, state);
  109. rename_file_from_hdd(newname, CD_FP.name,CD_FP.loc, CD_FP.size, state);
  110. strcpy(CD_FP.name, newname);
  111. return 0;
  112. }
  113. int fsgui_100(int p)
  114. {
  115. #ifdef HDD_FILE_MANAGEERUI
  116.         fileManageui_DrawProcessBar(p);
  117.         return 0;
  118. #else
  119. static int pp=-1;
  120. UINT8 buf[64];
  121. if(pp==p)
  122. return 0;
  123. pp=p;
  124. printf("INFO: COPY(%d%c)n",p,'%');
  125. psprintf(buf, "%d%%", p);
  126. FSGUI_FillFrameBuf(STARTX + 16*9 , LINETWO ,4*9, 12,BK_GROUNDY,BK_GROUNDCRCB);
  127. FSGUI_ShowString(STARTX + 16*9, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  128. FSGUI_FillFrameBuf(STARTX + 21*9 , LINETWO ,100, 12,WHITE_Y,WHITE_CRCB);
  129. FSGUI_FillFrameBuf(STARTX + 21*9 , LINETWO ,p, 12,YELLOW_Y,YELLOW_CRCB);
  130. if(pp==100)
  131. pp=-1;
  132. return 0;
  133. #endif
  134. }
  135. int fsgui_rename()
  136. {
  137. UINT8 buf[64];
  138. UINT8 name[16];
  139. int i;
  140. UINT32 ch=IRC_NULL;
  141. int run=1;
  142. int k=0;
  143. int ok=0;
  144. int f_update=0;
  145. D if(CD_FP.name[0]=='<' || CD_FP.name[0]=='/') // FILE MARK COPY'<' DEL'/'
  146. return 0;
  147. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  148. for(i=0;i<8;i++) {
  149. name[i]=0x20;
  150. }
  151. name[i]=0x0;
  152. for(i=0;i<8;i++) {
  153. if(CD_FP.name[i]==0x0) {
  154. break;
  155. }
  156. name[i]=CD_FP.name[i];
  157. }
  158. psprintf(buf, "FROM [%s] SIZE:%ldK", name, (CD_FP.size)/1024);
  159. printf("%sn",buf);
  160. FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  161. psprintf(buf, "  TO [%s]", name);
  162. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  163. psprintf(buf, "      ________");
  164. FSGUI_ShowString(STARTX, LINETWO_UL, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  165. FSGUI_ReplaceFrameBuf(STARTX + 6*9 , LINETWO ,8*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  166. while(run) {
  167. if(ir_rx_empty()) // IR EMPTY
  168. continue;
  169. ch = ir_getch();
  170. switch(ch) {
  171. case IRC_NULL:
  172. break;
  173. case IRC_SELECT:
  174. if(ok==1) {
  175. run=0;
  176. FSGUI_FillFrameBuf(STARTX + 16*9 , LINETWO ,4*9, 12,BK_GROUNDY,BK_GROUNDCRCB);
  177. do_rename(name);
  178. delay_1ms(1000);
  179. break;
  180. }
  181. printf("COPY IR[%x]->[%s]",ch, "IRC_SELECT");
  182. psprintf(buf, "  TO [%s]  OK", name);
  183. FSGUI_FillFrameBuf(STARTX + 6*9 , LINETWO ,8*9, 12,BK_GROUNDY,BK_GROUNDCRCB);
  184. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  185. FSGUI_ReplaceFrameBuf(STARTX + 16*9 , LINETWO ,4*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  186. k=0;
  187. ok=1;
  188. break;
  189. #ifdef MIKEY_MOREKEY
  190. #else
  191. case IRC_DOWN:
  192. if(k>=0) {
  193. name[k]= name[k]+1;
  194. if(name[k]<'A' || name[k]>'Z')
  195. name[k]= 'A';
  196. f_update++;
  197. }
  198. break;
  199. case IRC_UP:
  200. if(k>=0) {
  201. name[k]= name[k]-1;
  202. if(name[k]<'A' || name[k]>'Z')
  203. name[k]= 'Z';
  204. f_update++;
  205. }
  206. break;
  207. case IRC_LEFT:
  208. if(k>=0) {
  209. name[k]=' ';
  210. f_update++;
  211. k--;
  212. if(k<=0)
  213. k=0;
  214. }
  215. break;
  216. case IRC_RIGHT:
  217. k++;
  218. if(k>=7)
  219. k=7;
  220. f_update++;
  221. break;
  222. case IRC_P10:
  223. #endif
  224. case IRC_0:
  225. case IRC_1:
  226. case IRC_2:
  227. case IRC_3:
  228. case IRC_4:
  229. case IRC_5:
  230. case IRC_6:
  231. case IRC_7:
  232. case IRC_8:
  233. case IRC_9:
  234. if(ok==1)
  235. break;
  236. if(k==0) {
  237. for(i=0;i<8;i++) {
  238. name[i]=0x20;
  239. }
  240. }
  241. #ifdef MIKEY_MOREKEY
  242. #else
  243. if(ch==IRC_P10)
  244. name[k]='-';
  245. else
  246. #endif
  247. name[k]=ch+0x30;
  248. f_update++;
  249. k++;
  250. if(k>=7) {
  251. k=7;
  252. }
  253. break;
  254. case IRC_RETURN:
  255. case IRC_STOP:
  256. run=0;
  257. break;
  258. default:
  259. break;
  260. }
  261. if(f_update) {
  262. psprintf(buf, "  TO [%s]", name);
  263. FSGUI_FillFrameBuf(STARTX + 6*9 , LINETWO ,8*9, 12,HL_Y,HL_CRCB);
  264. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  265. f_update=0;
  266. }
  267. }
  268. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  269. FSGUI_Menu();
  270. FSGUI_Refresh();
  271. return 0;
  272. }
  273. int fsgui_del()
  274. {
  275. UINT8 buf[64];
  276. UINT8 name[16];
  277. int i;
  278. UINT32 ch=IRC_NULL;
  279. int run=1;
  280. D if(CD_FP.name[0]=='<' || CD_FP.name[0]=='/') // FILE MARK COPY'<' DEL'/'
  281. return 0;
  282. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  283. for(i=0;i<8;i++) {
  284. name[i]=0x20;
  285. }
  286. name[i]=0x0;
  287. for(i=0;i<8;i++) {
  288. if(CD_FP.name[i]==0x0) {
  289. break;
  290. }
  291. name[i]=CD_FP.name[i];
  292. }
  293. psprintf(buf, "FILE [%s] SIZE:%ldK", name, (CD_FP.size)/1024);
  294. printf("%sn",buf);
  295. FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  296. psprintf(buf, "PRESS KEY 1:DELETE 2:RENAME");
  297. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  298. while(run) {
  299. if(ir_rx_empty()) // IR EMPTY
  300. continue;
  301. ch = ir_getch();
  302. switch(ch) {
  303. case IRC_NULL:
  304. break;
  305. case IRC_1:
  306. FSGUI_ReplaceFrameBuf(STARTX + 10*9 , LINETWO ,8*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  307. do_rm();
  308. run=0;
  309. break;
  310. case IRC_2:
  311. FSGUI_ReplaceFrameBuf(STARTX + 19*9 , LINETWO ,8*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  312. fsgui_rename();
  313. run=0;
  314. break;
  315. case IRC_RETURN:
  316. case IRC_STOP:
  317. run=0;
  318. break;
  319. default:
  320. run=0;
  321. break;
  322. break;
  323. }
  324. }
  325. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  326. FSGUI_Menu();
  327. FSGUI_Refresh();
  328. return 0;
  329. }
  330. #define IFP iso9660_file[file_ptr]
  331. int fsgui_cdcopy()
  332. {
  333. extern UINT8 f_do_copy_vcd;
  334. extern UINT8 f_vcd;
  335. extern int copy_cd_to_hdd();
  336. UINT8 states[10]={0, FS_STATE_MP3, FS_STATE_JPEG, FS_STATE_OTHER, 0};
  337. int state=0;
  338. int file_ptr=0;
  339. UINT8 buf[64];
  340. UINT8 name[16];
  341. int i;
  342. for(file_ptr=0;file_ptr<pFsJpeg->iso9660_file_cnt;file_ptr++) {
  343. if(IFP.name[0]=='<' || IFP.name[0]=='/') // FILE MARK COPY'<' DEL'/'
  344. continue;
  345. if(IFP.type<=4)
  346. state = states[IFP.type];
  347. printf("nINFO: COPY this file[%s] msf[%x] len(%d) type(%d)->(%d)n",IFP.name, IFP.loc, IFP.size, IFP.type, state);
  348. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  349. for(i=0;i<8;i++) {
  350. name[i]=0x20;
  351. }
  352. name[i]=0x0;
  353. for(i=0;i<8;i++) {
  354. if(IFP.name[i]==0x0) {
  355. break;
  356. }
  357. name[i]=IFP.name[i];
  358. }
  359. psprintf(buf, "COPY [%s] SIZE:%ldK", name, (IFP.size)/1024);
  360. printf("%sn",buf);
  361. FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  362. psprintf(buf, "%3d%c [%d/%d]",(file_ptr)*100/pFsJpeg->iso9660_file_cnt,'%', file_ptr+1, pFsJpeg->iso9660_file_cnt);
  363. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  364. if(f_vcd) { // vcd/svcd
  365. UINT32 newvcdsize;
  366. f_do_copy_vcd=1;
  367. newvcdsize = ((IFP.size+2048-1)/2048) * 2352;
  368. printf("MIKEY: VCD: sz(%ld) -> newvcdsize(%ld)n", IFP.size, newvcdsize);
  369. copy_cd_to_hdd(IFP.name, IFP.loc, newvcdsize, state);
  370. }
  371. else 
  372. copy_cd_to_hdd(IFP.name, IFP.loc, IFP.size, state);
  373. IFP.name[0]='<'; // FILE COPY MARK
  374. psprintf(buf, "%3d%c [%d/%d]",(file_ptr+1)*100/pFsJpeg->iso9660_file_cnt,'%', file_ptr+1, pFsJpeg->iso9660_file_cnt);
  375. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  376. }
  377. return 0;
  378. }
  379. int fsgui_copy()
  380. {
  381. #ifndef HDD_FILE_MANAGEERUI
  382. UINT8 buf[64];
  383. #endif     
  384. UINT8 name[16];
  385. int i;
  386. UINT32 ch=IRC_NULL;
  387. int run=1;
  388. int ok=0;
  389. #ifdef SUPPORT_HDD_DELETEFILE
  390.         BYTE numName[6];
  391.         int codeNo =0;
  392. #ifndef SUPPORT_HDD_DELETEFILE
  393.         BYTE IsDelFile =0;
  394. #endif
  395. #endif
  396.         int k = 0;
  397. #ifdef HDD_FILE_MANAGEERUI
  398.         int retflag;
  399. #endif
  400. #ifndef SUPPORT_HDD_DELETEFILE
  401.       if (CD_FP.name[0] == '<' || CD_FP.name[0] == '/') // FILE MARK COPY'<' DEL'/'
  402.        return;
  403. #endif     
  404. #ifdef HDD_FILE_MANAGEERUI
  405.         Manageui_SetNewFile(CD_FP.name,(CD_FP.size)/1024);
  406.         fileManageui_Init();
  407. #else 
  408. #ifdef SUPPORT_HDD_DELETEFILE
  409.     if (!IsDelFile)
  410.     {
  411. #endif
  412. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  413.       for (i = 0; i < 8; i++)
  414.         {
  415. name[i]=0x20;
  416. }
  417. name[i]=0x0;
  418.       for (i = 0; i < 8; i++)
  419.         {
  420.           if (CD_FP.name[i] == 0x0)
  421.             {
  422. break;
  423. }
  424. name[i]=CD_FP.name[i];
  425. }
  426. psprintf(buf, "COPY [%s] SIZE:%ldK", name, (CD_FP.size)/1024);
  427. printf("%sn",buf);
  428. FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  429. #ifdef SUPPORT_HDD_DELETEFILE
  430.         for (i = 0; i < 5; i++)
  431.         {
  432.             numName[i]=0x20;
  433.         }
  434. #ifdef ADD_NEWFILE_SEQUENCE
  435. #ifdef SUPPORT_HDD_DELETEFILE
  436.         if (!IsDelFile)
  437. #endif
  438.         {
  439.             codeNo =GetNextNullCell();
  440.             if (codeNo)
  441.                 printf("new code no is %dn",codeNo);
  442.             else
  443.             {
  444.                 printf("Error:can't find coden");
  445.                 return 0;
  446.             }
  447.         }
  448.         for (i = 5; i > 0; i--)
  449.         {
  450.             numName[i-1]=(codeNo%10)+'0';
  451.             codeNo/=10;
  452.         }
  453. //      print_block(numName,6);
  454.         codeNo =GetNextNullCell();
  455.         
  456. #endif
  457.         numName[5]=0x0;
  458.         psprintf(buf, "  TO [%s]", numName);
  459. #else
  460. psprintf(buf, "  TO [%s]", name);
  461. #endif
  462. FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  463. #ifdef SUPPORT_HDD_DELETEFILE
  464.         psprintf(buf, "      _____");
  465.         FSGUI_ShowString(STARTX, LINETWO_UL, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  466.         FSGUI_ReplaceFrameBuf(STARTX + 6*9 , LINETWO ,5*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  467. #else
  468. FSGUI_ShowString(STARTX, LINETWO_UL, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  469. FSGUI_ReplaceFrameBuf(STARTX + 6*9 , LINETWO ,8*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  470. #endif  
  471. #ifdef SUPPORT_HDD_DELETEFILE
  472.         }
  473. #endif
  474. #endif
  475.       while (run)
  476.         {
  477. if(ir_rx_empty()) // IR EMPTY
  478. continue;
  479. ch = ir_getch();
  480.                 switch (ch)
  481.                   {
  482. case IRC_UP:
  483. #ifdef HDD_FILE_MANAGEERUI
  484.                             fileManageui_IrUp();
  485. #endif
  486. break;
  487. case IRC_DOWN:
  488. #ifdef HDD_FILE_MANAGEERUI
  489.                         fileManageui_IrDown();
  490.                         break;
  491. #else                        
  492. #ifdef SUPPORT_HDD_DELETEFILE
  493. if (CD_FP.name[0] == '<' || CD_FP.name[0] == '/') // FILE MARK COPY'<' DEL'/'
  494. break;
  495.                         if (IsDelFile)
  496.                     {
  497.                             IsDelFile =0;
  498.                             FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  499.                             for (i = 0; i < 8; i++)
  500.                         {
  501.                                 name[i]=0x20;
  502.                     }
  503.                             name[i]=0x0;
  504.                             for (i = 0; i < 8; i++)
  505.                     {
  506.                                 if (CD_FP.name[i] == 0x0)
  507.                         {
  508.                                     break;
  509.                         }
  510.                                 name[i]=CD_FP.name[i];
  511.                             }
  512.                             psprintf(buf, "COPY [%s] SIZE:%ldK", name, (CD_FP.size)/1024);
  513.                             FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  514.                             for (i = 0; i < 5; i++)
  515.                         {
  516.                                 numName[i]=0x20;
  517.                         }
  518.                             numName[i]=0x0;
  519.                             psprintf(buf, "  TO [%s]", numName);
  520.                             FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  521.                             psprintf(buf, "      _____");
  522.                             FSGUI_ShowString(STARTX, LINETWO_UL, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  523.                             FSGUI_ReplaceFrameBuf(STARTX + 6*9 , LINETWO ,5*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  524.                     }
  525.                         else
  526.                     {
  527.                             IsDelFile =1;
  528.                             FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  529.                             for (i = 0; i < 5; i++)
  530.                         {
  531.                                 numName[i]=0x20;
  532.                         }
  533.                             numName[i]=0x0;
  534.                             psprintf(buf, "    DELETE FILE NO.[%s]", numName);
  535.                             FSGUI_ShowString(STARTX+9, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  536.                             psprintf(buf, "_____");
  537.                             FSGUI_ShowString(STARTX+ 21*9, LINETWO_UL, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  538.                             FSGUI_ReplaceFrameBuf(STARTX + 21*9 , LINETWO ,5*9, 12,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  539.                     }
  540.                     break;
  541. #endif
  542. #endif
  543. case IRC_LEFT:
  544. #ifdef HDD_FILE_MANAGEERUI
  545.                         fileManagerui_IrLeft();
  546.                         break;
  547. #endif  
  548. case IRC_RIGHT:
  549.                             printf("IRC_RIGHTn");
  550. #ifdef HDD_FILE_MANAGEERUI
  551.                             fileManagerui_IrRight();
  552. #endif
  553. break;
  554. case IRC_SELECT:
  555. #ifndef HDD_FILE_MANAGEERUI
  556.                             if (ok == 1)
  557.                             {
  558. #ifdef SUPPORT_HDD_DELETEFILE
  559.                                 if (IsDelFile)
  560.                       {
  561.                                     printf("DELETE FILE %dn",codeNo);
  562.                                     DeleteUserFile(codeNo);
  563.                                     run = 0;
  564.                                     break;
  565.                       }
  566.                                 else
  567.                                 {
  568.                                     if (SaveIndexFile(UpdataUIindex()))
  569.                       {
  570.                                         printf("stFileInfo.filename %sn",stFileInfo.filename);
  571.                                         strcpy(name,stFileInfo.filename);
  572.                       }else
  573.                       {
  574.                                         printf("ERROR:Can't save MEGIDXn");    
  575.                                         run = 0;
  576. break;
  577.                                     }
  578.                                 }
  579. #endif
  580.                                 run=0;
  581.                                 FSGUI_FillFrameBuf(STARTX + 16 * 9, LINETWO, 4 * 9, 12,
  582.                                     BK_GROUNDY, BK_GROUNDCRCB);
  583.                                 do_copy(name);
  584.                                 delay_1ms(1000);
  585.                                 break;
  586.                             } 
  587. #endif                            
  588. #ifdef SUPPORT_HDD_DELETEFILE
  589. #ifdef ADD_NEWFILE_SEQUENCE
  590. #ifdef HDD_FILE_MANAGEERUI
  591.                             retflag =fileManageui_IrSelect();
  592.                             codeNo =fileManageui_GetSongCode();
  593.                             printf("irselect return word %d  codeNo %dn",retflag,codeNo);
  594.                             
  595.                             k = 0;
  596.                             for (i = 0; i <5; i++)
  597.                             {
  598.                                 numName[i]=0x20;
  599.                             }
  600.                             numName[i] =0;
  601.                             if (retflag ==2)
  602.                       {
  603.                                 printf("del code is %dn",codeNo);
  604.                                 if (IsfailCode(codeNo) ==ERROR_REPEAT_CODE)
  605.                           {
  606.                                     printf("DELETE FILE %dn",codeNo);
  607.                                     DeleteUserFile(codeNo);
  608.                                     fileManageui_IrReturn();
  609.                                     break;
  610.                                 }
  611.                             }
  612. #else
  613.                             if (IsDelFile)
  614.                             {
  615.                                 if (IsfailCode(codeNo) ==ERROR_REPEAT_CODE)
  616.                                 {
  617.                                     printf("name %sn",numName);
  618.                                     psprintf(buf, "    DELETE FILE NO.[%s] OK", numName);
  619.                                     FSGUI_FillFrameBuf(STARTX + 21* 9, LINETWO, 5 * 9, 12, BK_GROUNDY,
  620.                                                        BK_GROUNDCRCB);
  621.                                     FSGUI_ShowString(STARTX+9, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  622.                                     FSGUI_ReplaceFrameBuf(STARTX +  28* 9, LINETWO, 2 * 9, 12,
  623.                                                           BK_GROUNDY, BK_GROUNDCRCB, HL_Y, HL_CRCB);
  624.                           }  
  625.                                 break;
  626.                           }
  627. #endif
  628.                             else
  629. #ifdef HDD_FILE_MANAGEERUI
  630.                             if (retflag ==1)
  631. #endif
  632.                             {
  633. run=0;
  634.                                 if ((!IsfailCode(codeNo))&&(codeNo))
  635.                                 {
  636.                                     SetDefaultFileInfo(codeNo);
  637.                                 }else
  638.                                 {
  639.                                     printf("WARiNG:Overlap with exist fileCoden");    
  640. #ifdef HDD_FILE_MANAGEERUI
  641.                                     fileManageui_close();
  642. #endif
  643.                                     break;
  644.                                 }
  645.                                 if (SaveIndexFile(UpdataUIindex()))
  646.                                 {
  647.                                     printf("stFileInfo.filename %sn",stFileInfo.filename);
  648.                                     strcpy(name,stFileInfo.filename);
  649.                                 }else
  650.                                 {
  651.                                     printf("ERROR:Can't save MEGIDXn");    
  652. #ifdef HDD_FILE_MANAGEERUI
  653.                                     fileManageui_close();
  654. #endif 
  655.                                     break;
  656.                                 }
  657. #ifndef HDD_FILE_MANAGEERUI
  658.                                 FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  659.                                 psprintf(buf, "COPY [%s] SIZE:%ldK", name, (CD_FP.size)/1024);
  660.                                 printf("%sn",buf);
  661.                                 FSGUI_ShowString(STARTX, LINEONE, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  662.                                 psprintf(buf, "  TO [%05d]  OK",codeNo );
  663.                                 FSGUI_FillFrameBuf(STARTX + 6 * 9, LINETWO, 5 * 9, 12, BK_GROUNDY,
  664.                                                    BK_GROUNDCRCB);
  665.                                 FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y,
  666.                                                  FS_FONTCOLOR_FILE_CrCb);
  667.                                 FSGUI_ReplaceFrameBuf(STARTX + 12 * 9, LINETWO, 4 * 9, 12,
  668.                                                       BK_GROUNDY, BK_GROUNDCRCB, HL_Y, HL_CRCB);
  669.                         FSGUI_FillFrameBuf(STARTX + 16 * 9, LINETWO, 4 * 9, 12,
  670.                                            BK_GROUNDY, BK_GROUNDCRCB);
  671. #endif        
  672.                         do_copy(name);
  673.                         delay_1ms(1000);
  674. #ifndef HDD_FILE_MANAGEERUI
  675.                                 fileManageui_close();
  676. #endif        
  677.                         break;
  678.                       } 
  679. #ifdef HDD_FILE_MANAGEERUI
  680.                             else if(retflag ==3)
  681.                             {
  682.                                 fileManageui_close();
  683.                                 run = 0;
  684.                             }
  685.                             break;
  686. #endif
  687. #else
  688.                             if (k<5) {
  689.                                     printf("input Num less than 5n");
  690.                                     break;
  691.                     }
  692.                             for (i=0;i<5;i++)
  693.                                   {
  694.                                 codeNo*=10;
  695.                                 if (numName[i]!=0x20)
  696.                                       {
  697.                                     codeNo+=numName[i]-'0';
  698.                                       } 
  699.                                   }
  700.                             printf("codeNo is %d k is %dn",codeNo,k);
  701.                             if (IsDelFile)
  702.                                 {
  703.                                 if (IsfailCode(codeNo) ==ERROR_REPEAT_CODE)
  704.                                 {
  705.                                     printf("name %sn",numName);
  706.                                     psprintf(buf, "    DELETE FILE NO.[%s] OK", numName);
  707.                                     FSGUI_FillFrameBuf(STARTX + 21* 9, LINETWO, 5 * 9, 12, BK_GROUNDY,
  708.                                                        BK_GROUNDCRCB);
  709.                                     FSGUI_ShowString(STARTX+9, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  710.                                     FSGUI_ReplaceFrameBuf(STARTX +  28* 9, LINETWO, 2 * 9, 12,
  711.                                                           BK_GROUNDY, BK_GROUNDCRCB, HL_Y, HL_CRCB);
  712.                             }
  713.                         }
  714.                             else
  715.                             {
  716.                                 if ((!IsfailCode(codeNo))&&(codeNo))
  717.                                 {
  718.                                     SetDefaultFileInfo(codeNo);
  719.                                 }else
  720.                                 {
  721.                                     printf("WARiNG:Overlap with exist fileCoden");    
  722.                         run = 0;
  723. break;
  724. }
  725.                                 printf("name %sn",name);
  726.                                 psprintf(buf, "  TO [%s]  OK", numName);
  727.                                 FSGUI_FillFrameBuf(STARTX + 6 * 9, LINETWO, 5 * 9, 12, BK_GROUNDY,
  728.                                                    BK_GROUNDCRCB);
  729.                                 FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y,
  730.                                                  FS_FONTCOLOR_FILE_CrCb);
  731.                                 FSGUI_ReplaceFrameBuf(STARTX + 12 * 9, LINETWO, 4 * 9, 12,
  732.                                                       BK_GROUNDY, BK_GROUNDCRCB, HL_Y, HL_CRCB);
  733.                             }
  734. #endif
  735. #else
  736. printf("COPY IR[%x]->[%s]",ch, "IRC_SELECT");
  737. psprintf(buf, "  TO [%s]  OK", name);
  738.                     FSGUI_FillFrameBuf(STARTX + 6 * 9, LINETWO, 8 * 9, 12, BK_GROUNDY,
  739.                                        BK_GROUNDCRCB);
  740.                     FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y,
  741.                                      FS_FONTCOLOR_FILE_CrCb);
  742.                     FSGUI_ReplaceFrameBuf(STARTX + 16 * 9, LINETWO, 4 * 9, 12,
  743.                                           BK_GROUNDY, BK_GROUNDCRCB, HL_Y, HL_CRCB);
  744. #endif
  745. k=0;
  746. ok=1;
  747. break;
  748. case IRC_GOTO:
  749. break;
  750. case IRC_REPEAT:
  751. printf("COPY IR[%x]->[%s]",ch, "IRC_REPEAT");
  752. fsgui_cdcopy();
  753. run=0;
  754. break;
  755. case IRC_0:
  756. case IRC_1:
  757. case IRC_2:
  758. case IRC_3:
  759. case IRC_4:
  760. case IRC_5:
  761. case IRC_6:
  762. case IRC_7:
  763. case IRC_8:
  764. case IRC_9:
  765. #ifdef ADD_NEWFILE_SEQUENCE
  766.                             break;
  767. #else
  768. if(ok==1)
  769. break;
  770. #ifdef  SUPPORT_HDD_DELETEFILE            
  771.                             if (k == 0)
  772.                                   {
  773.                                 for (i = 0; i <5; i++)
  774. {
  775.                                     numName[i]=0x20;
  776. }
  777.                                 numName[i] =0;
  778.  }
  779.                             if(k>=5)
  780.                                         break;
  781.                             numName[k]=ch+0x30;
  782.                             k++;
  783.                           
  784.                             printf(" numName %sn",numName);
  785.                             if (IsDelFile)
  786. {
  787.                                 psprintf(buf, "    DELETE FILE NO.[%s]", numName);
  788.                                 FSGUI_FillFrameBuf(STARTX + 21*9 , LINETWO ,5*9, 12,HL_Y,HL_CRCB);
  789.                                 FSGUI_ShowString(STARTX+9, LINETWO, buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  790. }
  791.   else
  792.    {   
  793.                                 psprintf(buf, "  TO [%s]", numName);
  794.                                 FSGUI_FillFrameBuf(STARTX + 6*9 , LINETWO ,5*9, 12,HL_Y,HL_CRCB);
  795.                                 FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y,
  796.                                                  FS_FONTCOLOR_FILE_CrCb);
  797.                           }
  798. #else
  799.                     if (k == 0)
  800.                     {
  801.                         for (i = 0; i < 8; i++)
  802.                         {
  803. name[i]=0x20;
  804. }
  805. }
  806. if(k>=8)
  807. break;
  808. name[k]=ch+0x30;
  809. k++;
  810. psprintf(buf, "  TO [%s]", name);
  811. FSGUI_FillFrameBuf(STARTX + 6*9 , LINETWO ,8*9, 12,HL_Y,HL_CRCB);
  812.                     FSGUI_ShowString(STARTX, LINETWO, buf, FS_FONTCOLOR_FILE_Y,
  813.                                      FS_FONTCOLOR_FILE_CrCb);
  814. #endif
  815. break;
  816. #endif
  817. case IRC_3D:
  818. break;
  819. case IRC_RETURN:
  820. #ifdef HDD_FILE_MANAGEERUI
  821.                         if (!fileManageui_IrReturn())
  822.                             {
  823.                                 run =0;
  824.                             }
  825. #endif
  826.                     break;
  827. case IRC_STOP:
  828. #ifdef  HDD_FILE_MANAGEERUI              
  829. #endif
  830. run=0;
  831. break;
  832. case IRC_NULL:
  833. break;
  834. default:
  835. printf("COPY IR[%x]",ch);
  836. break;
  837. }
  838.             }
  839. #ifdef  HDD_FILE_MANAGEERUI              
  840.         fileManageui_close();
  841. #endif      
  842. FSGUI_FillFrameBuf(0,236,352,48,BK_GROUNDY,BK_GROUNDCRCB);
  843. FSGUI_Menu();
  844. FSGUI_Refresh();
  845. return 0;
  846. }
  847. #endif //#ifdef SUPPORT_HDD_ACCESS