Skip to content

Commit

Permalink
Simplify the procedure to generate bgm folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
hv0905 committed May 22, 2022
1 parent da12a75 commit f2e9f5b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ add_executable(HackNetOS
add_custom_command(TARGET HackNetOS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/ASCII $<TARGET_FILE_DIR:HackNetOS>/ASCII)

add_custom_command(TARGET HackNetOS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Scripts $<TARGET_FILE_DIR:HackNetOS>)
40 changes: 40 additions & 0 deletions Scripts/generate_bgm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
if ($args.Count -gt 0) {
$srcD = $args[0];
}

if ($null -eq $srcD -or( Get-Content $srcD -eq $null)) {
# prompt user to input the path
$srcD = Read-Host -Prompt "Enter the path of the source directory: ";
}

if ($null -eq (Get-ChildItem $srcD)) {
Write-Error "The source directory does not exist.";
exit 1;
}

Write-Host -ForegroundColor Green "Generating bgm directory...";

$backgroundMusic = Get-ChildItem $srcD -Filter "*Revole*.mp3";
$gotmail = Get-ChildItem $srcD -Filter "*You Got Mail*.mp3";

if ($null -eq (Get-ChildItem -Directory -Filter "bgm")) {
New-Item -Path "bgm" -Type Directory;
}

if ($null -ne $backgroundMusic) {
Write-Host -ForegroundColor Green "Copying Revole...";
Copy-Item $backgroundMusic -Destination "bgm/0.mp3";
} else {
Write-Host -ForegroundColor Yellow "Cannot find Revole";
}

if ($null -ne $gotmail) {
Write-Host -ForegroundColor Green "Copying You Got Mail...";
Copy-Item $gotmail -Destination "bgm/n0.mp3";
} else {
Write-Host -ForegroundColor Yellow "Cannot find You Got Mail";
}

Write-Host -ForegroundColor Green "Operation completed."


6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ Currently, some part of the game supports Chinese only, the i18n is on the way,
> This step is optional, the game can work properly without BGM feature.
1. Purchase and download [Hacknet OST](https://store.steampowered.com/app/408710/Hacknet_Official_Soundtrack/)
2. Create a directory called bgm on the program path.
3. Copy `Cinematrik - Hacknet OST - 09 Revole (R Mix).mp3` from OST directory to bgm directory and rename it to `0.mp3`.
4. Copy `Bit - Hacknet OST - 08 You Got Mail.mp3` from OST directory to bgm directory and rename it to `n0.mp3`.
5. Restart the game, now bgm should function properly.
2. Run `generate_bgm.ps1` using PowerShell to generate bgm directory automatically.
3. Restart the game if started, now bgm should function properly.

## 📷 Screenshots

Expand Down
6 changes: 2 additions & 4 deletions readme_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
> 这步是可选的, 游戏在没有bgm文件的情况下也可正常工作.
1. 从Steam购买并下载 [Hacknet OST](https://store.steampowered.com/app/408710/Hacknet_Official_Soundtrack/)
2. 在游戏目录中创建一个文件夹, 名字为 `bgm`.
3. 从OST中复制 `Cinematrik - Hacknet OST - 09 Revole (R Mix).mp3` 到bgm目录并将其重命名为 `0.mp3`.
4. 从OST中复制 `Bit - Hacknet OST - 08 You Got Mail.mp3` 到bgm目录并将其重命名为 `n0.mp3`.
5. 如果你已经打开了HacknetOS, 重启游戏.
2. 使用PowerShell运行`generate_bgm.ps1`即可自动生成bgm目录.
3. 如果你已经打开了HacknetOS, 重启游戏.

## 📷 截图

Expand Down

0 comments on commit f2e9f5b

Please sign in to comment.