summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc
index 59001fb..b4091e7 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -11,6 +11,7 @@
#include "audio/tracker.h"
#if !defined(STRIP_ALL)
#include "audio/backend/wav_dump_backend.h"
+#include "util/file_watcher.h"
#include <vector>
#endif
#include "generated/assets.h" // Include generated asset header
@@ -32,6 +33,7 @@ int main(int argc, char** argv) {
bool dump_wav = false;
bool tempo_test_enabled = false;
const char* wav_output_file = "audio_dump.wav";
+ bool hot_reload_enabled = false;
#if !defined(STRIP_ALL)
for (int i = 1; i < argc; ++i) {
@@ -57,6 +59,9 @@ int main(int argc, char** argv) {
}
} else if (strcmp(argv[i], "--tempo") == 0) {
tempo_test_enabled = true;
+ } else if (strcmp(argv[i], "--hot-reload") == 0) {
+ hot_reload_enabled = true;
+ printf("Hot-reload enabled (watching config files)\n");
}
}
#else
@@ -167,6 +172,16 @@ int main(int argc, char** argv) {
g_last_audio_time = audio_get_playback_time(); // Initialize after start
#if !defined(STRIP_ALL)
+ // Hot-reload setup
+ FileWatcher file_watcher;
+ if (hot_reload_enabled) {
+ file_watcher.add_file("assets/final/demo_assets.txt");
+ file_watcher.add_file("assets/demo.seq");
+ file_watcher.add_file("assets/music.track");
+ }
+#endif
+
+#if !defined(STRIP_ALL)
// In WAV dump mode, run headless simulation and write audio to file
if (dump_wav) {
printf("Running WAV dump simulation...\n");
@@ -255,6 +270,15 @@ int main(int argc, char** argv) {
// context
fill_audio_buffer(audio_dt, current_physical_time);
+#if !defined(STRIP_ALL)
+ // Hot-reload: Check for file changes
+ if (hot_reload_enabled && file_watcher.check_changes()) {
+ printf("\n[Hot-Reload] Config files changed - rebuild required\n");
+ printf("[Hot-Reload] Run: cmake --build build -j4 && ./build/demo64k\n");
+ file_watcher.reset();
+ }
+#endif
+
// --- Graphics Update ---
const float aspect_ratio = platform_state.aspect_ratio;