OSDN Git Service

[VM][FMTOWNS][MEMORY] Fix setup around memory banks by I/O 0404h and 0480h.
[csp-qt/common_source_project-fm7.git] / source / src / vm / msx / romtype2.h
1 /*
2         Common Source Code Project
3         MSX Series (experimental)
4
5         Author : umaiboux
6         Date   : 2016.03.xx-
7
8         [ ROM type hash ]
9 */
10
11 #ifndef _ROMTYPE2_H_
12
13 //#include <stdlib.h>
14 //#include <stdio.h>
15
16 #include "../../types/util_configwrapper.h"
17
18 static RomType hashRomType(uint8_t *rom, int size)
19 {
20         int crc32 = get_crc32(rom, size);
21         _TCHAR str_crc32[10];
22         _TCHAR str_romtype[32];
23         my_stprintf_s(str_crc32, 10, _T("%08X"), crc32);
24         MyGetPrivateProfileString(_T("CRC32"), str_crc32, _T("NONE"), str_romtype, sizeof(str_romtype)/sizeof(_TCHAR), create_local_path(_T("romhash.ini")));
25         int i;
26         for(i=0;; i++) {
27                 if ((!_tcscmp(typestr[i].p, str_romtype)) || (typestr[i].type == ROMTYPE_NONE)) {
28                         return (RomType)(typestr[i].type);
29                 }
30         }
31         return (RomType)ROMTYPE_NONE;
32 }
33
34 #define _ROMTYPE2_H_
35
36 #endif
37