mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-05 15:55:10 +00:00
Compare commits
8 Commits
cd5dde9940
...
ea83359957
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ea83359957 | ||
![]() |
033a0540f7 | ||
![]() |
64a20c74fc | ||
![]() |
76c114a02b | ||
![]() |
c248f1afa4 | ||
![]() |
63257d1ee9 | ||
![]() |
18f0bd1d4b | ||
![]() |
bc40d943bb |
@ -174,6 +174,15 @@ void AddCode(ARCode code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CountEnabledCodes()
|
||||||
|
{
|
||||||
|
if (!Config::AreCheatsEnabled())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
std::lock_guard guard(s_lock);
|
||||||
|
return s_active_codes.size();
|
||||||
|
}
|
||||||
|
|
||||||
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini,
|
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini,
|
||||||
const std::string& game_id, u16 revision)
|
const std::string& game_id, u16 revision)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@ void SetSyncedCodesAsActive();
|
|||||||
void UpdateSyncedCodes(std::span<const ARCode> codes);
|
void UpdateSyncedCodes(std::span<const ARCode> codes);
|
||||||
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes);
|
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes);
|
||||||
void AddCode(ARCode new_code);
|
void AddCode(ARCode new_code);
|
||||||
|
size_t CountEnabledCodes();
|
||||||
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini,
|
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini,
|
||||||
const std::string& game_id, u16 revision);
|
const std::string& game_id, u16 revision);
|
||||||
|
|
||||||
|
@ -203,8 +203,8 @@ private:
|
|||||||
EventType* m_ev_lost = nullptr;
|
EventType* m_ev_lost = nullptr;
|
||||||
|
|
||||||
CPUThreadConfigCallback::ConfigChangedCallbackID m_registered_config_callback_id;
|
CPUThreadConfigCallback::ConfigChangedCallbackID m_registered_config_callback_id;
|
||||||
float m_config_oc_factor = 0.0f;
|
float m_config_oc_factor = 1.0f;
|
||||||
float m_config_oc_inv_factor = 0.0f;
|
float m_config_oc_inv_factor = 1.0f;
|
||||||
bool m_config_sync_on_skip_idle = false;
|
bool m_config_sync_on_skip_idle = false;
|
||||||
|
|
||||||
s64 m_throttle_reference_cycle = 0;
|
s64 m_throttle_reference_cycle = 0;
|
||||||
|
@ -50,6 +50,15 @@ static std::vector<GeckoCode> s_active_codes;
|
|||||||
static std::vector<GeckoCode> s_synced_codes;
|
static std::vector<GeckoCode> s_synced_codes;
|
||||||
static std::mutex s_active_codes_lock;
|
static std::mutex s_active_codes_lock;
|
||||||
|
|
||||||
|
size_t CountEnabledCodes()
|
||||||
|
{
|
||||||
|
if (!Config::AreCheatsEnabled())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
std::lock_guard guard(s_active_codes_lock);
|
||||||
|
return s_active_codes.size();
|
||||||
|
}
|
||||||
|
|
||||||
void SetActiveCodes(std::span<const GeckoCode> gcodes, const std::string& game_id, u16 revision)
|
void SetActiveCodes(std::span<const GeckoCode> gcodes, const std::string& game_id, u16 revision)
|
||||||
{
|
{
|
||||||
std::lock_guard lk(s_active_codes_lock);
|
std::lock_guard lk(s_active_codes_lock);
|
||||||
|
@ -60,6 +60,7 @@ constexpr u32 HLE_TRAMPOLINE_ADDRESS = INSTALLER_END_ADDRESS - 4;
|
|||||||
// preserve the emulation performance.
|
// preserve the emulation performance.
|
||||||
constexpr u32 MAGIC_GAMEID = 0xD01F1BAD;
|
constexpr u32 MAGIC_GAMEID = 0xD01F1BAD;
|
||||||
|
|
||||||
|
size_t CountEnabledCodes();
|
||||||
void SetActiveCodes(std::span<const GeckoCode> gcodes, const std::string& game_id, u16 revision);
|
void SetActiveCodes(std::span<const GeckoCode> gcodes, const std::string& game_id, u16 revision);
|
||||||
void SetSyncedCodesAsActive();
|
void SetSyncedCodesAsActive();
|
||||||
void UpdateSyncedCodes(std::span<const GeckoCode> gcodes);
|
void UpdateSyncedCodes(std::span<const GeckoCode> gcodes);
|
||||||
|
@ -454,7 +454,7 @@ private:
|
|||||||
u32 m_even_field_last_hl = 0; // index last halfline of the even field
|
u32 m_even_field_last_hl = 0; // index last halfline of the even field
|
||||||
u32 m_odd_field_last_hl = 0; // index last halfline of the odd field
|
u32 m_odd_field_last_hl = 0; // index last halfline of the odd field
|
||||||
|
|
||||||
float m_config_vi_oc_factor = 0.0f;
|
float m_config_vi_oc_factor = 1.0f;
|
||||||
|
|
||||||
Config::ConfigChangedCallbackID m_config_changed_callback_id;
|
Config::ConfigChangedCallbackID m_config_changed_callback_id;
|
||||||
Core::System& m_system;
|
Core::System& m_system;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Config/WiimoteSettings.h"
|
#include "Core/Config/WiimoteSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/HW/WiimoteCommon/DataReport.h"
|
#include "Core/HW/WiimoteCommon/DataReport.h"
|
||||||
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
|
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
|
||||||
@ -207,7 +208,14 @@ void Wiimote::WriteReport(Report rpt)
|
|||||||
m_rumble_state = new_rumble_state;
|
m_rumble_state = new_rumble_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_write_reports.Push(std::move(rpt));
|
auto& core_timing = Core::System::GetInstance().GetCoreTiming();
|
||||||
|
|
||||||
|
// When invoked from the CPU thread, send the report at the proper time.
|
||||||
|
// From other threads (e.g. on construction/destruction) send the report immediately.
|
||||||
|
const auto report_time =
|
||||||
|
Core::IsCPUThread() ? core_timing.GetTargetHostTime(core_timing.GetTicks()) : Clock::now();
|
||||||
|
|
||||||
|
m_write_reports.Emplace(report_time, std::move(rpt));
|
||||||
IOWakeup();
|
IOWakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +342,8 @@ bool Wiimote::Write()
|
|||||||
if (m_write_reports.Empty())
|
if (m_write_reports.Empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Report const& rpt = m_write_reports.Front();
|
auto const& timed_report = m_write_reports.Front();
|
||||||
|
auto const& rpt = timed_report.report;
|
||||||
|
|
||||||
if (m_balance_board_dump_port > 0 && m_index == WIIMOTE_BALANCE_BOARD)
|
if (m_balance_board_dump_port > 0 && m_index == WIIMOTE_BALANCE_BOARD)
|
||||||
{
|
{
|
||||||
@ -342,6 +351,9 @@ bool Wiimote::Write()
|
|||||||
(void)Socket.send((char*)rpt.data(), rpt.size(), sf::IpAddress::LocalHost,
|
(void)Socket.send((char*)rpt.data(), rpt.size(), sf::IpAddress::LocalHost,
|
||||||
m_balance_board_dump_port);
|
m_balance_board_dump_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write the report at the proper time, mainly for speaker data, not that it will help much.
|
||||||
|
std::this_thread::sleep_until(timed_report.time);
|
||||||
int ret = IOWrite(rpt.data(), rpt.size());
|
int ret = IOWrite(rpt.data(), rpt.size());
|
||||||
|
|
||||||
m_write_reports.Pop();
|
m_write_reports.Pop();
|
||||||
|
@ -154,7 +154,14 @@ private:
|
|||||||
Common::Event m_thread_ready_event;
|
Common::Event m_thread_ready_event;
|
||||||
|
|
||||||
Common::SPSCQueue<Report> m_read_reports;
|
Common::SPSCQueue<Report> m_read_reports;
|
||||||
Common::SPSCQueue<Report> m_write_reports;
|
|
||||||
|
struct TimedReport
|
||||||
|
{
|
||||||
|
TimePoint time;
|
||||||
|
Report report;
|
||||||
|
};
|
||||||
|
|
||||||
|
Common::SPSCQueue<TimedReport> m_write_reports;
|
||||||
|
|
||||||
bool m_speaker_enabled_in_dolphin_config = false;
|
bool m_speaker_enabled_in_dolphin_config = false;
|
||||||
int m_balance_board_dump_port = 0;
|
int m_balance_board_dump_port = 0;
|
||||||
|
@ -28,7 +28,7 @@ constexpr u16 LegalNitroChannelMask = 0b0011'1111'1111'1110u;
|
|||||||
|
|
||||||
u16 SelectWifiChannel(u16 enabled_channels_mask, u16 current_channel)
|
u16 SelectWifiChannel(u16 enabled_channels_mask, u16 current_channel)
|
||||||
{
|
{
|
||||||
const Common::BitSet<u16> enabled_channels{enabled_channels_mask & LegalChannelMask};
|
const Common::BitSet<u16> enabled_channels(enabled_channels_mask & LegalChannelMask);
|
||||||
u16 next_channel = current_channel;
|
u16 next_channel = current_channel;
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "Core/PowerPC/MMU.h"
|
#include "Core/PowerPC/MMU.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
|
|
||||||
namespace PatchEngine
|
namespace PatchEngine
|
||||||
{
|
{
|
||||||
@ -200,6 +201,18 @@ void LoadPatches()
|
|||||||
ActionReplay::LoadAndApplyCodes(globalIni, localIni, sconfig.GetGameID(),
|
ActionReplay::LoadAndApplyCodes(globalIni, localIni, sconfig.GetGameID(),
|
||||||
sconfig.GetRevision());
|
sconfig.GetRevision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t enabled_patch_count =
|
||||||
|
std::ranges::count_if(s_on_frame, [](Patch patch) { return patch.enabled; });
|
||||||
|
if (enabled_patch_count > 0)
|
||||||
|
{
|
||||||
|
OSD::AddMessage(fmt::format("{} game patch(es) enabled", enabled_patch_count),
|
||||||
|
OSD::Duration::NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t enabled_cheat_count = ActionReplay::CountEnabledCodes() + Gecko::CountEnabledCodes();
|
||||||
|
if (enabled_cheat_count > 0)
|
||||||
|
OSD::AddMessage(fmt::format("{} cheat(s) enabled", enabled_cheat_count), OSD::Duration::NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Patch>& patches)
|
static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Patch>& patches)
|
||||||
|
Loading…
Reference in New Issue
Block a user