1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
* Mupen64plus - romcache.h *
3
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4
* Copyright (C) 2008 Tillin9 *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
#ifndef __ROMCACHE_H__
23
#define __ROMCACHE_H__
28
#define COMMENT_MAXLENGTH 256
30
/* The romdatabase contains the items mupen64plus indexes for each rom. These
31
* include the goodname (from the GoodN64 project), the current status of the rom
32
* in mupen, the N64 savetype used in the original cartridge (often necessary for
33
* booting the rom in mupen), the number of players (including netplay options),
34
* and whether the rom can make use of the N64's rumble feature. Md5, crc1, and
35
* crc2 used for rom lookup. Md5s are unique hashes of the ENTIRE rom. Crcs are not
36
* unique and read from the rom header, meaning corrupt crcs are also a problem.
37
* Crcs were widely used (mainly in the cheat system). Refmd5s allows for a smaller
38
* database file and need not be used outside database loading.
47
unsigned char status; /* Rom status on a scale from 0-5. */
48
unsigned char savetype;
49
unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */
50
unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */
53
typedef struct _romdatabase_search
55
romdatabase_entry entry;
56
struct _romdatabase_search* next_entry;
57
struct _romdatabase_search* next_crc;
58
struct _romdatabase_search* next_md5;
64
romdatabase_search* crc_lists[256];
65
romdatabase_search* md5_lists[256];
66
romdatabase_search* list;
69
extern romdatabase_entry empty_entry;
71
void romdatabase_open(void);
72
void romdatabase_close(void);
73
romdatabase_entry* ini_search_by_md5(md5_byte_t* md5);
74
/* Should be used by current cheat system (isn't), when cheat system is
75
* migrated to md5s, will be fully depreciated.
77
romdatabase_entry* ini_search_by_crc(unsigned int crc1, unsigned int crc2);
80
/* See http://code.google.com/p/mupen64plus/wiki/RomBrowserColumns for details. */
81
typedef struct _cache_entry
85
char filename[PATH_MAX];
86
char usercomments[COMMENT_MAXLENGTH];
87
char internalname[81]; /* Needs to be 4 times +1 (for '\0') for UTF8 conversion. */
88
unsigned char compressiontype; /* Enum for compression type. */
89
unsigned char imagetype; /* Enum for original rom image type. */
90
unsigned char cic; /* N64 boot chip, determined from rom. */
91
unsigned short countrycode; /* Found in rom header. */
92
unsigned int archivefile; /* 0 indexed file number in multirom archive. */
96
romdatabase_entry* inientry; /* Persistent pointer to romdatabase. */
97
struct _cache_entry* next;
107
RCS_WRITE_CACHE /* For quickly saving user comments from GUI frontend. */
113
unsigned char rcstask; /* Enum for what rcs thread should do. */
114
unsigned char rcspause; /* Bool for pausing after last file, toggled by start/stopping emulation. */
115
unsigned char clear; /* Bool for clearing on an update. */
120
extern rom_cache g_romcache;
122
int rom_cache_system(void* _arg);
125
#endif /* __ROMCACHE_H__ */