diff options
author | Nebuleon Fumika | 2013-02-08 05:50:22 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-02-08 05:50:22 -0500 |
commit | 927d456306672110870eb3386742c1c1ef8eb4f6 (patch) | |
tree | 509da9ac1727570b02572068aefb9cdf102ad75b /source/apu.cpp | |
parent | 433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1 (diff) | |
parent | d4fcf2697c9a45594e3ee0b8bf82e480ddd0b69b (diff) | |
download | snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.gz snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.bz2 snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.zip |
Merge branch 'master' into 8bitsound
Conflicts:
source/nds/entry.cpp
Diffstat (limited to 'source/apu.cpp')
-rw-r--r-- | source/apu.cpp | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/source/apu.cpp b/source/apu.cpp index 3c1a5d3..769d2bc 100644 --- a/source/apu.cpp +++ b/source/apu.cpp @@ -116,18 +116,14 @@ void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0, bool8 S9xInitAPU () { IAPU.RAM = (uint8 *) malloc (0x10000); - IAPU.ShadowRAM = (uint8 *) malloc (0x10000); - IAPU.CachedSamples = (uint8 *) malloc (0x40000); - if (!IAPU.RAM || !IAPU.ShadowRAM || !IAPU.CachedSamples) + if (!IAPU.RAM) { S9xDeinitAPU (); return (FALSE); } memset(IAPU.RAM, 0, 0x10000); - memset(IAPU.ShadowRAM, 0, 0x10000); - memset(IAPU.CachedSamples, 0, 0x40000); return (TRUE); } @@ -139,16 +135,6 @@ void S9xDeinitAPU () free ((char *) IAPU.RAM); IAPU.RAM = NULL; } - if (IAPU.ShadowRAM) - { - free ((char *) IAPU.ShadowRAM); - IAPU.ShadowRAM = NULL; - } - if (IAPU.CachedSamples) - { - free ((char *) IAPU.CachedSamples); - IAPU.CachedSamples = NULL; - } } EXTERN_C uint8 APUROM [64]; @@ -171,14 +157,15 @@ void S9xResetAPU () { memcpy(IAPU.RAM+(i<<8), IAPU.RAM, 0x100); } - - memcpy (IAPU.ShadowRAM, IAPU.RAM, 0x10000); - ZeroMemory (IAPU.CachedSamples, 0x40000); ZeroMemory (APU.OutPorts, 4); IAPU.DirectPage = IAPU.RAM; - memmove (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM)); - memmove (APU.ExtraRAM, APUROM, sizeof (APUROM)); + // memmove converted: Different mallocs [Neb] + // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] + memcpy (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM)); + // memmove converted: Different mallocs [Neb] + // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] + memcpy (APU.ExtraRAM, APUROM, sizeof (APUROM)); IAPU.PC = IAPU.RAM + IAPU.RAM [0xfffe] + (IAPU.RAM [0xffff] << 8); APU.Cycles = 0; IAPU.Registers.YA.W = 0; @@ -874,7 +861,9 @@ void S9xSetAPUControl (uint8 byte) { if (!APU.ShowROM) { - memmove (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM)); + // memmove converted: Different mallocs [Neb] + // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] + memcpy (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM)); APU.ShowROM = TRUE; } } @@ -883,7 +872,9 @@ void S9xSetAPUControl (uint8 byte) if (APU.ShowROM) { APU.ShowROM = FALSE; - memmove (&IAPU.RAM [0xffc0], APU.ExtraRAM, sizeof (APUROM)); + // memmove converted: Different mallocs [Neb] + // DS2 DMA notes: The APU ROM is not 32-byte aligned [Neb] + memcpy (&IAPU.RAM [0xffc0], APU.ExtraRAM, sizeof (APUROM)); } } IAPU.RAM [0xf1] = byte; |