summaryrefslogtreecommitdiff
path: root/src/core/mem_map.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2015-05-01 19:05:18 -0400
committerGravatar bunnei2015-05-01 19:05:18 -0400
commit6a2d8c46f21e8813e0472dba28932ed461ce1a66 (patch)
treed7057cf9926c822c12cc7d82814a252db79ca600 /src/core/mem_map.cpp
parentMerge pull request #717 from linkmauve/useless-auto (diff)
parentQt: Shutdown game on emulator close event. (diff)
downloadyuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.tar.gz
yuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.tar.xz
yuzu-6a2d8c46f21e8813e0472dba28932ed461ce1a66.zip
Merge pull request #713 from bunnei/qt-emuthread-fixes
Fix emulation state resetting to support multiple emulation sessions
Diffstat (limited to 'src/core/mem_map.cpp')
-rw-r--r--src/core/mem_map.cpp71
1 files changed, 46 insertions, 25 deletions
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp
index a14e8303e..22e359b3e 100644
--- a/src/core/mem_map.cpp
+++ b/src/core/mem_map.cpp
@@ -11,30 +11,30 @@
11 11
12namespace Memory { 12namespace Memory {
13 13
14u8* g_base = nullptr; ///< The base pointer to the auto-mirrored arena. 14u8* g_base; ///< The base pointer to the auto-mirrored arena.
15 15
16static MemArena arena; ///< The MemArena class 16static MemArena arena; ///< The MemArena class
17 17
18u8* g_exefs_code = nullptr; ///< ExeFS:/.code is loaded here 18u8* g_exefs_code; ///< ExeFS:/.code is loaded here
19u8* g_system_mem = nullptr; ///< System memory 19u8* g_system_mem; ///< System memory
20u8* g_heap = nullptr; ///< Application heap (main memory) 20u8* g_heap; ///< Application heap (main memory)
21u8* g_heap_linear = nullptr; ///< Linear heap 21u8* g_heap_linear; ///< Linear heap
22u8* g_vram = nullptr; ///< Video memory (VRAM) pointer 22u8* g_vram; ///< Video memory (VRAM) pointer
23u8* g_shared_mem = nullptr; ///< Shared memory 23u8* g_shared_mem; ///< Shared memory
24u8* g_dsp_mem = nullptr; ///< DSP memory 24u8* g_dsp_mem; ///< DSP memory
25u8* g_kernel_mem; ///< Kernel memory 25u8* g_kernel_mem; ///< Kernel memory
26 26
27static u8* physical_bootrom = nullptr; ///< Bootrom physical memory 27static u8* physical_bootrom; ///< Bootrom physical memory
28static u8* uncached_bootrom = nullptr; 28static u8* uncached_bootrom;
29 29
30static u8* physical_exefs_code = nullptr; ///< Phsical ExeFS:/.code is loaded here 30static u8* physical_exefs_code; ///< Phsical ExeFS:/.code is loaded here
31static u8* physical_system_mem = nullptr; ///< System physical memory 31static u8* physical_system_mem; ///< System physical memory
32static u8* physical_fcram = nullptr; ///< Main physical memory (FCRAM) 32static u8* physical_fcram; ///< Main physical memory (FCRAM)
33static u8* physical_heap_gsp = nullptr; ///< GSP heap physical memory 33static u8* physical_heap_gsp; ///< GSP heap physical memory
34static u8* physical_vram = nullptr; ///< Video physical memory (VRAM) 34static u8* physical_vram; ///< Video physical memory (VRAM)
35static u8* physical_shared_mem = nullptr; ///< Physical shared memory 35static u8* physical_shared_mem; ///< Physical shared memory
36static u8* physical_dsp_mem = nullptr; ///< Physical DSP memory 36static u8* physical_dsp_mem; ///< Physical DSP memory
37static u8* physical_kernel_mem; ///< Kernel memory 37static u8* physical_kernel_mem; ///< Kernel memory
38 38
39// We don't declare the IO region in here since its handled by other means. 39// We don't declare the IO region in here since its handled by other means.
40static MemoryView g_views[] = { 40static MemoryView g_views[] = {
@@ -73,6 +73,7 @@ void Init() {
73 } 73 }
74 74
75 g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena); 75 g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &arena);
76 MemBlock_Init();
76 77
77 LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap, 78 LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p (mirror at 0 @ %p)", g_heap,
78 physical_fcram); 79 physical_fcram);
@@ -81,9 +82,29 @@ void Init() {
81void Shutdown() { 82void Shutdown() {
82 u32 flags = 0; 83 u32 flags = 0;
83 MemoryMap_Shutdown(g_views, kNumMemViews, flags, &arena); 84 MemoryMap_Shutdown(g_views, kNumMemViews, flags, &arena);
84
85 arena.ReleaseSpace(); 85 arena.ReleaseSpace();
86 MemBlock_Shutdown();
87
86 g_base = nullptr; 88 g_base = nullptr;
89 g_exefs_code = nullptr;
90 g_system_mem = nullptr;
91 g_heap = nullptr;
92 g_heap_linear = nullptr;
93 g_vram = nullptr;
94 g_shared_mem = nullptr;
95 g_dsp_mem = nullptr;
96 g_kernel_mem = nullptr;
97
98 physical_bootrom = nullptr;
99 uncached_bootrom = nullptr;
100 physical_exefs_code = nullptr;
101 physical_system_mem = nullptr;
102 physical_fcram = nullptr;
103 physical_heap_gsp = nullptr;
104 physical_vram = nullptr;
105 physical_shared_mem = nullptr;
106 physical_dsp_mem = nullptr;
107 physical_kernel_mem = nullptr;
87 108
88 LOG_DEBUG(HW_Memory, "shutdown OK"); 109 LOG_DEBUG(HW_Memory, "shutdown OK");
89} 110}