OROCHI
 
Loading...
Searching...
No Matches
GxResPadRecorder.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_CORE_NAMESPACE_BEGIN()
14
15//===========================================================================
17//===========================================================================
19{
20 //-----------------------------------------------------------
22 //-----------------------------------------------------------
24public:
25 // RTTI定義
26 GX_RTTI_RESOURCE_NAME(GxResPadRecorder, GxResBase, "入力パッドレコーダ")
27 // ClassBaseReference継承クラス用禁止宣言
29
30
31 static const u32 RESOURCE_VERSION;
33 static constexpr u32 ALLOCATE_INPUTDATA_BUFFER_MIN = GxMath::VALUE_256;
34
35protected:
38 {
39 //-----------------------------------------------------------
41 //-----------------------------------------------------------
43 public:
44 GX_RTTI_STRUCT(GxPadRecordHeader)
45
46
47 //-----------------------------------------------------------
49 //-----------------------------------------------------------
51 public:
56
58 };
59
62 {
63 //-----------------------------------------------------------
65 //-----------------------------------------------------------
67 public:
68 GX_RTTI_STRUCT(GxPadRecordInformation)
69
70
71 //-----------------------------------------------------------
73 //-----------------------------------------------------------
75 public:
76 u32 _frame;
77 u32 _player;
79
81 };
82
84 //-----------------------------------------------------------
86 //-----------------------------------------------------------
88public:
90 GxResPadRecorder(void);
92 void cleanup(void) override;
94 void initialize(u32 playerNum, u32 randSeed);
95
97 //-----------------------------------------------------------
99 //-----------------------------------------------------------
101protected:
103 b32 load(GxStream& stream, u32 dataSize);
104#if GX_DEVELOP
106 b32 save(GxStream& stream);
107#endif // GX_DEVELOP
108
110 //-----------------------------------------------------------
112 //-----------------------------------------------------------
114public:
116 void getData(GxPad::GxInputData& dst, u32 player, u32 frame) const;
118 void setData(const GxPad::GxInputData& src, u32 player, u32 frame);
120 constexpr u32 getRandomSeed(void) const { return _header._randSeed; }
122 constexpr u32 getPlayerNum(void) const { return _header._playerNum; }
124 constexpr u32 getFrameCount(void) const { return _header._frameCount; }
125
126protected:
128 void setCount(u32 count);
130 u32 getCount(void) const;
132 GX_FORCE_INLINE void getInputDataForProperty(void* const pValue, u32 index) const { *(GxPadRecordInformation**)pValue = &_pInputData[index]; }
134 GX_FORCE_INLINE void setInputDataForProperty(const void* const pValue, u32 index) { _pInputData[index] = *(*(GxPadRecordInformation**)pValue); }
135
137 //-----------------------------------------------------------
139 //-----------------------------------------------------------
141protected:
145
147};
148
149#if GX_DEVELOP
150//===========================================================================
152//===========================================================================
153class GxResPadRecorderXml : public GxResPadRecorder
154{
155 //-----------------------------------------------------------
157 //-----------------------------------------------------------
159public:
160 // RTTI定義
161 GX_RTTI_RESOURCE(GxResPadRecorderXml, GxResPadRecorder)
162 // ClassBaseReference継承クラス用禁止宣言
163 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxResPadRecorderXml)
164
165
166 //-----------------------------------------------------------
168 //-----------------------------------------------------------
170public:
172 GxResPadRecorderXml(void);
173
175 //-----------------------------------------------------------
177 //-----------------------------------------------------------
179public:
181 b32 finalize(void) { return true; }
182
183protected:
185 GX_FORCE_INLINE b32 load(GxStream& stream, u32 /*dataSize*/) { return loadXml(stream); }
187 GX_FORCE_INLINE b32 save(GxStream& stream) { return saveXml(stream, getRtti()); }
188
190};
191
192//===========================================================================
194//===========================================================================
195class GxResPadRecorderCsv : public GxResPadRecorder
196{
197 //-----------------------------------------------------------
199 //-----------------------------------------------------------
201public:
202 // RTTI定義
203 GX_RTTI_RESOURCE(GxResPadRecorderCsv, GxResPadRecorder)
204 // ClassBaseReference継承クラス用禁止宣言
205 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxResPadRecorderCsv)
206
207private:
208 // 列番号定義
209 enum ROW_NUMBER
210 {
211 ROW_NUMBER_HEADER = 0,
212 ROW_NUMBER_DATA
213 };
214
215 // 行番号定義 (ヘッダー列)
216 enum COLUMN_HEADER
217 {
218 COLUMN_HEADER_RANDOM_SEED = 0,
219 COLUMN_HEADER_PLAYER_NUM,
220 COLUMN_HEADER_FRAME_COUNT,
221 COLUMN_HEADER_DATA_COUNT,
222
223 COLUMN_HEADER_MAX
224 };
225
226 // 行番号定義 (データ列)
227 enum COLUMN_DATA
228 {
229 COLUMN_DATA_FRAME = 0,
230 COLUMN_DATA_PLAYER,
231 COLUMN_DATA_ON,
232 COLUMN_DATA_STICK_RIGHT_X,
233 COLUMN_DATA_STICK_RIGHT_Y,
234 COLUMN_DATA_STICK_LEFT_X,
235 COLUMN_DATA_STICK_LEFT_Y,
236 COLUMN_DATA_TRIGGER_RIGHT,
237 COLUMN_DATA_TRIGGER_LEFT,
238
239 COLUMN_DATA_MAX
240 };
241
243 //-----------------------------------------------------------
245 //-----------------------------------------------------------
247public:
249 GxResPadRecorderCsv(void);
251 void cleanup(void) override;
252
254 //-----------------------------------------------------------
256 //-----------------------------------------------------------
258public:
260 GX_FORCE_INLINE b32 finalize(void) { return true; }
261
262protected:
264 b32 load(GxStream& stream, u32 dataSize);
266 b32 save(GxStream& stream);
267
269 //-----------------------------------------------------------
271 //-----------------------------------------------------------
273private:
274 GxResCellSheetCsv* _pCellSheet;
275
277};
278
279#endif // GX_DEVELOP
280
281GX_CORE_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
#define GX_RTTI_RESOURCE(__THIS__, __BASE__)
リソースクラス型情報宣言
Definition GxRttiResource.h:102
virtual GxRtti & getRtti(void) const =0
Rttiの取得
算術演算クラス
Definition GxMath.h:84
リソース基底クラス
Definition GxResBase.h:23
入力パッドレコーダーリソースクラス
Definition GxResPadRecorder.h:19
GxPadRecordInformation * _pInputData
入力パッド記録情報ポインタ (※要素数はヘッダー内メンバに記述)
Definition GxResPadRecorder.h:143
GX_FORCE_INLINE void setInputDataForProperty(const void *const pValue, u32 index)
入力パッド記録情報格納
Definition GxResPadRecorder.h:134
constexpr u32 getPlayerNum(void) const
保持プレイヤー人数取得
Definition GxResPadRecorder.h:122
void cleanup(void) override
解放
Definition GxResPadRecorder.cpp:44
u32 _allocateCount
入力パッド情報バッファ確保数
Definition GxResPadRecorder.h:144
constexpr u32 getFrameCount(void) const
保持フレーム数取得
Definition GxResPadRecorder.h:124
b32 load(GxStream &stream, u32 dataSize)
リソース読み込み
Definition GxResPadRecorder.cpp:61
GxPadRecordHeader _header
入力パッド記録情報ヘッダー
Definition GxResPadRecorder.h:142
constexpr u32 getRandomSeed(void) const
乱数シード取得
Definition GxResPadRecorder.h:120
GX_FORCE_INLINE void getInputDataForProperty(void *const pValue, u32 index) const
入力パッド記録情報取得
Definition GxResPadRecorder.h:132
ストリーム基礎クラス
Definition GxStream.h:20
入力情報
Definition GxInputPad.h:114
入力パッド記録情報ヘッダー
Definition GxResPadRecorder.h:38
u32 _randSeed
乱数シード
Definition GxResPadRecorder.h:52
u32 _playerNum
保持プレイヤー数
Definition GxResPadRecorder.h:53
u32 _dataCount
記録データ個数
Definition GxResPadRecorder.h:55
u32 _frameCount
保持フレーム数
Definition GxResPadRecorder.h:54
入力パッド記録情報
Definition GxResPadRecorder.h:62
u32 _player
対象プレイヤー
Definition GxResPadRecorder.h:77
GxPad::GxInputData _inputData
パッド情報
Definition GxResPadRecorder.h:78
u32 _frame
対象フレーム
Definition GxResPadRecorder.h:76
Definition GxBase.h:24
32bitブーリアン
Definition GxDefine.h:173