Browse Source

option for constant prng seed

Thomas B 1 week ago
parent
commit
c4c9a5ca01
2 changed files with 18 additions and 9 deletions
  1. 13
    0
      src/main.c
  2. 5
    9
      src/sound_over.c

+ 13
- 0
src/main.c View File

45
 #include "table_speed_shot.h"
45
 #include "table_speed_shot.h"
46
 #include "main.h"
46
 #include "main.h"
47
 
47
 
48
+/*
49
+ * TODO: The gb-interceptor has problems emulating the
50
+ * DIV register properly. When using it to initialize
51
+ * our random number generator seed, the emulation
52
+ * runs out-of-sync with the real hardware.
53
+ * Using a constant seed 'fixes' this.
54
+ */
55
+//#define CONSTANT_SEED 42
56
+
48
 uint8_t debug_menu_index = 0;
57
 uint8_t debug_menu_index = 0;
49
 uint8_t debug_special_value = 0;
58
 uint8_t debug_special_value = 0;
50
 
59
 
659
 
668
 
660
     splash();
669
     splash();
661
 
670
 
671
+#ifdef CONSTANT_SEED
672
+    uint16_t seed = CONSTANT_SEED;
673
+#else
662
     uint16_t seed = DIV_REG;
674
     uint16_t seed = DIV_REG;
663
     waitpadup();
675
     waitpadup();
664
     seed |= ((uint16_t)DIV_REG) << 8;
676
     seed |= ((uint16_t)DIV_REG) << 8;
677
+#endif
665
     initarand(seed);
678
     initarand(seed);
666
 
679
 
667
     while (1) {
680
     while (1) {

+ 5
- 9
src/sound_over.c View File

32
 BANKREF(sound_over)
32
 BANKREF(sound_over)
33
 
33
 
34
 static const enum notes over_notes[] = {
34
 static const enum notes over_notes[] = {
35
-    // fanfare
36
-    /*
37
-     C3,  C3,  C3,  C3, Ab2, Ab2, Bb2, Bb2,
38
-     C3,  C3, SIL, Bb2,  C3,  C3, SIL, SIL,
39
-    */
40
-
41
-    // repeat
35
+    // repeat 1
42
 
36
 
43
     Ab4,  C5, Ab4,  F4, Ab4, Ab4, Ab4,  C5,
37
     Ab4,  C5, Ab4,  F4, Ab4, Ab4, Ab4,  C5,
44
     Ab4,  F4, Ab4, Bb4,  C5, Bb4, Ab4,  F4,
38
     Ab4,  F4, Ab4, Bb4,  C5, Bb4, Ab4,  F4,
70
     Bb4,  D5, Bb4,  G4, Bb4, Bb4, Bb4, D5,
64
     Bb4,  D5, Bb4,  G4, Bb4, Bb4, Bb4, D5,
71
     Bb4,  G4, Bb4,  C5,  D5,  C5, Bb4, G4,
65
     Bb4,  G4, Bb4,  C5,  D5,  C5, Bb4, G4,
72
 
66
 
73
-    // repeat
67
+    // repeat 2
74
 
68
 
75
     Ab4,  C5, Ab4,  F4, Ab4, Ab4, Ab4,  C5,
69
     Ab4,  C5, Ab4,  F4, Ab4, Ab4, Ab4,  C5,
76
     Ab4,  F4, Ab4, Bb4,  C5, Bb4, Ab4,  F4,
70
     Ab4,  F4, Ab4, Bb4,  C5, Bb4, Ab4,  F4,
124
      E2, SIL,  E2, SIL,  E2, SIL,  E2, SIL
118
      E2, SIL,  E2, SIL,  E2, SIL,  E2, SIL
125
 
119
 
126
 static const enum notes over_notes2[] = {
120
 static const enum notes over_notes2[] = {
121
+    // repeat 1
122
+
127
     ADD_LOOP, ADD_LOOP_2,
123
     ADD_LOOP, ADD_LOOP_2,
128
     ADD_LOOP, ADD_LOOP_3,
124
     ADD_LOOP, ADD_LOOP_3,
129
     ADD_LOOP, ADD_LOOP_2,
125
     ADD_LOOP, ADD_LOOP_2,
138
     SIL, SIL, SIL, SIL, SIL, SIL, SIL, SIL,
134
     SIL, SIL, SIL, SIL, SIL, SIL, SIL, SIL,
139
     SIL, SIL, SIL, SIL, SIL, SIL, SIL, SIL,
135
     SIL, SIL, SIL, SIL, SIL, SIL, SIL, SIL,
140
 
136
 
141
-    // repeat
137
+    // repeat 2
142
 
138
 
143
     ADD_LOOP, ADD_LOOP_2,
139
     ADD_LOOP, ADD_LOOP_2,
144
     ADD_LOOP, ADD_LOOP_3,
140
     ADD_LOOP, ADD_LOOP_3,

Loading…
Cancel
Save