aboutsummaryrefslogtreecommitdiff
path: root/source/loadzip.cpp
diff options
context:
space:
mode:
authorNebuleon Fumika2013-02-08 05:50:22 -0500
committerNebuleon Fumika2013-02-08 05:50:22 -0500
commit927d456306672110870eb3386742c1c1ef8eb4f6 (patch)
tree509da9ac1727570b02572068aefb9cdf102ad75b /source/loadzip.cpp
parent433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1 (diff)
parentd4fcf2697c9a45594e3ee0b8bf82e480ddd0b69b (diff)
downloadsnes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.gz
snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.bz2
snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.zip
Merge branch 'master' into 8bitsound
Conflicts: source/nds/entry.cpp
Diffstat (limited to 'source/loadzip.cpp')
-rw-r--r--source/loadzip.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/loadzip.cpp b/source/loadzip.cpp
index 4ee3bcb..d3e24a1 100644
--- a/source/loadzip.cpp
+++ b/source/loadzip.cpp
@@ -132,8 +132,7 @@ bool8 LoadZip(const char* zipname,
char name[132];
unzGetCurrentFileInfo(file, &info, name,128, NULL,0, NULL,0);
- int calc_size = info.uncompressed_size / 0x2000;
- calc_size *= 0x2000;
+ int calc_size = info.uncompressed_size & ~0x1FFF; // round to lower 0x2000
if(!(info.uncompressed_size - calc_size == 512 || info.uncompressed_size == calc_size))
{
port = unzGoToNextFile(file);
@@ -190,8 +189,7 @@ bool8 LoadZip(const char* zipname,
// assert(info.uncompressed_size <= CMemory::MAX_ROM_SIZE + 512);
int FileSize = info.uncompressed_size;
- int calc_size = FileSize / 0x2000;
- calc_size *= 0x2000;
+ int calc_size = FileSize & ~0x1FFF; // round to lower 0x2000
int l = unzReadCurrentFile(file,ptr,FileSize);
if(unzCloseCurrentFile(file) == UNZ_CRCERROR)
@@ -224,6 +222,8 @@ bool8 LoadZip(const char* zipname,
if ((FileSize - calc_size == 512 && !Settings.ForceNoHeader) ||
Settings.ForceHeader)
{
+ // memmove required: Overlapping addresses [Neb]
+ // DS2 DMA notes: Can be split into 512-byte DMA blocks [Neb]
memmove (ptr, ptr + 512, calc_size);
(*headers)++;
FileSize -= 512;