mirror of
https://github.com/libretro/parallel-gx1.git
synced 2026-11-07 04:26:01 -10:00
remove LIBRETRO ifdefs
This commit is contained in:
1 parent
cd38818e52
commit
c878c0d818
61 files changed
+32
-528
No files matched your search
@@ -98,7 +98,6 @@ std::optional<std::wstring> GetModuleName(void* hInstance)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
bool is_uwp()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@@ -111,6 +110,5 @@ bool is_uwp()
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Common
|
||||
@@ -5,11 +5,9 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <optional>
|
||||
#ifdef __LIBRETRO__
|
||||
#include <windows.h>
|
||||
#include <appmodel.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <string>
|
||||
#ifdef __MINGW32__
|
||||
#include <sys/stat.h>
|
||||
@@ -85,7 +83,5 @@ struct MacOSVersion // NSOperatingSystemVersion
|
||||
MacOSVersion GetMacOSVersion();
|
||||
#endif
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
extern bool is_uwp();
|
||||
#endif
|
||||
} // namespace Common
|
||||
@@ -36,9 +36,7 @@ public:
|
||||
FILE_LISTENER = 0,
|
||||
CONSOLE_LISTENER,
|
||||
LOG_WINDOW_LISTENER,
|
||||
#ifdef __LIBRETRO__
|
||||
CUSTOM_LISTENER,
|
||||
#endif
|
||||
NUMBER_OF_LISTENERS // Must be last
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#ifdef IPHONEOS
|
||||
#include "Common/JITMemoryTracker.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include <vector>
|
||||
#include "DolphinLibretro/Common/Globals.h"
|
||||
static void* s_last_exec_rw = nullptr;
|
||||
@@ -45,7 +44,6 @@ static unsigned s_last_exec_mode = 0;
|
||||
// Slots claimed and released with a CAS; a handful of regions at most.
|
||||
static retro_atomic_ptr_t s_frontend_regions[64];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IPHONEOS
|
||||
namespace Common
|
||||
@@ -70,7 +68,7 @@ static JITMemoryTracker g_jit_memory_tracker;
|
||||
|
||||
void* AllocateExecutableMemory(size_t size)
|
||||
{
|
||||
#if defined(IPHONEOS) && defined(__LIBRETRO__)
|
||||
#if defined(IPHONEOS)
|
||||
{
|
||||
struct retro_exec_mem_alloc alloc = {};
|
||||
alloc.version = 1;
|
||||
@@ -369,7 +367,7 @@ size_t MemPhysical()
|
||||
#if defined(__APPLE__) && defined(__aarch64__)
|
||||
ptrdiff_t AllocateWritableRegionAndGetDiff(void* rx_ptr, size_t size)
|
||||
{
|
||||
#if defined(IPHONEOS) && defined(__LIBRETRO__)
|
||||
#if defined(IPHONEOS)
|
||||
if (s_last_exec_rw && s_last_exec_mode == RETRO_EXEC_MEM_MODE_DUAL_MAP)
|
||||
{
|
||||
ptrdiff_t diff = static_cast<u8*>(s_last_exec_rw) - static_cast<u8*>(rx_ptr);
|
||||
@@ -405,7 +403,7 @@ ptrdiff_t AllocateWritableRegionAndGetDiff(void* rx_ptr, size_t size)
|
||||
|
||||
void FreeWritableRegion(void* rx_ptr, size_t size, ptrdiff_t diff)
|
||||
{
|
||||
#if defined(IPHONEOS) && defined(__LIBRETRO__)
|
||||
#if defined(IPHONEOS)
|
||||
// Frontend owns the writable region; nothing to do here.
|
||||
// FreeExecutableMemory will tell the frontend to free everything.
|
||||
#else
|
||||
@@ -422,8 +420,6 @@ void FreeExecutableMemory(void* ptr, size_t size)
|
||||
return;
|
||||
#ifdef IPHONEOS
|
||||
g_jit_memory_tracker.UnregisterJITRegion(ptr);
|
||||
#endif
|
||||
#if defined(IPHONEOS) && defined(__LIBRETRO__)
|
||||
for (auto& slot : s_frontend_regions)
|
||||
{
|
||||
if (retro_atomic_cas_ptr(&slot, ptr, nullptr))
|
||||
|
||||
@@ -15,11 +15,7 @@ public:
|
||||
|
||||
ScopeGuard(ScopeGuard&& other) : m_finalizer(std::move(other.m_finalizer))
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
other.m_finalizer.reset();
|
||||
#else
|
||||
other.Dismiss();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ScopeGuard() { Exit(); }
|
||||
|
||||
@@ -13,9 +13,7 @@ enum class WindowSystemType
|
||||
Wayland,
|
||||
FBDev,
|
||||
Haiku,
|
||||
#ifdef __LIBRETRO__
|
||||
Libretro,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct WindowSystemInfo
|
||||
|
||||
@@ -165,34 +165,12 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(std::vector<std
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
std::string folder_path;
|
||||
#endif
|
||||
std::string extension;
|
||||
SplitPath(paths.front(),
|
||||
#ifndef __LIBRETRO__
|
||||
&folder_path,
|
||||
#else
|
||||
nullptr,
|
||||
#endif
|
||||
nullptr, &extension);
|
||||
Common::ToLower(&extension);
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
if (extension == ".m3u" || extension == ".m3u8")
|
||||
{
|
||||
paths = ReadM3UFile(paths.front(), folder_path);
|
||||
if (paths.empty())
|
||||
return {};
|
||||
|
||||
for (std::string& path : paths)
|
||||
UnifyPathSeparators(path);
|
||||
|
||||
SplitPath(paths.front(), nullptr, nullptr, &extension);
|
||||
Common::ToLower(&extension);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string path = paths.front();
|
||||
if (paths.size() == 1)
|
||||
paths.clear();
|
||||
|
||||
@@ -223,6 +223,4 @@ void CreateSystemMenuTitleDirs();
|
||||
|
||||
void AddRiivolutionPatches(BootParameters* boot_params,
|
||||
std::vector<DiscIO::Riivolution::Patch> riivolution_patches);
|
||||
#ifdef __LIBRETRO__
|
||||
std::vector<std::string> ReadM3UFile(const std::string& m3u_path, const std::string& folder_path);
|
||||
#endif
|
||||
@@ -22,9 +22,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "Common/CommonPaths.h"
|
||||
#endif
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@@ -179,7 +177,6 @@ bool BootCore(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
|
||||
AchievementManager::GetInstance().CloseGame();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// For Libretro we check for the IPL file here, the disc region is known by now
|
||||
// so we can easily get the correct path to check.
|
||||
if (!system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL))
|
||||
@@ -222,7 +219,6 @@ bool BootCore(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
Config::SetCurrent(Config::MAIN_SKIP_IPL, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const bool load_ipl = !system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL) &&
|
||||
std::holds_alternative<BootParameters::Disc>(boot->parameters);
|
||||
|
||||
+9
-13
@@ -157,9 +157,7 @@ void DisplayMessage(std::string message, int time_in_ms = 0);
|
||||
|
||||
// Run a function on the CPU thread, asynchronously.
|
||||
void RunOnCPUThread(Core::System& system, Common::MoveOnlyFunction<void()> function
|
||||
#ifdef __LIBRETRO__
|
||||
, bool wait_for_completion = false
|
||||
#endif
|
||||
);
|
||||
|
||||
// for calling back into UI code without introducing a dependency on it in core
|
||||
@@ -193,16 +191,14 @@ void UpdateInputGate(bool require_focus, bool require_full_focus = false);
|
||||
|
||||
void UpdateTitle(Core::System& system);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
WindowSystemInfo wsi);
|
||||
void SingleCorePostRunShutdown();
|
||||
extern std::unique_ptr<BootParameters> g_boot_params;
|
||||
// Starts EmuThread on its own thread (dual core); s_emu_thread is its handle.
|
||||
bool StartEmuThread(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
const WindowSystemInfo& wsi);
|
||||
extern sthread_t* s_emu_thread;
|
||||
extern bool s_frame_step;
|
||||
#endif
|
||||
void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
WindowSystemInfo wsi);
|
||||
void SingleCorePostRunShutdown();
|
||||
extern std::unique_ptr<BootParameters> g_boot_params;
|
||||
// Starts EmuThread on its own thread (dual core); s_emu_thread is its handle.
|
||||
bool StartEmuThread(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
const WindowSystemInfo& wsi);
|
||||
extern sthread_t* s_emu_thread;
|
||||
extern bool s_frame_step;
|
||||
|
||||
} // namespace Core
|
||||
@@ -16,9 +16,7 @@
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/System.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include "VideoCommon/AsyncRequests.h"
|
||||
#endif
|
||||
|
||||
namespace CPU
|
||||
{
|
||||
@@ -37,9 +35,7 @@ CPUManager::CPUManager(Core::System& system) : m_system(system)
|
||||
retro_eventcount_init(&m_stepping_released);
|
||||
retro_eventcount_init(&m_cpu_wake);
|
||||
retro_eventcount_init(&m_cpu_idle);
|
||||
#ifdef __LIBRETRO__
|
||||
retro_atomic_int_init(&m_cpu_run_state_reached, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUManager::~CPUManager()
|
||||
@@ -69,9 +65,7 @@ void CPUManager::Init(PowerPC::CPUCore cpu_core)
|
||||
void CPUManager::Shutdown()
|
||||
{
|
||||
Stop();
|
||||
#ifdef __LIBRETRO__
|
||||
retro_atomic_store_release_int(&m_cpu_run_state_reached, 0);
|
||||
#endif
|
||||
m_system.GetPowerPC().Shutdown();
|
||||
}
|
||||
|
||||
@@ -156,9 +150,7 @@ void CPUManager::Run()
|
||||
{
|
||||
auto& power_pc = m_system.GetPowerPC();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
retro_atomic_store_release_int(&m_cpu_run_state_reached, 1);
|
||||
#endif
|
||||
while (LoadState() != State::PowerDown)
|
||||
{
|
||||
// Wait out a PauseAndLock: the host thread is standing in for this one.
|
||||
@@ -274,7 +266,6 @@ void CPUManager::Run()
|
||||
Host_UpdateDisasmDialog();
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void CPUManager::RunSingleFrame()
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
@@ -290,7 +281,6 @@ void CPUManager::RunSingleFrame()
|
||||
|
||||
AsyncRequests::GetInstance()->PullEvents();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CPUManager::RunAdjacentSystems(bool running)
|
||||
{
|
||||
|
||||
@@ -52,9 +52,7 @@ public:
|
||||
// To be called by the CPU Thread.
|
||||
void Run();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void RunSingleFrame();
|
||||
#endif
|
||||
|
||||
// Causes shutdown
|
||||
// Once started, State::PowerDown cannot be stopped.
|
||||
@@ -108,12 +106,10 @@ public:
|
||||
// PauseAndLock(), as while the CPU is in the run loop, it won't execute the function.
|
||||
void AddCPUThreadJob(Common::MoveOnlyFunction<void()> function);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
bool HasCPURunStateBeenReached() const
|
||||
{
|
||||
return retro_atomic_load_acquire_int(&m_cpu_run_state_reached) != 0;
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
struct Job
|
||||
{
|
||||
@@ -163,8 +159,6 @@ private:
|
||||
mpsc_stack_t m_pending_jobs;
|
||||
|
||||
Core::System& m_system;
|
||||
#ifdef __LIBRETRO__
|
||||
retro_atomic_int_t m_cpu_run_state_reached;
|
||||
#endif
|
||||
};
|
||||
} // namespace CPU
|
||||
@@ -14,9 +14,7 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/BitUtils.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include "Common/CommonPaths.h"
|
||||
#endif
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
@@ -498,7 +496,6 @@ void Init()
|
||||
if (!s_backup.IsOpen())
|
||||
PanicAlertFmt("Failed to open/create: {}", base_path + "backup.bin");
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// SegaBoot is firmware, but older installations keep it alongside other Triforce data.
|
||||
const std::string system_sega_boot_filename =
|
||||
File::GetSysDirectory() + TRI_SYS_DIR DIR_SEP "segaboot.gcm";
|
||||
@@ -513,24 +510,6 @@ void Init()
|
||||
system_sega_boot_filename, legacy_sega_boot_filename);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
// This is the firmware for the Triforce
|
||||
const std::string sega_boot_filename = base_path + "segaboot.gcm";
|
||||
|
||||
if (!File::Exists(sega_boot_filename))
|
||||
{
|
||||
PanicAlertFmt("Failed to open segaboot.gcm({}), which is required for test menus.",
|
||||
sega_boot_filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
File::IOFile sega_boot(sega_boot_filename, "rb+");
|
||||
if (!sega_boot.IsOpen())
|
||||
{
|
||||
PanicAlertFmt("Failed to read: {}", sega_boot_filename);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
const u64 length = std::min<u64>(sega_boot.GetSize(), sizeof(s_firmware));
|
||||
sega_boot.ReadBytes(s_firmware.data(), length);
|
||||
|
||||
@@ -679,12 +679,7 @@ std::string Core::GetSavePath(std::string_view rom_path, int device_number)
|
||||
{
|
||||
// This is done to make the save file compatible with the save from the mGBA core in RA as it
|
||||
// saves in *.srm format.
|
||||
#ifdef __LIBRETRO__
|
||||
std::string save_path = fmt::format("{}.srm", rom_path.substr(0, rom_path.find_last_of('.')));
|
||||
#else
|
||||
std::string save_path =
|
||||
fmt::format("{}-{}.sav", rom_path.substr(0, rom_path.find_last_of('.')), device_number + 1);
|
||||
#endif
|
||||
|
||||
if (!Config::Get(Config::MAIN_GBA_SAVES_IN_ROM_PATH))
|
||||
{
|
||||
|
||||
@@ -204,11 +204,9 @@ GCMemcardDirectory::GCMemcardDirectory(std::string directory, ExpansionInterface
|
||||
m_dir2 = m_dir1;
|
||||
m_bat2 = m_bat1;
|
||||
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_GCMEMCARD_THREAD)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if !defined(SKIP_GCMEMCARD_THREAD)
|
||||
m_flush_thread = sthread_create(Common::ThreadEntry<&GCMemcardDirectory::FlushThread>, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GCMemcardDirectory::FlushThread()
|
||||
@@ -249,9 +247,7 @@ GCMemcardDirectory::~GCMemcardDirectory()
|
||||
m_flush_trigger.Set();
|
||||
frame_clock_wake_all();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if (m_flush_thread)
|
||||
#endif
|
||||
Common::JoinThread(m_flush_thread);
|
||||
|
||||
FlushToFile();
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
#include "InputCommon/ControllerEmu/StickGate.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/Common/Globals.h"
|
||||
#endif
|
||||
|
||||
static const u16 button_bitmasks[] = {
|
||||
PAD_BUTTON_A,
|
||||
@@ -267,13 +265,8 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
|
||||
bool GCPad::GetMicButton() const
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (Libretro::Input::g_gc_mic_button[i])
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
const auto input_scope = ReadScope();
|
||||
return m_mic->controls.back()->GetState<bool>();
|
||||
#endif
|
||||
}
|
||||
@@ -67,12 +67,10 @@ public:
|
||||
|
||||
static constexpr u32 BUFFER_SIZE = 128;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void ChangeDevice(SIDevices device, int channel)
|
||||
{
|
||||
AddDevice(device, channel);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// SI Interrupt Types
|
||||
|
||||
@@ -866,7 +866,7 @@ void WiimoteScanner::PopulateDevices()
|
||||
|
||||
void WiimoteScanner::ThreadFunc()
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_WIMOTESCANNER_THREAD)
|
||||
#if defined(SKIP_WIMOTESCANNER_THREAD)
|
||||
return;
|
||||
#endif
|
||||
retro_atomic_store_release_int(&s_manager_running, 1);
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#include "Core/System.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/Common/Globals.h"
|
||||
#endif
|
||||
|
||||
namespace IOS::HLE
|
||||
{
|
||||
@@ -441,12 +439,10 @@ bool ESDevice::LaunchPPCTitle(u64 title_id)
|
||||
"The emulated software will likely hang now.",
|
||||
title_id);
|
||||
}
|
||||
#ifdef __LIBRETRO__
|
||||
// Only the disc is booted, so leaving it (HOME menu → Wii Menu) would hang on a black screen. Ask the
|
||||
// frontend to close the game instead, as a real Wii returns to its menu.
|
||||
if (Libretro::environ_cb)
|
||||
Libretro::environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, nullptr);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
#include "Core/IOS/VersionInfo.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/Common/Globals.h"
|
||||
#endif
|
||||
|
||||
namespace IOS::HLE
|
||||
{
|
||||
@@ -62,7 +60,6 @@ IPCReply ESDevice::GetTicketViewCount(const IOCtlVRequest& request)
|
||||
WARN_LOG_FMT(IOS_ES, "GetViewCount: Faking IOS title {:016x} being present", TitleID);
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// Only the disc is booted, so the Wii Menu has no ticket. A game returning to it (HOME menu → Wii Menu,
|
||||
// OSReturnToMenu) asks for its ticket views first and stalls on none, a black screen. Ask the frontend to close the
|
||||
// game instead, as a real Wii returns to its menu.
|
||||
@@ -72,7 +69,6 @@ IPCReply ESDevice::GetTicketViewCount(const IOCtlVRequest& request)
|
||||
if (Libretro::environ_cb)
|
||||
Libretro::environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: {:016x} (View Count = {})", TitleID,
|
||||
view_count);
|
||||
|
||||
@@ -95,7 +95,7 @@ const char* GaiStrError(s32 error)
|
||||
NetIPTopDevice::NetIPTopDevice(EmulationKernel& ios, const std::string& device_name)
|
||||
: EmulationDevice(ios, device_name)
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_NETWORK_WORKER_THREAD)
|
||||
#if defined(SKIP_NETWORK_WORKER_THREAD)
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ NetKDRequestDevice::NetKDRequestDevice(EmulationKernel& ios, const std::string&
|
||||
: EmulationDevice(ios, device_name), m_config{ios.GetFS()}, m_dl_list{ios.GetFS()},
|
||||
m_send_list{ios.GetFS()}, m_friend_list{ios.GetFS()}, m_time_device{time_device}
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_WICONNECT24_WORKER_THREAD)
|
||||
#if defined(SKIP_WICONNECT24_WORKER_THREAD)
|
||||
return;
|
||||
#endif
|
||||
// Enable all NWC24 permissions
|
||||
@@ -237,7 +237,7 @@ void NetKDRequestDevice::IncrementSchedulerWord(size_t index)
|
||||
|
||||
void NetKDRequestDevice::SchedulerTimer()
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_KDSCHEDULER_TIMER_THREAD)
|
||||
#if defined(SKIP_KDSCHEDULER_TIMER_THREAD)
|
||||
return;
|
||||
#endif
|
||||
u32 mail_time_state = 0;
|
||||
|
||||
@@ -280,14 +280,10 @@ void WiimoteDevice::EventDisconnect(u8 reason)
|
||||
|
||||
void WiimoteDevice::SetSource(WiimoteCommon::HIDWiimote* hid_source)
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
if(!hid_source)
|
||||
return;
|
||||
#endif
|
||||
if (m_hid_source && IsConnected())
|
||||
{
|
||||
Activate(false);
|
||||
}
|
||||
|
||||
m_hid_source = hid_source;
|
||||
|
||||
@@ -453,9 +449,7 @@ void WiimoteDevice::ExecuteL2capCmd(u8* ptr, u32 size)
|
||||
m_host->SendACLPacket(GetBD(), reinterpret_cast<const u8*>(&data_frame), sizeof(data_frame));
|
||||
|
||||
// Does the wii remote reply on the control or interrupt channel in this situation?
|
||||
#ifdef __LIBRETRO__
|
||||
if (IsSourceValid())
|
||||
#endif
|
||||
m_hid_source->InterruptDataOutput(data + sizeof(hid_type), data_size - sizeof(hid_type));
|
||||
}
|
||||
else
|
||||
@@ -470,9 +464,7 @@ void WiimoteDevice::ExecuteL2capCmd(u8* ptr, u32 size)
|
||||
const u8 hid_type = data[0];
|
||||
if (hid_type == ((WiimoteCommon::HID_TYPE_DATA << 4) | WiimoteCommon::HID_PARAM_OUTPUT))
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
if (IsSourceValid())
|
||||
#endif
|
||||
m_hid_source->InterruptDataOutput(data + sizeof(hid_type), data_size - sizeof(hid_type));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -56,7 +56,7 @@ void USBScanner::PublishDevices(DeviceMap map)
|
||||
quiesce_retire(&m_quiesce, &static_cast<Devices*>(old)->node, FreeDevices);
|
||||
}
|
||||
|
||||
#if defined(__LIBRETRO__) && defined(__LIBUSB__)
|
||||
#if defined(__LIBUSB__)
|
||||
void USBScanner::Shutdown()
|
||||
{
|
||||
if(m_context)
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
DeviceMap GetDevices() const;
|
||||
|
||||
#if defined(__LIBRETRO__) && defined(__LIBUSB__)
|
||||
#if defined(__LIBUSB__)
|
||||
void Shutdown();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
libusb_exit(m_context);
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void Shutdown()
|
||||
{
|
||||
if (!m_context || !m_event_thread_running.TestAndClear())
|
||||
@@ -60,7 +59,6 @@ public:
|
||||
libusb_exit(m_context);
|
||||
m_context = nullptr; // clear this so it no longer fires in deconstructor again
|
||||
}
|
||||
#endif
|
||||
|
||||
libusb_context* GetContext() const { return m_context; }
|
||||
|
||||
@@ -113,7 +111,7 @@ Context::Context() : m_impl{std::make_unique<Impl>()}
|
||||
|
||||
Context::~Context() = default;
|
||||
|
||||
#if defined(__LIBUSB__) && defined(__LIBRETRO__)
|
||||
#if defined(__LIBUSB__)
|
||||
void Context::Shutdown()
|
||||
{
|
||||
if(m_impl)
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
operator libusb_context*() const;
|
||||
bool IsValid() const;
|
||||
#if defined(__LIBRETRO__) && defined(__LIBUSB__)
|
||||
#if defined(__LIBUSB__)
|
||||
void Shutdown();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -178,9 +178,6 @@ static constexpr bool s_use_compression = true;
|
||||
|
||||
static bool ReadHeader(const std::string& filename, StateHeader& header);
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
static
|
||||
#endif
|
||||
void DoState(Core::System& system, PointerWrap& p)
|
||||
{
|
||||
bool is_wii = system.IsWii() || system.IsMIOS();
|
||||
@@ -921,15 +918,14 @@ void SetOnAfterLoadCallback(AfterLoadCallbackFunc callback)
|
||||
|
||||
void Init(Core::System& system)
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_SAVESTATE_THREAD)
|
||||
return;
|
||||
#endif
|
||||
#if !defined(SKIP_SAVESTATE_THREAD)
|
||||
s_compress_and_dump_thread.Reset("Savestate Worker",
|
||||
std::bind_front(&CompressAndDumpState, std::ref(system)));
|
||||
|
||||
s_flush_unsaved_data_hook = UICommon::AddFlushUnsavedDataCallback([] {
|
||||
WaitForStateSaves();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include "Common/ChunkFile.h"
|
||||
#endif
|
||||
|
||||
namespace Core
|
||||
{
|
||||
@@ -110,7 +108,5 @@ void UndoLoadState(Core::System& system);
|
||||
using AfterLoadCallbackFunc = std::function<void()>;
|
||||
void SetOnAfterLoadCallback(AfterLoadCallbackFunc callback);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void DoState(Core::System& system, PointerWrap& p);
|
||||
#endif
|
||||
} // namespace State
|
||||
@@ -284,7 +284,7 @@ IOS::HLE::USBScanner& System::GetUSBScanner() const
|
||||
return m_impl->m_usb_scanner;
|
||||
}
|
||||
|
||||
#if defined(__LIBRETRO__) && defined(__LIBUSB__)
|
||||
#if defined(__LIBUSB__)
|
||||
void System::ShutdownUSBScanner()
|
||||
{
|
||||
m_impl->m_usb_scanner.Shutdown();
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
Sram& GetSRAM() const;
|
||||
SystemTimers::SystemTimersManager& GetSystemTimers() const;
|
||||
IOS::HLE::USBScanner& GetUSBScanner() const;
|
||||
#if defined(__LIBRETRO__) && defined(__LIBUSB__)
|
||||
#if defined(__LIBUSB__)
|
||||
void ShutdownUSBScanner();
|
||||
#endif
|
||||
VertexShaderManager& GetVertexShaderManager() const;
|
||||
|
||||
@@ -1065,190 +1065,3 @@ void InputBackend::PopulateDevices()
|
||||
}
|
||||
|
||||
} // namespace ciface::Android
|
||||
|
||||
// JNI entry points of the Android app; the libretro core has no Java side.
|
||||
#ifndef __LIBRETRO__
|
||||
extern "C" {
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_dispatchKeyEventNative(
|
||||
JNIEnv* env, jclass, jobject key_event)
|
||||
{
|
||||
const jint action = env->CallIntMethod(key_event, s_key_event_get_action);
|
||||
ControlState state;
|
||||
switch (action)
|
||||
{
|
||||
case AKEY_EVENT_ACTION_DOWN:
|
||||
state = 1;
|
||||
break;
|
||||
case AKEY_EVENT_ACTION_UP:
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
const jint device_id = env->CallIntMethod(key_event, s_input_event_get_device_id);
|
||||
const std::shared_ptr<ciface::Core::Device> device = FindDevice(device_id);
|
||||
if (!device)
|
||||
return JNI_FALSE;
|
||||
|
||||
const jint keycode = env->CallIntMethod(key_event, s_key_event_get_keycode);
|
||||
const std::string input_name = ConstructKeyName(keycode);
|
||||
|
||||
ciface::Core::Device::Input* input = device->FindInput(input_name);
|
||||
if (!input)
|
||||
{
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Could not find input {} in device {}", input_name,
|
||||
device->GetQualifiedName());
|
||||
return false;
|
||||
}
|
||||
|
||||
auto casted_input = static_cast<ciface::Android::AndroidInput*>(input);
|
||||
casted_input->SetState(state);
|
||||
const Clock::time_point last_polled = casted_input->GetLastPolled();
|
||||
|
||||
DEBUG_LOG_FMT(CONTROLLERINTERFACE, "Set {} of {} to {}", input_name, device->GetQualifiedName(),
|
||||
state);
|
||||
|
||||
return last_polled >= Clock::now() - ACTIVE_INPUT_TIMEOUT;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_dispatchGenericMotionEventNative(
|
||||
JNIEnv* env, jclass, jobject motion_event)
|
||||
{
|
||||
const jint device_id = env->CallIntMethod(motion_event, s_input_event_get_device_id);
|
||||
const std::shared_ptr<ciface::Core::Device> device = FindDevice(device_id);
|
||||
if (!device)
|
||||
return JNI_FALSE;
|
||||
|
||||
const jint source = env->CallIntMethod(motion_event, s_motion_event_get_source);
|
||||
const std::string axis_name_prefix = ConstructAxisNamePrefix(source);
|
||||
|
||||
Clock::time_point last_polled{};
|
||||
|
||||
for (ciface::Core::Device::Input* input : device->Inputs())
|
||||
{
|
||||
const std::string input_name = input->GetName();
|
||||
if (input_name.starts_with(axis_name_prefix))
|
||||
{
|
||||
const std::string axis_id_str = input_name.substr(
|
||||
axis_name_prefix.size(), input_name.size() - axis_name_prefix.size() - sizeof('+'));
|
||||
|
||||
int axis_id;
|
||||
if (!TryParse(axis_id_str, &axis_id))
|
||||
{
|
||||
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Failed to parse \"{}\" from \"{}\" as axis ID",
|
||||
axis_id_str, input_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
float value = env->CallFloatMethod(motion_event, s_motion_event_get_axis_value, axis_id);
|
||||
|
||||
auto casted_input = static_cast<ciface::Android::AndroidInput*>(input);
|
||||
casted_input->SetState(value);
|
||||
last_polled = std::max(last_polled, casted_input->GetLastPolled());
|
||||
|
||||
DEBUG_LOG_FMT(CONTROLLERINTERFACE, "Set {} of {} to {}", input_name,
|
||||
device->GetQualifiedName(), value);
|
||||
}
|
||||
}
|
||||
|
||||
return last_polled >= Clock::now() - ACTIVE_INPUT_TIMEOUT;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_dispatchSensorEventNative(
|
||||
JNIEnv* env, jclass, jstring j_device_qualifier, jstring j_axis_name, jfloat value)
|
||||
{
|
||||
ciface::Core::DeviceQualifier device_qualifier;
|
||||
device_qualifier.FromString(GetJString(env, j_device_qualifier));
|
||||
const std::shared_ptr<ciface::Core::Device> device =
|
||||
g_controller_interface.FindDevice(device_qualifier);
|
||||
if (!device)
|
||||
return JNI_FALSE;
|
||||
|
||||
const std::string axis_name = GetJString(env, j_axis_name);
|
||||
|
||||
Clock::time_point last_polled{};
|
||||
|
||||
for (ciface::Core::Device::Input* input : device->Inputs())
|
||||
{
|
||||
const std::string input_name = input->GetName();
|
||||
if (input_name == axis_name)
|
||||
{
|
||||
auto casted_input = static_cast<ciface::Android::AndroidInput*>(input);
|
||||
casted_input->SetState(value);
|
||||
last_polled = std::max(last_polled, casted_input->GetLastPolled());
|
||||
}
|
||||
}
|
||||
|
||||
return last_polled >= Clock::now() - ACTIVE_INPUT_TIMEOUT;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_notifySensorSuspendedState(
|
||||
JNIEnv* env, jclass, jstring j_device_qualifier, jobjectArray j_axis_names, jboolean suspended)
|
||||
{
|
||||
ciface::Core::DeviceQualifier device_qualifier;
|
||||
device_qualifier.FromString(GetJString(env, j_device_qualifier));
|
||||
const std::shared_ptr<ciface::Core::Device> device =
|
||||
g_controller_interface.FindDevice(device_qualifier);
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
const std::vector<std::string> axis_names = JStringArrayToVector(env, j_axis_names);
|
||||
|
||||
for (ciface::Core::Device::Input* input : device->Inputs())
|
||||
{
|
||||
bool is_axis = false;
|
||||
for (const auto& axis_name : axis_names)
|
||||
is_axis = is_axis || axis_name == input->GetName();
|
||||
if (is_axis)
|
||||
{
|
||||
auto casted_input = static_cast<ciface::Android::AndroidSensorAxis*>(input);
|
||||
casted_input->NotifyIsSuspended(static_cast<bool>(suspended));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_00024InputDeviceListener_onInputDeviceAdded(
|
||||
JNIEnv* env, jobject, jint device_id)
|
||||
{
|
||||
ciface::Android::InputBackend::AddDevice(env, device_id);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_00024InputDeviceListener_onInputDeviceRemoved(
|
||||
JNIEnv*, jobject, jint device_id)
|
||||
{
|
||||
ciface::Android::InputBackend::RemoveDevice(device_id);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_00024InputDeviceListener_onInputDeviceChanged(
|
||||
JNIEnv* env, jobject, jint device_id)
|
||||
{
|
||||
// AddDevice will automatically remove the existing device
|
||||
ciface::Android::InputBackend::AddDevice(env, device_id);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_getAllDeviceStrings(
|
||||
JNIEnv* env, jclass)
|
||||
{
|
||||
return SpanToJStringArray(env, g_controller_interface.GetAllDeviceStrings());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_getDevice(
|
||||
JNIEnv* env, jclass, jstring j_device_string)
|
||||
{
|
||||
ciface::Core::DeviceQualifier qualifier;
|
||||
qualifier.FromString(GetJString(env, j_device_string));
|
||||
return CoreDeviceToJava(env, g_controller_interface.FindDevice(qualifier));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -39,9 +39,6 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
|
||||
|
||||
retro_atomic_store_release_int(&m_populating_devices_counter, 1);
|
||||
|
||||
#if defined(CIFACE_USE_ANDROID) && !defined(__LIBRETRO__)
|
||||
m_input_backends.emplace_back(ciface::Android::CreateInputBackend(this));
|
||||
#endif
|
||||
#ifdef CIFACE_USE_DUALSHOCKUDPCLIENT
|
||||
m_input_backends.emplace_back(ciface::DualShockUDPClient::CreateInputBackend(this));
|
||||
#endif
|
||||
|
||||
@@ -135,10 +135,8 @@ void InputConfig::SaveConfig()
|
||||
|
||||
ControllerEmu::EmulatedController* InputConfig::GetController(int index) const
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
if (index < 0 || index >= static_cast<int>(m_controllers.size()))
|
||||
return nullptr;
|
||||
#endif
|
||||
return m_controllers.at(index).get();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,6 @@
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#if defined(__APPLE__) && !defined(__LIBRETRO__)
|
||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||
#endif
|
||||
|
||||
namespace UICommon
|
||||
{
|
||||
static Config::ConfigChangedCallbackID s_config_changed_callback_id;
|
||||
@@ -182,15 +178,6 @@ void InitControllers(const WindowSystemInfo& wsi)
|
||||
|
||||
void ShutdownControllers()
|
||||
{
|
||||
#ifndef __LIBRETRO__
|
||||
Pad::Shutdown();
|
||||
Pad::ShutdownGBA();
|
||||
Keyboard::Shutdown();
|
||||
Wiimote::Shutdown();
|
||||
HotkeyManagerEmu::Shutdown();
|
||||
FreeLook::Shutdown();
|
||||
#endif
|
||||
|
||||
g_controller_interface.Shutdown();
|
||||
}
|
||||
|
||||
@@ -321,28 +308,6 @@ void InhibitScreenSaver(bool inhibit)
|
||||
SetThreadExecutionState(ES_CONTINUOUS |
|
||||
(inhibit ? (ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED) : 0));
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && !defined(__LIBRETRO__)
|
||||
static IOPMAssertionID s_power_assertion = kIOPMNullAssertionID;
|
||||
if (inhibit)
|
||||
{
|
||||
CFStringRef reason_for_activity = CFSTR("Emulation Running");
|
||||
if (IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep,
|
||||
kIOPMAssertionLevelOn, reason_for_activity,
|
||||
&s_power_assertion) != kIOReturnSuccess)
|
||||
{
|
||||
s_power_assertion = kIOPMNullAssertionID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_power_assertion != kIOPMNullAssertionID)
|
||||
{
|
||||
IOPMAssertionRelease(s_power_assertion);
|
||||
s_power_assertion = kIOPMNullAssertionID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string FormatSize(u64 bytes, int decimals)
|
||||
|
||||
@@ -109,14 +109,10 @@ void VideoBackend::FillBackendInfo()
|
||||
g_backend_info.bSupportsCoarseDerivatives = true;
|
||||
g_backend_info.bSupportsTextureQueryLevels = true;
|
||||
g_backend_info.bSupportsLodBiasInSampler = true;
|
||||
#ifdef __LIBRETRO__
|
||||
if (Common::is_uwp())
|
||||
g_backend_info.bSupportsLogicOp = false;
|
||||
else
|
||||
#else
|
||||
g_backend_info.bSupportsLogicOp = D3D::SupportsLogicOp(g_Config.iAdapter);
|
||||
#endif
|
||||
g_backend_info.bSupportsSettingObjectNames = true;
|
||||
g_backend_info.bSupportsSettingObjectNames = true;
|
||||
g_backend_info.bSupportsPartialMultisampleResolve = true;
|
||||
g_backend_info.bSupportsDynamicVertexLoader = false;
|
||||
g_backend_info.bSupportsHDROutput = true;
|
||||
|
||||
@@ -295,7 +295,7 @@ void StateManager::SyncComputeBindings()
|
||||
start = end;
|
||||
}
|
||||
}
|
||||
#ifdef __LIBRETRO__
|
||||
|
||||
// Rebinds everything Apply() binds after the frontend drew with the shared
|
||||
// context: its shader passes overwrite constant buffer slots that m_current
|
||||
// still records as ours, which turned the picture black with a preset.
|
||||
@@ -351,7 +351,6 @@ void StateManager::Restore()
|
||||
m_current = m_pending;
|
||||
m_dirtyFlags = 0;
|
||||
}
|
||||
#endif
|
||||
} // namespace D3D
|
||||
|
||||
// Creating the same state twice is harmless (D3D11 hands back the same object), so a thread
|
||||
|
||||
@@ -219,9 +219,7 @@ public:
|
||||
// state changes
|
||||
void Apply();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void Restore();
|
||||
#endif
|
||||
// Binds constant buffers/textures/samplers to the compute shader stage.
|
||||
// We don't track these explicitly because it's not often-used.
|
||||
void SetComputeUAV(u32 index, ID3D11UnorderedAccessView* uav);
|
||||
|
||||
@@ -22,9 +22,7 @@ public:
|
||||
|
||||
static constexpr const char* CONFIG_NAME = "D3D";
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void FillD3DBackendInfo() { FillBackendInfo(); }
|
||||
#endif
|
||||
private:
|
||||
void FillBackendInfo();
|
||||
};
|
||||
|
||||
@@ -482,7 +482,6 @@ void DXContext::WaitForFence(u64 fence)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// a seperate function is needed to bind externally managed device to dolphin
|
||||
bool DXContext::CreateWithExternalDevice(ID3D12Device* device, ID3D12CommandQueue* queue)
|
||||
{
|
||||
@@ -534,5 +533,4 @@ bool DXContext::CreateWithExternalDevice(ID3D12Device* device, ID3D12CommandQueu
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
} // namespace DX12
|
||||
@@ -139,9 +139,7 @@ public:
|
||||
// Re-creates the root signature. Call when the host config changes (e.g. bbox/per-pixel shading).
|
||||
void RecreateGXRootSignature();
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
static bool CreateWithExternalDevice(ID3D12Device* device, ID3D12CommandQueue* queue);
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Number of command lists. One is being built while the other(s) are executed.
|
||||
|
||||
@@ -86,11 +86,9 @@ std::vector<std::string> GetAdapterNames()
|
||||
Microsoft::WRL::ComPtr<IDXGIFactory> factory;
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if (create_dxgi_factory2)
|
||||
hr = create_dxgi_factory2(0, IID_PPV_ARGS(&factory));
|
||||
else if (create_dxgi_factory)
|
||||
#endif
|
||||
hr = create_dxgi_factory(IID_PPV_ARGS(&factory));
|
||||
|
||||
if (FAILED(hr))
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/Common/Options.h"
|
||||
#endif
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
|
||||
@@ -94,12 +94,10 @@ public:
|
||||
|
||||
SurfaceInfo GetSurfaceInfo() const override;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void SetSystemFrameBuffer(GLuint fbo)
|
||||
{
|
||||
m_system_framebuffer->SetFBO(fbo);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -112,9 +112,7 @@ public:
|
||||
std::vector<AbstractTexture*> additional_color_attachments);
|
||||
|
||||
GLuint GetFBO() const { return m_fbo; }
|
||||
#ifdef __LIBRETRO__
|
||||
void SetFBO(GLuint fbo) { m_fbo = fbo; }
|
||||
#endif
|
||||
// Used for updating the dimensions of the system/window framebuffer.
|
||||
void UpdateDimensions(u32 width, u32 height);
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/Common/Globals.h"
|
||||
#endif
|
||||
|
||||
#include "VideoBackends/Software/EfbCopy.h"
|
||||
#include "VideoBackends/Software/Rasterizer.h"
|
||||
@@ -132,9 +130,7 @@ void SWGfx::ShowImage(const AbstractTexture* source_texture,
|
||||
*dst++ = (static_cast<u32>(s[0]) << 16) | (static_cast<u32>(s[1]) << 8) | s[2];
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
Libretro::Video::video_cb(m_picture.data(), width, height, width * 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SWGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable,
|
||||
|
||||
@@ -42,17 +42,6 @@ static Common::DynamicLibrary s_vulkan_module;
|
||||
|
||||
static bool OpenVulkanLibrary(bool force_system_library)
|
||||
{
|
||||
#if defined(__APPLE__) && !defined(__LIBRETRO__)
|
||||
// Check if a path to a specific Vulkan library has been specified.
|
||||
char* libvulkan_env = getenv("LIBVULKAN_PATH");
|
||||
if (libvulkan_env && s_vulkan_module.Open(libvulkan_env))
|
||||
return true;
|
||||
|
||||
// Use the libMoltenVK.dylib from the application bundle.
|
||||
std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libMoltenVK.dylib";
|
||||
return s_vulkan_module.Open(filename.c_str());
|
||||
#else
|
||||
|
||||
#if defined(ANDROID) && _M_ARM_64
|
||||
const std::string& driver_lib_name = g_Config.customDriverLibraryName;
|
||||
|
||||
@@ -73,10 +62,8 @@ static bool OpenVulkanLibrary(bool force_system_library)
|
||||
INFO_LOG_FMT(HOST_GPU, "Successfully loaded driver: {}", driver_lib_name);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG_FMT(HOST_GPU, "Loading driver {} failed.", driver_lib_name);
|
||||
}
|
||||
|
||||
WARN_LOG_FMT(HOST_GPU, "Loading driver {} failed.", driver_lib_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -88,7 +75,6 @@ static bool OpenVulkanLibrary(bool force_system_library)
|
||||
// Android devices may not have libvulkan.so.1, only libvulkan.so.
|
||||
filename = Common::DynamicLibrary::GetVersionedFilename("vulkan");
|
||||
return s_vulkan_module.Open(filename.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LoadVulkanLibrary(bool force_system_library)
|
||||
|
||||
@@ -83,7 +83,7 @@ void CustomAssetLoader::FreeBatch(quiesce_node_t* node)
|
||||
|
||||
void CustomAssetLoader::WorkerThreadRun(u32 thread_index)
|
||||
{
|
||||
#if defined(__LIBRETRO__) && defined(SKIP_ASSETLOADER_THREAD)
|
||||
#if defined(SKIP_ASSETLOADER_THREAD)
|
||||
return;
|
||||
#endif
|
||||
Common::SetCurrentThreadName(fmt::format("Asset Loader {}", thread_index).c_str());
|
||||
|
||||
@@ -140,7 +140,6 @@ void FifoManager::ExitGpuLoop()
|
||||
m_gpu_mainloop.Stop(Common::BlockingLoop::StopMode::NonBlock);
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// Called by the CPU thread at the end of the frame. It can get there before the frontend
|
||||
// thread has entered RunGpuLoop(); the loop of the last frame then still counts as stopped
|
||||
// and this Stop() does nothing, so the request is kept for RunGpuLoop() to act on.
|
||||
@@ -149,7 +148,6 @@ void FifoManager::StopGpuLoop()
|
||||
retro_atomic_store_release_int(&m_stop_gpu_loop_requested, 1);
|
||||
m_gpu_mainloop.Stop(Common::BlockingLoop::StopMode::NonBlock);
|
||||
}
|
||||
#endif
|
||||
|
||||
void FifoManager::EmulatorState(bool running)
|
||||
{
|
||||
@@ -312,7 +310,6 @@ bool FifoManager::RunGpuLoop(s64 budget_us)
|
||||
m_gpu_mainloop.SetSleepDeadline(deadline_us);
|
||||
m_gpu_mainloop.Run(
|
||||
[&] {
|
||||
#ifdef __LIBRETRO__
|
||||
if (retro_atomic_load_acquire_int(&m_stop_gpu_loop_requested))
|
||||
m_gpu_mainloop.Stop(Common::BlockingLoop::StopMode::NonBlock);
|
||||
else if (deadline_us && (s64)cpu_features_get_time_usec() >= deadline_us)
|
||||
@@ -320,7 +317,6 @@ bool FifoManager::RunGpuLoop(s64 budget_us)
|
||||
out_of_time = true;
|
||||
m_gpu_mainloop.Stop(Common::BlockingLoop::StopMode::NonBlock);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Run events from the CPU thread.
|
||||
AsyncRequests::GetInstance()->PullEvents();
|
||||
@@ -431,12 +427,10 @@ bool FifoManager::RunGpuLoop(s64 budget_us)
|
||||
}
|
||||
});
|
||||
m_gpu_mainloop.SetSleepDeadline(0);
|
||||
#ifdef __LIBRETRO__
|
||||
/* a field's end that came while the loop was out of time is kept for
|
||||
* the next run, which then finishes that field's work and stops */
|
||||
if (!out_of_time)
|
||||
retro_atomic_store_release_int(&m_stop_gpu_loop_requested, 0);
|
||||
#endif
|
||||
return !out_of_time;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +79,7 @@ public:
|
||||
void ExitGpuLoop();
|
||||
void EmulatorState(bool running);
|
||||
void ResetVideoBuffer();
|
||||
#ifdef __LIBRETRO__
|
||||
void StopGpuLoop();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void RefreshConfig();
|
||||
@@ -94,10 +92,8 @@ private:
|
||||
static constexpr u32 FIFO_SIZE = 2 * 1024 * 1024;
|
||||
|
||||
Common::BlockingLoop m_gpu_mainloop;
|
||||
#ifdef __LIBRETRO__
|
||||
// Set by StopGpuLoop(), so that a stop requested before RunGpuLoop() got going still ends it.
|
||||
retro_atomic_int_t m_stop_gpu_loop_requested{};
|
||||
#endif
|
||||
|
||||
Common::Flag m_emu_running_state;
|
||||
|
||||
|
||||
@@ -232,11 +232,9 @@ std::string GeneratePassthroughGeometryShader(u32 num_tex, u32 num_colors)
|
||||
// We have to explicitly unroll this loop otherwise the GL compiler gets cranky.
|
||||
for (u32 v = 0; v < 3; v++)
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
// Outputs are undefined after EmitVertex()
|
||||
if (v > 0)
|
||||
code.Write(" gl_Layer = j;\n");
|
||||
#endif
|
||||
code.Write(" gl_Position = gl_in[{}].gl_Position;\n", v);
|
||||
for (u32 i = 0; i < num_tex; i++)
|
||||
{
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
#include "VideoCommon/RenderState.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include <cmath>
|
||||
|
||||
#include "VideoCommon/VertexShaderManager.h"
|
||||
#endif
|
||||
|
||||
static constexpr int LINE_PT_TEX_OFFSETS[8] = {0, 16, 8, 4, 2, 1, 1, 1};
|
||||
|
||||
@@ -62,13 +60,10 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
constants.stereoparams[1] = g_ActiveConfig.bStereoSwapEyes ? -offset : offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
constants.stereoparams[0] = constants.stereoparams[1] = 0;
|
||||
}
|
||||
|
||||
constants.stereoparams[2] = g_ActiveConfig.stereo_convergence;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if (g_libretro_vr_camera.applied)
|
||||
{
|
||||
// Move each eye onto its own headset frustum as well as separating it. The shader adds
|
||||
@@ -91,7 +86,6 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
constants.stereoparams[1] = -eye_offset;
|
||||
constants.stereoparams[2] = 0.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ std::unique_ptr<VideoCommon::Presenter> g_presenter;
|
||||
|
||||
namespace VideoCommon
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
bool g_frontend_takes_frames = false;
|
||||
#endif
|
||||
|
||||
// Stretches the native/internal analog resolution aspect ratio from ~4:3 to ~16:9
|
||||
static float SourceAspectRatioToWidescreen(float source_aspect)
|
||||
@@ -210,13 +208,11 @@ void Presenter::ViSwap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height,
|
||||
|
||||
video_events.before_present_event.Trigger(present_info);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if (!g_frontend_takes_frames)
|
||||
{
|
||||
m_last_xfb_id = std::numeric_limits<u64>::max();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!is_duplicate || !g_ActiveConfig.bSkipPresentingDuplicateXFBs)
|
||||
{
|
||||
@@ -1041,14 +1037,10 @@ void Presenter::DoState(PointerWrap& p)
|
||||
|
||||
retro_atomic_store_relaxed_int(&m_immediate_swap_happened_this_field, 0);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
/* shown inside the next retro_run, where the frontend takes pictures,
|
||||
* by the next field: never taken for a repeat of what was shown
|
||||
* before the load */
|
||||
m_last_xfb_id = std::numeric_limits<u64>::max();
|
||||
#else
|
||||
ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride, m_last_xfb_height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,10 @@ enum class AspectMode : int;
|
||||
namespace VideoCommon
|
||||
{
|
||||
class PostProcessing;
|
||||
#ifdef __LIBRETRO__
|
||||
/* Set while retro_run runs the emulation, the only time the frontend
|
||||
* takes pictures: a field swapped at any other time, while a state is
|
||||
* saved or loaded say, is not presented, and the next field is. */
|
||||
extern bool g_frontend_takes_frames;
|
||||
#endif
|
||||
// Presenter is a class that deals with putting the final XFB on the screen.
|
||||
// It also handles post-processing.
|
||||
class Presenter
|
||||
|
||||
@@ -62,13 +62,10 @@ void ShaderCache::InitializeShaderCache()
|
||||
{
|
||||
LoadCaches();
|
||||
LoadPipelineUIDCache();
|
||||
#ifdef __LIBRETRO__
|
||||
if (g_ActiveConfig.UsingUberShaders())
|
||||
LoadUberPipelineUIDCache();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
/* With ubershaders, every draw without its specialized pipeline yet is
|
||||
* drawn with an ubershader one. The ones this game drew with before are
|
||||
* built before it starts, as a draw would otherwise build its own on
|
||||
@@ -87,11 +84,6 @@ void ShaderCache::InitializeShaderCache()
|
||||
if (m_async_shader_compiler->HasWorkerThreads())
|
||||
QueueUberShaderPipelines();
|
||||
}
|
||||
#else
|
||||
// Queue ubershader precompiling if required.
|
||||
if (g_ActiveConfig.UsingUberShaders())
|
||||
QueueUberShaderPipelines();
|
||||
#endif
|
||||
|
||||
// Compile all known UIDs.
|
||||
CompileMissingPipelines();
|
||||
@@ -202,12 +194,10 @@ std::optional<const AbstractPipeline*> ShaderCache::GetPipelineForUidAsync(const
|
||||
const AbstractPipeline* ShaderCache::GetUberPipelineForUid(const GXUberPipelineUid& uid)
|
||||
{
|
||||
auto it = m_gx_uber_pipeline_cache.find(uid);
|
||||
#ifdef __LIBRETRO__
|
||||
/* every one a draw uses is recorded, to be built before the game
|
||||
* starts next time */
|
||||
if (m_gx_uber_pipeline_uid_cache_file.IsOpen() && !m_recorded_uber_pipeline_uids.contains(uid))
|
||||
AppendGXUberPipelineUID(uid);
|
||||
#endif
|
||||
if (it != m_gx_uber_pipeline_cache.end() && !it->second.second)
|
||||
return it->second.first.get();
|
||||
|
||||
@@ -909,7 +899,6 @@ void ShaderCache::LoadPipelineUIDCache()
|
||||
void ShaderCache::ClosePipelineUIDCache()
|
||||
{
|
||||
// This is left as a method in case we need to append extra data to the file in the future.
|
||||
#ifdef __LIBRETRO__
|
||||
if (m_gx_pipeline_uid_cache_file.IsOpen() && !m_pending_gx_pipeline_uids.empty() &&
|
||||
!m_gx_pipeline_uid_cache_file.WriteArray(m_pending_gx_pipeline_uids.data(),
|
||||
m_pending_gx_pipeline_uids.size()))
|
||||
@@ -926,11 +915,9 @@ void ShaderCache::ClosePipelineUIDCache()
|
||||
m_pending_gx_uber_pipeline_uids.clear();
|
||||
m_recorded_uber_pipeline_uids.clear();
|
||||
m_gx_uber_pipeline_uid_cache_file.Close();
|
||||
#endif
|
||||
m_gx_pipeline_uid_cache_file.Close();
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
void ShaderCache::LoadUberPipelineUIDCache()
|
||||
{
|
||||
const u32 magic = 0x44495555; // UUID
|
||||
@@ -1006,7 +993,6 @@ void ShaderCache::CompileMissingUberPipelines()
|
||||
QueueUberPipelineCompile(it.first, COMPILE_PRIORITY_UBERSHADER_PIPELINE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ShaderCache::AddSerializedGXPipelineUID(const SerializedGXPipelineUid& uid)
|
||||
{
|
||||
@@ -1029,16 +1015,8 @@ void ShaderCache::AppendGXPipelineUID(const GXPipelineUid& config)
|
||||
|
||||
SerializedGXPipelineUid disk_uid;
|
||||
SerializePipelineUid(config, disk_uid);
|
||||
#ifdef __LIBRETRO__
|
||||
// Keep filesystem writes off the draw path. Save on reload or shutdown.
|
||||
m_pending_gx_pipeline_uids.push_back(disk_uid);
|
||||
#else
|
||||
if (!m_gx_pipeline_uid_cache_file.WriteBytes(&disk_uid, sizeof(disk_uid)))
|
||||
{
|
||||
WARN_LOG_FMT(VIDEO, "Writing pipeline UID to cache failed, closing file.");
|
||||
m_gx_pipeline_uid_cache_file.Close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShaderCache::QueueVertexShaderCompile(const VertexShaderUid& uid, u32 priority)
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#ifdef __LIBRETRO__
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/IOFile.h"
|
||||
@@ -170,12 +168,10 @@ private:
|
||||
std::unique_ptr<AbstractPipeline> pipeline);
|
||||
void AddSerializedGXPipelineUID(const SerializedGXPipelineUid& uid);
|
||||
void AppendGXPipelineUID(const GXPipelineUid& config);
|
||||
#ifdef __LIBRETRO__
|
||||
void LoadUberPipelineUIDCache();
|
||||
void AppendGXUberPipelineUID(const GXUberPipelineUid& config);
|
||||
/* queues the ubershader pipelines known and not built yet */
|
||||
void CompileMissingUberPipelines();
|
||||
#endif
|
||||
|
||||
// ASync Compiler Methods
|
||||
void QueueVertexShaderCompile(const VertexShaderUid& uid, u32 priority);
|
||||
@@ -244,7 +240,6 @@ private:
|
||||
std::map<GXUberPipelineUid, std::pair<std::unique_ptr<AbstractPipeline>, bool>>
|
||||
m_gx_uber_pipeline_cache;
|
||||
File::IOFile m_gx_pipeline_uid_cache_file;
|
||||
#ifdef __LIBRETRO__
|
||||
std::vector<SerializedGXPipelineUid> m_pending_gx_pipeline_uids;
|
||||
/* The ubershader pipelines a game drew with, as for the specialized
|
||||
* ones: compiled while the game boots next time, so a hybrid draw
|
||||
@@ -255,7 +250,6 @@ private:
|
||||
std::set<GXUberPipelineUid> m_recorded_uber_pipeline_uids;
|
||||
// Pipelines whose cache data is written once their compile, on the driver's threads, is done.
|
||||
std::vector<GXPipelineUid> m_unwritten_gx_pipelines;
|
||||
#endif
|
||||
Common::LinearDiskCache<SerializedGXPipelineUid, u8> m_gx_pipeline_disk_cache;
|
||||
Common::LinearDiskCache<SerializedGXUberPipelineUid, u8> m_gx_uber_pipeline_disk_cache;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ std::string GetDiskShaderCacheFileName(APIType api_type, const char* type, bool
|
||||
ShaderHostConfig host_config = ShaderHostConfig::GetCurrent();
|
||||
filename += fmt::format("-{:06X}", host_config.bits);
|
||||
|
||||
#if defined(__LIBRETRO__) && defined(__WEBOS__)
|
||||
#if defined(__WEBOS__)
|
||||
// The webOS core option toggles binding layout, which changes the
|
||||
// generated GLSL
|
||||
if (g_backend_info.bSupportsBindingLayout)
|
||||
|
||||
@@ -544,10 +544,8 @@ void VertexManagerBase::Flush()
|
||||
CalculateNormals(VertexLoaderManager::GetCurrentVertexFormat());
|
||||
// Calculate ZSlope for zfreeze
|
||||
const auto used_textures = UsedTextures();
|
||||
#ifdef __LIBRETRO__
|
||||
bool vr_textured = false;
|
||||
bool vr_samples_copy = false;
|
||||
#endif
|
||||
std::vector<std::string> texture_names;
|
||||
Common::SmallVector<u32, 8> texture_units;
|
||||
std::array<SamplerState, 8> samplers;
|
||||
@@ -560,10 +558,8 @@ void VertexManagerBase::Flush()
|
||||
const auto cache_entry = g_texture_cache->Load(i);
|
||||
if (!cache_entry)
|
||||
continue;
|
||||
#ifdef __LIBRETRO__
|
||||
vr_textured = true;
|
||||
vr_samples_copy |= cache_entry->IsCopy();
|
||||
#endif
|
||||
const float custom_tex_scale = cache_entry->GetWidth() / float(cache_entry->native_width);
|
||||
samplers[i] = TextureCacheBase::GetSamplerState(
|
||||
i, custom_tex_scale, cache_entry->is_custom_tex, cache_entry->has_arbitrary_mips);
|
||||
@@ -576,10 +572,8 @@ void VertexManagerBase::Flush()
|
||||
const auto cache_entry = g_texture_cache->Load(i);
|
||||
if (cache_entry)
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
vr_textured = true;
|
||||
vr_samples_copy |= cache_entry->IsCopy();
|
||||
#endif
|
||||
bool named = false;
|
||||
for (const auto& name : texture_names)
|
||||
named = named || name == cache_entry->texture_info_name;
|
||||
@@ -596,10 +590,8 @@ void VertexManagerBase::Flush()
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef __LIBRETRO__
|
||||
g_libretro_vr_camera.draw_textured = vr_textured;
|
||||
g_libretro_vr_camera.draw_samples_copy = vr_samples_copy;
|
||||
#endif
|
||||
vertex_shader_manager.SetConstants(texture_names, xf_state_manager);
|
||||
if (!bpmem.genMode.zfreeze)
|
||||
{
|
||||
@@ -882,7 +874,6 @@ void VertexManagerBase::UpdatePipelineObject()
|
||||
case ShaderCompilationMode::AsynchronousUberShaders:
|
||||
case ShaderCompilationMode::AsynchronousSkipRendering:
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
/* no threads to build on: asking for the pipeline in the background
|
||||
* would build it on the spot, then an ubershader one besides */
|
||||
if (!g_shader_cache->CanCompileInBackground())
|
||||
@@ -890,7 +881,6 @@ void VertexManagerBase::UpdatePipelineObject()
|
||||
m_current_pipeline_object = g_shader_cache->GetPipelineForUid(m_current_pipeline_config);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// Can we background compile shaders? If so, get the pipeline asynchronously.
|
||||
auto res = g_shader_cache->GetPipelineForUidAsync(m_current_pipeline_config);
|
||||
if (res && (!*res || (*res)->IsReady()))
|
||||
@@ -899,12 +889,10 @@ void VertexManagerBase::UpdatePipelineObject()
|
||||
m_current_pipeline_object = *res;
|
||||
return;
|
||||
}
|
||||
#ifdef __LIBRETRO__
|
||||
/* built and still compiling on the driver's threads: asked again
|
||||
* next draw, until it is ready */
|
||||
if (res)
|
||||
m_pipeline_config_changed = true;
|
||||
#endif
|
||||
|
||||
if (g_ActiveConfig.iShaderCompilationMode == ShaderCompilationMode::AsynchronousUberShaders)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#include "VideoCommon/XFStateManager.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include "Core/System.h"
|
||||
#include "VideoCommon/GeometryShaderManager.h"
|
||||
|
||||
@@ -62,7 +61,6 @@ static bool LibretroVRCameraChanged()
|
||||
screen != g_libretro_vr_camera.screen_applied ||
|
||||
((camera || screen) && g_libretro_vr_camera.dirty);
|
||||
}
|
||||
#endif
|
||||
|
||||
void VertexShaderManager::Init()
|
||||
{
|
||||
@@ -147,7 +145,6 @@ Common::Matrix44 VertexShaderManager::LoadProjectionMatrix()
|
||||
PRIM_LOG("Projection: {} {} {} {} {} {}", rawProjection[0], rawProjection[1], rawProjection[2],
|
||||
rawProjection[3], rawProjection[4], rawProjection[5]);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
const bool use_vr_camera = UseLibretroVRCamera();
|
||||
const bool use_vr_screen = UseLibretroVRScreen();
|
||||
LibretroVRCamera& vr = g_libretro_vr_camera;
|
||||
@@ -184,14 +181,11 @@ Common::Matrix44 VertexShaderManager::LoadProjectionMatrix()
|
||||
Core::System::GetInstance().GetGeometryShaderManager().SetProjectionChanged();
|
||||
vr.applied = use_vr_camera;
|
||||
vr.screen_applied = use_vr_screen;
|
||||
#endif
|
||||
|
||||
auto corrected_matrix = Common::Matrix44::FromArray(m_projection_matrix);
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if (use_vr_camera)
|
||||
corrected_matrix *= g_libretro_vr_camera.view;
|
||||
#endif
|
||||
|
||||
if (g_freelook_camera.IsActive() && xfmem.projection.type == ProjectionType::Perspective)
|
||||
corrected_matrix *= g_freelook_camera.GetView();
|
||||
@@ -204,9 +198,7 @@ Common::Matrix44 VertexShaderManager::LoadProjectionMatrix()
|
||||
void VertexShaderManager::SetProjectionMatrix(XFStateManager& xf_state_manager)
|
||||
{
|
||||
if (xf_state_manager.DidProjectionChange() || g_freelook_camera.GetController()->IsDirty()
|
||||
#ifdef __LIBRETRO__
|
||||
|| LibretroVRCameraChanged()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
xf_state_manager.ResetProjection();
|
||||
@@ -499,9 +491,7 @@ void VertexShaderManager::SetConstants(std::span<const std::string> textures,
|
||||
|
||||
if (xf_state_manager.DidProjectionChange() || g_freelook_camera.GetController()->IsDirty() ||
|
||||
!projection_actions.empty() || m_projection_graphics_mod_change
|
||||
#ifdef __LIBRETRO__
|
||||
|| LibretroVRCameraChanged()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
xf_state_manager.ResetProjection();
|
||||
|
||||
@@ -16,7 +16,6 @@ class PointerWrap;
|
||||
struct PortableVertexDeclaration;
|
||||
class XFStateManager;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
// Head-tracked camera for the libretro core's immersive VR mode.
|
||||
struct LibretroVRCamera
|
||||
{
|
||||
@@ -47,7 +46,6 @@ struct LibretroVRCamera
|
||||
bool draw_samples_copy = false;
|
||||
};
|
||||
extern LibretroVRCamera g_libretro_vr_camera;
|
||||
#endif
|
||||
|
||||
// The non-API dependent parts.
|
||||
class alignas(16) VertexShaderManager
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
#ifdef HAS_VULKAN
|
||||
#include "VideoBackends/Vulkan/VideoBackend.h"
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(__LIBRETRO__)
|
||||
#include "VideoBackends/Metal/VideoBackend.h"
|
||||
#endif
|
||||
|
||||
#include "VideoCommon/AbstractGfx.h"
|
||||
#include "VideoCommon/AsyncRequests.h"
|
||||
@@ -66,9 +63,7 @@
|
||||
#include "VideoCommon/VideoState.h"
|
||||
#include "VideoCommon/Widescreen.h"
|
||||
#include "VideoCommon/XFStateManager.h"
|
||||
#ifdef __LIBRETRO__
|
||||
#include "DolphinLibretro/VideoContexts/ContextStatus.h"
|
||||
#endif
|
||||
|
||||
VideoBackendBase* g_video_backend = nullptr;
|
||||
|
||||
@@ -215,9 +210,6 @@ const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvail
|
||||
backends.push_back(std::make_unique<Vulkan::VideoBackend>());
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(__LIBRETRO__)
|
||||
backends.emplace(backends.begin(), std::make_unique<Metal::VideoBackend>());
|
||||
#endif
|
||||
#ifdef HAS_OPENGL
|
||||
backends.push_back(std::make_unique<SW::VideoSoftware>());
|
||||
#endif
|
||||
@@ -260,10 +252,8 @@ void VideoBackendBase::PopulateBackendInfo(const WindowSystemInfo& wsi)
|
||||
ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
|
||||
g_backend_info.DisplayName = g_video_backend->GetDisplayName();
|
||||
g_video_backend->InitBackendInfo(wsi);
|
||||
#ifdef __LIBRETRO__
|
||||
if (g_backend_info.api_type == APIType::Nothing)
|
||||
return;
|
||||
#endif
|
||||
// We validate the config after initializing the backend info, as system-specific settings
|
||||
// such as anti-aliasing, or the selected adapter may be invalid, and should be checked.
|
||||
g_Config.VerifyValidity();
|
||||
@@ -305,17 +295,13 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr<AbstractGfx> gfx,
|
||||
std::unique_ptr<EFBInterfaceBase> efb_interface,
|
||||
std::unique_ptr<TextureCacheBase> texture_cache)
|
||||
{
|
||||
#ifdef __LIBRETRO__
|
||||
const bool is_initialized = g_context_status.IsInitialized();
|
||||
if(!is_initialized)
|
||||
{
|
||||
#endif
|
||||
memset(reinterpret_cast<u8*>(&g_main_cp_state), 0, sizeof(g_main_cp_state));
|
||||
memset(reinterpret_cast<u8*>(&g_preprocess_cp_state), 0, sizeof(g_preprocess_cp_state));
|
||||
s_tex_mem.fill(0);
|
||||
#ifdef __LIBRETRO__
|
||||
}
|
||||
#endif
|
||||
// do not initialize again for the config window
|
||||
m_initialized = true;
|
||||
|
||||
@@ -347,10 +333,8 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr<AbstractGfx> gfx,
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
if(is_initialized)
|
||||
return true;
|
||||
#endif
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& command_processor = system.GetCommandProcessor();
|
||||
command_processor.Init();
|
||||
@@ -404,7 +388,4 @@ void VideoBackendBase::ShutdownShared()
|
||||
m_initialized = false;
|
||||
|
||||
VertexLoaderManager::Clear();
|
||||
#ifndef __LIBRETRO__
|
||||
system.GetFifo().Shutdown();
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user