22726e4d |
1 | /****************************************************************************** |
2 | * Arachnoid Graphics Plugin for Mupen64Plus |
3 | * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ |
4 | * |
5 | * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson |
6 | * |
7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License |
9 | * as published by the Free Software Foundation; either version 2 |
10 | * of the License, or (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | *****************************************************************************/ |
21 | |
22 | #ifndef ROM_DETECTOR_H_ |
23 | #define ROM_DETECTOR_H_ |
24 | |
25 | #include "N64Games.h" |
26 | |
27 | //***************************************************************************** |
28 | //* ROM Header |
29 | //! Stored in each rom, gives us information about rom. |
30 | //***************************************************************************** |
31 | //#pragma pack(push, 1) |
32 | struct ROMHeader |
33 | { |
34 | unsigned char x1, x2, x3, x4; |
35 | unsigned int clockRate; |
36 | unsigned int bootAddressOffset; |
37 | unsigned int release; |
38 | unsigned int CRC1; //!< Hash value |
39 | unsigned int CRC2; //!< Hash value |
40 | unsigned long long unknown0; |
41 | char romName[20]; //!< Name of rom, used to identify what rom it is. |
42 | unsigned int unknown1; |
43 | unsigned short unknown2; |
44 | unsigned char unknown3; |
45 | unsigned char nManufacturer; |
46 | unsigned short cartID; |
47 | signed char countryID; |
48 | unsigned char unknown4; |
49 | }; |
50 | //#pragma pack(pop) |
51 | //***************************************************************************** |
52 | //* COMBINER TYPE |
53 | //! What kind of combiner to use |
54 | //***************************************************************************** |
55 | enum COMBINER_TYPE |
56 | { |
57 | CT_ADVANCED, |
58 | CT_SIMPLE, |
59 | CT_DUMMY, |
60 | }; |
61 | |
62 | //***************************************************************************** |
63 | //* CLEAR TYPE |
64 | //! When to clear screen |
65 | //***************************************************************************** |
66 | enum CLEAR_TYPE |
67 | { |
68 | CT_NEVER, |
69 | CT_AFTER_ONE_DISPLAY_LIST, |
70 | CT_AFTER_TWO_DISPLAY_LIST, |
71 | CT_AFTER_THREE_DISPLAY_LIST, |
72 | }; |
73 | |
74 | //***************************************************************************** |
75 | //* ROM Detector |
76 | //! Class for detecting which rom it is and settings states after that. |
77 | //***************************************************************************** |
78 | class ROMDetector |
79 | { |
80 | public: |
81 | |
82 | //Destructor |
83 | ~ROMDetector(); |
84 | |
85 | //Singleton Instance |
86 | static ROMDetector& getSingleton() |
87 | { |
88 | static ROMDetector instance; |
89 | return instance; |
90 | } |
91 | |
92 | //Initialize |
93 | void initialize(unsigned char* romHeader); |
94 | |
95 | const char* getRomName() { return m_romHeader.romName; } |
96 | |
97 | public: |
98 | |
99 | //! Get Rom ID |
100 | //! @return ID of the current running rom (game). |
101 | N64_ROM_ID getRomID() { return m_currentRomID; } |
102 | |
103 | //! Get Combiner Type |
104 | //! @return ID of the combiner to use. |
105 | COMBINER_TYPE getCombinerType() { return m_combinerType; } |
106 | |
107 | //! Get Clear Type |
108 | //! @return when to clear screen. |
109 | CLEAR_TYPE getClearType() { return m_clearType; } |
110 | |
111 | //! Get Ignore Fill Rects |
112 | //! @return True if we should ignore fill rect instructions. |
113 | bool getIgnoreFillRects() { return m_ignoreFillRects; } |
114 | |
115 | //! Get Disable Face Culling |
116 | //! @return True if we never should enable Face Culling. |
117 | bool getDisableFaceCulling() { return m_forceDisableFaceCulling; } |
118 | |
119 | //! Get Use Multi Texturing |
120 | //! @return True if we should use multiple textures when rendering |
121 | bool getUseMultiTexture() { return m_useMultiTexture; } |
122 | |
123 | //! Get Use Secondary Color |
124 | //! @return True if we should secondary color when rendering |
125 | bool getUseSecondaryColor() { return m_useSecondaryColor; } |
126 | |
127 | private: |
128 | |
129 | //Construtor |
130 | ROMDetector(); |
131 | |
132 | //Get rom ID |
133 | N64_ROM_ID _getRomID(char romName[20]); |
134 | |
135 | private: |
136 | |
137 | ROMHeader m_romHeader; //!< Rom header with information about rom |
138 | |
139 | N64_ROM_ID m_currentRomID; //!< What rom is running |
140 | COMBINER_TYPE m_combinerType; //!< What combiner to use |
141 | CLEAR_TYPE m_clearType; //!< When to clear screen |
142 | bool m_ignoreFillRects; //!< Ignore fill rectangles? |
143 | bool m_forceDisableFaceCulling; //!< Disable face culling? |
144 | bool m_useMultiTexture; //!< Use multitextureing? |
145 | bool m_useSecondaryColor; //!< Use secondary color? |
146 | |
147 | }; |
148 | |
149 | |
150 | #endif |