]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmddata.c
Update mifarehost.c
[proxmark3-svn] / client / cmddata.c
index 8c2049ad1cbf4af9f6c68f860a6d1833a912d609..c12c2ce6d58cd9341740a215f81a67b468c73744 100644 (file)
@@ -68,15 +68,21 @@ void save_restoreDB(uint8_t saveOpt)
        static uint8_t SavedDB[MAX_DEMOD_BUF_LEN];
        static size_t SavedDBlen;
        static bool DB_Saved = false;
+       static int savedDemodStartIdx = 0;
+       static int savedDemodClock = 0;
 
-       if (saveOpt==1) { //save
+       if (saveOpt == GRAPH_SAVE) { //save
 
                memcpy(SavedDB, DemodBuffer, sizeof(DemodBuffer));
                SavedDBlen = DemodBufferLen;
                DB_Saved=true;
+               savedDemodStartIdx = g_DemodStartIdx;
+               savedDemodClock = g_DemodClock;
        } else if (DB_Saved) { //restore
                memcpy(DemodBuffer, SavedDB, sizeof(DemodBuffer));
                DemodBufferLen = SavedDBlen;
+               g_DemodClock = savedDemodClock;
+               g_DemodStartIdx = savedDemodStartIdx;
        }
        return;
 }
@@ -803,12 +809,12 @@ int FSKrawDemod(const char *Cmd, bool verbose)
                if (!rfLen) rfLen = 50;
        }
        int startIdx = 0;
-       int size = fskdemod_ext(BitStream, BitLen, rfLen, invert, fchigh, fclow, &startIdx);
+       int size = fskdemod(BitStream, BitLen, rfLen, invert, fchigh, fclow, &startIdx);
        if (size > 0) {
                setDemodBuf(BitStream,size,0);
                setClockGrid(rfLen, startIdx);
-       
-               // Now output the bitstream to the scrollback by line of 16 bits
+
+    // Now output the bitstream to the scrollback by line of 16 bits
                if (verbose || g_debugMode) {
                        PrintAndLog("\nUsing Clock:%u, invert:%u, fchigh:%u, fclow:%u", (unsigned int)rfLen, (unsigned int)invert, (unsigned int)fchigh, (unsigned int)fclow);
                        PrintAndLog("%s decoded bitstream:",GetFSKType(fchigh,fclow,invert));
@@ -1070,6 +1076,7 @@ void setClockGrid(int clk, int offset) {
        g_DemodStartIdx = offset;
        g_DemodClock = clk;
        if (g_debugMode) PrintAndLog("demodoffset %d, clk %d",offset,clk);
+
        if (offset > clk) offset %= clk;
        if (offset < 0) offset += clk;
 
Impressum, Datenschutz