Rough implementation of GCM_CONTEXT_DMA methods

Rough implementation of GCM_CONTEXT_DMA methods.
Fixes #1487
This commit is contained in:
Ani 2017-02-17 18:42:34 +00:00 committed by Ivan
commit 65104b5909

View file

@ -102,41 +102,57 @@ namespace rsx
u32 get_address(u32 offset, u32 location) u32 get_address(u32 offset, u32 location)
{ {
u32 res = 0;
switch (location) switch (location)
{ {
case CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER: case CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER:
case CELL_GCM_LOCATION_LOCAL: case CELL_GCM_LOCATION_LOCAL:
{ {
//TODO: don't use not named constants like 0xC0000000 // TODO: Don't use unnamed constants like 0xC0000000
res = 0xC0000000 + offset; return 0xC0000000 + offset;
break;
} }
case CELL_GCM_CONTEXT_DMA_MEMORY_HOST_BUFFER: case CELL_GCM_CONTEXT_DMA_MEMORY_HOST_BUFFER:
case CELL_GCM_LOCATION_MAIN: case CELL_GCM_LOCATION_MAIN:
{ {
res = (u32)RSXIOMem.RealAddr(offset); // TODO: Error Check? if (u32 result = RSXIOMem.RealAddr(offset))
if (res == 0)
{ {
fmt::throw_exception("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped" HERE, offset, location); return result;
} }
fmt::throw_exception("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped" HERE, offset, location);
//if (fxm::get<GSRender>()->strict_ordering[offset >> 20]) //if (fxm::get<GSRender>()->strict_ordering[offset >> 20])
//{ //{
// _mm_mfence(); // probably doesn't have any effect on current implementation // _mm_mfence(); // probably doesn't have any effect on current implementation
//} //}
break;
} }
default:
{ case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT:
return 0x100000 + offset; // TODO: Properly implement
case CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN:
return 0x800 + offset; // TODO: Properly implement
case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_NOTIFY0:
return 0x40 + offset; // TODO: Properly implement
case CELL_GCM_CONTEXT_DMA_NOTIFY_MAIN_0:
fmt::throw_exception("Unimplemented CELL_GCM_CONTEXT_DMA_NOTIFY_MAIN_0 (offset=0x%x, location=0x%x)" HERE, offset, location);
case CELL_GCM_CONTEXT_DMA_SEMAPHORE_RW:
case CELL_GCM_CONTEXT_DMA_SEMAPHORE_R:
return 0x100 + offset; // TODO: Properly implement
case CELL_GCM_CONTEXT_DMA_DEVICE_RW:
fmt::throw_exception("Unimplemented CELL_GCM_CONTEXT_DMA_DEVICE_RW (offset=0x%x, location=0x%x)" HERE, offset, location);
case CELL_GCM_CONTEXT_DMA_DEVICE_R:
fmt::throw_exception("Unimplemented CELL_GCM_CONTEXT_DMA_DEVICE_R (offset=0x%x, location=0x%x)" HERE, offset, location);
fmt::throw_exception("Invalid location (offset=0x%x, location=0x%x)" HERE, offset, location); fmt::throw_exception("Invalid location (offset=0x%x, location=0x%x)" HERE, offset, location);
} }
}
return res;
} }
u32 get_vertex_type_size_on_host(vertex_base_type type, u32 size) u32 get_vertex_type_size_on_host(vertex_base_type type, u32 size)