More bugfixes from PR comments

This commit is contained in:
inspuration 2014-06-13 14:17:26 -04:00
parent 28e5bff419
commit db122c7499
4 changed files with 14 additions and 11 deletions

View File

@ -22,7 +22,9 @@
GraphicsDebugger g_debugger; GraphicsDebugger g_debugger;
//Handle to irq memory //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 /// GSP shared memory GX command buffer header
@ -126,7 +128,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) {
Kernel::SetPermanentLock(event_handle, true); Kernel::SetPermanentLock(event_handle, true);
cmd_buff[2] = g_thread_id; // ThreadID 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; cmd_buff[4] = g_mem_irq;
} }

View File

@ -13,7 +13,9 @@
namespace HID_User { 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() { Handle GetMemIPCHandle() {
return g_mem_ipc; return g_mem_ipc;
@ -21,7 +23,7 @@ Handle GetMemIPCHandle() {
void GetIPCHandles(Service::Interface* self) { void GetIPCHandles(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer(); 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; cmd_buff[3] = g_mem_ipc;
} }

View File

@ -73,11 +73,10 @@ inline void _Read(T &var, const u32 addr) {
// Shared memory // Shared memory
} else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) {
for (std::map<u32, MemoryBlock>::iterator it = g_shared_map.begin(); it != g_shared_map.end(); it++) { for (std::map<u32, MemoryBlock>::iterator it = g_shared_map.begin(); it != g_shared_map.end(); ++it) {
MemoryBlock block = it->second; MemoryBlock block = it->second;
if ((vaddr >= block.base_address) && (vaddr < block.GetVirtualAddress())) { if ((vaddr >= block.base_address) && (vaddr < block.GetVirtualAddress())) {
Handle handle = block.handle; Kernel::ReadSharedMemory<T>(block.handle, var, addr);
Kernel::ReadSharedMemory<T>(handle, var, addr);
return; return;
} }
} }
@ -126,11 +125,10 @@ inline void _Write(u32 addr, const T data) {
// Shared memory // Shared memory
} else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) {
for (std::map<u32, MemoryBlock>::iterator it = g_shared_map.begin(); it != g_shared_map.end(); it++) { for (std::map<u32, MemoryBlock>::iterator it = g_shared_map.begin(); it != g_shared_map.end(); ++it) {
MemoryBlock block = it->second; MemoryBlock block = it->second;
if ((vaddr >= block.base_address) && (vaddr < block.base_address + block.size)) { if ((vaddr >= block.base_address) && (vaddr < block.base_address + block.size)) {
Handle handle = block.handle; Kernel::WriteSharedMemory<T>(block.handle, data, addr);
Kernel::WriteSharedMemory<T>(handle, data, addr);
return; return;
} }
} }

View File

@ -36,6 +36,7 @@ void Init(EmuWindow* emu_window) {
glewExperimental = GL_TRUE; glewExperimental = GL_TRUE;
#endif #endif
#if EMU_PLATFORM == PLATFORM_WINDOWS #if EMU_PLATFORM == PLATFORM_WINDOWS
//Similar to OSX problem, windows requires glewExperimental to avoid runtime errors
glewExperimental = GL_TRUE; glewExperimental = GL_TRUE;
#endif #endif