From db122c74992d7d5fdfc7f9c783eaadd1cb8dca04 Mon Sep 17 00:00:00 2001 From: inspuration Date: Fri, 13 Jun 2014 14:17:26 -0400 Subject: [PATCH] More bugfixes from PR comments --- src/core/hle/service/gsp.cpp | 6 ++++-- src/core/hle/service/hid.cpp | 6 ++++-- src/core/mem_map_funcs.cpp | 10 ++++------ src/video_core/video_core.cpp | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 34b8535fb..5468b7c74 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -22,7 +22,9 @@ GraphicsDebugger g_debugger; //Handle to irq memory -Handle g_mem_irq; +Handle g_mem_irq = 0; + +static const int irq_mem_size = 0x1000; //TODO(bravia): determine the correct size for this region /// GSP shared memory GX command buffer header @@ -126,7 +128,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) { Kernel::SetPermanentLock(event_handle, true); cmd_buff[2] = g_thread_id; // ThreadID - g_mem_irq = Kernel::CreateSharedMemory(0x1000); //page size for now + g_mem_irq = Kernel::CreateSharedMemory(irq_mem_size); //page size for now cmd_buff[4] = g_mem_irq; } diff --git a/src/core/hle/service/hid.cpp b/src/core/hle/service/hid.cpp index a92a9aa0a..d6673739a 100644 --- a/src/core/hle/service/hid.cpp +++ b/src/core/hle/service/hid.cpp @@ -13,7 +13,9 @@ namespace HID_User { -Handle g_mem_ipc = NULL; +Handle g_mem_ipc = 0; + +static const int ipc_mem_size = 0x1000; //TODO(bravia): determine size of this region Handle GetMemIPCHandle() { return g_mem_ipc; @@ -21,7 +23,7 @@ Handle GetMemIPCHandle() { void GetIPCHandles(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); - g_mem_ipc = Kernel::CreateSharedMemory(0x1000); //page size for now + g_mem_ipc = Kernel::CreateSharedMemory(ipc_mem_size); cmd_buff[3] = g_mem_ipc; } diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index c8ef8dbf6..6829124fd 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -73,11 +73,10 @@ inline void _Read(T &var, const u32 addr) { // Shared memory } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { - for (std::map::iterator it = g_shared_map.begin(); it != g_shared_map.end(); it++) { + for (std::map::iterator it = g_shared_map.begin(); it != g_shared_map.end(); ++it) { MemoryBlock block = it->second; if ((vaddr >= block.base_address) && (vaddr < block.GetVirtualAddress())) { - Handle handle = block.handle; - Kernel::ReadSharedMemory(handle, var, addr); + Kernel::ReadSharedMemory(block.handle, var, addr); return; } } @@ -126,11 +125,10 @@ inline void _Write(u32 addr, const T data) { // Shared memory } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { - for (std::map::iterator it = g_shared_map.begin(); it != g_shared_map.end(); it++) { + for (std::map::iterator it = g_shared_map.begin(); it != g_shared_map.end(); ++it) { MemoryBlock block = it->second; if ((vaddr >= block.base_address) && (vaddr < block.base_address + block.size)) { - Handle handle = block.handle; - Kernel::WriteSharedMemory(handle, data, addr); + Kernel::WriteSharedMemory(block.handle, data, addr); return; } } diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index b53555bf1..247ec6743 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -36,7 +36,8 @@ void Init(EmuWindow* emu_window) { glewExperimental = GL_TRUE; #endif #if EMU_PLATFORM == PLATFORM_WINDOWS - glewExperimental = GL_TRUE; + //Similar to OSX problem, windows requires glewExperimental to avoid runtime errors + glewExperimental = GL_TRUE; #endif