forked from wuyongzheng/gimgtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sf_mps.c
57 lines (55 loc) · 1.66 KB
/
sf_mps.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "gimglib.h"
void dump_mps (struct subfile_struct *mps)
{
unsigned int line;
for (line = 0; line < mps->size;) {
int type = *(mps->base + line + 0);
int size = *(uint16_t *)(mps->base + line + 1);
int ptr = line + 3;
switch(type) {
case 0x46:
printf("0x46: pid=%d fid=%d",
*(uint16_t *)(mps->base + ptr + 0),
*(uint16_t *)(mps->base + ptr + 2));
ptr += 4;
printf(" str1=\"%s\"\n", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
break;
case 0x4c:
printf("0x4c: pid=%d fid=%d ?=0x%x",
*(uint16_t *)(mps->base + ptr + 0),
*(uint16_t *)(mps->base + ptr + 2),
*(uint16_t *)(mps->base + ptr + 6));
ptr += 8;
printf(" area=\"%s\"", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
printf(" name=\"%s\"", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
printf(" str3=\"%s\"", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
printf(" id=%x ?=%x\n", *(uint32_t *)(mps->base + ptr),
*(uint32_t *)(mps->base + ptr + 4));
ptr += 8;
break;
case 0x50:
printf("0x50: pid=%d fid=%d ?=%s\n",
*(uint16_t *)(mps->base + ptr + 0),
*(uint16_t *)(mps->base + ptr + 2),
dump_unknown_bytes(mps->base + ptr + 4, size - 4));
break;
case 0x55:
printf("0x55: str=\"%s\"\n", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
break;
case 0x56:
printf("0x56: str=\"%s\"", mps->base + ptr);
ptr += strlen((char *)mps->base + ptr) + 1;
printf(" ?=0x%x\n", *(mps->base + ptr));
ptr += 1;
break;
default:
printf("0x%02x: %s\n", type, dump_unknown_bytes(mps->base + ptr, size));
}
line += size + 3;
}
}