1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

Fix fxo dependencies

This commit is contained in:
Megamouse 2023-12-14 20:26:59 +01:00
parent 47fcb9562f
commit 907e0fa8c8
8 changed files with 45 additions and 17 deletions

View File

@ -4,6 +4,7 @@
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_process.h"
#include "Emu/Cell/lv2/sys_event.h"
#include "Emu/Cell/Modules/cellAudioOut.h"
#include "cellAudio.h"
#include "util/video_provider.h"
@ -677,6 +678,9 @@ void cell_audio_thread::reset_counters()
cell_audio_thread::cell_audio_thread()
{
// Initialize dependencies
g_fxo->need<audio_out_configuration>();
// Initialize loop variables (regardless of provider in order to initialize timestamps)
reset_counters();

View File

@ -3,6 +3,7 @@
#include "Emu/IdManager.h"
#include "Emu/System.h"
#include "Emu/system_config.h"
#include "Emu//Cell/Modules/cellAudioOut.h"
#include "util/video_provider.h"
#include "sys_process.h"
@ -1305,6 +1306,11 @@ namespace audio
rsxaudio_backend_thread::rsxaudio_backend_thread()
{
// Initialize dependencies
g_fxo->need<audio_out_configuration>();
new_emu_cfg = get_emu_cfg();
const u64 new_vol = g_cfg.audio.volume;
callback_cfg.atomic_op([&](callback_config& val)

View File

@ -528,7 +528,7 @@ private:
u64 start_time = get_system_time();
u64 time_period_idx = 1;
emu_audio_cfg new_emu_cfg{get_emu_cfg()};
emu_audio_cfg new_emu_cfg{};
bool emu_cfg_changed = true;
rsxaudio_state new_ra_state{};

View File

@ -95,6 +95,12 @@ namespace IPC_socket
return *this;
}
IPC_server_manager::IPC_server_manager(bool enabled)
{
// Enable IPC if needed
set_server_enabled(enabled);
}
void IPC_server_manager::set_server_enabled(bool enabled)
{
if (enabled)

View File

@ -54,6 +54,7 @@ namespace IPC_socket
int m_old_port = 0;
public:
explicit IPC_server_manager(bool enabled);
void set_server_enabled(bool enabled);
};
}

View File

@ -43,6 +43,7 @@ struct usio_memory
{
std::vector<u8> backup_memory;
usio_memory() = default;
usio_memory(const usio_memory&) = delete;
usio_memory& operator=(const usio_memory&) = delete;
@ -59,6 +60,9 @@ struct usio_memory
usb_device_usio::usb_device_usio(const std::array<u8, 7>& location)
: usb_device_emulated(location)
{
// Initialize dependencies
g_fxo->need<usio_memory>();
device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE,
UsbDeviceDescriptor{
.bcdUSB = 0x0110,
@ -141,7 +145,8 @@ extern bool is_input_allowed();
void usb_device_usio::load_backup()
{
g_fxo->get<usio_memory>().init();
usio_memory& memory = g_fxo->get<usio_memory>();
memory.init();
fs::file usio_backup_file;
@ -151,7 +156,7 @@ void usb_device_usio::load_backup()
return;
}
const u64 file_size = g_fxo->get<usio_memory>().backup_memory.size();
const u64 file_size = memory.backup_memory.size();
if (usio_backup_file.size() != file_size)
{
@ -159,7 +164,7 @@ void usb_device_usio::load_backup()
return;
}
usio_backup_file.read(g_fxo->get<usio_memory>().backup_memory.data(), file_size);
usio_backup_file.read(memory.backup_memory.data(), file_size);
}
void usb_device_usio::save_backup()

View File

@ -523,17 +523,18 @@ u64 VKGSRender::get_cycles()
VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
{
if (m_instance.create("RPCS3"))
{
m_instance.bind();
}
else
// Initialize dependencies
g_fxo->need<rsx::dma_manager>();
if (!m_instance.create("RPCS3"))
{
rsx_log.fatal("Could not find a Vulkan compatible GPU driver. Your GPU(s) may not support Vulkan, or you need to install the Vulkan runtime and drivers");
m_device = VK_NULL_HANDLE;
return;
}
m_instance.bind();
std::vector<vk::physical_device>& gpus = m_instance.enumerate_devices();
//Actually confirm that the loader found at least one compatible device
@ -890,9 +891,9 @@ VKGSRender::~VKGSRender()
vkDeviceWaitIdle(*m_device);
// Globals. TODO: Refactor lifetime management
if (backend_config.supports_asynchronous_compute)
if (auto async_scheduler = g_fxo->try_get<vk::AsyncTaskScheduler>())
{
g_fxo->get<vk::AsyncTaskScheduler>().destroy();
async_scheduler->destroy();
}
// GC cleanup
@ -2412,12 +2413,12 @@ void VKGSRender::close_and_submit_command_buffer(vk::fence* pFence, VkSemaphore
primary_submit_info.wait_on(wait_semaphore, pipeline_stage_flags);
}
auto& async_scheduler = g_fxo->get<vk::AsyncTaskScheduler>();
if (async_scheduler.is_recording())
if (auto async_scheduler = g_fxo->try_get<vk::AsyncTaskScheduler>();
async_scheduler && async_scheduler->is_recording())
{
if (async_scheduler.is_host_mode())
if (async_scheduler->is_host_mode())
{
const VkSemaphore async_sema = *async_scheduler.get_sema();
const VkSemaphore async_sema = *async_scheduler->get_sema();
secondary_submit_info.queue_signal(async_sema);
primary_submit_info.wait_on(async_sema, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
@ -2425,7 +2426,7 @@ void VKGSRender::close_and_submit_command_buffer(vk::fence* pFence, VkSemaphore
vk::get_resource_manager()->push_down_current_scope();
}
async_scheduler.flush(secondary_submit_info, force_flush);
async_scheduler->flush(secondary_submit_info, force_flush);
}
if (signal_semaphore)

View File

@ -634,7 +634,12 @@ void Emulator::Init()
// Load IPC config
g_cfg_ipc.load();
sys_log.notice("Using IPC config:\n%s", g_cfg_ipc.to_string());
g_fxo->get<IPC_socket::IPC_server_manager>().set_server_enabled(g_cfg_ipc.get_server_enabled());
// Create and start IPC server only if needed
if (g_cfg_ipc.get_server_enabled())
{
g_fxo->init<IPC_socket::IPC_server_manager>(true);
}
}
void Emulator::SetUsr(const std::string& user)