Skip to content

Commit 3c3b204

Browse files
committed
Merge Rewrite scarecrow hacks in C (OoTRandomizer#2508) and [S9] Re-add some sometimes hints that were unintentionally excluded (OoTRandomizer#2509)
1 parent d0b31d9 commit 3c3b204

10 files changed

Lines changed: 42320 additions & 42065 deletions

File tree

ASM/build/asm_symbols.txt

Lines changed: 1241 additions & 1243 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/build/bundle.o

1.35 KB
Binary file not shown.

ASM/build/c_symbols.txt

Lines changed: 724 additions & 723 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/c/scarecrow.c

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,53 @@
11
#include <stdint.h>
22

3-
void store_scarecrow_fix(uint16_t* from, uint16_t* song) {
4-
for (int i = 0; i < 0x40; i+=2) {
5-
if (song[i] == 0x5700 || song[i] == 0) continue;
6-
if (song[i + 1] < 4) song[i + 1] = 4;
3+
typedef struct OcarinaNote {
4+
/* 0x0 */ uint8_t pitch; // number of semitones above middle C
5+
/* 0x2 */ uint16_t length; // number of frames the note is sustained
6+
/* 0x4 */ uint8_t volume;
7+
/* 0x5 */ uint8_t vibrato;
8+
/* 0x6 */ int8_t bend; // frequency multiplicative offset from the pitch
9+
/* 0x7 */ uint8_t bFlat4Flag; // Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4) gets mapped to either C_RIGHT and C_LEFT
10+
} OcarinaNote; // size = 0x8
11+
12+
void* save_scarecrow_song(uint8_t* dest, uint8_t* src, int32_t len) {
13+
14+
// Check if the first note is a rest, and shift the song to start to the next note if so.
15+
if (src[0] == 0xFF) {
16+
src += 8;
17+
len -= 8;
18+
}
19+
20+
// Fix the length of each note to a minimum.
21+
OcarinaNote* scarecrow_song = (OcarinaNote*)src;
22+
uint8_t song_notes = 0;
23+
for (uint8_t i = 0; i < 20; i++) {
24+
if (scarecrow_song[i].length < 4 && scarecrow_song[i].pitch > 0) {
25+
scarecrow_song[i].length = 4;
26+
}
27+
28+
// Determine position of eighth non-rest note
29+
if (scarecrow_song[i].pitch > 0 && scarecrow_song[i].pitch != 0xFF) {
30+
song_notes++;
31+
}
32+
// Ignore rests and notes after the eighth input
33+
if (song_notes > 8) {
34+
scarecrow_song[i].pitch = 0;
35+
scarecrow_song[i].length = 0;
36+
scarecrow_song[i].volume = 0;
37+
scarecrow_song[i].vibrato = 0;
38+
scarecrow_song[i].bend = 0;
39+
scarecrow_song[i].bFlat4Flag = 0;
40+
}
741
}
42+
43+
// Displaced Memcpy
44+
uint8_t* d = dest;
45+
const uint8_t* s = src;
46+
47+
while (len > 0) {
48+
*d++ = *s++;
49+
len--;
50+
}
51+
52+
return dest;
853
}

ASM/src/scarecrow.asm

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,3 @@ adapt_scarecrow:
1717
nop
1818
; Now we can continue with our comparison between t0 and at
1919
; If at != t0, following code will branch to ignore
20-
21-
22-
save_scarecrow_song:
23-
; 80057030
24-
; A0 = Scarecrow Song save address (copy to)
25-
; A1 = Scarecrow Song live location (copy from)
26-
; A2 = 0x80
27-
addiu sp, sp, -0x18
28-
sw a1, 0x0(sp)
29-
sw a2, 0x4(sp)
30-
sw a3, 0x8(sp)
31-
sw ra, 0x10(sp)
32-
lb t0, 0x0000(a1)
33-
addiu t1, t0, 1
34-
bne t1, zero, @@copy_song ; if scarecrow song doesn't begin with a rest, copy it to the save data
35-
nop
36-
or a0, zero, a1
37-
addiu a1, a1, 8
38-
jal 0x57030 ; shift scarecrow song over by 1 note
39-
addiu a2, a2, -8
40-
41-
@@copy_song:
42-
jal store_scarecrow_fix
43-
nop
44-
lw ra, 0x10(sp)
45-
lw a3, 0x8(sp)
46-
lw a2, 0x4(sp)
47-
lw a1, 0x0(sp)
48-
j 0x57030
49-
addiu sp,sp,0x18

data/Hints/tournament.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
{ "location": "Sheik in Ice Cavern", "types": ["sometimes"] },
1515
{ "location": "Sheik at Colossus", "types": ["sometimes"] },
1616
{ "location": "GF HBA 1500 Points", "types": ["sometimes"] },
17-
{ "location": "GC Maze Left Chest", "types": ["sometimes"] },
18-
{ "location": "GV Chest", "types": ["sometimes"] },
19-
{ "location": "HC Great Fairy Reward", "types": ["sometimes"] },
20-
{ "location": "OGC Great Fairy Reward", "types": ["sometimes"] },
21-
{ "location": "Water Temple River Chest", "types": ["sometimes"] },
22-
{ "location": "Gerudo Training Ground Maze Path Final Chest", "types": ["sometimes"] },
23-
{ "location": "Spirit Temple Silver Gauntlets Chest", "types": ["sometimes"] },
24-
{ "location": "Spirit Temple Mirror Shield Chest", "types": ["sometimes"] },
2517
{ "location": "Graveyard Dampe Race Rewards", "types": ["dual"] },
2618
{ "location": "Graveyard Royal Family Tomb Contents", "types": ["dual"] },
2719
{ "location": "Ice Cavern Final Room", "types": ["dual"] }

data/generated/patch_symbols.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)