@r2o3/rgskin-nodejs 0.0.1
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/LICENSE +7 -0
- package/README.md +350 -0
- package/package.json +28 -0
- package/rgskin.d.ts +316 -0
- package/rgskin.js +3650 -0
- package/rgskin_bg.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright © 2025 menvae
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# rgskin
|
|
2
|
+
A library for loading and creating skins for various rhythm games. It supports cross-platform usage including Web and Node.js environments via WebAssembly (WASM).
|
|
3
|
+
|
|
4
|
+
## Table of Contents
|
|
5
|
+
|
|
6
|
+
- [Rust Usage](#rust-usage)
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [API Reference](#api-reference)
|
|
9
|
+
- [Importing/Loading Skins](#importingloading-skins)
|
|
10
|
+
- [Creating Skins](#creating-skins)
|
|
11
|
+
- [Exporting Skins](#exporting-skins)
|
|
12
|
+
- [JavaScript/TypeScript Usage](#javascripttypescript-usage)
|
|
13
|
+
- [Installation](#installation-1)
|
|
14
|
+
- [API Reference](#api-reference-1)
|
|
15
|
+
- [Initialization](#initialization)
|
|
16
|
+
- [Importing/Loading Skins](#importingloading-skins-1)
|
|
17
|
+
- [Creating Skins](#creating-skins-1)
|
|
18
|
+
- [Exporting Skins](#exporting-skins-1)
|
|
19
|
+
- [Building](#building)
|
|
20
|
+
- [Rust Library](#rust-library)
|
|
21
|
+
- [WASM Bindings](#wasm-bindings)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
## Rust Usage
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
Add this to your `Cargo.toml`:
|
|
28
|
+
```toml
|
|
29
|
+
[dependencies]
|
|
30
|
+
rgskin = "0.0.1"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or run:
|
|
34
|
+
```sh
|
|
35
|
+
cargo add rgskin
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### API Reference
|
|
39
|
+
|
|
40
|
+
#### Importing/Loading Skins
|
|
41
|
+
|
|
42
|
+
##### Recommended way of Loading a skin
|
|
43
|
+
|
|
44
|
+
```rust
|
|
45
|
+
use rgskin::prelude::*;
|
|
46
|
+
|
|
47
|
+
// importing a skin from a directory
|
|
48
|
+
let osu_skin = import::osu::skin_from_dir("path/to/skin").expect("Failed to import skin!");
|
|
49
|
+
let fluxis_skin = import::fluxis::skin_from_dir("path/to/skin").expect("Failed to import skin!");
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
##### Manually loading a skin
|
|
53
|
+
|
|
54
|
+
```rust
|
|
55
|
+
use rgskin::prelude::*;
|
|
56
|
+
|
|
57
|
+
// create a new texture store, this is where the actual textures will be stored
|
|
58
|
+
let mut textures = TextureStore::new();
|
|
59
|
+
|
|
60
|
+
// you can import textures from a directory like this:
|
|
61
|
+
textures = import::all_textures_from_dir("path/to/skin")?;
|
|
62
|
+
|
|
63
|
+
// or alternatively if you parse the skin config first, you can import only the textures you need like this:
|
|
64
|
+
let raw_str = import::osu::ini_str_from_dir("path/to/skin");
|
|
65
|
+
let skin_config = OsuSkinIni::from_str(&raw_str)?;
|
|
66
|
+
|
|
67
|
+
// since get_required_texture_paths returns a HashSet, we need to convert it to a Vec<&str> for the import function
|
|
68
|
+
let required_texture_paths_set = skin_config.get_required_texture_paths();
|
|
69
|
+
let required_texture_paths = required_texture_paths_set.iter().map(|s| s.as_str()).collect::<Vec<_>>();
|
|
70
|
+
|
|
71
|
+
textures = import::textures_from_dir("path/to/skin", &required_texture_paths)?;
|
|
72
|
+
|
|
73
|
+
// now you can create a skin from the config and textures
|
|
74
|
+
|
|
75
|
+
let osu_skin = OsuSkin::new(skin_config, Some(textures), None); // last parameter is the sound samples store, which you can import similarly to textures
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Creating Skins
|
|
79
|
+
|
|
80
|
+
All skins are loaded in their original formats; Any textures go in ``TextureStore`` or samples go in ``SampleStore``, etc. The config is also preserved so, this next part will talk about dealing with generic skins as creating skins for a specific game differs from one to another.
|
|
81
|
+
|
|
82
|
+
Additionally all skins can be converting into a generic version of it.
|
|
83
|
+
|
|
84
|
+
Examples:
|
|
85
|
+
```rust
|
|
86
|
+
OsuSkin::from_generic_mania(&generic);
|
|
87
|
+
OsuSkin.to_generic_mania();
|
|
88
|
+
```
|
|
89
|
+
```rust
|
|
90
|
+
FluXisSkin::from_generic_mania(&generic);
|
|
91
|
+
FluXisSkin.to_generic_mania(fluxis_layout); // if you don't have a layout you can just pass None or ().
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
Unlike skins from games not all textures are stored in ``TextureStore``. Skin Elements can have their own textures that are shared pointers (``Option<Arc<RwLock<Texture>>>``). Meaning the texture can be shared anywhere either in a ``TextureStore`` or inside a Skin Element.
|
|
97
|
+
|
|
98
|
+
#### Exporting Skins
|
|
99
|
+
|
|
100
|
+
##### Recommened way of exporting a skin
|
|
101
|
+
|
|
102
|
+
```rust
|
|
103
|
+
export::osu::skin_to_dir(&skin, "path/to/export/to")?;
|
|
104
|
+
export::fluxis::skin_to_dir(&skin, "path/to/export/to")?;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
###### Manually exporting a skin
|
|
108
|
+
```rust
|
|
109
|
+
export::osu::ini_to_dir(skin.skin_ini, "path/to/export/to"); // export::{game}
|
|
110
|
+
export::textures_to_dir(skin.textures, "path/to/export/to");
|
|
111
|
+
export::samples_to_dir(skin.samples, "path/to/export/to"); // if you have samples
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## JavaScript/TypeScript Usage
|
|
115
|
+
|
|
116
|
+
### Installation
|
|
117
|
+
For Node.js:
|
|
118
|
+
```sh
|
|
119
|
+
npm install @r2o3/rgskin-nodejs
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For web projects:
|
|
123
|
+
```html
|
|
124
|
+
<script src="https://unpkg.com/@r2o3/rgskin-browser@latest/rgskin.js"></script>
|
|
125
|
+
```
|
|
126
|
+
or
|
|
127
|
+
```javascript
|
|
128
|
+
npm install @r2o3/rgskin-browser
|
|
129
|
+
```
|
|
130
|
+
then use as an ES module
|
|
131
|
+
|
|
132
|
+
### API Reference
|
|
133
|
+
|
|
134
|
+
#### Initialization
|
|
135
|
+
```javascript
|
|
136
|
+
// For ES modules
|
|
137
|
+
import * as rgskin from '@r2o3/rgskin'; // or if not in node modules use the path to rgskin.js
|
|
138
|
+
|
|
139
|
+
// or alternatively
|
|
140
|
+
const rgskin = await import('path/to/rgskin.js')
|
|
141
|
+
|
|
142
|
+
// For CommonJS
|
|
143
|
+
const rgskin = require('rgskin');
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
you may need to do ``await rgskin.default()`` after importing if you've imported it in a script tag (with type="module") or you get an error like ``Uncaught TypeError: Cannot read properties of undefined (reading '__wbindgen_malloc')``
|
|
147
|
+
|
|
148
|
+
As of now you can't parse/write using the original structures in JS/TS, will be supported in the *near* future.
|
|
149
|
+
|
|
150
|
+
#### Importing/Loading Skins
|
|
151
|
+
|
|
152
|
+
For Node:
|
|
153
|
+
|
|
154
|
+
##### Recommended way of Loading a skin
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
const OsuSkin = rgskin.osuSkinFromDir("path/to/skin");
|
|
158
|
+
const FluXisSkin = rgskin.fluXisSkinFromDir("path/to/skin");
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
##### Manually loading a skin
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
// create a new texture store, this is where the actual textures will be stored
|
|
165
|
+
let textures = new rgskin.TextureStore();
|
|
166
|
+
|
|
167
|
+
// you can import textures from a directory like this:
|
|
168
|
+
textures = rgskin.allTexturesFromDir("path/to/skin");
|
|
169
|
+
|
|
170
|
+
// you can parse configs like this:
|
|
171
|
+
let raw_str = rgskin.iniStrFromDir("path/to/skin")
|
|
172
|
+
let skin_config = rgskin.OsuSkinIni.fromStr(raw_str);
|
|
173
|
+
|
|
174
|
+
let osuSKin = new rgskin.OsuSkin(skin_config, textures, null) // last parameter is the sound samples store, which you can import similarly to textures
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
For Browsers:
|
|
178
|
+
|
|
179
|
+
Unfortunately you can't automatically import everything using a single function.
|
|
180
|
+
So you'll have to do a bit of work. Check [FilesMap preparation](#preparing-the-filesmap)
|
|
181
|
+
|
|
182
|
+
##### Recommended way of Loading a skin
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
const OsuSkin = rgskin.osuSkinFromFiles(filesMap);
|
|
186
|
+
const FluXisSkin = rgskin.fluXisSkinFromFiles(filesMap);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
##### Manually loading a skin
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
// create a new texture store, this is where the actual textures will be stored
|
|
193
|
+
let textures = new rgskin.TextureStore();
|
|
194
|
+
|
|
195
|
+
// you can import textures from files like this:
|
|
196
|
+
// filesMap is a Map object with relative path -> Uint8Array pairs
|
|
197
|
+
textures = rgskin.allTexturesFromFiles(filesMap);
|
|
198
|
+
|
|
199
|
+
// you can parse configs like this:
|
|
200
|
+
// assuming you have the skin.ini file in your filesMap
|
|
201
|
+
let raw_str = filesMap.get("skin.ini"); // get the Uint8Array
|
|
202
|
+
let decoder = new TextDecoder();
|
|
203
|
+
let ini_string = decoder.decode(raw_str);
|
|
204
|
+
let skin_config = rgskin.OsuSkinIni.fromStr(ini_string);
|
|
205
|
+
|
|
206
|
+
let osuSkin = new rgskin.OsuSkin(skin_config, textures, null); // last parameter is the sound samples store, which you can import similarly to textures
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
##### Preparing the filesMap
|
|
210
|
+
|
|
211
|
+
The `filesMap` parameter is a JavaScript `Map` object where:
|
|
212
|
+
- Keys are filenames (strings)
|
|
213
|
+
- Values are file contents as `Uint8Array`
|
|
214
|
+
|
|
215
|
+
Example: Reading files from an HTML file input
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
const filesMap = new Map();
|
|
219
|
+
|
|
220
|
+
// assuming you have an <input type="file" multiple webkitdirectory> element
|
|
221
|
+
fileInput.addEventListener('change', async (event) => {
|
|
222
|
+
const files = event.target.files;
|
|
223
|
+
|
|
224
|
+
for (const file of files) {
|
|
225
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
226
|
+
const uint8Array = new Uint8Array(arrayBuffer);
|
|
227
|
+
const relativePath = file.webkitRelativePath || file.name;
|
|
228
|
+
filesMap.set(relativePath, uint8Array);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// now you can import the skin
|
|
232
|
+
const skin = rgskin.osuSkinFromFiles(filesMap);
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### Creating Skins
|
|
237
|
+
|
|
238
|
+
Check [Rust's Creating Skins](#creating-skins) for more details
|
|
239
|
+
|
|
240
|
+
```javascript
|
|
241
|
+
OsuSkin.fromGenericMania(&generic);
|
|
242
|
+
OsuSkin.toGenericMania();
|
|
243
|
+
```
|
|
244
|
+
```javascript
|
|
245
|
+
FluXisSkin.fromGenericMania(&generic);
|
|
246
|
+
FluXisSkin.toGenericMania(fluxis_layout); // if you don't have a layout you can just not pass anything or null.
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Exporting Skins
|
|
250
|
+
|
|
251
|
+
For Node:
|
|
252
|
+
|
|
253
|
+
##### Recommended way of exporting a skin
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
rgskin.osuSkinToDir(skin, "path/to/export/to");
|
|
257
|
+
rgskin.fluXisSkinToDir(skin, "path/to/export/to");
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
##### Manually exporting a skin
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
rgskin.iniToDir(skin.skin_ini, "path/to/export/to");
|
|
264
|
+
rgskin.texturesToDir(skin.textures, "path/to/export/to");
|
|
265
|
+
rgskin.samplesToDir(skin.samples, "path/to/export/to"); // if you have samples
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
For Browsers:
|
|
269
|
+
|
|
270
|
+
##### Recommended way of exporting a skin
|
|
271
|
+
|
|
272
|
+
```javascript
|
|
273
|
+
// Returns a JavaScript Map object with relative path -> Uint8Array pairs
|
|
274
|
+
const filesMap = rgskin.osuSkinToFiles(skin);
|
|
275
|
+
const filesMap = rgskin.fluXisSkinToFiles(skin);
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
##### Manually exporting a skin
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
const iniString = rgskin.iniToString(skin.skin_ini);
|
|
282
|
+
const texturesMap = rgskin.texturesToFiles(skin.textures);
|
|
283
|
+
const samplesMap = rgskin.samplesToFiles(skin.samples);
|
|
284
|
+
|
|
285
|
+
// combine them into a single Map if needed
|
|
286
|
+
const filesMap = new Map([
|
|
287
|
+
['skin.ini', new TextEncoder().encode(iniString)],
|
|
288
|
+
...texturesMap,
|
|
289
|
+
...samplesMap
|
|
290
|
+
]);
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Actually Exporting/Downloading the files will depend on your implementation.
|
|
294
|
+
|
|
295
|
+
Example using JSZip:
|
|
296
|
+
```javascript
|
|
297
|
+
const filesMap = rgskin.osuSkinToFiles(skin);
|
|
298
|
+
|
|
299
|
+
const zip = new JSZip();
|
|
300
|
+
filesMap.forEach((data, path) => {
|
|
301
|
+
zip.file(path, data);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const zipBlob = await zip.generateAsync({ type: 'blob' });
|
|
305
|
+
const link = document.createElement('a');
|
|
306
|
+
link.href = URL.createObjectURL(zipBlob);
|
|
307
|
+
link.download = 'skin.zip';
|
|
308
|
+
link.click();
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Example Downloading each file indiviually:
|
|
312
|
+
|
|
313
|
+
```javascript
|
|
314
|
+
const filesMap = rgskin.osuSkinToFiles(skin);
|
|
315
|
+
|
|
316
|
+
filesMap.forEach((data, path) => {
|
|
317
|
+
const blob = new Blob([data]);
|
|
318
|
+
const link = document.createElement('a');
|
|
319
|
+
link.href = URL.createObjectURL(blob);
|
|
320
|
+
link.download = path;
|
|
321
|
+
link.click();
|
|
322
|
+
});
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Building
|
|
326
|
+
|
|
327
|
+
### Rust Library
|
|
328
|
+
```sh
|
|
329
|
+
cargo build
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### WASM Bindings
|
|
333
|
+
1. Install wasm-pack:
|
|
334
|
+
```sh
|
|
335
|
+
cargo install wasm-pack
|
|
336
|
+
```
|
|
337
|
+
> [!IMPORTANT]
|
|
338
|
+
> It's really recommended to have [wasm-opt](https://github.com/WebAssembly/binaryen) installed and added to path for the wasm build.
|
|
339
|
+
|
|
340
|
+
2. Build the package:
|
|
341
|
+
```sh
|
|
342
|
+
npm run build # debug build
|
|
343
|
+
npm run build-release # release build
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
3. This will build it for both node and browser and the output will be in `dist-web` and `dist-node` directory.
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
r2o3 uses the MIT License for all its sibiling projects.
|
|
350
|
+
See [LICENSE](https://github.com/r2o3/rgskin/blob/master/LICENSE) for more information
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@r2o3/rgskin-nodejs",
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"menvae"
|
|
5
|
+
],
|
|
6
|
+
"description": "A library for converting rhythm game skins.",
|
|
7
|
+
"version": "0.0.1",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/r2o3/rgskin"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"rgskin_bg.wasm",
|
|
15
|
+
"rgskin.js",
|
|
16
|
+
"rgskin.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"main": "rgskin.js",
|
|
19
|
+
"types": "rgskin.d.ts",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"wasm",
|
|
22
|
+
"rust",
|
|
23
|
+
"rhythm-game",
|
|
24
|
+
"parser",
|
|
25
|
+
"converter",
|
|
26
|
+
"skin"
|
|
27
|
+
]
|
|
28
|
+
}
|
package/rgskin.d.ts
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class BinaryStore {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
constructor();
|
|
8
|
+
insertBinary(binary: RawBytes): void;
|
|
9
|
+
makeUnique(new_path: string, binary: RawBytes): string;
|
|
10
|
+
loadFromArrayBuffer(path: string, buffer: ArrayBuffer): void;
|
|
11
|
+
loadFromUint8Array(path: string, array: Uint8Array): void;
|
|
12
|
+
allLoaded(): boolean;
|
|
13
|
+
loadedCount(): number;
|
|
14
|
+
unloadedPaths(): Array<any>;
|
|
15
|
+
hasBinary(path: string): boolean;
|
|
16
|
+
getBinaryPath(path: string): string | undefined;
|
|
17
|
+
binaryHasData(path: string): boolean;
|
|
18
|
+
getBinaryData(path: string): Uint8Array | undefined;
|
|
19
|
+
contains(path: string): boolean;
|
|
20
|
+
remove(path: string): boolean;
|
|
21
|
+
getLength(): number;
|
|
22
|
+
isEmpty(): boolean;
|
|
23
|
+
getPaths(): Array<any>;
|
|
24
|
+
clear(): void;
|
|
25
|
+
copy(original_path: string, new_path: string): string | undefined;
|
|
26
|
+
makeUniqueCopy(original_path: string, new_base_path: string): string | undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class FluXisKeymode {
|
|
30
|
+
private constructor();
|
|
31
|
+
free(): void;
|
|
32
|
+
[Symbol.dispose](): void;
|
|
33
|
+
keymode: number;
|
|
34
|
+
column_width: number;
|
|
35
|
+
hit_position: number;
|
|
36
|
+
tint_notes: boolean;
|
|
37
|
+
tint_lns: boolean;
|
|
38
|
+
tint_receptors: boolean;
|
|
39
|
+
colors: string[];
|
|
40
|
+
receptors_first: boolean;
|
|
41
|
+
receptor_offset: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class FluXisLayout {
|
|
45
|
+
private constructor();
|
|
46
|
+
free(): void;
|
|
47
|
+
[Symbol.dispose](): void;
|
|
48
|
+
name: string;
|
|
49
|
+
author: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class FluXisSkin {
|
|
53
|
+
free(): void;
|
|
54
|
+
[Symbol.dispose](): void;
|
|
55
|
+
constructor(skin_json: SkinJson, textures?: TextureStore | null, samples?: BinaryStore | null);
|
|
56
|
+
toGenericMania(): GenericManiaSkin;
|
|
57
|
+
toGenericManiaWithLayout(layout: FluXisLayout): GenericManiaSkin;
|
|
58
|
+
static fromGenericMania(skin: GenericManiaSkin): FluXisSkinWithLayout;
|
|
59
|
+
getKeymode(keymode: number): FluXisKeymode | undefined;
|
|
60
|
+
getRequiredTexturePaths(): string[];
|
|
61
|
+
getRequiredSamplePaths(): string[];
|
|
62
|
+
skin_json: SkinJson;
|
|
63
|
+
textures: TextureStore;
|
|
64
|
+
samples: BinaryStore;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class FluXisSkinWithLayout {
|
|
68
|
+
private constructor();
|
|
69
|
+
free(): void;
|
|
70
|
+
[Symbol.dispose](): void;
|
|
71
|
+
skin: FluXisSkin;
|
|
72
|
+
layout: FluXisLayout;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class General {
|
|
76
|
+
private constructor();
|
|
77
|
+
free(): void;
|
|
78
|
+
[Symbol.dispose](): void;
|
|
79
|
+
static fromStr(content: string): General;
|
|
80
|
+
toString(): string;
|
|
81
|
+
name: string;
|
|
82
|
+
author: string;
|
|
83
|
+
version: string;
|
|
84
|
+
animation_framerate: number;
|
|
85
|
+
allow_slider_ball_tint: boolean;
|
|
86
|
+
combo_burst_random: boolean;
|
|
87
|
+
cursor_centre: boolean;
|
|
88
|
+
cursor_expand: boolean;
|
|
89
|
+
cursor_rotate: boolean;
|
|
90
|
+
cursor_trail_rotate: boolean;
|
|
91
|
+
custom_combo_burst_sounds: Uint16Array;
|
|
92
|
+
hit_circle_overlay_above_number: boolean;
|
|
93
|
+
layered_hit_sounds: boolean;
|
|
94
|
+
slider_ball_flip: boolean;
|
|
95
|
+
spinner_fade_playfield: boolean;
|
|
96
|
+
spinner_frequency_modulate: boolean;
|
|
97
|
+
spinner_no_blink: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export class GenericManiaSkin {
|
|
101
|
+
private constructor();
|
|
102
|
+
free(): void;
|
|
103
|
+
[Symbol.dispose](): void;
|
|
104
|
+
toGenericMania(): GenericManiaSkin;
|
|
105
|
+
static fromGenericMania(skin: GenericManiaSkin): GenericManiaSkin;
|
|
106
|
+
getKeymode(keymode: number): Keymode | undefined;
|
|
107
|
+
getRequiredTexturePaths(): string[];
|
|
108
|
+
getRequiredSamplePaths(): string[];
|
|
109
|
+
textures: TextureStore;
|
|
110
|
+
samples: BinaryStore;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export class Info {
|
|
114
|
+
private constructor();
|
|
115
|
+
free(): void;
|
|
116
|
+
[Symbol.dispose](): void;
|
|
117
|
+
name: string;
|
|
118
|
+
creator: string;
|
|
119
|
+
accent: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export class Keymode {
|
|
123
|
+
private constructor();
|
|
124
|
+
free(): void;
|
|
125
|
+
[Symbol.dispose](): void;
|
|
126
|
+
static fromStr(content: string): OsuKeymode;
|
|
127
|
+
toStr(): string;
|
|
128
|
+
getTexturePaths(): string[];
|
|
129
|
+
keymode: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class OsuKeymode {
|
|
133
|
+
private constructor();
|
|
134
|
+
free(): void;
|
|
135
|
+
[Symbol.dispose](): void;
|
|
136
|
+
keymode: number;
|
|
137
|
+
keys_under_notes: boolean;
|
|
138
|
+
judgement_line: boolean;
|
|
139
|
+
upside_down: boolean;
|
|
140
|
+
special_style: number;
|
|
141
|
+
combo_burst_style: number;
|
|
142
|
+
get split_stages(): boolean | undefined;
|
|
143
|
+
set split_stages(value: boolean | null | undefined);
|
|
144
|
+
stage_separation: number;
|
|
145
|
+
separate_score: boolean;
|
|
146
|
+
hit_position: number;
|
|
147
|
+
light_position: number;
|
|
148
|
+
get score_position(): number | undefined;
|
|
149
|
+
set score_position(value: number | null | undefined);
|
|
150
|
+
get combo_position(): number | undefined;
|
|
151
|
+
set combo_position(value: number | null | undefined);
|
|
152
|
+
column_start: number;
|
|
153
|
+
column_right: number;
|
|
154
|
+
column_line_width: Uint32Array;
|
|
155
|
+
column_width: Uint32Array;
|
|
156
|
+
column_spacing: Uint32Array;
|
|
157
|
+
barline_height: number;
|
|
158
|
+
lighting_n_width: Uint32Array;
|
|
159
|
+
lighting_l_width: Uint32Array;
|
|
160
|
+
get width_for_note_height_scale(): number | undefined;
|
|
161
|
+
set width_for_note_height_scale(value: number | null | undefined);
|
|
162
|
+
light_frame_per_second: number;
|
|
163
|
+
key_flip_when_upside_down: boolean;
|
|
164
|
+
note_body_style: number;
|
|
165
|
+
note_body_style_columns: Uint8Array;
|
|
166
|
+
receptor_images: string[];
|
|
167
|
+
receptor_images_down: string[];
|
|
168
|
+
normal_note_images: string[];
|
|
169
|
+
long_note_head_images: string[];
|
|
170
|
+
long_note_body_images: string[];
|
|
171
|
+
long_note_tail_images: string[];
|
|
172
|
+
stage_left: string;
|
|
173
|
+
stage_right: string;
|
|
174
|
+
stage_bottom: string;
|
|
175
|
+
stage_hint: string;
|
|
176
|
+
stage_light: string;
|
|
177
|
+
lighting_n: string;
|
|
178
|
+
lighting_l: string;
|
|
179
|
+
warning_arrow: string;
|
|
180
|
+
hit0: string;
|
|
181
|
+
hit50: string;
|
|
182
|
+
hit100: string;
|
|
183
|
+
hit200: string;
|
|
184
|
+
hit300: string;
|
|
185
|
+
hit300g: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export class OsuSkin {
|
|
189
|
+
free(): void;
|
|
190
|
+
[Symbol.dispose](): void;
|
|
191
|
+
constructor(skin_ini: OsuSkinIni, textures?: TextureStore | null, samples?: BinaryStore | null);
|
|
192
|
+
toGenericMania(): GenericManiaSkin;
|
|
193
|
+
static fromGenericMania(skin: GenericManiaSkin): OsuSkin;
|
|
194
|
+
getKeymode(keymode: number): OsuKeymode | undefined;
|
|
195
|
+
getRequiredTexturePaths(): string[];
|
|
196
|
+
getRequiredSamplePaths(): string[];
|
|
197
|
+
skin_ini: OsuSkinIni;
|
|
198
|
+
textures: TextureStore;
|
|
199
|
+
samples: BinaryStore;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export class OsuSkinIni {
|
|
203
|
+
free(): void;
|
|
204
|
+
[Symbol.dispose](): void;
|
|
205
|
+
constructor();
|
|
206
|
+
static fromStr(json_str: string): OsuSkinIni;
|
|
207
|
+
toString(): string;
|
|
208
|
+
getRequiredTexturePaths(): string[];
|
|
209
|
+
getRequiredSamplePaths(): string[];
|
|
210
|
+
getKeymode(keymode: number): OsuKeymode | undefined;
|
|
211
|
+
general: General;
|
|
212
|
+
keymodes: OsuKeymode[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export class RawBytes {
|
|
216
|
+
free(): void;
|
|
217
|
+
[Symbol.dispose](): void;
|
|
218
|
+
constructor(path: string);
|
|
219
|
+
static fromBytes(path: string, bytes: Uint8Array): RawBytes;
|
|
220
|
+
getData(): Uint8Array | undefined;
|
|
221
|
+
static fromArrayBuffer(path: string, buffer: ArrayBuffer): RawBytes;
|
|
222
|
+
static fromArrayBufferUnloaded(path: string, buffer: ArrayBuffer): RawBytes;
|
|
223
|
+
static fromUint8Array(path: string, array: Uint8Array): RawBytes;
|
|
224
|
+
static fromUint8ArrayUnloaded(path: string, array: Uint8Array): RawBytes;
|
|
225
|
+
getPath(): string;
|
|
226
|
+
hasData(): boolean;
|
|
227
|
+
isLoaded(): boolean;
|
|
228
|
+
isUnloaded(): boolean;
|
|
229
|
+
isEmpty(): boolean;
|
|
230
|
+
load(): void;
|
|
231
|
+
unload(): void;
|
|
232
|
+
path: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export class SkinJson {
|
|
236
|
+
free(): void;
|
|
237
|
+
[Symbol.dispose](): void;
|
|
238
|
+
constructor();
|
|
239
|
+
static fromStr(json_str: string): SkinJson;
|
|
240
|
+
toString(): string;
|
|
241
|
+
info: Info;
|
|
242
|
+
keymodes: FluXisKeymode[];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export class Texture {
|
|
246
|
+
free(): void;
|
|
247
|
+
[Symbol.dispose](): void;
|
|
248
|
+
constructor(path: string);
|
|
249
|
+
static fromBlank(path: string): Texture;
|
|
250
|
+
static fromArrayBuffer(path: string, buffer: ArrayBuffer): Texture;
|
|
251
|
+
static fromArrayBufferUnloaded(path: string, buffer: ArrayBuffer): Texture;
|
|
252
|
+
static fromUint8Array(path: string, array: Uint8Array): Texture;
|
|
253
|
+
static fromUint8ArrayUnloaded(path: string, array: Uint8Array): Texture;
|
|
254
|
+
getPath(): string;
|
|
255
|
+
hasData(): boolean;
|
|
256
|
+
isLoaded(): boolean;
|
|
257
|
+
isUnloaded(): boolean;
|
|
258
|
+
isEmpty(): boolean;
|
|
259
|
+
load(): void;
|
|
260
|
+
unload(): void;
|
|
261
|
+
path: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export class TextureStore {
|
|
265
|
+
free(): void;
|
|
266
|
+
[Symbol.dispose](): void;
|
|
267
|
+
constructor();
|
|
268
|
+
insertTexture(texture: Texture): void;
|
|
269
|
+
makeUnique(new_path: string, texture: Texture): string;
|
|
270
|
+
loadFromArrayBuffer(path: string, buffer: ArrayBuffer): void;
|
|
271
|
+
loadFromUint8Array(path: string, array: Uint8Array): void;
|
|
272
|
+
allLoaded(): boolean;
|
|
273
|
+
loadedCount(): number;
|
|
274
|
+
unloadedPaths(): Array<any>;
|
|
275
|
+
hasTexture(path: string): boolean;
|
|
276
|
+
getTexturePath(path: string): string | undefined;
|
|
277
|
+
textureHasData(path: string): boolean;
|
|
278
|
+
contains(path: string): boolean;
|
|
279
|
+
remove(path: string): boolean;
|
|
280
|
+
getLength(): number;
|
|
281
|
+
isEmpty(): boolean;
|
|
282
|
+
getPaths(): Array<any>;
|
|
283
|
+
clear(): void;
|
|
284
|
+
copy(original_path: string, new_path: string): string | undefined;
|
|
285
|
+
makeUniqueCopy(original_path: string, new_base_path: string): string | undefined;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function allSamplesFromDir(path: string): BinaryStore;
|
|
289
|
+
|
|
290
|
+
export function allTexturesFromDir(path: string): TextureStore;
|
|
291
|
+
|
|
292
|
+
export function fluXisSkinFromDir(path: string): FluXisSkin;
|
|
293
|
+
|
|
294
|
+
export function fluXisSkinToDir(skin: FluXisSkin, path: string): void;
|
|
295
|
+
|
|
296
|
+
export function iniStrFromDir(path: string): string;
|
|
297
|
+
|
|
298
|
+
export function iniToDir(skin_ini: OsuSkinIni, path: string): void;
|
|
299
|
+
|
|
300
|
+
export function jsonStrFromDir(path: string): string;
|
|
301
|
+
|
|
302
|
+
export function jsonToDir(skin_json: SkinJson, path: string): void;
|
|
303
|
+
|
|
304
|
+
export function layoutToDir(layout_json: FluXisLayout, path: string): void;
|
|
305
|
+
|
|
306
|
+
export function osuSkinFromDir(path: string): OsuSkin;
|
|
307
|
+
|
|
308
|
+
export function osuSkinToDir(skin: OsuSkin, path: string): void;
|
|
309
|
+
|
|
310
|
+
export function samplesFromDir(path: string, relative_sample_paths: Array<any>): BinaryStore;
|
|
311
|
+
|
|
312
|
+
export function samplesToDir(samples: BinaryStore, path: string): void;
|
|
313
|
+
|
|
314
|
+
export function texturesFromDir(path: string, relative_texture_paths: Array<any>): TextureStore;
|
|
315
|
+
|
|
316
|
+
export function texturesToDir(textures: TextureStore, path: string): void;
|