ic-scm / automatic-bars-patcher Goto Github PK
View Code? Open in Web Editor NEWA tool for patching BARS files when modding custom music into games that use BWAV files.
License: GNU General Public License v3.0
A tool for patching BARS files when modding custom music into games that use BWAV files.
License: GNU General Public License v3.0
Having the 6 PM hourlies (from ACNH) renamed to instead play at 7 PM, causes broken audio playback, with no apparent differences in the file known, having checked in HxD, even if said files are converted to .wav, then back to .bwav.
In-game, it sounds like both channels of stereo are playing the same song at different points. Shortly after this occurs, the game softlocks/freezes & crashes, along with audio stuttering.
The ACNH 5 PM playing at 6 PM plays normally, maybe worth noting?
Any conversions I did were done using openrevolution, I have not experienced any other crashes using other tracks during 7PM, or otherwise to my memory.
ABP = Automatic Bars Patcher
So there's 2 things to address here.
I wrote a Python script that will parse a BARS file and extract all BWAVs, so I actually got my hands on what is technically THE original BWAV file to satisfy the ABP.
Since ABP asks for an original BWAV, what is the appropriate way to patch BARS files for sound effects? If I did it correctly by extracting the BWAV from the BARS file and feeding it to ABP, what is the cause for the new BARS file not including the new BWAV file, but a distorted copy of the original?
I'm a bit of a newbie with C++, and I'm not sure if I'm doing something wrong, but when I try to run 'build.sh', nothing happens, and when I run it on the Terminal, I get the following compiler error:
`PS C:\Users\MYUSERNAME\Downloads\automatic-bars-patcher-1.0.0\automatic-bars-patcher-1.0.0\pc> g++ -O2 -pipe main.cpp -o auto_bars_patcher -Wall -Wextra
In file included from main.cpp:9:
../bars-patcher-core/bars-patcher.h: In function 'unsigned char barspatcher_run(bool, const char*, const char*, const char*, const char*)':
../bars-patcher-core/bars-patcher.h:101:5: error: 'uint64_t' was not declared in this scope
101 | uint64_t bars_size;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:22:1: note: 'uint64_t' is defined in header ''; did you forget to '#include '?
21 | #include <dirent.h>
+++ |+#include
22 | #elif defined BARSPATCHER_VERSION_NX
../bars-patcher-core/bars-patcher.h:111:9: error: 'bars_size' was not declared in this scope
111 | bars_size = ifile.tellg();
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: error: 'uint16_t' was not declared in this scope
147 | uint16_t mod_dir_list_count = 0;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: note: 'uint16_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:163:27: error: 'struct dirent' has no member named 'd_type'
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:163:37: error: 'DT_REG' was not declared in this scope
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:165:22: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
165 | mod_dir_list[mod_dir_list_count] = (char*)malloc(strlen(mod_dir_entry->d_name)+1);
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:173:25: error: expected ';' before 'i'
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:173:44: error: 'i' was not declared in this scope
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:191:25: error: expected ';' before 'i'
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:191:44: error: 'i' was not declared in this scope
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:200:8: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
200 | if(mod_dir_list_count == 0) {
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:211:13: error: expected ';' before 'patched_files'
211 | uint16_t patched_files = 0, skipped_files = 0;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:17: error: expected ';' before 'entry'
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:40: error: 'entry' was not declared in this scope
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~
../bars-patcher-core/bars-patcher.h:241:17: error: expected ';' before 'og_bwav_size'
241 | uint64_t og_bwav_size;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:248:17: error: 'skipped_files' was not declared in this scope
248 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:257:25: error: expected ';' before 'i'
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:257:44: error: 'i' was not declared in this scope
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:263:17: error: expected ';' before 'mod_bwav_size'
263 | uint64_t mod_bwav_size;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:272:25: error: expected ';' before 'i'
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:272:44: error: 'i' was not declared in this scope
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:278:9: error: 'og_bwav_size' was not declared in this scope; did you mean 'og_bwav_data'?
278 | og_bwav_size = og_bwav.tellg();
| ^~~~~~~~~~~~
| og_bwav_data
../bars-patcher-core/bars-patcher.h:279:9: error: 'mod_bwav_size' was not declared in this scope; did you mean 'mod_bwav_data'?
279 | mod_bwav_size = mod_bwav.tellg();
| ^~~~~~~~~~~~~
| mod_bwav_data
../bars-patcher-core/bars-patcher.h:296:25: error: expected ';' before 'i'
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:296:44: error: 'i' was not declared in this scope
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:308:13: error: 'skipped_files' was not declared in this scope
308 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:313:13: error: 'skipped_files' was not declared in this scope
313 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:327:17: error: expected ';' before 'og_bwav_chnum'
327 | uint16_t og_bwav_chnum, mod_bwav_chnum;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:328:9: error: 'og_bwav_chnum' was not declared in this scope; did you mean 'og_bwav_bom'?
328 | og_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, og_bwav_data, 0x0E, 2, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:329:9: error: 'mod_bwav_chnum' was not declared in this scope; did you mean 'mod_bwav_bom'?
329 | mod_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, mod_bwav_data, 0x0E, 2, mod_bwav_bom);
| ^~~~~~~~~~~~~~
| mod_bwav_bom
../bars-patcher-core/bars-patcher.h:333:13: error: 'skipped_files' was not declared in this scope
333 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: error: 'uint32_t' was not declared in this scope
338 | uint32_t og_bwav_crc32;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: note: 'uint32_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:339:9: error: 'uint8_t' was not declared in this scope
339 | uint8_t og_bwav_crc32_bytes[4];
| ^~~~~~~
../bars-patcher-core/bars-patcher.h:339:9: note: 'uint8_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:342:16: error: 'og_bwav_crc32_bytes' was not declared in this scope
342 | memcpy(og_bwav_crc32_bytes, slice_output, 4);
| ^~~~~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:343:9: error: 'og_bwav_crc32' was not declared in this scope; did you mean 'og_bwav_bom'?
343 | og_bwav_crc32 = barspatcher_getSliceAsNumber(slice_output, og_bwav_crc32_bytes, 0, 4, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:346:17: error: expected ';' before 'patch_length'
346 | uint32_t patch_length = 0x10 + 0x4Cmod_bwav_chnum;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:347:12: error: 'patch_length' was not declared in this scope
347 | if(patch_length > BARSPATCHER_MODBWAV_MEMBLOCK_SIZE) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:349:13: error: 'skipped_files' was not declared in this scope
349 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:357:17: error: expected ';' before 'patches_written'
357 | uint16_t patches_written = 0;
| ^~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:358:17: error: expected ';' before 'c'
358 | uint16_t c;
| ^~
| ;
../bars-patcher-core/bars-patcher.h:361:21: error: expected ';' before 'bars_pos'
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:361:34: error: 'bars_pos' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:361:45: error: 'bars_size' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:363:17: error: 'c' was not declared in this scope
363 | for(c = 0; c < 4; c++) {
| ^
../bars-patcher-core/bars-patcher.h:372:25: error: expected ';' before 'bars_bwav_offset'
372 | uint32_t bars_bwav_offset = bars_pos - 0x08;
| ^~~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:373:65: error: 'bars_bwav_offset' was not declared in this scope
373 | if(verbose) printf("Found at 0x%08X in BARS, ", bars_bwav_offset);
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:32: error: 'bars_bwav_offset' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:51: error: 'patch_length' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:381:29: error: expected ';' before 'i'
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~
| ;
../bars-patcher-core/bars-patcher.h:381:35: error: 'i' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^
../bars-patcher-core/bars-patcher.h:381:39: error: 'patch_length' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:382:31: error: 'bars_bwav_offset' was not declared in this scope
382 | bars_data[bars_bwav_offset + i] = mod_bwav_data[i];
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:386:17: error: 'patches_written' was not declared in this scope
386 | patches_written++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:12: error: 'patches_written' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:33: error: 'patched_files' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:395:13: error: 'skipped_files' was not declared in this scope
395 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:400:8: error: 'patched_files' was not declared in this scope
400 | if(patched_files == 0) {
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:405:21: error: expected ';' before 'i'
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:405:40: error: 'i' was not declared in this scope
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:418:21: error: expected ';' before 'i'
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:418:40: error: 'i' was not declared in this scope
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:423:35: error: 'bars_size' was not declared in this scope
423 | ofile.write((char)bars_data, bars_size);
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:431:21: error: expected ';' before 'i'
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:431:40: error: 'i' was not declared in this scope
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:439:57: error: 'patched_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:439:105: error: 'skipped_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:443:17: error: expected ';' before 'i'
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:443:36: error: 'i' was not declared in this scope
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^`
Where am I going wrong?
When I try to patch in new music files for indoor areas such as the airport or town hall, ACNH crashes when I try to enter those areas. I've paid close attention to making sure the new files have the right amount of channels, so that should not be an issue.
I play ACNH v2.0.6 (emulated using Yuzu) and use the PC version of the ABP tool using a Linux Mint virtual machine, in case this matters.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.