summaryrefslogtreecommitdiff
path: root/src/m4a.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-03-29 20:56:15 -0400
committerGitHub <noreply@github.com>2021-03-29 20:56:15 -0400
commit50e9666e1637b15bd57fd7ee88180e50d2eb5e8c (patch)
treeb1543b6d79695862cb60d686548dd1a996b69e8c /src/m4a.c
parentdea07dc8656c8fb32f5b389b9f4f9a30fe26e555 (diff)
parente8b6b4b65e3b53f5fcf83035b9f848c5ef6378bd (diff)
Merge branch 'master' into doc-introcred
Diffstat (limited to 'src/m4a.c')
-rw-r--r--src/m4a.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/m4a.c b/src/m4a.c
index e079ba4f6..7d7193334 100644
--- a/src/m4a.c
+++ b/src/m4a.c
@@ -1616,6 +1616,9 @@ void ply_xcmd_0C(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tra
void ply_xcmd_0D(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track)
{
u32 unk;
+#ifdef UBFIX
+ unk = 0;
+#endif
READ_XCMD_BYTE(unk, 0) // UB: uninitialized variable
READ_XCMD_BYTE(unk, 1)
@@ -1657,18 +1660,12 @@ start_song:
mplayInfo = &gPokemonCryMusicPlayers[i];
mplayInfo->ident++;
-#define CRY ((s32)&gPokemonCrySongs + i * sizeof(struct PokemonCrySong))
-#define CRY_OFS(field) offsetof(struct PokemonCrySong, field)
+ gPokemonCrySongs[i] = gPokemonCrySong;
- memcpy((void *)CRY, &gPokemonCrySong, sizeof(struct PokemonCrySong));
-
- *(u32 *)(CRY + CRY_OFS(tone)) = (u32)tone;
- *(u32 *)(CRY + CRY_OFS(part)) = CRY + CRY_OFS(part0);
- *(u32 *)(CRY + CRY_OFS(part) + 4) = CRY + CRY_OFS(part1);
- *(u32 *)(CRY + CRY_OFS(gotoTarget)) = CRY + CRY_OFS(cont);
-
-#undef CRY_OFS
-#undef CRY
+ gPokemonCrySongs[i].tone = tone;
+ gPokemonCrySongs[i].part[0] = &gPokemonCrySongs[i].part0;
+ gPokemonCrySongs[i].part[1] = &gPokemonCrySongs[i].part1;
+ gPokemonCrySongs[i].gotoTarget = (u32)&gPokemonCrySongs[i].cont;
mplayInfo->ident = ID_NUMBER;