Rewrite scarecrow hacks in C#2508
Conversation
|
|
||
| // Fix the length of each note to a minimum. | ||
| OcarinaNote* scarecrow_song = (OcarinaNote*)src; | ||
| for (uint8_t i = 0; i < 8; i++) { |
There was a problem hiding this comment.
There can be rests in between notes, so the song is not necessarily just 8 OcarinaNotes long. You should check the entire 20-note buffer, updating the length if pitch is non-zero. I know the original C hack only updated the first 8 OcarinaNotes, but we should make it correct while we're in here.
Lowest note is 0x02 (OCARINA_PITCH_D4) assuming no stick/Z-button modifiers. Trying to record a song with modifiers actually ignored the modifiers when playtesting, so it's safe to assume 0x02 as the lower bound for a player input.
There was a problem hiding this comment.
If we wanted to try fixing the 9-note problem, we could also use this loop to count non-rest notes and zero everything out after the 8th one in the buffer. IMO that should be saved for another PR given the time pressure.
| } | ||
| } | ||
|
|
||
| // Displaced Memcpy |
There was a problem hiding this comment.
Why not use the existing MemCpy function? No actual problem with the code below, just curious.
There was a problem hiding this comment.
Laziness honestly, since the function is just a couple of lines
There was a problem hiding this comment.
Sounds good. For future reference, it's already defined in z64.h as z64_memcopy.
There was a problem hiding this comment.
Wait how did i miss that lol, i thought this wasn't interfaced already.
|
also could you run this code through the compiler with |
|
No new warning for building scarecrow.o with -Wall 👍 |
check whole song buffer and ignore more than 8 notes
…imes hints that were unintentionally excluded (#2509)
…imes hints that were unintentionally excluded (#2509)
…dd some sometimes hints that were unintentionally excluded (OoTRandomizer#2509)
Rewrites the scarecrow hacks in rando to C to get rid of a faulty asm block, see mracsys analysis here : #2492 (comment)
The current Scarecrow hack hooks in this place :
https://github.com/zeldaret/oot/blob/main/src/code/z_message.c#L3744
So we can directly hook instead to a C function with the same arguments, and armed with more decomp knowledge than back then. The goal is to keep the same fixes as the original 2 PR : #167 and #359
This new function has 3 parts :