blob: c259c57d407d18989fe81441eb0fa39ca8d0c7e3 (
plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/**
* JASSeqReader.cpp
*
*/
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JAudio2/JASSeqReader.h"
void JASSeqReader::init() {
field_0x00 = 0;
field_0x04 = 0;
field_0x08 = 0;
for (int i = 0; i < 8; i++) {
field_0x0c[i] = NULL;
field_0x2c[i] = 0;
}
}
void JASSeqReader::init(void* param_0) {
field_0x00 = (u8*)param_0;
field_0x04 = field_0x00;
field_0x08 = 0;
for (int i = 0; i < 8; i++) {
field_0x0c[i] = NULL;
field_0x2c[i] = 0;
}
}
bool JASSeqReader::call(u32 param_0) {
if (field_0x08 >= 8) {
JUT_WARN(42, "%s", "Cannot exec call command");
return false;
}
field_0x0c[field_0x08++] = (u16*)field_0x04;
field_0x04 = field_0x00 + param_0;
return true;
}
bool JASSeqReader::loopStart(u32 param_0) {
if (8 <= field_0x08) {
JUT_WARN(53, "%s", "Cannot exec loopStart command");
return false;
}
field_0x0c[field_0x08] = (u16*)field_0x04;
field_0x2c[field_0x08++] = param_0;
return true;
}
bool JASSeqReader::loopEnd() {
if (field_0x08 == 0) {
JUT_WARN(65, "%s", "cannot loopE for call-stack is NULL");
return false;
}
u16 tmp = field_0x2c[field_0x08 - 1];
if (tmp != 0) {
tmp--;
}
if (!tmp) {
field_0x08--;
return true;
}
field_0x2c[field_0x08 - 1] = tmp;
field_0x04 = (u8*)field_0x0c[field_0x08 - 1];
return true;
}
bool JASSeqReader::ret() {
if (field_0x08 == 0) {
return false;
}
field_0x04 = (u8*)field_0x0c[--field_0x08];
return true;
}
int JASSeqReader::readMidiValue() {
int byte = readByte();
if (!(byte & 0x80)) {
return byte;
}
byte &= 0x7f;
int i = 0;
while (true) {
if (2 < i) {
JUT_WARN(100, "%s", "readMidiValue: Too large value");
return 0;
}
u8 newByte = readByte();
byte = byte << 7;
byte |= newByte & 0x7f;
if (!(newByte & 0x80)) {
break;
}
i++;
}
return byte;
}
|