forked from KaidenTBIO/ABKCaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputDataSub.cpp
81 lines (67 loc) · 1.87 KB
/
inputDataSub.cpp
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
#include "inputDataClass.h"
using namespace std;
int inputDataSubClass::init(){
if( !data ) return 1;
memset( &dataInfo, 0, sizeof( gameInfoStruct ) );
//念のため
Sleep(100);
memset( data, 0xFF, inputBuf_size * 2 );
return 0;
}
inputDataSubClass::inputDataSubClass(){
memset( &dataInfo, 0, sizeof(dataInfo) );
data = (WORD*)malloc( inputBuf_size * 2);
}
inputDataSubClass::~inputDataSubClass(){
if( data ){
free( data );
data = NULL;
}
}
//void *memcpy(void *dest, void *src, size_t size);
int inputDataSubClass::SetInputDataArea( DWORD Time, WORD* Address, WORD Size ){
//要検討
if( Time >= inputBuf_size ) return 1;
if( (ULONGLONG)Time + (ULONGLONG)Size >= inputBuf_size ) return 1;
memcpy( &data[ Time ], Address, Size );
return 0;
}
WORD* inputDataSubClass::GetInputDataAddress( DWORD Time, WORD Size ){
//要検討
if( Time >= inputBuf_size ) return 0;
if( (ULONGLONG)Time + (ULONGLONG)Size >= inputBuf_size ) return 0;
if( data[ Time + Size ] == 0xFFFF ) return 0;
return &data[ Time ];
}
//SetInput
//暫定
void inputDataSubClass::SetInputDataSub( DWORD Time, WORD Input ){
if( Time < inputBuf_size ){
if( data[ Time ] == 0xFFFF ){
if( Input == 0xFFFF ) Input = 0;
data[ Time ] = Input;
}
}
}
void inputDataSubClass::SetInputDataA( DWORD Time, WORD Input ){
SetInputDataSub( Time, Input );
}
void inputDataSubClass::SetInputDataB( DWORD Time, WORD Input ){
SetInputDataSub( Time + 1, Input );
}
//GetInput
//暫定
int inputDataSubClass::GetInputDataSub( DWORD Time, WORD* Input ){
if( Time >= inputBuf_size ) return 1;
if( data[ Time ] == 0xFFFF ) return 1;
if( Input ) *Input = data[ Time ];
return 0;
}
int inputDataSubClass::GetInputDataA( DWORD Time, WORD* Input ){
if( GetInputDataSub( Time, Input ) ) return 1;
return 0;
}
int inputDataSubClass::GetInputDataB( DWORD Time, WORD* Input ){
if( GetInputDataSub( Time + 1, Input ) ) return 1;
return 0;
}