HostInterface: Add software cursor mode
This will probably need to be extended in the future.
This commit is contained in:
parent
f98bb033ff
commit
f9eb3719e3
|
@ -1002,6 +1002,8 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||||
si.SetBoolValue("Display", "ShowSpeed", false);
|
si.SetBoolValue("Display", "ShowSpeed", false);
|
||||||
si.SetBoolValue("Display", "Fullscreen", false);
|
si.SetBoolValue("Display", "Fullscreen", false);
|
||||||
si.SetBoolValue("Display", "VSync", true);
|
si.SetBoolValue("Display", "VSync", true);
|
||||||
|
si.SetStringValue("Display", "SoftwareCursorPath", "");
|
||||||
|
si.SetFloatValue("Display", "SoftwareCursorScale", 1.0f);
|
||||||
|
|
||||||
si.SetBoolValue("CDROM", "ReadThread", true);
|
si.SetBoolValue("CDROM", "ReadThread", true);
|
||||||
si.SetBoolValue("CDROM", "RegionCheck", true);
|
si.SetBoolValue("CDROM", "RegionCheck", true);
|
||||||
|
@ -1152,6 +1154,21 @@ void HostInterface::UpdateSettings(SettingsInterface& si)
|
||||||
if (m_display && m_settings.display_integer_scaling != old_settings.display_integer_scaling)
|
if (m_display && m_settings.display_integer_scaling != old_settings.display_integer_scaling)
|
||||||
m_display->SetDisplayIntegerScaling(m_settings.display_integer_scaling);
|
m_display->SetDisplayIntegerScaling(m_settings.display_integer_scaling);
|
||||||
|
|
||||||
|
if (m_software_cursor_use_count > 0 && m_display &&
|
||||||
|
(m_settings.display_software_cursor_path != old_settings.display_software_cursor_path ||
|
||||||
|
m_settings.display_software_cursor_scale != old_settings.display_software_cursor_scale))
|
||||||
|
{
|
||||||
|
if (m_settings.display_software_cursor_path.empty())
|
||||||
|
{
|
||||||
|
m_display->ClearSoftwareCursor();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_display->SetSoftwareCursor(m_settings.display_software_cursor_path.c_str(),
|
||||||
|
m_settings.display_software_cursor_scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_settings.log_level != old_settings.log_level || m_settings.log_filter != old_settings.log_filter ||
|
if (m_settings.log_level != old_settings.log_level || m_settings.log_filter != old_settings.log_filter ||
|
||||||
m_settings.log_to_console != old_settings.log_to_console ||
|
m_settings.log_to_console != old_settings.log_to_console ||
|
||||||
m_settings.log_to_window != old_settings.log_to_window || m_settings.log_to_file != old_settings.log_to_file)
|
m_settings.log_to_window != old_settings.log_to_window || m_settings.log_to_file != old_settings.log_to_file)
|
||||||
|
@ -1361,3 +1378,21 @@ bool HostInterface::SaveScreenshot(const char* filename /* = nullptr */, bool fu
|
||||||
AddFormattedOSDMessage(5.0f, "Screenshot saved to '%s'.", filename);
|
AddFormattedOSDMessage(5.0f, "Screenshot saved to '%s'.", filename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HostInterface::EnableSoftwareCursor()
|
||||||
|
{
|
||||||
|
if (m_software_cursor_use_count++ > 0 || m_settings.display_software_cursor_path.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_display->SetSoftwareCursor(m_settings.display_software_cursor_path.c_str(),
|
||||||
|
m_settings.display_software_cursor_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HostInterface::DisableSoftwareCursor()
|
||||||
|
{
|
||||||
|
DebugAssert(m_software_cursor_use_count > 0);
|
||||||
|
if (--m_software_cursor_use_count > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_display->ClearSoftwareCursor();
|
||||||
|
}
|
||||||
|
|
|
@ -166,6 +166,12 @@ public:
|
||||||
/// Deletes save states for the specified game code. If resume is set, the resume state is deleted too.
|
/// Deletes save states for the specified game code. If resume is set, the resume state is deleted too.
|
||||||
void DeleteSaveStates(const char* game_code, bool resume);
|
void DeleteSaveStates(const char* game_code, bool resume);
|
||||||
|
|
||||||
|
/// Enables the software cursor. Can be called multiple times, but must be matched by a call to DisableSoftwareCursor().
|
||||||
|
void EnableSoftwareCursor();
|
||||||
|
|
||||||
|
/// Disables the software cursor, preventing it from being renderered.
|
||||||
|
void DisableSoftwareCursor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
|
@ -270,6 +276,8 @@ protected:
|
||||||
std::deque<OSDMessage> m_osd_messages;
|
std::deque<OSDMessage> m_osd_messages;
|
||||||
std::mutex m_osd_messages_lock;
|
std::mutex m_osd_messages_lock;
|
||||||
|
|
||||||
|
u32 m_software_cursor_use_count = 0;
|
||||||
|
|
||||||
bool m_paused = false;
|
bool m_paused = false;
|
||||||
bool m_speed_limiter_temp_disabled = false;
|
bool m_speed_limiter_temp_disabled = false;
|
||||||
bool m_speed_limiter_enabled = false;
|
bool m_speed_limiter_enabled = false;
|
||||||
|
|
|
@ -9,9 +9,15 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
Log_SetChannel(NamcoGunCon);
|
Log_SetChannel(NamcoGunCon);
|
||||||
|
|
||||||
NamcoGunCon::NamcoGunCon(System* system) : m_system(system) {}
|
NamcoGunCon::NamcoGunCon(System* system) : m_system(system)
|
||||||
|
{
|
||||||
|
m_system->GetHostInterface()->EnableSoftwareCursor();
|
||||||
|
}
|
||||||
|
|
||||||
NamcoGunCon::~NamcoGunCon() = default;
|
NamcoGunCon::~NamcoGunCon()
|
||||||
|
{
|
||||||
|
m_system->GetHostInterface()->DisableSoftwareCursor();
|
||||||
|
}
|
||||||
|
|
||||||
ControllerType NamcoGunCon::GetType() const
|
ControllerType NamcoGunCon::GetType() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "host_interface.h"
|
#include "host_interface.h"
|
||||||
#include <array>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
Settings::Settings() = default;
|
Settings::Settings() = default;
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ void Settings::Load(SettingsInterface& si)
|
||||||
display_show_vps = si.GetBoolValue("Display", "ShowVPS", false);
|
display_show_vps = si.GetBoolValue("Display", "ShowVPS", false);
|
||||||
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
||||||
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
||||||
|
display_software_cursor_path = si.GetStringValue("Display", "SoftwareCursorPath", "");
|
||||||
|
display_software_cursor_scale = si.GetFloatValue("Display", "SoftwareCursorScale", 1.0f);
|
||||||
|
|
||||||
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
||||||
cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", true);
|
cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", true);
|
||||||
|
@ -143,6 +145,8 @@ void Settings::Save(SettingsInterface& si) const
|
||||||
si.SetBoolValue("Display", "ShowVPS", display_show_vps);
|
si.SetBoolValue("Display", "ShowVPS", display_show_vps);
|
||||||
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
||||||
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
||||||
|
si.SetStringValue("Display", "SoftwareCursorPath", display_software_cursor_path.c_str());
|
||||||
|
si.SetFloatValue("Display", "SoftwareCursorScale", display_software_cursor_scale);
|
||||||
|
|
||||||
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
||||||
si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check);
|
si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check);
|
||||||
|
|
|
@ -64,6 +64,8 @@ struct Settings
|
||||||
bool display_show_vps = false;
|
bool display_show_vps = false;
|
||||||
bool display_show_speed = false;
|
bool display_show_speed = false;
|
||||||
bool video_sync_enabled = true;
|
bool video_sync_enabled = true;
|
||||||
|
std::string display_software_cursor_path;
|
||||||
|
float display_software_cursor_scale = 1.0f;
|
||||||
|
|
||||||
bool cdrom_read_thread = true;
|
bool cdrom_read_thread = true;
|
||||||
bool cdrom_region_check = true;
|
bool cdrom_region_check = true;
|
||||||
|
|
Loading…
Reference in New Issue