Skip to content

Commit

Permalink
バーチャルキャスト ver1.7.0a (Steam対応版リリース) 以降に対応
Browse files Browse the repository at this point in the history
  • Loading branch information
esperecyan committed Aug 3, 2019
1 parent c3fc8dc commit 5e8e8d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/VirtualCast.exe
/config.json
/config.yaml
/config.yml
/*.lnk
/node_modules
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ allow_direct_view: true
------
![](demo.gif)

1. [バーチャルキャストを起動.js.cmd]を `VirtualCast.exe` があるフォルダに保存します
1. [バーチャルキャストを起動.js.cmd]を好きなフォルダに保存します
2. `バーチャルキャストを起動.js.cmd` をダブルクリックして実行します。
3. `config.json` の内容をもとに `config.yaml` が作成された後、バーチャルキャストが起動します。
**※記述しているニコニ立体番号が多い場合、`config.yaml` の作成にしばらくかかります。**
Expand Down
36 changes: 13 additions & 23 deletions バーチャルキャストを起動.js.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ EXIT %errorlevel% */
* @see {@link https://github.com/esperecyan/virtualcast-config}
*/
(function () {
var Shell = WSH.CreateObject('WScript.Shell');

/**
* 実行ファイルのファイル名。
* @constant {string}
*/
var EXE_FILE_NAME = 'VirtualCast.exe';
var EXE_URL = 'steam://rungameid/947890';

/**
* config.json の `niconico.charcter_models` に指定できる最大のモデル数。
Expand All @@ -26,7 +27,13 @@ var EXE_FILE_NAME = 'VirtualCast.exe';
var MAX_NICONICO_CHARCTER_MODELS_COUNT = 16;

/**
* 出力先ファイル名。
* 出力先フォルダパス。
* @constant {string}
*/
var CONFIG_FOLDER_PATH = Shell.ExpandEnvironmentStrings('%USERPROFILE%\\Documents\\My Games\\VirtualCast');

/**
* 出力先ファイルパス。
* @constant {string}
*/
var OUTPUT_FILE_NAME = 'config.json';
Expand All @@ -53,7 +60,6 @@ var DELAY_MILISECONDS = 1000;


var FileSystemObject = WSH.CreateObject('Scripting.FileSystemObject');
var Shell = WSH.CreateObject('WScript.Shell');
var htmlfile = WSH.CreateObject('htmlfile');
htmlfile.write('<meta http-equiv="x-ua-compatible" content="IE=Edge" />');
var JSON = htmlfile.parentWindow.JSON;
Expand Down Expand Up @@ -148,15 +154,13 @@ function isValidConfig(config, filename)
return true;
}

var folder = FileSystemObject.GetFolder(FileSystemObject.GetParentFolderName(WSH.ScriptFullName));
var folder = FileSystemObject.GetFolder(CONFIG_FOLDER_PATH);

var exeFile, outputFile, inputFile;
var outputFile, inputFile;
var files = new Enumerator(folder.files);
for (; !files.atEnd(); files.moveNext()) {
var file = files.item();
if (file.Name === EXE_FILE_NAME) {
exeFile = file;
} else if (file.Name === OUTPUT_FILE_NAME) {
if (file.Name === OUTPUT_FILE_NAME) {
outputFile = file;
} else if (INPUT_FILE_NAMES.includes(file.Name)) {
if (inputFile) {
Expand All @@ -173,16 +177,6 @@ for (; !files.atEnd(); files.moveNext()) {
}
}

if (!exeFile) {
Shell.Popup(
'「' + EXE_FILE_NAME + '」が見つかりません。「' + WSH.ScriptName + '」を同じフォルダに入れる必要があります。',
0,
WSH.ScriptName,
vbOKOnly + vbCritical
);
return;
}

if (inputFile) {
// config.yaml → config.json
if ((outputFile || folder).Attributes & ReadOnly) {
Expand Down Expand Up @@ -336,11 +330,7 @@ if (inputFile) {
return;
}

var command = '"' + folder.Path + '\\' + EXE_FILE_NAME + '"';
for (var i = 0, l = WSH.Arguments.length; i < l; i++) {
command += ' ' + WSH.Arguments(i);
}
Shell.Run(command);
Shell.Run('explorer ' + EXE_URL);
})();


Expand Down

0 comments on commit 5e8e8d5

Please sign in to comment.