⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace-compare.c

📁 一个任天堂掌上游戏机NDS的源代码
💻 C
字号:
/*************************************************************************** DSemu - The Next Generation                                             ** Compare DSemu register dump with VBA [trace-compare.c]                  ** Copyright Imran Nazar, 2005; released under the BSD public licence.     ***************************************************************************/#include <stdio.h>// The 17 words, in human readable formchar *entries[17]={    "r00", "r01", "r02", "r03",    "r04", "r05", "r06", "r07",    "r08", "r09", "r10", "r11",    "r12", "r13", "r14", "r15",    "flags",};int main(){    FILE *vba, *dse;    unsigned int bufVBA[17], bufDSE[17];    int i, diff, cnt=0;        vba = fopen("gbatrace.bin","rb");    dse = fopen("dsemu-trace.bin","rb");    fread(bufDSE, 4, 17, dse);    // For each instruction, read 17 words from both traces, and compare    // If a difference is found, print it, and wait 5 seconds.    do {	diff=0;	fread(bufVBA, 4, 17, vba);	fread(bufDSE, 4, 17, dse);	for(i=0;i<17;++i) if(bufVBA[i]!=bufDSE[i]) diff++;        if(diff)	{	    printf("Difference at instruction #%d (file offset %d)\n", cnt, cnt*68);	    for(i=0;i<17;i++)                printf("%s:vba=%08X, %s:dse=%08X\n", entries[i], bufVBA[i], entries[i], bufDSE[i]);	    printf("Sleeping for 5 seconds.\n");	    sleep(5);	}	cnt++;    } while((!feof(vba)) && (!feof(dse)));        fclose(vba);    fclose(dse);    return 0;}/*** EOF: trace-compare.c ************************************************/

⌨️ 快捷键说明

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