diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-11-03 10:04:50 -0800 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-11-03 11:08:59 -0800 |
| commit | e290a3d39c31fc05199048f91d2f855ac351bf80 (patch) | |
| tree | 8455b1b100d7f33cc040d6ec188065d553780d1a /Source/Core/Common/MemArena.cpp | |
| parent | 4cf869795788b1faf38dc0a1c8ac1c57b3881a14 (diff) | |
MemArena: Fix the launching of non-Wii games
When we cleaned up the code to calculate the shm_position and total_mem
in one step, we sometimes skipped over certain views because they were
Wii-only. When looking at the total memory, we'd look at the last field,
whether or not it was skipped. Since Wii-only fields are the last view,
this meant that the shm_position was 0, since it was skipped, causing us
to map a 0-sized field. Fix this by explicitly returning the total size
from MemoryMap_InitializeViews.
Additionally, the shm_position was being calculated incorrectly because
it was adding up the shm_position *before* the mirror, rather than after
it. Fix this by adopting a scheme similar to what we had before.
Diffstat (limited to 'Source/Core/Common/MemArena.cpp')
| -rw-r--r-- | Source/Core/Common/MemArena.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp index a51da9bc3a..0a9e9e298e 100644 --- a/Source/Core/Common/MemArena.cpp +++ b/Source/Core/Common/MemArena.cpp @@ -222,9 +222,10 @@ bail: return false; } -static void MemoryMap_InitializeViews(MemoryView *views, int num_views, u32 flags) +static u32 MemoryMap_InitializeViews(MemoryView *views, int num_views, u32 flags) { u32 shm_position = 0; + u32 last_position; for (int i = 0; i < num_views; i++) { @@ -233,17 +234,19 @@ static void MemoryMap_InitializeViews(MemoryView *views, int num_views, u32 flag SKIP(flags, views[i].flags); + if (views[i].flags & MV_MIRROR_PREVIOUS) + shm_position = last_position; views[i].shm_position = shm_position; - - if (!(views[i].flags & MV_MIRROR_PREVIOUS)) - shm_position += views[i].size; + last_position = shm_position; + shm_position += views[i].size; } + + return shm_position; } u8 *MemoryMap_Setup(MemoryView *views, int num_views, u32 flags, MemArena *arena) { - MemoryMap_InitializeViews(views, num_views, flags); - u32 total_mem = views[num_views - 1].shm_position; + u32 total_mem = MemoryMap_InitializeViews(views, num_views, flags); arena->GrabSHMSegment(total_mem); |
