Skip to content

Commit

Permalink
起動オプションで読み込むモデルを切り替えられるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
esperecyan committed Sep 5, 2018
1 parent 95cc951 commit 0e22d4f
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 0 deletions.
136 changes: 136 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,142 @@ allow_direct_view: true

[バーチャルキャストを起動.js.cmd]: https://esperecyan.github.io/virtualcast-config/%E3%83%90%E3%83%BC%E3%83%81%E3%83%A3%E3%83%AB%E3%82%AD%E3%83%A3%E3%82%B9%E3%83%88%E3%82%92%E8%B5%B7%E5%8B%95.js.cmd

起動オプション
--------------
### `--esperecyan-niconico-character-models-offset-16x=[数字]`
`niconico.character_models` の順番をズラします。

:

```yaml
niconico:
character_models:
- 32797
- 32806
- 32813
- 32819
- 32830
- 32865
- 32872
- 32876
- 32898
- 32899
- 32928
- 32947
- 32952
- 32969
- 33010
- 33028
- 40000
- 40001
- 40023
- 40051
- 40077
- 40093
- 40258
- 40363
- 40463
- 40480
- 40481
- 40524
- 40567
- 40624
- 40660
- 40677
- 41036
```

#### `--esperecyan-niconico-character-models-offset-16x=0` の場合
指定しなかった場合と同じ。

#### `--esperecyan-niconico-character-models-offset-16x=1` の場合

```json
{
"niconico": {
"character_models": [
40000,
40001,
40023,
40051,
40077,
40093,
40258,
40363,
40463,
40480,
40481,
40524,
40567,
40624,
40660,
40677,
41036,
32797,
32806,
32813,
32819,
32830,
32865,
32872,
32876,
32898,
32899,
32928,
32947,
32952,
32969,
33010,
33028
]
}
}
```

#### `--esperecyan-niconico-character-models-offset-16x=2` の場合

```json
{
"niconico": {
"character_models": [
41036,
32797,
32806,
32813,
32819,
32830,
32865,
32872,
32876,
32898,
32899,
32928,
32947,
32952,
32969,
33010,
33028,
40000,
40001,
40023,
40051,
40077,
40093,
40258,
40363,
40463,
40480,
40481,
40524,
40567,
40624,
40660,
40677
]
}
}
```

Contribution
------------
Pull Request、または Issue よりお願いいたします。
Expand Down
37 changes: 37 additions & 0 deletions バーチャルキャストを起動.js.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ EXIT %errorlevel% */
*/
var EXE_FILE_NAME = 'VirtualCast.exe';

/**
* config.json の `niconico.charcter_models` に指定できる最大のモデル数。
* @constant {string}
*/
var MAX_NICONICO_CHARCTER_MODELS_COUNT = 16;

/**
* 出力先ファイル名。
* @constant {string}
Expand Down Expand Up @@ -204,6 +210,22 @@ if (inputFile) {
return;
}

if (typeof config.niconico === 'object' && config.niconico !== null
&& Array.isArray(config.niconico.character_models)) {
for (var i = 0, l = WSH.Arguments.length; i < l; i++) {
if (WSH.Arguments(i).startsWith('--esperecyan-niconico-character-models-offset-16x=')) {
var offset = Number.parseInt(
WSH.Arguments(i).replace('--esperecyan-niconico-character-models-offset-16x=', '')
) * MAX_NICONICO_CHARCTER_MODELS_COUNT;
if (config.niconico.character_models.length > offset) {
config.niconico.character_models
= config.niconico.character_models.concat(config.niconico.character_models.splice(0, offset));
}
break;
}
}
}

putFileContents(folder.Path + '\\' + OUTPUT_FILE_NAME, JSON.stringify(config, null, '\t').replace(/\n/g, '\r\n'));
} else if (outputFile) {
// config.json → config.yaml
Expand Down Expand Up @@ -3023,6 +3045,21 @@ if (!Array.prototype.includes) {
}
});
}

/**
* @see [String.prototype.startsWith() - JavaScript | MDN]{@link
* https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill}
* @license CC0-1.0
*/
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(search, pos) {
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
};
}

if (!Number.parseInt) {
Number.parseInt = parseInt;
}
}


Expand Down

0 comments on commit 0e22d4f

Please sign in to comment.