sonolus-next-rush-engine 2.5.0 → 2.9.0-kizu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/EngineConfiguration +0 -0
- package/dist/EnginePlayData +0 -0
- package/dist/EnginePreviewData +0 -0
- package/dist/EngineRom +0 -0
- package/dist/EngineTutorialData +0 -0
- package/dist/EngineWatchData +0 -0
- package/dist/extended/convert.js +9 -7
- package/dist/index.d.ts +9 -3
- package/dist/index.js +10 -7
- package/dist/lib/binaryseeker/reader.js +50 -63
- package/dist/lib/binaryseeker/writer.js +75 -70
- package/dist/sus/convert.js +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -8,6 +8,14 @@ Perspective-lane rhythm game for [Sonolus](https://sonolus.com).
|
|
|
8
8
|
|
|
9
9
|
Package version.
|
|
10
10
|
|
|
11
|
+
### `engineFullName`
|
|
12
|
+
|
|
13
|
+
Engine full name.
|
|
14
|
+
|
|
15
|
+
### `engineShortName`
|
|
16
|
+
|
|
17
|
+
Engine short name.
|
|
18
|
+
|
|
11
19
|
### `databaseEngineItem`
|
|
12
20
|
|
|
13
21
|
Partial database engine item compatible with [sonolus-express](https://github.com/Sonolus/sonolus-express).
|
package/dist/EngineConfiguration
CHANGED
|
Binary file
|
package/dist/EnginePlayData
CHANGED
|
Binary file
|
package/dist/EnginePreviewData
CHANGED
|
Binary file
|
package/dist/EngineRom
CHANGED
|
Binary file
|
package/dist/EngineTutorialData
CHANGED
|
Binary file
|
package/dist/EngineWatchData
CHANGED
|
Binary file
|
package/dist/extended/convert.js
CHANGED
|
@@ -121,12 +121,13 @@ function lastIndexLeq(arr, x, key) {
|
|
|
121
121
|
return lo - 1;
|
|
122
122
|
}
|
|
123
123
|
class ExtData {
|
|
124
|
+
entities;
|
|
125
|
+
byArch = new Map();
|
|
126
|
+
byName = new Map();
|
|
127
|
+
indexByEntity = new Map();
|
|
128
|
+
notes = [];
|
|
129
|
+
connectors = [];
|
|
124
130
|
constructor(entities) {
|
|
125
|
-
this.byArch = new Map();
|
|
126
|
-
this.byName = new Map();
|
|
127
|
-
this.indexByEntity = new Map();
|
|
128
|
-
this.notes = [];
|
|
129
|
-
this.connectors = [];
|
|
130
131
|
this.entities = entities;
|
|
131
132
|
entities.forEach((e, idx) => {
|
|
132
133
|
const arch = e.archetype;
|
|
@@ -151,9 +152,10 @@ class ExtData {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
class EntityBuilder {
|
|
155
|
+
archetype;
|
|
156
|
+
values = {};
|
|
157
|
+
refs = {};
|
|
154
158
|
constructor(archetype) {
|
|
155
|
-
this.values = {};
|
|
156
|
-
this.refs = {};
|
|
157
159
|
this.archetype = archetype;
|
|
158
160
|
}
|
|
159
161
|
set(key, val) {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,15 +7,21 @@ import { USC } from './usc/index.js';
|
|
|
7
7
|
export * from './usc/index.js';
|
|
8
8
|
export { type ExtendedEntityData, type ExtendedEntityDataField, extendedToLevelData, mmwsToUSC, susToUSC, ucmmwsToLevelData, uscToLevelData, };
|
|
9
9
|
export declare const convertToLevelData: (input: string | Uint8Array | USC | LevelData, offset?: number) => LevelData;
|
|
10
|
-
export declare const version = "2.
|
|
10
|
+
export declare const version = "2.9.0-kizu";
|
|
11
|
+
export declare const engineFullName: {
|
|
12
|
+
readonly en: 'Next RUSH';
|
|
13
|
+
};
|
|
14
|
+
export declare const engineShortName: {
|
|
15
|
+
readonly en: 'Next RUSH';
|
|
16
|
+
};
|
|
11
17
|
export declare const databaseEngineItem: {
|
|
12
18
|
readonly name: 'next-rush';
|
|
13
19
|
readonly version: 13;
|
|
14
20
|
readonly title: {
|
|
15
|
-
readonly en:
|
|
21
|
+
readonly en: `##LOCALIZE:${string}`;
|
|
16
22
|
};
|
|
17
23
|
readonly subtitle: {
|
|
18
|
-
readonly en:
|
|
24
|
+
readonly en: `##LOCALIZE:${string}`;
|
|
19
25
|
};
|
|
20
26
|
readonly author: {
|
|
21
27
|
readonly en: 'Next RUSH';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextFunction } from '@sonolus/core';
|
|
1
2
|
import { isExtendedLevelData } from './extended/analyze.js';
|
|
2
3
|
import { extendedToLevelData, } from './extended/convert.js';
|
|
3
4
|
import { isLevelData } from './LevelData/analyze.js';
|
|
@@ -65,16 +66,18 @@ export const convertToLevelData = (input, offset = 0) => {
|
|
|
65
66
|
}
|
|
66
67
|
return uscToLevelData(usc, offset, true, true);
|
|
67
68
|
};
|
|
68
|
-
export const version = '2.
|
|
69
|
+
export const version = '2.9.0-kizu';
|
|
70
|
+
export const engineFullName = {
|
|
71
|
+
en: 'Next RUSH',
|
|
72
|
+
};
|
|
73
|
+
export const engineShortName = {
|
|
74
|
+
en: 'Next RUSH',
|
|
75
|
+
};
|
|
69
76
|
export const databaseEngineItem = {
|
|
70
77
|
name: 'next-rush',
|
|
71
78
|
version: 13,
|
|
72
|
-
title: {
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
subtitle: {
|
|
76
|
-
en: 'Next RUSH',
|
|
77
|
-
},
|
|
79
|
+
title: { en: `${TextFunction.Localize}:${JSON.stringify(engineShortName)}` },
|
|
80
|
+
subtitle: { en: `${TextFunction.Localize}:${JSON.stringify(engineFullName)}` },
|
|
78
81
|
author: {
|
|
79
82
|
en: 'Next RUSH',
|
|
80
83
|
},
|
|
@@ -2,53 +2,41 @@
|
|
|
2
2
|
* Simple cursor-based binary reader.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
6
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
8
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
9
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10
|
-
};
|
|
11
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var _BinaryReader_data, _BinaryReader_cursor;
|
|
17
5
|
/**
|
|
18
6
|
* Simple cursor-based binary reader.
|
|
19
7
|
*/
|
|
20
8
|
export class BinaryReader {
|
|
9
|
+
#data;
|
|
10
|
+
#cursor;
|
|
21
11
|
/**
|
|
22
12
|
* Create a new BinarySeeker instance.
|
|
23
13
|
* @param data - The ArrayBuffer to read from.
|
|
24
14
|
* @returns A new BinarySeeker instance.
|
|
25
15
|
*/
|
|
26
16
|
constructor(data) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__classPrivateFieldSet(this, _BinaryReader_data, new DataView(data), "f");
|
|
30
|
-
__classPrivateFieldSet(this, _BinaryReader_cursor, 0, "f");
|
|
17
|
+
this.#data = new DataView(data);
|
|
18
|
+
this.#cursor = 0;
|
|
31
19
|
}
|
|
32
20
|
/**
|
|
33
21
|
* Returns the current cursor position.
|
|
34
22
|
*/
|
|
35
23
|
get cursor() {
|
|
36
|
-
return
|
|
24
|
+
return this.#cursor;
|
|
37
25
|
}
|
|
38
26
|
/**
|
|
39
27
|
* Seek to a specific offset in the buffer.
|
|
40
28
|
* @param offset - The offset to seek to.
|
|
41
29
|
*/
|
|
42
30
|
seek(offset) {
|
|
43
|
-
|
|
31
|
+
this.#cursor = offset;
|
|
44
32
|
}
|
|
45
33
|
/**
|
|
46
34
|
* Read a single byte from the buffer.
|
|
47
35
|
* @returns The byte read.
|
|
48
36
|
*/
|
|
49
37
|
readUInt8() {
|
|
50
|
-
const value =
|
|
51
|
-
|
|
38
|
+
const value = this.#data.getUint8(this.#cursor);
|
|
39
|
+
this.#cursor += 1;
|
|
52
40
|
return value;
|
|
53
41
|
}
|
|
54
42
|
/**
|
|
@@ -56,8 +44,8 @@ export class BinaryReader {
|
|
|
56
44
|
* @returns The byte read.
|
|
57
45
|
*/
|
|
58
46
|
readInt8() {
|
|
59
|
-
const value =
|
|
60
|
-
|
|
47
|
+
const value = this.#data.getInt8(this.#cursor);
|
|
48
|
+
this.#cursor += 1;
|
|
61
49
|
return value;
|
|
62
50
|
}
|
|
63
51
|
/**
|
|
@@ -90,7 +78,7 @@ export class BinaryReader {
|
|
|
90
78
|
return endian === 'le' ? this.readFloat64LE() : this.readFloat64BE();
|
|
91
79
|
default:
|
|
92
80
|
kind;
|
|
93
|
-
throw new Error(`Unknown type: ${kind}`);
|
|
81
|
+
throw new Error(`Unknown type: ${String(kind)}`);
|
|
94
82
|
}
|
|
95
83
|
}
|
|
96
84
|
/**
|
|
@@ -98,8 +86,8 @@ export class BinaryReader {
|
|
|
98
86
|
* @returns The number read.
|
|
99
87
|
*/
|
|
100
88
|
readUInt64LE() {
|
|
101
|
-
const value =
|
|
102
|
-
|
|
89
|
+
const value = this.#data.getBigUint64(this.#cursor, true);
|
|
90
|
+
this.#cursor += 8;
|
|
103
91
|
return value;
|
|
104
92
|
}
|
|
105
93
|
/**
|
|
@@ -107,8 +95,8 @@ export class BinaryReader {
|
|
|
107
95
|
* @returns The number read.
|
|
108
96
|
*/
|
|
109
97
|
readUInt32LE() {
|
|
110
|
-
const value =
|
|
111
|
-
|
|
98
|
+
const value = this.#data.getUint32(this.#cursor, true);
|
|
99
|
+
this.#cursor += 4;
|
|
112
100
|
return value;
|
|
113
101
|
}
|
|
114
102
|
/**
|
|
@@ -116,8 +104,8 @@ export class BinaryReader {
|
|
|
116
104
|
* @returns The number read.
|
|
117
105
|
*/
|
|
118
106
|
readUInt16LE() {
|
|
119
|
-
const value =
|
|
120
|
-
|
|
107
|
+
const value = this.#data.getUint16(this.#cursor, true);
|
|
108
|
+
this.#cursor += 2;
|
|
121
109
|
return value;
|
|
122
110
|
}
|
|
123
111
|
/**
|
|
@@ -125,8 +113,8 @@ export class BinaryReader {
|
|
|
125
113
|
* @returns The number read.
|
|
126
114
|
*/
|
|
127
115
|
readInt64LE() {
|
|
128
|
-
const value =
|
|
129
|
-
|
|
116
|
+
const value = this.#data.getBigInt64(this.#cursor, true);
|
|
117
|
+
this.#cursor += 8;
|
|
130
118
|
return value;
|
|
131
119
|
}
|
|
132
120
|
/**
|
|
@@ -134,8 +122,8 @@ export class BinaryReader {
|
|
|
134
122
|
* @returns The number read.
|
|
135
123
|
*/
|
|
136
124
|
readInt32LE() {
|
|
137
|
-
const value =
|
|
138
|
-
|
|
125
|
+
const value = this.#data.getInt32(this.#cursor, true);
|
|
126
|
+
this.#cursor += 4;
|
|
139
127
|
return value;
|
|
140
128
|
}
|
|
141
129
|
/**
|
|
@@ -143,8 +131,8 @@ export class BinaryReader {
|
|
|
143
131
|
* @returns The number read.
|
|
144
132
|
*/
|
|
145
133
|
readInt16LE() {
|
|
146
|
-
const value =
|
|
147
|
-
|
|
134
|
+
const value = this.#data.getInt16(this.#cursor, true);
|
|
135
|
+
this.#cursor += 2;
|
|
148
136
|
return value;
|
|
149
137
|
}
|
|
150
138
|
/**
|
|
@@ -152,8 +140,8 @@ export class BinaryReader {
|
|
|
152
140
|
* @returns The number read.
|
|
153
141
|
*/
|
|
154
142
|
readUInt64BE() {
|
|
155
|
-
const value =
|
|
156
|
-
|
|
143
|
+
const value = this.#data.getBigUint64(this.#cursor, false);
|
|
144
|
+
this.#cursor += 8;
|
|
157
145
|
return value;
|
|
158
146
|
}
|
|
159
147
|
/**
|
|
@@ -161,8 +149,8 @@ export class BinaryReader {
|
|
|
161
149
|
* @returns The number read.
|
|
162
150
|
*/
|
|
163
151
|
readUInt32BE() {
|
|
164
|
-
const value =
|
|
165
|
-
|
|
152
|
+
const value = this.#data.getUint32(this.#cursor, false);
|
|
153
|
+
this.#cursor += 4;
|
|
166
154
|
return value;
|
|
167
155
|
}
|
|
168
156
|
/**
|
|
@@ -170,8 +158,8 @@ export class BinaryReader {
|
|
|
170
158
|
* @returns The number read.
|
|
171
159
|
*/
|
|
172
160
|
readUInt16BE() {
|
|
173
|
-
const value =
|
|
174
|
-
|
|
161
|
+
const value = this.#data.getUint16(this.#cursor, false);
|
|
162
|
+
this.#cursor += 2;
|
|
175
163
|
return value;
|
|
176
164
|
}
|
|
177
165
|
/**
|
|
@@ -179,8 +167,8 @@ export class BinaryReader {
|
|
|
179
167
|
* @returns The number read.
|
|
180
168
|
*/
|
|
181
169
|
readInt64BE() {
|
|
182
|
-
const value =
|
|
183
|
-
|
|
170
|
+
const value = this.#data.getBigInt64(this.#cursor, false);
|
|
171
|
+
this.#cursor += 8;
|
|
184
172
|
return value;
|
|
185
173
|
}
|
|
186
174
|
/**
|
|
@@ -188,8 +176,8 @@ export class BinaryReader {
|
|
|
188
176
|
* @returns The number read.
|
|
189
177
|
*/
|
|
190
178
|
readInt32BE() {
|
|
191
|
-
const value =
|
|
192
|
-
|
|
179
|
+
const value = this.#data.getInt32(this.#cursor, false);
|
|
180
|
+
this.#cursor += 4;
|
|
193
181
|
return value;
|
|
194
182
|
}
|
|
195
183
|
/**
|
|
@@ -197,8 +185,8 @@ export class BinaryReader {
|
|
|
197
185
|
* @returns The number read.
|
|
198
186
|
*/
|
|
199
187
|
readInt16BE() {
|
|
200
|
-
const value =
|
|
201
|
-
|
|
188
|
+
const value = this.#data.getInt16(this.#cursor, false);
|
|
189
|
+
this.#cursor += 2;
|
|
202
190
|
return value;
|
|
203
191
|
}
|
|
204
192
|
/**
|
|
@@ -206,8 +194,8 @@ export class BinaryReader {
|
|
|
206
194
|
* @returns The number read.
|
|
207
195
|
*/
|
|
208
196
|
readFloat32BE() {
|
|
209
|
-
const value =
|
|
210
|
-
|
|
197
|
+
const value = this.#data.getFloat32(this.#cursor, false);
|
|
198
|
+
this.#cursor += 4;
|
|
211
199
|
return value;
|
|
212
200
|
}
|
|
213
201
|
/**
|
|
@@ -215,8 +203,8 @@ export class BinaryReader {
|
|
|
215
203
|
* @returns The number read.
|
|
216
204
|
*/
|
|
217
205
|
readFloat64BE() {
|
|
218
|
-
const value =
|
|
219
|
-
|
|
206
|
+
const value = this.#data.getFloat64(this.#cursor, false);
|
|
207
|
+
this.#cursor += 8;
|
|
220
208
|
return value;
|
|
221
209
|
}
|
|
222
210
|
/** Alias for `readFloat32BE` */
|
|
@@ -232,8 +220,8 @@ export class BinaryReader {
|
|
|
232
220
|
* @returns The number read.
|
|
233
221
|
*/
|
|
234
222
|
readFloat32LE() {
|
|
235
|
-
const value =
|
|
236
|
-
|
|
223
|
+
const value = this.#data.getFloat32(this.#cursor, true);
|
|
224
|
+
this.#cursor += 4;
|
|
237
225
|
return value;
|
|
238
226
|
}
|
|
239
227
|
/**
|
|
@@ -241,8 +229,8 @@ export class BinaryReader {
|
|
|
241
229
|
* @returns The number read.
|
|
242
230
|
*/
|
|
243
231
|
readFloat64LE() {
|
|
244
|
-
const value =
|
|
245
|
-
|
|
232
|
+
const value = this.#data.getFloat64(this.#cursor, true);
|
|
233
|
+
this.#cursor += 8;
|
|
246
234
|
return value;
|
|
247
235
|
}
|
|
248
236
|
/**
|
|
@@ -252,8 +240,8 @@ export class BinaryReader {
|
|
|
252
240
|
readString() {
|
|
253
241
|
const buffer = [];
|
|
254
242
|
while (true) {
|
|
255
|
-
const charCode =
|
|
256
|
-
|
|
243
|
+
const charCode = this.#data.getUint8(this.#cursor);
|
|
244
|
+
this.#cursor += 1;
|
|
257
245
|
if (charCode === 0) {
|
|
258
246
|
break;
|
|
259
247
|
}
|
|
@@ -270,9 +258,9 @@ export class BinaryReader {
|
|
|
270
258
|
readBytes(length) {
|
|
271
259
|
const buffer = new Uint8Array(length);
|
|
272
260
|
for (let i = 0; i < length; i++) {
|
|
273
|
-
buffer[i] =
|
|
261
|
+
buffer[i] = this.#data.getUint8(this.#cursor + i);
|
|
274
262
|
}
|
|
275
|
-
|
|
263
|
+
this.#cursor += length;
|
|
276
264
|
return buffer;
|
|
277
265
|
}
|
|
278
266
|
/**
|
|
@@ -280,8 +268,8 @@ export class BinaryReader {
|
|
|
280
268
|
* @returns The buffer read.
|
|
281
269
|
*/
|
|
282
270
|
readToEnd() {
|
|
283
|
-
const buffer = new Uint8Array(
|
|
284
|
-
|
|
271
|
+
const buffer = new Uint8Array(this.#data.buffer, this.#cursor);
|
|
272
|
+
this.#cursor = this.#data.byteLength;
|
|
285
273
|
return buffer;
|
|
286
274
|
}
|
|
287
275
|
/**
|
|
@@ -299,7 +287,6 @@ export class BinaryReader {
|
|
|
299
287
|
* Returns if there are more data to read.
|
|
300
288
|
*/
|
|
301
289
|
get hasMoreData() {
|
|
302
|
-
return
|
|
290
|
+
return this.#cursor < this.#data.byteLength;
|
|
303
291
|
}
|
|
304
292
|
}
|
|
305
|
-
_BinaryReader_data = new WeakMap(), _BinaryReader_cursor = new WeakMap();
|
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
* Simple cursor-based binary writer.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
6
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
8
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
9
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10
|
-
};
|
|
11
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var _BinaryWriter_data, _BinaryWriter_view, _BinaryWriter_maxCursor, _BinaryWriter_cursor;
|
|
17
5
|
/**
|
|
18
6
|
* Simple cursor-based binary writer.
|
|
19
7
|
*
|
|
@@ -21,33 +9,33 @@ var _BinaryWriter_data, _BinaryWriter_view, _BinaryWriter_maxCursor, _BinaryWrit
|
|
|
21
9
|
* The buffer will grow automatically as needed, but you can use {@link ensureSize} to reduce the number of resizing.
|
|
22
10
|
*/
|
|
23
11
|
export class BinaryWriter {
|
|
12
|
+
#data;
|
|
13
|
+
#view;
|
|
14
|
+
#maxCursor;
|
|
15
|
+
#cursor;
|
|
24
16
|
/**
|
|
25
17
|
* Create a new BinaryWriter instance.
|
|
26
18
|
* @param initialSize - The initial size of the buffer. The buffer will grow automatically as needed, but this parameter can help reduce the number of resizing.
|
|
27
19
|
* @returns A new BinaryWriter instance.
|
|
28
20
|
*/
|
|
29
21
|
constructor(initialSize = 256) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
__classPrivateFieldSet(this, _BinaryWriter_data, new Uint8Array(initialSize), "f");
|
|
35
|
-
__classPrivateFieldSet(this, _BinaryWriter_view, new DataView(__classPrivateFieldGet(this, _BinaryWriter_data, "f").buffer), "f");
|
|
36
|
-
__classPrivateFieldSet(this, _BinaryWriter_cursor, 0, "f");
|
|
37
|
-
__classPrivateFieldSet(this, _BinaryWriter_maxCursor, 0, "f");
|
|
22
|
+
this.#data = new Uint8Array(initialSize);
|
|
23
|
+
this.#view = new DataView(this.#data.buffer);
|
|
24
|
+
this.#cursor = 0;
|
|
25
|
+
this.#maxCursor = 0;
|
|
38
26
|
}
|
|
39
27
|
/**
|
|
40
28
|
* Returns the current cursor position.
|
|
41
29
|
*/
|
|
42
30
|
get cursor() {
|
|
43
|
-
return
|
|
31
|
+
return this.#cursor;
|
|
44
32
|
}
|
|
45
33
|
/**
|
|
46
34
|
* Seek to a specific offset in the buffer.
|
|
47
35
|
*/
|
|
48
36
|
seek(offset) {
|
|
49
|
-
this.preWrite(offset -
|
|
50
|
-
|
|
37
|
+
this.preWrite(offset - this.#cursor);
|
|
38
|
+
this.#cursor = offset;
|
|
51
39
|
this.postWrite(0);
|
|
52
40
|
}
|
|
53
41
|
/**
|
|
@@ -56,7 +44,7 @@ export class BinaryWriter {
|
|
|
56
44
|
*/
|
|
57
45
|
writeUInt8(value) {
|
|
58
46
|
this.preWrite(1);
|
|
59
|
-
|
|
47
|
+
this.#view.setUint8(this.#cursor, value);
|
|
60
48
|
this.postWrite(1);
|
|
61
49
|
}
|
|
62
50
|
/**
|
|
@@ -65,7 +53,7 @@ export class BinaryWriter {
|
|
|
65
53
|
*/
|
|
66
54
|
writeInt8(value) {
|
|
67
55
|
this.preWrite(1);
|
|
68
|
-
|
|
56
|
+
this.#data[this.#cursor] = value;
|
|
69
57
|
this.postWrite(1);
|
|
70
58
|
}
|
|
71
59
|
/**
|
|
@@ -87,26 +75,44 @@ export class BinaryWriter {
|
|
|
87
75
|
this.writeInt8(value);
|
|
88
76
|
break;
|
|
89
77
|
case 'u32':
|
|
90
|
-
endian === 'le'
|
|
78
|
+
if (endian === 'le')
|
|
79
|
+
this.writeUInt32LE(value);
|
|
80
|
+
else
|
|
81
|
+
this.writeUInt32BE(value);
|
|
91
82
|
break;
|
|
92
83
|
case 'u16':
|
|
93
|
-
endian === 'le'
|
|
84
|
+
if (endian === 'le')
|
|
85
|
+
this.writeUInt16LE(value);
|
|
86
|
+
else
|
|
87
|
+
this.writeUInt16BE(value);
|
|
94
88
|
break;
|
|
95
89
|
case 'i32':
|
|
96
|
-
endian === 'le'
|
|
90
|
+
if (endian === 'le')
|
|
91
|
+
this.writeInt32LE(value);
|
|
92
|
+
else
|
|
93
|
+
this.writeInt32BE(value);
|
|
97
94
|
break;
|
|
98
95
|
case 'i16':
|
|
99
|
-
endian === 'le'
|
|
96
|
+
if (endian === 'le')
|
|
97
|
+
this.writeInt16LE(value);
|
|
98
|
+
else
|
|
99
|
+
this.writeInt16BE(value);
|
|
100
100
|
break;
|
|
101
101
|
case 'f32':
|
|
102
|
-
endian === 'le'
|
|
102
|
+
if (endian === 'le')
|
|
103
|
+
this.writeFloat32LE(value);
|
|
104
|
+
else
|
|
105
|
+
this.writeFloat32BE(value);
|
|
103
106
|
break;
|
|
104
107
|
case 'f64':
|
|
105
|
-
endian === 'le'
|
|
108
|
+
if (endian === 'le')
|
|
109
|
+
this.writeFloat64LE(value);
|
|
110
|
+
else
|
|
111
|
+
this.writeFloat64BE(value);
|
|
106
112
|
break;
|
|
107
113
|
default:
|
|
108
114
|
kind;
|
|
109
|
-
throw new Error(`Unknown kind: ${kind}`);
|
|
115
|
+
throw new Error(`Unknown kind: ${String(kind)}`);
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
/**
|
|
@@ -115,7 +121,7 @@ export class BinaryWriter {
|
|
|
115
121
|
*/
|
|
116
122
|
writeUInt32LE(value) {
|
|
117
123
|
this.preWrite(4);
|
|
118
|
-
|
|
124
|
+
this.#view.setUint32(this.#cursor, value, true);
|
|
119
125
|
this.postWrite(4);
|
|
120
126
|
}
|
|
121
127
|
/**
|
|
@@ -124,7 +130,7 @@ export class BinaryWriter {
|
|
|
124
130
|
*/
|
|
125
131
|
writeUInt32BE(value) {
|
|
126
132
|
this.preWrite(4);
|
|
127
|
-
|
|
133
|
+
this.#view.setUint32(this.#cursor, value, false);
|
|
128
134
|
this.postWrite(4);
|
|
129
135
|
}
|
|
130
136
|
/**
|
|
@@ -133,7 +139,7 @@ export class BinaryWriter {
|
|
|
133
139
|
*/
|
|
134
140
|
writeUInt16LE(value) {
|
|
135
141
|
this.preWrite(2);
|
|
136
|
-
|
|
142
|
+
this.#view.setUint16(this.#cursor, value, true);
|
|
137
143
|
this.postWrite(2);
|
|
138
144
|
}
|
|
139
145
|
/**
|
|
@@ -142,7 +148,7 @@ export class BinaryWriter {
|
|
|
142
148
|
*/
|
|
143
149
|
writeUInt16BE(value) {
|
|
144
150
|
this.preWrite(2);
|
|
145
|
-
|
|
151
|
+
this.#view.setUint16(this.#cursor, value, false);
|
|
146
152
|
this.postWrite(2);
|
|
147
153
|
}
|
|
148
154
|
/**
|
|
@@ -151,7 +157,7 @@ export class BinaryWriter {
|
|
|
151
157
|
*/
|
|
152
158
|
writeInt32LE(value) {
|
|
153
159
|
this.preWrite(4);
|
|
154
|
-
|
|
160
|
+
this.#view.setInt32(this.#cursor, value, true);
|
|
155
161
|
this.postWrite(4);
|
|
156
162
|
}
|
|
157
163
|
/**
|
|
@@ -160,7 +166,7 @@ export class BinaryWriter {
|
|
|
160
166
|
*/
|
|
161
167
|
writeInt32BE(value) {
|
|
162
168
|
this.preWrite(4);
|
|
163
|
-
|
|
169
|
+
this.#view.setInt32(this.#cursor, value, false);
|
|
164
170
|
this.postWrite(4);
|
|
165
171
|
}
|
|
166
172
|
/**
|
|
@@ -169,7 +175,7 @@ export class BinaryWriter {
|
|
|
169
175
|
*/
|
|
170
176
|
writeInt16LE(value) {
|
|
171
177
|
this.preWrite(2);
|
|
172
|
-
|
|
178
|
+
this.#view.setInt16(this.#cursor, value, true);
|
|
173
179
|
this.postWrite(2);
|
|
174
180
|
}
|
|
175
181
|
/**
|
|
@@ -178,7 +184,7 @@ export class BinaryWriter {
|
|
|
178
184
|
*/
|
|
179
185
|
writeInt16BE(value) {
|
|
180
186
|
this.preWrite(2);
|
|
181
|
-
|
|
187
|
+
this.#view.setInt16(this.#cursor, value, false);
|
|
182
188
|
this.postWrite(2);
|
|
183
189
|
}
|
|
184
190
|
/**
|
|
@@ -187,7 +193,7 @@ export class BinaryWriter {
|
|
|
187
193
|
*/
|
|
188
194
|
writeUInt64LE(value) {
|
|
189
195
|
this.preWrite(8);
|
|
190
|
-
|
|
196
|
+
this.#view.setBigUint64(this.#cursor, value, true);
|
|
191
197
|
this.postWrite(8);
|
|
192
198
|
}
|
|
193
199
|
/**
|
|
@@ -196,7 +202,7 @@ export class BinaryWriter {
|
|
|
196
202
|
*/
|
|
197
203
|
writeUInt64BE(value) {
|
|
198
204
|
this.preWrite(8);
|
|
199
|
-
|
|
205
|
+
this.#view.setBigUint64(this.#cursor, value, false);
|
|
200
206
|
this.postWrite(8);
|
|
201
207
|
}
|
|
202
208
|
/**
|
|
@@ -205,7 +211,7 @@ export class BinaryWriter {
|
|
|
205
211
|
*/
|
|
206
212
|
writeInt64LE(value) {
|
|
207
213
|
this.preWrite(8);
|
|
208
|
-
|
|
214
|
+
this.#view.setBigInt64(this.#cursor, value, true);
|
|
209
215
|
this.postWrite(8);
|
|
210
216
|
}
|
|
211
217
|
/**
|
|
@@ -214,7 +220,7 @@ export class BinaryWriter {
|
|
|
214
220
|
*/
|
|
215
221
|
writeInt64BE(value) {
|
|
216
222
|
this.preWrite(8);
|
|
217
|
-
|
|
223
|
+
this.#view.setBigInt64(this.#cursor, value, false);
|
|
218
224
|
this.postWrite(8);
|
|
219
225
|
}
|
|
220
226
|
/**
|
|
@@ -223,7 +229,7 @@ export class BinaryWriter {
|
|
|
223
229
|
*/
|
|
224
230
|
writeFloat32LE(value) {
|
|
225
231
|
this.preWrite(4);
|
|
226
|
-
|
|
232
|
+
this.#view.setFloat32(this.#cursor, value, true);
|
|
227
233
|
this.postWrite(4);
|
|
228
234
|
}
|
|
229
235
|
/**
|
|
@@ -232,7 +238,7 @@ export class BinaryWriter {
|
|
|
232
238
|
*/
|
|
233
239
|
writeFloat64LE(value) {
|
|
234
240
|
this.preWrite(8);
|
|
235
|
-
|
|
241
|
+
this.#view.setFloat64(this.#cursor, value, true);
|
|
236
242
|
this.postWrite(8);
|
|
237
243
|
}
|
|
238
244
|
/**
|
|
@@ -241,7 +247,7 @@ export class BinaryWriter {
|
|
|
241
247
|
*/
|
|
242
248
|
writeFloat32BE(value) {
|
|
243
249
|
this.preWrite(4);
|
|
244
|
-
|
|
250
|
+
this.#view.setFloat32(this.#cursor, value, false);
|
|
245
251
|
this.postWrite(4);
|
|
246
252
|
}
|
|
247
253
|
/**
|
|
@@ -250,7 +256,7 @@ export class BinaryWriter {
|
|
|
250
256
|
*/
|
|
251
257
|
writeFloat64BE(value) {
|
|
252
258
|
this.preWrite(8);
|
|
253
|
-
|
|
259
|
+
this.#view.setFloat64(this.#cursor, value, false);
|
|
254
260
|
this.postWrite(8);
|
|
255
261
|
}
|
|
256
262
|
/** Alias for `writeFloat32LE` */
|
|
@@ -271,9 +277,9 @@ export class BinaryWriter {
|
|
|
271
277
|
const bytes = encoder.encode(value);
|
|
272
278
|
this.preWrite(bytes.length + 1);
|
|
273
279
|
for (let i = 0; i < bytes.length; i++) {
|
|
274
|
-
|
|
280
|
+
this.#data[this.#cursor + i] = bytes[i];
|
|
275
281
|
}
|
|
276
|
-
|
|
282
|
+
this.#data[this.#cursor + bytes.length] = 0;
|
|
277
283
|
this.postWrite(bytes.length + 1);
|
|
278
284
|
}
|
|
279
285
|
/**
|
|
@@ -283,7 +289,7 @@ export class BinaryWriter {
|
|
|
283
289
|
*/
|
|
284
290
|
writeBytes(value) {
|
|
285
291
|
this.preWrite(value.length);
|
|
286
|
-
|
|
292
|
+
this.#data.set(value, this.#cursor);
|
|
287
293
|
this.postWrite(value.length);
|
|
288
294
|
}
|
|
289
295
|
/**
|
|
@@ -296,7 +302,7 @@ export class BinaryWriter {
|
|
|
296
302
|
const bytes = encoder.encode(value);
|
|
297
303
|
this.preWrite(bytes.length);
|
|
298
304
|
for (let i = 0; i < bytes.length; i++) {
|
|
299
|
-
|
|
305
|
+
this.#data[this.#cursor + i] = bytes[i];
|
|
300
306
|
}
|
|
301
307
|
this.postWrite(bytes.length);
|
|
302
308
|
}
|
|
@@ -305,7 +311,7 @@ export class BinaryWriter {
|
|
|
305
311
|
* @returns The buffer as a Uint8Array.
|
|
306
312
|
*/
|
|
307
313
|
toUint8Array() {
|
|
308
|
-
return Uint8Array.from(
|
|
314
|
+
return Uint8Array.from(this.#data.slice(0, this.#maxCursor));
|
|
309
315
|
}
|
|
310
316
|
/**
|
|
311
317
|
* Increase the buffer size to the specified size if the buffer is too small.
|
|
@@ -313,31 +319,31 @@ export class BinaryWriter {
|
|
|
313
319
|
* @returns The new buffer size.
|
|
314
320
|
*/
|
|
315
321
|
ensureSize(size) {
|
|
316
|
-
if (
|
|
322
|
+
if (this.#data.byteLength < size) {
|
|
317
323
|
this.extendBuffer(size);
|
|
318
324
|
}
|
|
319
|
-
return
|
|
325
|
+
return this.#data.byteLength;
|
|
320
326
|
}
|
|
321
327
|
/** Get the current length of the buffer. */
|
|
322
328
|
get length() {
|
|
323
|
-
return
|
|
329
|
+
return this.#maxCursor;
|
|
324
330
|
}
|
|
325
331
|
/** Get the current capacity of the buffer. */
|
|
326
332
|
get capacity() {
|
|
327
|
-
return
|
|
333
|
+
return this.#data.byteLength;
|
|
328
334
|
}
|
|
329
335
|
/** Allocate more space in the buffer, if needed. */
|
|
330
336
|
preWrite(size) {
|
|
331
|
-
if (
|
|
337
|
+
if (this.#cursor + size > this.#data.byteLength) {
|
|
332
338
|
let newSize;
|
|
333
|
-
if (
|
|
334
|
-
newSize =
|
|
339
|
+
if (this.#data.byteLength >= 2048) {
|
|
340
|
+
newSize = this.#data.byteLength + 2048;
|
|
335
341
|
}
|
|
336
342
|
else {
|
|
337
|
-
newSize =
|
|
343
|
+
newSize = this.#data.byteLength * 2;
|
|
338
344
|
}
|
|
339
|
-
if (
|
|
340
|
-
newSize =
|
|
345
|
+
if (this.#cursor + size > newSize) {
|
|
346
|
+
newSize = this.#cursor + size;
|
|
341
347
|
}
|
|
342
348
|
this.extendBuffer(newSize);
|
|
343
349
|
}
|
|
@@ -345,16 +351,15 @@ export class BinaryWriter {
|
|
|
345
351
|
/** Allocate more space in the buffer. */
|
|
346
352
|
extendBuffer(length) {
|
|
347
353
|
const newData = new Uint8Array(length);
|
|
348
|
-
newData.set(
|
|
349
|
-
|
|
350
|
-
|
|
354
|
+
newData.set(this.#data);
|
|
355
|
+
this.#data = newData;
|
|
356
|
+
this.#view = new DataView(newData.buffer);
|
|
351
357
|
}
|
|
352
358
|
/** Update the cursor after writing to the buffer. */
|
|
353
359
|
postWrite(size) {
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
|
|
360
|
+
this.#cursor += size;
|
|
361
|
+
if (this.#cursor > this.#maxCursor) {
|
|
362
|
+
this.#maxCursor = this.#cursor;
|
|
357
363
|
}
|
|
358
364
|
}
|
|
359
365
|
}
|
|
360
|
-
_BinaryWriter_data = new WeakMap(), _BinaryWriter_view = new WeakMap(), _BinaryWriter_maxCursor = new WeakMap(), _BinaryWriter_cursor = new WeakMap();
|
package/dist/sus/convert.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonolus-next-rush-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0-kizu",
|
|
4
4
|
"description": "Perspective-lane rhythm game for Sonolus",
|
|
5
5
|
"author": "Hyeon2",
|
|
6
6
|
"repository": {
|
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"check-type": "tsc -p . --noEmit",
|
|
30
|
-
"check-lint": "oxlint
|
|
31
|
-
"check-format": "oxfmt --check
|
|
30
|
+
"check-lint": "oxlint",
|
|
31
|
+
"check-format": "oxfmt --check",
|
|
32
32
|
"oxc": "npm run check-lint && npm run check-format",
|
|
33
|
-
"format": "oxfmt
|
|
34
|
-
"fix": "oxlint --fix
|
|
33
|
+
"format": "oxfmt",
|
|
34
|
+
"fix": "oxlint --fix && oxfmt",
|
|
35
35
|
"version": "node ./version.js",
|
|
36
36
|
"build": "tsc -p . && node ./build.js"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@sonolus/core": "~7.15.
|
|
39
|
+
"@sonolus/core": "~7.15.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@sonolus/sonolus.js": "~9.7.3",
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"oxfmt": "
|
|
45
|
-
"oxlint": "
|
|
46
|
-
"oxlint-tsgolint": "
|
|
43
|
+
"@types/node": "^22.20.1",
|
|
44
|
+
"oxfmt": "^0.66.0",
|
|
45
|
+
"oxlint": "^1.81.0",
|
|
46
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
47
47
|
"typescript": "~7.0.2"
|
|
48
48
|
}
|
|
49
49
|
}
|