diff options
author | Nebuleon Fumika | 2013-02-06 19:07:39 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-02-06 19:07:39 -0500 |
commit | 5e3426d0d26bb25810aca6593416ac0125ea6e8f (patch) | |
tree | 15c44732299ca8f4df6d2e46d63c8e18a61e03c3 /source/apu.cpp | |
parent | 90de0280db8e33d9e54a65639be6ec76510e4bb0 (diff) | |
download | snes9x2005-5e3426d0d26bb25810aca6593416ac0125ea6e8f.tar.gz snes9x2005-5e3426d0d26bb25810aca6593416ac0125ea6e8f.tar.bz2 snes9x2005-5e3426d0d26bb25810aca6593416ac0125ea6e8f.zip |
Remove 320 KiB of memory allocations in APU emulation that were completely unused but constantly re-zeroed.
Frees up 320 KiB for other uses, and saves ~4 milliseconds at emulator startup, when resetting the APU and when loading a new game.
Diffstat (limited to 'source/apu.cpp')
-rw-r--r-- | source/apu.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/source/apu.cpp b/source/apu.cpp index d60cc75..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,10 +157,7 @@ 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 converted: Different mallocs [Neb] |