+int CmdHF14AMfuELoad(const char *Cmd)
+{
+ //FILE * f;
+ //char filename[FILE_PATH_SIZE];
+ //char *fnameptr = filename;
+ //char buf[64] = {0x00};
+ //uint8_t buf8[64] = {0x00};
+ //int i, len, blockNum, numBlocks;
+ //int nameParamNo = 1;
+
+ char ctmp = param_getchar(Cmd, 0);
+
+ if ( ctmp == 'h' || ctmp == 0x00) return usage_hf_mfu_eload();
+
+/*
+ switch (ctmp) {
+ case '0' : numBlocks = 5*4; break;
+ case '1' :
+ case '\0': numBlocks = 16*4; break;
+ case '2' : numBlocks = 32*4; break;
+ case '4' : numBlocks = 256; break;
+ default: {
+ numBlocks = 16*4;
+ nameParamNo = 0;
+ }
+ }
+
+ len = param_getstr(Cmd,nameParamNo,filename);
+
+ if (len > FILE_PATH_SIZE - 4) len = FILE_PATH_SIZE - 4;
+
+ fnameptr += len;
+
+ sprintf(fnameptr, ".eml");
+
+ // open file
+ f = fopen(filename, "r");
+ if (f == NULL) {
+ PrintAndLog("File %s not found or locked", filename);
+ return 1;
+ }
+
+ blockNum = 0;
+ while(!feof(f)){
+ memset(buf, 0, sizeof(buf));
+
+ if (fgets(buf, sizeof(buf), f) == NULL) {
+
+ if (blockNum >= numBlocks) break;
+
+ PrintAndLog("File reading error.");
+ fclose(f);
+ return 2;
+ }
+
+ if (strlen(buf) < 32){
+ if(strlen(buf) && feof(f))
+ break;
+ PrintAndLog("File content error. Block data must include 32 HEX symbols");
+ fclose(f);
+ return 2;
+ }
+
+ for (i = 0; i < 32; i += 2) {
+ sscanf(&buf[i], "%02x", (unsigned int *)&buf8[i / 2]);
+ }
+
+ if (mfEmlSetMem(buf8, blockNum, 1)) {
+ PrintAndLog("Cant set emul block: %3d", blockNum);
+ fclose(f);
+ return 3;
+ }
+ printf(".");
+ blockNum++;
+
+ if (blockNum >= numBlocks) break;
+ }
+ fclose(f);
+ printf("\n");
+
+ if ((blockNum != numBlocks)) {
+ PrintAndLog("File content error. Got %d must be %d blocks.",blockNum, numBlocks);
+ return 4;
+ }
+ PrintAndLog("Loaded %d blocks from file: %s", blockNum, filename);
+ */
+ return 0;
+}
+
+