summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/audit.h
blob: 3b6eaffd4a28e83ec740ab4e11c54d5f851b27ff (plain) (blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/***************************************************************************

    audit.h

    ROM, disk, and sample auditing functions.

    Copyright Nicola Salmoria and the MAME Team.
    Visit http://mamedev.org for licensing and usage restrictions.

***************************************************************************/

#pragma once

#ifndef __AUDIT_H__
#define __AUDIT_H__

#include "hash.h"



/***************************************************************************
    CONSTANTS
***************************************************************************/

/* hashes to use for validation */
#define AUDIT_VALIDATE_FAST				"R"		/* CRC only */
#define AUDIT_VALIDATE_FULL				"RS"	/* CRC + SHA1 */

/* return values from audit_verify_roms and audit_verify_samples */
enum
{
	CORRECT = 0,
	BEST_AVAILABLE,
	INCORRECT,
	NOTFOUND
};

/* image types for audit_record.type */
enum
{
	AUDIT_FILE_ROM = 0,
	AUDIT_FILE_DISK,
	AUDIT_FILE_SAMPLE
};

/* status values for audit_record.status */
enum
{
	AUDIT_STATUS_GOOD = 0,
	AUDIT_STATUS_FOUND_INVALID,
	AUDIT_STATUS_NOT_FOUND,
	AUDIT_STATUS_ERROR
};

/* substatus values for audit_record.substatus */
enum
{
	SUBSTATUS_GOOD = 0,
	SUBSTATUS_GOOD_NEEDS_REDUMP,
	SUBSTATUS_FOUND_NODUMP,
	SUBSTATUS_FOUND_BAD_CHECKSUM,
	SUBSTATUS_FOUND_WRONG_LENGTH,
	SUBSTATUS_NOT_FOUND,
	SUBSTATUS_NOT_FOUND_NODUMP,
	SUBSTATUS_NOT_FOUND_OPTIONAL,
	SUBSTATUS_NOT_FOUND_PARENT,
	SUBSTATUS_NOT_FOUND_BIOS,
	SUBSTATUS_ERROR = 100
};



/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

typedef struct _audit_record audit_record;
struct _audit_record
{
	UINT8			type;					/* type of item that was audited */
	UINT8			status;					/* status of audit on this item */
	UINT8			substatus;				/* finer-detail status */
	const char *	name;					/* name of item */
	UINT32			explength;				/* expected length of item */
	UINT32			length;					/* actual length of item */
	hash_collection	exphashes;      		/* expected hash data */
	hash_collection	hashes;					/* actual hash information */
};



/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

int audit_images(emu_options &options, const game_driver *gamedrv, const char *validation, audit_record **audit);
int audit_samples(emu_options &options, const game_driver *gamedrv, audit_record **audit);
int audit_summary(const game_driver *gamedrv, int count, const audit_record *records, int output);


#endif	/* __AUDIT_H__ */