Previous 15994 Revisions Next

r3206 Monday 8th September, 2008 at 15:31:18 UTC by Firewave
Updated to match new coding guidelines
[src/mess]cheatms.c cheatms.h

src/mess/cheatms.c
r3205r3206
1717    GLOBALS
1818***************************************************************************/
1919
20static UINT32            * deviceCRCList = NULL;
21static INT32            deviceCRCListLength = 0;
22UINT32            thisGameCRC = 0;
20static UINT32 *device_crc_list = NULL;
21static INT32 device_crc_list_length = 0;
22UINT32 this_game_crc = 0;
2323
2424
2525
r3205r3206
2727    CODE
2828***************************************************************************/
2929
30static void BuildCRCTable(running_machine *machine)
30static void build_crc_table(running_machine *machine)
3131{
3232   int   listIdx;
3333   const device_config *img;
3434
35   free(deviceCRCList);
35   free(device_crc_list);
3636
37   // allocate list with single member (0x00000000)
38   deviceCRCList = calloc(1, sizeof(UINT32));
39   deviceCRCListLength = 1;
37   /* allocate list with single member (0x00000000) */
38   device_crc_list = calloc(1, sizeof(UINT32));
39   device_crc_list_length = 1;
4040
4141   for (img = image_device_first(machine->config); img != NULL; img = image_device_next(img))
4242   {
r3205r3206
4545         UINT32   crc = image_crc(img);
4646         int      isUnique = 1;
4747
48         for(listIdx = 0; listIdx < deviceCRCListLength; listIdx++)
48         for(listIdx = 0; listIdx < device_crc_list_length; listIdx++)
4949         {
50            if(deviceCRCList[listIdx] == crc)
50            if(device_crc_list[listIdx] == crc)
5151            {
5252               isUnique = 0;
5353
r3205r3206
5757
5858         if(isUnique)
5959         {
60            if(!thisGameCRC)
61               thisGameCRC = crc;
60            if(!this_game_crc)
61               this_game_crc = crc;
6262
63            deviceCRCList = realloc(deviceCRCList, (deviceCRCListLength + 1) * sizeof(UINT32));
63            device_crc_list = realloc(device_crc_list, (device_crc_list_length + 1) * sizeof(UINT32));
6464
65            deviceCRCList[deviceCRCListLength] = crc;
66            deviceCRCListLength++;
65            device_crc_list[device_crc_list_length] = crc;
66            device_crc_list_length++;
6767         }
6868      }
6969   }
7070}
7171
7272
73void InitMessCheats(running_machine *machine)
73void cheat_mess_init(running_machine *machine)
7474{
75   deviceCRCList =         NULL;
76   deviceCRCListLength =   0;
77   thisGameCRC =         0;
75   device_crc_list = NULL;
76   device_crc_list_length = 0;
77   this_game_crc =   0;
7878
79   BuildCRCTable(machine);
79   build_crc_table(machine);
8080}
8181
8282
8383
84void StopMessCheats(void)
84void cheat_mess_exit(void)
8585{
86   free(deviceCRCList);
87   deviceCRCList = NULL;
86   free(device_crc_list);
87   device_crc_list = NULL;
8888
89   deviceCRCListLength = 0;
90   thisGameCRC = 0;
89   device_crc_list_length = 0;
90   this_game_crc = 0;
9191}
9292
9393
9494
95int MatchesCRCTable(UINT32 crc)
95int cheat_mess_matches_crc_table(UINT32 crc)
9696{
97   int   i;
97   int i;
9898
99   for(i = 0; i < deviceCRCListLength; i++)
100      if(deviceCRCList[i] == crc)
99   for(i = 0; i < device_crc_list_length; i++)
100      if(device_crc_list[i] == crc)
101101         return 1;
102102
103103   return 0;
src/mess/cheatms.h
r3205r3206
66
77*********************************************************************/
88
9#ifndef CHEATMS_H
10#define CHEATMS_H
9#pragma once
1110
12extern UINT32            thisGameCRC;
11#ifndef __CHEATMS_H__
12#define __CHEATMS_H__
1313
14void InitMessCheats(running_machine *machine);
15void StopMessCheats(void);
16int MatchesCRCTable(UINT32 crc);
14extern UINT32 this_game_crc;
1715
18#endif /* CHEATMS_H */
16void cheat_mess_init(running_machine *machine);
17void cheat_mess_exit(void);
18int cheat_mess_matches_crc_table(UINT32 crc);
19
20#endif /* __CHEATMS_H__ */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team