diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 1bc68c76d9..7b3f522a1e 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -89,6 +89,11 @@ struct RsxReports { be_t g_rsx_event_port{ 0 }; u32 g_driverInfo{ 0 }; +// this timestamp is a complete guess, it seems 'roughly' right for now so im just leaving it +u64 rsxTimeStamp() { + return (get_system_time() / 1000000 * 0x5F5E100); +} + s32 sys_rsx_device_open() { sys_rsx.todo("sys_rsx_device_open()"); @@ -163,8 +168,8 @@ s32 sys_rsx_context_allocate(vm::ptr context_id, vm::ptr lpar_dma_cont driverInfo.version_driver = 0x211; driverInfo.version_gpu = 0x5c; driverInfo.memory_size = 0xFE00000; - driverInfo.nvcore_frequency = 500000000; - driverInfo.memory_frequency = 650000000; + driverInfo.nvcore_frequency = 500000000; // 0x1DCD6500 + driverInfo.memory_frequency = 650000000; // 0x26BE3680 driverInfo.reportsNotifyOffset = 0x1000; driverInfo.reportsOffset = 0; driverInfo.reportsReportOffset = 0x1400; @@ -265,6 +270,7 @@ s32 sys_rsx_context_iounmap(u32 context_id, u32 io_addr, u32 a3, u32 size) */ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u64 a5, u64 a6) { + if (package_id != 0x101) sys_rsx.todo("sys_rsx_context_attribute(context_id=0x%x, package_id=0x%x, a3=0x%llx, a4=0x%llx, a5=0x%llx, a6=0x%llx)", context_id, package_id, a3, a4, a5, a6); // hle/lle protection @@ -287,14 +293,14 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6 // todo: this is wrong and should be 'second' vblank handler and freq // although gcmSys seems just hardcoded at 1, so w/e driverInfo.head[1].vBlankCount++; - driverInfo.head[1].lastSecondVTime = get_system_time(); + driverInfo.head[1].lastSecondVTime = rsxTimeStamp(); sys_event_port_send(g_rsx_event_port, 0, (1 << 1), 0); sys_event_port_send(g_rsx_event_port, 0, (1 << 11), 0); // second vhandler break; case 0x102: // Display flip driverInfo.head[a3].flipFlags |= 0x80000000; - driverInfo.head[a3].lastFlip = get_system_time(); // should rsxthread set this? + driverInfo.head[a3].lastFlip = rsxTimeStamp(); // should rsxthread set this? if (a3 == 0) sys_event_port_send(g_rsx_event_port, 0, (1 << 3), 0); if (a3 == 1) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 15028c4118..6921d23721 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -63,7 +63,19 @@ namespace rsx //return 0x100000 + offset; // TODO: Properly implement case CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN: - return 0x800 + offset; // TODO: Properly implement + { + if (u32 result = RSXIOMem.RealAddr(0x0e000000 + offset)) + { + return result; + } + + fmt::throw_exception("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped" HERE, offset, location); + + //if (fxm::get()->strict_ordering[offset >> 20]) + //{ + // _mm_mfence(); // probably doesn't have any effect on current implementation + //} + } case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_NOTIFY0: return 0x40 + offset; // TODO: Properly implement @@ -388,6 +400,9 @@ namespace rsx // TODO: exit condition while (!Emu.IsStopped()) { + if (!Emu.IsRunning()) + std::this_thread::sleep_for(10ms); + if (get_system_time() - start_time > vblank_count * 1000000 / 60) { vblank_count++; diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index d39832e119..2d6c59ce0a 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -145,7 +145,7 @@ namespace rsx //const u32 addr = get_address(method_registers.semaphore_offset_4097(), rsx->nv4097_semaphore_index); //vm::ps3::write32(addr, arg); const u32 index = method_registers.semaphore_offset_4097() >> 4; - LOG_ERROR(RSX, "readrelease: 0x%x, 0x%x, addr:0x%x", arg, index, rsx->label_addr); + //LOG_ERROR(RSX, "readrelease: 0x%x, 0x%x, addr:0x%x", arg, index, rsx->label_addr); auto& sema = vm::ps3::_ref(rsx->label_addr); sema.semaphore[index].val = arg; sema.semaphore[index].pad = 0; @@ -166,7 +166,7 @@ namespace rsx //vm::ps3::write32(addr, (arg & 0xff00ff00) | ((arg & 0xff) << 16) | ((arg >> 16) & 0xff)); const u32 index = method_registers.semaphore_offset_4097() >> 4; u32 val = (arg & 0xff00ff00) | ((arg & 0xff) << 16) | ((arg >> 16) & 0xff); - LOG_ERROR(RSX, "wriuterelease: 0x%x, 0x%x, addr:0x%x", val, index, rsx->label_addr); + //LOG_ERROR(RSX, "wriuterelease: 0x%x, 0x%x, addr:0x%x", val, index, rsx->label_addr); auto& sema = vm::ps3::_ref(rsx->label_addr); sema.semaphore[index].val = val; sema.semaphore[index].pad = 0; @@ -1328,6 +1328,7 @@ namespace rsx methods[NV4097_SET_TEXTURE_BORDER_COLOR] = nullptr; methods[NV4097_SET_VERTEX_DATA4F_M] = nullptr; methods[NV4097_SET_COLOR_KEY_COLOR] = nullptr; + methods[0x1d04 >> 2] = nullptr; methods[NV4097_SET_SHADER_CONTROL] = nullptr; methods[NV4097_SET_INDEXED_CONSTANT_READ_LIMITS] = nullptr; methods[NV4097_SET_SEMAPHORE_OFFSET] = nullptr;