卡片召唤师
精华
|
战斗力 鹅
|
回帖 0
注册时间 2016-12-26
|
楼主 |
发表于 2020-5-18 09:24
|
显示全部楼层
注意:泄露包里面有很多套monsdata文件。我写了一个自动写monsdata的小程序,现在不用再手工贴到bin里面了。
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int readBank (unsigned char* outp, char *fname, unsigned int addr)
- {
- int i=0;
- FILE* fi;
- unsigned char* fblk;
- fblk=(unsigned char*)malloc(16384);
- memset(fblk, 0, 16384);
- printf("Reading %s...\n", fname);
- fi=fopen(fname, "rb");
- if (!fi)
- {
- printf("open file %s error!\n", fname);
- goto error3;
- }
- while(fread(fblk+i, 1, 1, fi) == 1)
- {
- ++i;
- }
- fclose(fi);
- memcpy(outp+addr, fblk, 16384);
- free(fblk);
- return 1;
- error3:
- free(fblk);
- return 0;
- }
- main(int argc, char* argv[])
- {
- int i=0, r;
- char ofn[256];
- FILE* fi, *fo;
- unsigned char* outp;
- unsigned char* fblk;
- memset(ofn, 0, 256);
- if(argc<2)
- {
- printf("usage: %s filename\n", argv[0]);
- return;
- }
- for(i=strlen(argv[1]); i>=0; i--)
- {
- if(*(argv[1]+i) == '.')
- {
- memcpy(ofn, argv[1], i);
- break;
- }
- }
- strcat(ofn, ".gb");
-
- i=0;
- outp=(unsigned char*)malloc(2097152);
- fblk=(unsigned char*)malloc(16384);
- printf("Reading from %s..\n", argv[1]);
- fi=fopen(argv[1], "rb");
- if (!fi)
- {
- printf("open %s file error!\n", argv[1]);
- goto error3;
- }
- while(fread(outp+i*16384, 1, 16384, fi) == 16384)
- {
- ++i;
- }
- printf("Read %d banks\n", i);
- fclose(fi);
- r=readBank(outp, "bank12.bin", 0x12*0x4000);
- r=readBank(outp, "bank13.bin", 0x1f*0x4000);
- r=readBank(outp, "bank14.bin", 0x20*0x4000);
- r=readBank(outp, "bank15.bin", 0x15*0x4000);
- r=readBank(outp, "bank16.bin", 0x16*0x4000);
- r=readBank(outp, "bank17.bin", 0x17*0x4000);
- r=readBank(outp, "bank18.bin", 0x18*0x4000);
- r=readBank(outp, "bank19.bin", 0x19*0x4000);
- r=readBank(outp, "bank1a.bin", 0x1a*0x4000);
- r=readBank(outp, "bank1b.bin", 0x1b*0x4000);
- r=readBank(outp, "bank1c.bin", 0x1c*0x4000);
- r=readBank(outp, "bank1d.bin", 0x1d*0x4000);
- r=readBank(outp, "bank1e.bin", 0x1e*0x4000);
- r=readBank(outp, "bank1f.bin", 0x2e*0x4000);
- if(!r)
- {
- printf("read graphic banks error!\n");
- goto error3;
- }
- printf("Writing %s..\n", ofn);
- fo=fopen(ofn,"wb");
- if (!fo)
- {
- printf("open %s error!\n", ofn);
- goto error3;
- }
- fwrite(outp, 16384, i, fo);
- fclose(fo);
- error3:
- free(outp);
- free(fblk);
- }
复制代码
|
评分
-
查看全部评分
|