| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | #include "mywin_user_filder.h"
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #include "avi.h"
 | 
					
						
							|  |  |  |  | #include "char_encode.h"
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | #include "elf.h"
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #include "ff.h"
 | 
					
						
							|  |  |  |  | #include "gif.h"
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | #include "lcd_rgb.h"
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #include "mywin_inc.h"
 | 
					
						
							|  |  |  |  | #include "mywin_music.h"
 | 
					
						
							|  |  |  |  | #include "mywin_user_animation.h"
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | #include "mywin_user_debug.h"
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #include "mywin_user_photo.h"
 | 
					
						
							|  |  |  |  | #include "nes_main.h"
 | 
					
						
							|  |  |  |  | #include "nrf.h"
 | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | #include "string.h"
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #include "system_updata.h"
 | 
					
						
							|  |  |  |  | #include "tools.h"
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | #define WIN_FILDER_TYPE "WIN_FilderStruct"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static const char *g_popup_itmes[] = { | 
					
						
							|  |  |  |  |     "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>ϵͳ<EFBFBD>ļ<EFBFBD>", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ϣ", "ɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | void FILDER_Delete(WIN_FilderStruct *up); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | WIN_FilderStruct *WIN_CreatFilder(WIN_WindowStruct *base, | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |                                   void (*msgLoop)(struct _WIN_WindowStruct *win, | 
					
						
							|  |  |  |  |                                                   WIN_MsgStruct *msg), | 
					
						
							|  |  |  |  |                                   int x, int y, int x_size, int y_size) { | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѭ<CFA2><D1AD>
 | 
					
						
							|  |  |  |  |   if (msgLoop == 0) { | 
					
						
							|  |  |  |  |     msgLoop = (void (*)(struct _WIN_WindowStruct *win, | 
					
						
							|  |  |  |  |                         WIN_MsgStruct *msg))FILDER_defaultMsgLoop; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   WIN_FilderStruct *ret = mymalloc_exm(sizeof(WIN_FilderStruct)); | 
					
						
							|  |  |  |  |   // <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>캯<EFBFBD><ECBAAF>
 | 
					
						
							|  |  |  |  |   if (ret) { | 
					
						
							|  |  |  |  |     mymemset(ret, 0, sizeof(WIN_FilderStruct)); | 
					
						
							|  |  |  |  |     //		if (0==WIN_CreatWindowExt((WIN_WindowStruct
 | 
					
						
							|  |  |  |  |     //*)ret,base,msgLoop,x,y,x_size,y_size))
 | 
					
						
							|  |  |  |  |     if (0 == WIN_CreatTouchEx((WIN_TouchWinStruct *)ret, base, msgLoop, x, y, | 
					
						
							|  |  |  |  |                               x_size, y_size)) { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
 | 
					
						
							|  |  |  |  |       myfree(ret); | 
					
						
							|  |  |  |  |       ret = 0; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |       ((WIN_WindowStruct *)ret)->winType = WIN_FILDER_TYPE; | 
					
						
							|  |  |  |  |       ((WIN_WindowStruct *)ret)->deleteWindow = | 
					
						
							|  |  |  |  |           (void (*)(struct _WIN_WindowStruct *win))FILDER_Delete; | 
					
						
							|  |  |  |  |       ((WIN_WindowStruct *)ret)->bkcolor = 0x808080; | 
					
						
							|  |  |  |  |       ((WIN_WindowStruct *)ret)->color = 0xffffff; | 
					
						
							|  |  |  |  |       ((WIN_WindowStruct *)ret)->intercept = 1; // <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |       ret->titleHight = 30; | 
					
						
							|  |  |  |  |       ret->itemHight = 30; | 
					
						
							|  |  |  |  |       ret->itemIndent = 35; | 
					
						
							|  |  |  |  |       ret->scrollbar_xsize = 10; | 
					
						
							|  |  |  |  |       ret->itemNumOnePage = | 
					
						
							|  |  |  |  |           (((WIN_WindowStruct *)ret)->y_size - ret->titleHight) / | 
					
						
							|  |  |  |  |           ret->itemHight; | 
					
						
							|  |  |  |  |       ret->itemHight = (((WIN_WindowStruct *)ret)->y_size - ret->titleHight) / | 
					
						
							|  |  |  |  |                        ret->itemNumOnePage; | 
					
						
							|  |  |  |  |       ret->imgDir = 0; | 
					
						
							|  |  |  |  |       ret->imgFile = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       tools_updata_on(); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   return ret; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_Delete(WIN_FilderStruct *up) { | 
					
						
							|  |  |  |  |   tools_updata_off(); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |   // <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٺ<EFBFBD><D9BA><EFBFBD>
 | 
					
						
							|  |  |  |  |   WIN_DeleteWindow((WIN_WindowStruct *)up); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | int FILDER_SetIndex(WIN_FilderStruct *filder, int index); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ͬʱɨ<CAB1><C9A8>·<EFBFBD><C2B7><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_SetFileDir(WIN_FilderStruct *filder, char *dir) { | 
					
						
							|  |  |  |  |   mymemcpy(filder->dirName, dir, strlen(dir)); | 
					
						
							|  |  |  |  |   FILDER_ClearItem(filder); | 
					
						
							|  |  |  |  |   FILDER_ScanFile(filder); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_ClearItem(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   filder->fileNum = 0; | 
					
						
							|  |  |  |  |   filder->firstItemOnPage = 0; | 
					
						
							|  |  |  |  |   filder->dirNum = 0; | 
					
						
							|  |  |  |  |   filder->file[0].name[0] = 0; | 
					
						
							|  |  |  |  |   FILDER_SetIndex(filder, 0); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ŀ
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_AddItem(WIN_FilderStruct *filder, Filder_FildInfo *file) { | 
					
						
							|  |  |  |  |   if (filder->fileNum < FILDER_FILE_MAXNUM) { | 
					
						
							|  |  |  |  |     mymemcpy(&filder->file[filder->fileNum], file, sizeof(Filder_FildInfo)); | 
					
						
							|  |  |  |  |     filder->fileNum++; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD><D0A3>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>1
 | 
					
						
							|  |  |  |  |     if (file->type == FILDER_DIR_TYPE) { | 
					
						
							|  |  |  |  |       filder->dirNum++; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8>λ<EFBFBD>ò<EFBFBD><C3B2><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ŀ
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_InsertItem(WIN_FilderStruct *filder, Filder_FildInfo *file, | 
					
						
							|  |  |  |  |                        int index) { | 
					
						
							|  |  |  |  |   if (index < 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   if (filder->fileNum < FILDER_FILE_MAXNUM) { | 
					
						
							|  |  |  |  |     // <20><><EFBFBD>б<EFBFBD><D0B1>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
 | 
					
						
							|  |  |  |  |     if (index < filder->fileNum) { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
 | 
					
						
							|  |  |  |  |       for (int i = filder->fileNum - 1; i >= index; i--) { | 
					
						
							|  |  |  |  |         mymemcpy(&filder->file[i + 1], &filder->file[i], | 
					
						
							|  |  |  |  |                  sizeof(Filder_FildInfo)); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
 | 
					
						
							|  |  |  |  |       mymemcpy(&filder->file[index], file, sizeof(Filder_FildInfo)); | 
					
						
							|  |  |  |  |       filder->fileNum++; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD><D0A3>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>1
 | 
					
						
							|  |  |  |  |       if (file->type == FILDER_DIR_TYPE) { | 
					
						
							|  |  |  |  |         filder->dirNum++; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       FILDER_AddItem(filder, file); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><>ջ
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_PathPush(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   if (filder->path.fileNum < FILDER_DIR_DEPTH) { | 
					
						
							|  |  |  |  |     for (int i = filder->path.fileNum; i > 0; i--) { | 
					
						
							|  |  |  |  |       filder->path.first[i] = filder->path.first[i - 1]; | 
					
						
							|  |  |  |  |       filder->path.index[i] = filder->path.index[i - 1]; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     filder->path.first[0] = filder->firstItemOnPage; | 
					
						
							|  |  |  |  |     filder->path.index[0] = filder->index; | 
					
						
							|  |  |  |  |     filder->path.fileNum++; | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   return -1; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><>ջ
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_PathPull(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   if (filder->path.fileNum) { | 
					
						
							|  |  |  |  |     filder->firstItemOnPage = filder->path.first[0]; | 
					
						
							|  |  |  |  |     filder->index = filder->path.index[0]; | 
					
						
							|  |  |  |  |     filder->path.fileNum--; | 
					
						
							|  |  |  |  |     for (int i = 0; i < filder->path.fileNum; i++) { | 
					
						
							|  |  |  |  |       filder->path.first[i] = filder->path.first[i + 1]; | 
					
						
							|  |  |  |  |       filder->path.index[i] = filder->path.index[i + 1]; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   return -1; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ӵ<EFBFBD>Ŀ¼<C4BF><C2BC>ͬʱɨ<CAB1><C9A8>·<EFBFBD><C2B7><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD>,Ŀ<>겻<EFBFBD><EAB2BB>Ŀ¼ʱ<C2BC><CAB1><EFBFBD><EFBFBD>-1
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_DirAppend(WIN_FilderStruct *filder, Filder_FildInfo *file) { | 
					
						
							|  |  |  |  |   int dir_len = strlen(filder->dirName); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (file->type == FILDER_DIR_TYPE) { | 
					
						
							|  |  |  |  |     filder->dirName[dir_len] = '/'; | 
					
						
							|  |  |  |  |     dir_len++; | 
					
						
							|  |  |  |  |     mymemcpy(&filder->dirName[dir_len], file->name, strlen(file->name) + 1); | 
					
						
							|  |  |  |  |     FILDER_PathPush(filder); | 
					
						
							|  |  |  |  |     FILDER_ClearItem(filder); | 
					
						
							|  |  |  |  |     FILDER_ScanFile(filder); | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, 0); | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ŀ¼<C4BF><C2BC>ͬʱɨ<CAB1><C9A8>Ŀ¼<C4BF>µ<EFBFBD><C2B5>ļ<EFBFBD>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>-1
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_DirCut(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   int dir_len = strlen(filder->dirName); | 
					
						
							|  |  |  |  |   if (dir_len == 0) | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							|  |  |  |  |   char *ptr_name = &filder->dirName[dir_len - 1]; | 
					
						
							|  |  |  |  |   while (*ptr_name && (*ptr_name != '/') && (*ptr_name != ':')) { | 
					
						
							|  |  |  |  |     *ptr_name = 0; | 
					
						
							|  |  |  |  |     ptr_name--; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (*ptr_name == '/') { | 
					
						
							|  |  |  |  |     *ptr_name = 0; | 
					
						
							|  |  |  |  |     FILDER_ClearItem(filder); | 
					
						
							|  |  |  |  |     FILDER_PathPull(filder); | 
					
						
							|  |  |  |  |     FILDER_ScanFile(filder); | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, filder->index); | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_GetFileRoute(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   int dir_len = strlen(filder->dirName); | 
					
						
							|  |  |  |  |   mymemcpy(filder->fileName, filder->dirName, dir_len + 1); | 
					
						
							|  |  |  |  |   filder->fileName[dir_len] = '/'; | 
					
						
							|  |  |  |  |   dir_len++; | 
					
						
							|  |  |  |  |   mymemcpy(&filder->fileName[dir_len], filder->file[filder->index].name, | 
					
						
							|  |  |  |  |            strlen(filder->file[filder->index].name) + 1); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // ɨ<><C9A8><EFBFBD>ļ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_ScanFile(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   FRESULT ret = FR_OK; | 
					
						
							|  |  |  |  |   DIR dir = {0}; | 
					
						
							|  |  |  |  |   FILINFO *file_info = 0; | 
					
						
							|  |  |  |  |   Filder_FildInfo *file_info_x = 0; | 
					
						
							|  |  |  |  |   file_info = mymalloc(sizeof(FILINFO)); | 
					
						
							|  |  |  |  |   file_info_x = mymalloc(sizeof(Filder_FildInfo)); | 
					
						
							|  |  |  |  |   ret = f_findfirst(&dir, file_info, filder->dirName, "*"); | 
					
						
							|  |  |  |  |   while ((ret == FR_OK) && (file_info->fname[0] != 0)) { | 
					
						
							|  |  |  |  |     mymemcpy(file_info_x->name, file_info->fname, strlen(file_info->fname) + 1); | 
					
						
							|  |  |  |  |     file_info_x->size = file_info->fsize; | 
					
						
							|  |  |  |  |     if (AM_DIR & file_info->fattrib) { | 
					
						
							|  |  |  |  |       file_info_x->type = FILDER_DIR_TYPE; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       file_info_x->type = FILDER_FILE_TYPE; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if (filder->fileNum < FILDER_FILE_MAXNUM) { | 
					
						
							|  |  |  |  |       if (file_info_x->type == FILDER_DIR_TYPE) { | 
					
						
							|  |  |  |  |         FILDER_InsertItem(filder, file_info_x, filder->dirNum); | 
					
						
							|  |  |  |  |       } else { | 
					
						
							|  |  |  |  |         FILDER_AddItem(filder, file_info_x); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     ret = f_findnext(&dir, file_info); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   myfree(file_info); | 
					
						
							|  |  |  |  |   myfree(file_info_x); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_OpenFile(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   int str_len = strlen(filder->file[filder->index].name); | 
					
						
							|  |  |  |  |   char *p_str = &filder->file[filder->index].name[str_len - 4]; | 
					
						
							|  |  |  |  |   if (strcmp(p_str, ".jpg") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     PHOTO_ShowPhoto((WIN_WindowStruct *)filder, filder->fileName); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".bmp") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     PHOTO_ShowPhoto((WIN_WindowStruct *)filder, filder->fileName); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".png") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     PHOTO_ShowPhoto((WIN_WindowStruct *)filder, filder->fileName); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".pic") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     WIN_PicStruct pic = {0}; | 
					
						
							| 
									
										
										
										
											2025-10-18 13:58:40 +08:00
										 |  |  |  |     uint32_t file_size = 0; | 
					
						
							|  |  |  |  |     uint8_t *data = 0; | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |     FIL *file = mymalloc(sizeof(FIL)); | 
					
						
							|  |  |  |  |     FILINFO *file_info = mymalloc(sizeof(FILINFO)); | 
					
						
							|  |  |  |  |     UINT br; | 
					
						
							| 
									
										
										
										
											2025-10-18 13:58:40 +08:00
										 |  |  |  |     uint8_t res = 0; | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |     f_stat((char *)filder->fileName, file_info); | 
					
						
							|  |  |  |  |     data = mymalloc(file_info->fsize); | 
					
						
							|  |  |  |  |     f_open(file, (char *)filder->fileName, FA_READ); | 
					
						
							|  |  |  |  |     f_read(file, data, file_info->fsize, &br); | 
					
						
							|  |  |  |  |     f_close(file); | 
					
						
							| 
									
										
										
										
											2025-10-18 13:58:40 +08:00
										 |  |  |  |     res = WIN_GetImageSize((uint8_t *)data, &pic.xsize, &pic.ysize); | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |     if (res == 0) { | 
					
						
							| 
									
										
										
										
											2025-10-18 13:58:40 +08:00
										 |  |  |  |       pic.data = (uint16_t *)(data + 8); | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  |     PHOTO_ShowPic((WIN_WindowStruct *)filder, &pic); | 
					
						
							|  |  |  |  |     myfree(data); | 
					
						
							|  |  |  |  |     myfree(file); | 
					
						
							|  |  |  |  |     myfree(file_info); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".gif") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     ANIMATION_ShowGif((WIN_WindowStruct *)filder, (char *)filder->fileName); | 
					
						
							|  |  |  |  |   } else if ((strcmp(p_str, ".nes") == 0) || (strcmp(p_str, ".NES") == 0)) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     WIN_KeyShieldOn(); | 
					
						
							| 
									
										
										
										
											2025-10-18 13:58:40 +08:00
										 |  |  |  |     nes_load((uint8_t *)filder->fileName, LCD_GetShowAddr(), | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  |              LCD_GetLcdSizeX() / 2 - 128, LCD_GetLcdSizeY() / 2 - 120); | 
					
						
							|  |  |  |  |     WIN_KeyShieldOff(); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".avi") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     WIN_KeyShieldOn(); | 
					
						
							|  |  |  |  |     int ret = video_play(filder->fileName, 0); | 
					
						
							|  |  |  |  |     WIN_KeyShieldOff(); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".mp3") == 0) { | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     MUSIC_PlaySong((WIN_WindowStruct *)filder, filder->fileName); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".axf") == 0) { | 
					
						
							|  |  |  |  |     // ִ<>г<EFBFBD><D0B3><EFBFBD><EFBFBD>ļ<EFBFBD>
 | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     app_run_path(filder->fileName); | 
					
						
							|  |  |  |  |   } else if (strcmp(p_str, ".lua") == 0) { | 
					
						
							|  |  |  |  |     // ִ<><D6B4>lua<75>ű<EFBFBD>
 | 
					
						
							|  |  |  |  |     FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |     DEBUG_EnterPrintCmd(filder->fileName); | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><EFBFBD>ļ<EFBFBD>", "ȷ<EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                     5000); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_PaintItem(WIN_FilderStruct *filder, int index) { | 
					
						
							|  |  |  |  |   if (index < 0 || index >= filder->fileNum) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   int x = 0; | 
					
						
							|  |  |  |  |   int y = filder->titleHight + filder->y_off + | 
					
						
							|  |  |  |  |           (index - filder->firstItemOnPage) * filder->itemHight; | 
					
						
							|  |  |  |  |   int x_size = ((WIN_WindowStruct *)filder)->x_size; | 
					
						
							|  |  |  |  |   int y_size = filder->itemHight; | 
					
						
							|  |  |  |  |   Filder_FildInfo *file = &filder->file[index]; | 
					
						
							|  |  |  |  |   // <20><>ʾͼ<CABE><CDBC>
 | 
					
						
							|  |  |  |  |   int img_xsize = 0; | 
					
						
							|  |  |  |  |   int img_ysize = 0; | 
					
						
							|  |  |  |  |   char *img = 0; | 
					
						
							|  |  |  |  |   if (file->type == FILDER_DIR_TYPE) { | 
					
						
							|  |  |  |  |     img = filder->imgDir; | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     img = filder->imgFile; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (img) { | 
					
						
							|  |  |  |  |     WIN_PicStruct *pic = WIN_GetPic(img); | 
					
						
							|  |  |  |  |     if (pic) { | 
					
						
							|  |  |  |  |       WIN_DrawPic(pic, x + (filder->itemIndent - pic->xsize) / 2, | 
					
						
							|  |  |  |  |                   y + (y_size - img_ysize) / 2, pic->xsize, pic->ysize); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   // <20><>ʾ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
 | 
					
						
							|  |  |  |  |   //    RECT_Struct rs={0};//<2F><><EFBFBD>ڲü<DAB2><C3BC><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   //    rs.x=x+filder->itemIndent;rs.y=y;
 | 
					
						
							|  |  |  |  |   //    rs.x_size=x_size-filder->scrollbar_xsize-filder->itemIndent-1;
 | 
					
						
							|  |  |  |  |   //    rs.y_size=y_size;
 | 
					
						
							|  |  |  |  |   //    WIN_SetWinInvalidRect (((WIN_WindowStruct *)filder),&rs);
 | 
					
						
							|  |  |  |  |   if (index == filder->index) | 
					
						
							|  |  |  |  |     WIN_DrawTxtAt(file->name, x + filder->itemIndent + filder->scroll_x, | 
					
						
							|  |  |  |  |                   y + y_size / 2 - WIN_GetFontHight() / 2); | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     WIN_DrawTxtAt(file->name, x + filder->itemIndent, | 
					
						
							|  |  |  |  |                   y + y_size / 2 - WIN_GetFontHight() / 2); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><><EFBFBD>ƺ<EFBFBD><C6BA><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_DefaultPaint(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   // ʹ<><CAB9>˫<EFBFBD><CBAB><EFBFBD>壬<EFBFBD><E5A3AC>ֹ<EFBFBD><D6B9>˸
 | 
					
						
							|  |  |  |  |   //	LCD_LayerBufferOn();
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   int x = 0; | 
					
						
							|  |  |  |  |   int y = 0; | 
					
						
							|  |  |  |  |   int x_size = ((WIN_WindowStruct *)filder)->x_size; | 
					
						
							|  |  |  |  |   int y_size = ((WIN_WindowStruct *)filder)->y_size; | 
					
						
							|  |  |  |  |   char txt_buff[20] = {0}; | 
					
						
							|  |  |  |  |   WIN_PaintBackGround((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   int scrollbar_x = x_size - filder->scrollbar_xsize; | 
					
						
							|  |  |  |  |   int scrollbar_y = y + filder->titleHight; | 
					
						
							|  |  |  |  |   int scrollbar_xsize = filder->scrollbar_xsize; | 
					
						
							|  |  |  |  |   int scrollbar_ysize = y_size - scrollbar_y; | 
					
						
							|  |  |  |  |   int scrollbar_tstart = | 
					
						
							|  |  |  |  |       filder->firstItemOnPage * scrollbar_ysize / filder->fileNum; | 
					
						
							|  |  |  |  |   int scrollbar_tsize = | 
					
						
							|  |  |  |  |       filder->itemNumOnePage * scrollbar_ysize / filder->fileNum; | 
					
						
							|  |  |  |  |   WIN_SetLcdColor(((WIN_WindowStruct *)filder)->color); | 
					
						
							|  |  |  |  |   WIN_DrawHLine(scrollbar_x, scrollbar_y, scrollbar_x + scrollbar_xsize - 1); | 
					
						
							|  |  |  |  |   WIN_DrawHLine(scrollbar_x, scrollbar_y + scrollbar_ysize - 1, | 
					
						
							|  |  |  |  |                 scrollbar_x + scrollbar_xsize - 1); | 
					
						
							|  |  |  |  |   WIN_DrawVLine(scrollbar_x, scrollbar_y, scrollbar_y + scrollbar_ysize - 1); | 
					
						
							|  |  |  |  |   WIN_DrawVLine(scrollbar_x + scrollbar_xsize - 1, scrollbar_y, | 
					
						
							|  |  |  |  |                 scrollbar_y + scrollbar_ysize - 1); | 
					
						
							|  |  |  |  |   WIN_FillRectByColor(scrollbar_x, scrollbar_y + scrollbar_tstart, | 
					
						
							|  |  |  |  |                       scrollbar_xsize, scrollbar_tsize); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   WIN_SetFontMode(WIN_DRAWMODE_ALONE); | 
					
						
							|  |  |  |  |   WIN_DrawTxtHCenterAt("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", x_size / 2, | 
					
						
							|  |  |  |  |                        filder->titleHight / 2 - WIN_GetFontHight() / 2); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><>ʾ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
 | 
					
						
							|  |  |  |  |   sprintf(txt_buff, "%d/%d", filder->index + 1, filder->fileNum); | 
					
						
							|  |  |  |  |   WIN_DrawTxtAt(txt_buff, | 
					
						
							|  |  |  |  |                 x_size - WIN_GetFontWidth() * strlen(txt_buff) / 2 - 1, | 
					
						
							|  |  |  |  |                 filder->titleHight / 2 - WIN_GetFontHight() / 2); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><>ʾѡ<CABE>п<EFBFBD>
 | 
					
						
							|  |  |  |  |   int selete_x = x; | 
					
						
							|  |  |  |  |   int selete_y = y + filder->titleHight; | 
					
						
							|  |  |  |  |   int selete_xsize = x_size - scrollbar_xsize - 1; | 
					
						
							|  |  |  |  |   int selete_ysize = filder->itemHight; | 
					
						
							|  |  |  |  |   WIN_SetLcdColor(0x00ffff); | 
					
						
							|  |  |  |  |   selete_y += filder->itemHight * (filder->index - filder->firstItemOnPage); | 
					
						
							|  |  |  |  |   WIN_FillRectByColorAlpha(selete_x, selete_y, selete_xsize, selete_ysize, 16); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><>ʾ<EFBFBD>ļ<EFBFBD>
 | 
					
						
							|  |  |  |  |   RECT_Struct rs = {0}; // <20><><EFBFBD>ڲü<DAB2><C3BC><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   rs.x = x; | 
					
						
							|  |  |  |  |   rs.y = y + filder->titleHight; | 
					
						
							|  |  |  |  |   rs.x_size = x_size - scrollbar_xsize - 1; | 
					
						
							|  |  |  |  |   rs.y_size = y_size - rs.y; | 
					
						
							|  |  |  |  |   WIN_SetLcdColor(((WIN_WindowStruct *)filder)->color); | 
					
						
							|  |  |  |  |   WIN_SetWinInvalidRect(((WIN_WindowStruct *)filder), &rs); | 
					
						
							|  |  |  |  |   for (int i = 0; i < filder->itemNumOnePage + 2; i++) { | 
					
						
							|  |  |  |  |     FILDER_PaintItem(filder, i + filder->firstItemOnPage - 1); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   WIN_SetWinInvalidRect(((WIN_WindowStruct *)filder), 0); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | typedef struct { | 
					
						
							|  |  |  |  |   char *name; | 
					
						
							|  |  |  |  |   char *path; | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | } sysfile_updata_struct; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static int sysfile_updata(void *ptr) { | 
					
						
							|  |  |  |  |   sysfile_updata_struct *t = ptr; | 
					
						
							|  |  |  |  |   SysFile_Updata(t->name, t->path); | 
					
						
							|  |  |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static void FILDER_Down(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   if (filder->index < filder->fileNum - 1) { | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, filder->index + 1); | 
					
						
							|  |  |  |  |     if (filder->index >= filder->firstItemOnPage + filder->itemNumOnePage) { | 
					
						
							|  |  |  |  |       filder->firstItemOnPage++; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, 0); | 
					
						
							|  |  |  |  |     filder->firstItemOnPage = 0; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static void FILDER_Up(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   if (filder->index > 0) { | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, filder->index - 1); | 
					
						
							|  |  |  |  |     if (filder->index < filder->firstItemOnPage) { | 
					
						
							|  |  |  |  |       filder->firstItemOnPage--; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     FILDER_SetIndex(filder, filder->fileNum - 1); | 
					
						
							|  |  |  |  |     if (filder->fileNum > filder->itemNumOnePage) | 
					
						
							|  |  |  |  |       filder->firstItemOnPage = filder->fileNum - filder->itemNumOnePage; | 
					
						
							|  |  |  |  |     else | 
					
						
							|  |  |  |  |       filder->firstItemOnPage = 0; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static int g_send_file(void *t); | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | static int set_progress(int now, int all); | 
					
						
							|  |  |  |  | static void get_progress(int *now, int *all); | 
					
						
							|  |  |  |  | static int g_send(void *data, int size); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static void FILDER_Enter(WIN_FilderStruct *filder, int x, int y) { | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (FILDER_DirAppend(filder, &filder->file[filder->index]) == -1) { | 
					
						
							|  |  |  |  |     // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD><C4B4><EFBFBD>
 | 
					
						
							|  |  |  |  |     int index = POPUP_SelectItem((WIN_WindowStruct *)filder, | 
					
						
							|  |  |  |  |                                  (char **)g_popup_itmes, 6, x, y); | 
					
						
							|  |  |  |  |     if (index == 0) { | 
					
						
							|  |  |  |  |       FILDER_OpenFile(filder); | 
					
						
							|  |  |  |  |     } else if (index == 1) { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |       char *txt_buff = mymalloc(256); | 
					
						
							|  |  |  |  |       mymemcpy(txt_buff, filder->file[filder->index].name, | 
					
						
							|  |  |  |  |                strlen(filder->file[filder->index].name) + 1); | 
					
						
							|  |  |  |  |       if (INPUT_KeyBoard((WIN_WindowStruct *)filder, txt_buff, 256) == 1) { | 
					
						
							|  |  |  |  |         char *txt_path_old = mymalloc(256); | 
					
						
							|  |  |  |  |         FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |         mymemcpy(txt_path_old, filder->fileName, | 
					
						
							|  |  |  |  |                  strlen(filder->fileName) + 1); // ԭʼ·<CABC><C2B7>
 | 
					
						
							|  |  |  |  |         mymemcpy(filder->file[filder->index].name, txt_buff, | 
					
						
							|  |  |  |  |                  strlen(txt_buff) + 1); // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
 | 
					
						
							|  |  |  |  |         FILDER_GetFileRoute(filder);    // <20><>·<EFBFBD><C2B7>
 | 
					
						
							|  |  |  |  |         if (f_rename(txt_path_old, filder->fileName) == FR_OK) { | 
					
						
							|  |  |  |  |           MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD>", | 
					
						
							|  |  |  |  |                           "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |         } else { | 
					
						
							|  |  |  |  |           MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                           "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         myfree(txt_path_old); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       myfree(txt_buff); | 
					
						
							|  |  |  |  |     } else if (index == 2) { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD>Ƶ<EFBFBD>ϵͳ<CFB5>ļ<EFBFBD>
 | 
					
						
							|  |  |  |  |       FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |       // SysFile_Updata (filder->file[filder->index].name,filder->fileName);
 | 
					
						
							|  |  |  |  |       sysfile_updata_struct upd = {0}; | 
					
						
							|  |  |  |  |       upd.name = filder->file[filder->index].name; | 
					
						
							|  |  |  |  |       upd.path = filder->fileName; | 
					
						
							|  |  |  |  |       WORKING_DoWork((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                      sysfile_updata, &upd); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>Ѹ<EFBFBD><EFBFBD>Ƶ<EFBFBD>ϵͳ<EFBFBD>ļ<EFBFBD>", | 
					
						
							|  |  |  |  |                       "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |     } else if (index == 3) { | 
					
						
							|  |  |  |  |       // <20>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
 | 
					
						
							|  |  |  |  |       char *txt_buff = mymalloc(512); | 
					
						
							|  |  |  |  |       FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |       sprintf(txt_buff, "·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>%u Byte", filder->fileName, | 
					
						
							|  |  |  |  |               (uint32_t)filder->file[filder->index].size); | 
					
						
							|  |  |  |  |       MSGBOX_Tips((WIN_WindowStruct *)filder, "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ϣ", txt_buff, "ȷ<EFBFBD><EFBFBD>"); | 
					
						
							|  |  |  |  |       myfree(txt_buff); | 
					
						
							|  |  |  |  |     } else if (index == 4) { | 
					
						
							|  |  |  |  |       // ɾ<><C9BE>
 | 
					
						
							|  |  |  |  |       if (MSGBOX_Inquiry((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                          "ȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "ȷ<EFBFBD><EFBFBD>", "ȡ<EFBFBD><EFBFBD>") == 0) { | 
					
						
							|  |  |  |  |         FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |         if (f_unlink(filder->fileName) == FR_OK) { | 
					
						
							|  |  |  |  |           MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                           "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |           FILDER_ClearItem(filder); | 
					
						
							|  |  |  |  |           FILDER_ScanFile(filder); | 
					
						
							|  |  |  |  |         } else { | 
					
						
							|  |  |  |  |           MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "ɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                           "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } else if (index == 5) { | 
					
						
							|  |  |  |  |       // <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |       FILDER_GetFileRoute(filder); | 
					
						
							|  |  |  |  |       SysFile_SendStruct send; | 
					
						
							|  |  |  |  |       SysFile_SendFileInit(&send, filder->file[filder->index].name, | 
					
						
							|  |  |  |  |                            filder->fileName, g_send, set_progress); | 
					
						
							|  |  |  |  |       int ret = WORKING_DoWorkPro((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>", | 
					
						
							|  |  |  |  |                                   g_send_file, &send, 0, 0, get_progress, 25); | 
					
						
							|  |  |  |  |       if (ret == 0) | 
					
						
							|  |  |  |  |         MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳɹ<EFBFBD>", | 
					
						
							|  |  |  |  |                         "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |       else | 
					
						
							|  |  |  |  |         MSGBOX_TipsTime((WIN_WindowStruct *)filder, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>", | 
					
						
							|  |  |  |  |                         "ȷ<EFBFBD><EFBFBD>", 5000); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } // if (FILDER_DirAppend (filder,&filder->file[filder->index])==-1)
 | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | static int g_send_now; | 
					
						
							|  |  |  |  | static int g_send_all; | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static int set_progress(int now, int all) { | 
					
						
							|  |  |  |  |   g_send_now = now; | 
					
						
							|  |  |  |  |   g_send_all = all; | 
					
						
							|  |  |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2025-07-01 00:09:47 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static void get_progress(int *now, int *all) { | 
					
						
							|  |  |  |  |   *now = g_send_now; | 
					
						
							|  |  |  |  |   *all = g_send_all; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static int g_send(void *data, int size) { | 
					
						
							|  |  |  |  |   if (nrf_send(data, size, 0) == NRF_OK) | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static int g_send_file(void *t) { | 
					
						
							|  |  |  |  |   g_send_now = 0; | 
					
						
							|  |  |  |  |   g_send_all = 0; | 
					
						
							|  |  |  |  |   SysFile_SendStruct *send = t; | 
					
						
							|  |  |  |  |   int ret = 0; | 
					
						
							|  |  |  |  |   ret = SysFile_SendFileName(send); | 
					
						
							|  |  |  |  |   if (ret != 0) | 
					
						
							|  |  |  |  |     return ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   ret = SysFile_SendFileInfo(send); | 
					
						
							|  |  |  |  |   if (ret != 0) | 
					
						
							|  |  |  |  |     return ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   ret = SysFile_SendFileData(send); | 
					
						
							|  |  |  |  |   return ret; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | static void FILDER_Home(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (FILDER_DirCut(filder) == -1) { | 
					
						
							|  |  |  |  |     // <20>Ǹ<EFBFBD>Ŀ¼<C4BF>ˣ<EFBFBD><CBA3>˳<EFBFBD><CBB3>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     ((WIN_WindowStruct *)filder)->deleteWindow((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_GetTouchIndex(WIN_FilderStruct *filder, int x, int y) { | 
					
						
							|  |  |  |  |   if (y < filder->titleHight) | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							|  |  |  |  |   return (y - filder->titleHight) / filder->itemHight + filder->firstItemOnPage; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_SetIndex(WIN_FilderStruct *filder, int index) { | 
					
						
							|  |  |  |  |   int x_size = ((WIN_WindowStruct *)filder)->x_size - filder->itemIndent; | 
					
						
							|  |  |  |  |   Filder_FildInfo *file = &filder->file[index]; | 
					
						
							|  |  |  |  |   filder->scroll_xsize = (strlen(file->name) + 4) * WIN_GetFontWidth() / 2; | 
					
						
							|  |  |  |  |   if (filder->scroll_xsize > x_size) { | 
					
						
							|  |  |  |  |     if (filder->scroll_timer == 0) | 
					
						
							|  |  |  |  |       filder->scroll_timer = WIN_CreatTimer((WIN_WindowStruct *)filder, 50); | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     if (filder->scroll_timer) | 
					
						
							|  |  |  |  |       WIN_DeleteTimer(filder->scroll_timer); | 
					
						
							|  |  |  |  |     filder->scroll_timer = 0; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   filder->index = index; | 
					
						
							|  |  |  |  |   filder->scroll_x = 0; | 
					
						
							|  |  |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_ScrollTimer(WIN_FilderStruct *filder) { | 
					
						
							|  |  |  |  |   int x_size = ((WIN_WindowStruct *)filder)->x_size - filder->itemIndent; | 
					
						
							|  |  |  |  |   int y = (filder->index - filder->firstItemOnPage) * filder->itemHight + | 
					
						
							|  |  |  |  |           filder->titleHight; | 
					
						
							|  |  |  |  |   if (filder->scroll_x + filder->scroll_xsize > x_size) { | 
					
						
							|  |  |  |  |     filder->scroll_x -= 3; | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     filder->scroll_x = 4 * WIN_GetFontWidth() / 2; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   WIN_SetInvalidRectWhenTop((WIN_WindowStruct *)filder, filder->itemIndent, y, | 
					
						
							|  |  |  |  |                             x_size, filder->itemHight); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | #define FIRST_ADD()                                                            \
 | 
					
						
							|  |  |  |  |   {                                                                            \ | 
					
						
							|  |  |  |  |     if (filder->firstItemOnPage < filder->fileNum - filder->itemNumOnePage) {  \ | 
					
						
							|  |  |  |  |       filder->firstItemOnPage++;                                               \ | 
					
						
							|  |  |  |  |       if (filder->index < filder->firstItemOnPage)                             \ | 
					
						
							|  |  |  |  |         FILDER_SetIndex(filder, filder->firstItemOnPage);                      \ | 
					
						
							|  |  |  |  |       filder->y_off += filder->itemHight;                                      \ | 
					
						
							|  |  |  |  |     } else                                                                     \ | 
					
						
							|  |  |  |  |       filder->y_off = 0;                                                       \ | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | #define FIRST_SUB()                                                            \
 | 
					
						
							|  |  |  |  |   {                                                                            \ | 
					
						
							|  |  |  |  |     if (filder->firstItemOnPage > 0) {                                         \ | 
					
						
							|  |  |  |  |       filder->firstItemOnPage--;                                               \ | 
					
						
							|  |  |  |  |       if (filder->index >                                                      \ | 
					
						
							|  |  |  |  |           filder->firstItemOnPage + filder->itemNumOnePage - 1)                \ | 
					
						
							|  |  |  |  |         FILDER_SetIndex(filder,                                                \ | 
					
						
							|  |  |  |  |                         filder->firstItemOnPage + filder->itemNumOnePage - 1); \ | 
					
						
							|  |  |  |  |       filder->y_off -= filder->itemHight;                                      \ | 
					
						
							|  |  |  |  |     } else                                                                     \ | 
					
						
							|  |  |  |  |       filder->y_off = 0;                                                       \ | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #define IS_MIDDLE()                                                            \
 | 
					
						
							|  |  |  |  |   (filder->firstItemOnPage > 0 || m->y_move < 0) &&                            \ | 
					
						
							|  |  |  |  |       (filder->firstItemOnPage < filder->fileNum - filder->itemNumOnePage ||   \ | 
					
						
							|  |  |  |  |        m->y_move > 0) | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | void FILDER_defaultMsgLoop(WIN_FilderStruct *filder, WIN_MsgStruct *msg) { | 
					
						
							|  |  |  |  |   WIN_MoveStruct *m = 0; | 
					
						
							|  |  |  |  |   WIN_KeyStruct *k = 0; | 
					
						
							|  |  |  |  |   switch (msg->msg) { | 
					
						
							|  |  |  |  |   case WIN_MSG_PAINT: | 
					
						
							|  |  |  |  |     FILDER_DefaultPaint(filder); | 
					
						
							|  |  |  |  |     break; | 
					
						
							|  |  |  |  |   case WIN_MSG_TIMER: | 
					
						
							|  |  |  |  |     if (msg->data.v == filder->scroll_timer) { | 
					
						
							|  |  |  |  |       FILDER_ScrollTimer(filder); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     break; | 
					
						
							|  |  |  |  |   case WIN_MSG_KEY: | 
					
						
							|  |  |  |  |     k = msg->data.p; | 
					
						
							|  |  |  |  |     // <20>յ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ؼ<F2B7B5BB>
 | 
					
						
							|  |  |  |  |     if (k->shortPress & KEY_VALUE_DOWN) { | 
					
						
							|  |  |  |  |       FILDER_Down(filder); | 
					
						
							|  |  |  |  |     } // if (k->shortPress&KEY_VALUE_DOWN)
 | 
					
						
							|  |  |  |  |     else if (k->shortPress & KEY_VALUE_UP) { | 
					
						
							|  |  |  |  |       FILDER_Up(filder); | 
					
						
							|  |  |  |  |     } // else if (k->shortPress&KEY_VALUE_UP)
 | 
					
						
							|  |  |  |  |     else if (k->shortPress & KEY_VALUE_ENTER) { | 
					
						
							|  |  |  |  |       FILDER_Enter(filder, 100, 100); | 
					
						
							|  |  |  |  |     } else if (k->shortPress & KEY_VALUE_HOME) { | 
					
						
							|  |  |  |  |       FILDER_Home(filder); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if (k->shortPress) { | 
					
						
							|  |  |  |  |       WIN_SetInvalid((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     break; // case WIN_MSG_KEY:
 | 
					
						
							|  |  |  |  |   case WIN_MSG_MOVE: | 
					
						
							|  |  |  |  |     m = msg->data.p; | 
					
						
							|  |  |  |  |     switch (m->moveType) { | 
					
						
							|  |  |  |  |     case MOVE_DATA_SHORT: { | 
					
						
							|  |  |  |  |       int index = FILDER_GetTouchIndex(filder, m->x_move, m->y_move); | 
					
						
							|  |  |  |  |       if (index == filder->index) { | 
					
						
							|  |  |  |  |         FILDER_Enter(filder, m->x_move, m->y_move); | 
					
						
							|  |  |  |  |       } else if (index != -1) { | 
					
						
							|  |  |  |  |         FILDER_SetIndex(filder, index); | 
					
						
							|  |  |  |  |       } else { | 
					
						
							|  |  |  |  |         FILDER_Home(filder); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       WIN_SetInvalid((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  |     } break; | 
					
						
							|  |  |  |  |     case MOVE_DATA_MOVED: | 
					
						
							|  |  |  |  |       if (IS_MIDDLE()) { | 
					
						
							|  |  |  |  |         filder->y_off += m->y_move; | 
					
						
							|  |  |  |  |         if (filder->y_off >= filder->itemHight) { | 
					
						
							|  |  |  |  |           FIRST_SUB(); | 
					
						
							|  |  |  |  |         } else if (filder->y_off <= -filder->itemHight) { | 
					
						
							|  |  |  |  |           FIRST_ADD(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         if (m->y_move == 0 && m->x_move == 0) { | 
					
						
							|  |  |  |  |           filder->y_off = 0; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       } else { | 
					
						
							|  |  |  |  |         filder->y_off = 0; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       WIN_SetInvalidWhenTop((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     default: | 
					
						
							|  |  |  |  |       WIN_DefaultMsgLoop((WIN_WindowStruct *)filder, msg); | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     break; | 
					
						
							|  |  |  |  |   case WIN_MSG_CHID: | 
					
						
							|  |  |  |  |     switch (msg->data.v) { | 
					
						
							|  |  |  |  |     case CHID_DELETE: | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     case CHID_USER: { | 
					
						
							|  |  |  |  |       if (msg->data2.v == BUTTON_PRESSED) { | 
					
						
							|  |  |  |  |         // if (msg->srcWin==filder->key_back)
 | 
					
						
							|  |  |  |  |         // {
 | 
					
						
							|  |  |  |  |         // 	//<2F><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |         // 	FILDER_Home(filder);
 | 
					
						
							|  |  |  |  |         // }
 | 
					
						
							|  |  |  |  |         // else if (msg->srcWin==filder->key_up)
 | 
					
						
							|  |  |  |  |         // {
 | 
					
						
							|  |  |  |  |         // 	FILDER_Up(filder);
 | 
					
						
							|  |  |  |  |         // }
 | 
					
						
							|  |  |  |  |         // else if (msg->srcWin==filder->key_down)
 | 
					
						
							|  |  |  |  |         // {
 | 
					
						
							|  |  |  |  |         // 	FILDER_Down(filder);
 | 
					
						
							|  |  |  |  |         // }
 | 
					
						
							|  |  |  |  |         // else if (msg->srcWin==filder->key_enter)
 | 
					
						
							|  |  |  |  |         // {
 | 
					
						
							|  |  |  |  |         // 	FILDER_Enter(filder);
 | 
					
						
							|  |  |  |  |         // }
 | 
					
						
							|  |  |  |  |         // WIN_SetInvalid((WIN_WindowStruct *)filder);
 | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } break; | 
					
						
							|  |  |  |  |     default: | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     break; | 
					
						
							|  |  |  |  |   default: | 
					
						
							|  |  |  |  |     WIN_DefaultMsgLoop((WIN_WindowStruct *)filder, msg); | 
					
						
							|  |  |  |  |     break; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 19:47:28 +08:00
										 |  |  |  | // ѡ<><D1A1><EFBFBD>ļ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2025-10-18 01:02:27 +08:00
										 |  |  |  | int FILDER_ChooseFile(WIN_WindowStruct *win, char *dir) { | 
					
						
							|  |  |  |  |   WIN_FilderStruct *filder = 0; | 
					
						
							|  |  |  |  |   if (win) { | 
					
						
							|  |  |  |  |     filder = WIN_CreatFilder(win, 0, 0, 0, win->x_size, win->y_size); | 
					
						
							|  |  |  |  |   } else | 
					
						
							|  |  |  |  |     filder = WIN_CreatFilder(0, 0, 0, 0, WIN_GetWinStruct()->lcd->getLcdSizeX(), | 
					
						
							|  |  |  |  |                              WIN_GetWinStruct()->lcd->getLcdSizeY()); | 
					
						
							|  |  |  |  |   WIN_SetBackPicPath((WIN_WindowStruct *)filder, win->pic_path); | 
					
						
							|  |  |  |  |   FILDER_SetFileDir(filder, dir); | 
					
						
							|  |  |  |  |   WIN_ShowWindow((WIN_WindowStruct *)filder); | 
					
						
							|  |  |  |  |   // return WIN_RunBlock ((WIN_WindowStruct *)filder);
 | 
					
						
							|  |  |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } |