mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 16:59:18 +01:00
Merge pull request #7151 from lioncash/const
Movie: Make pointer parameters const where applicable
This commit is contained in:
commit
d07e599a74
@ -7,6 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstring>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <mbedtls/config.h>
|
#include <mbedtls/config.h>
|
||||||
@ -642,7 +643,7 @@ static void SetInputDisplayString(ControllerState padState, int controllerID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: CPU Thread
|
// NOTE: CPU Thread
|
||||||
static void SetWiiInputDisplayString(int remoteID, u8* const data,
|
static void SetWiiInputDisplayString(int remoteID, const u8* const data,
|
||||||
const WiimoteEmu::ReportFeatures& rptf, int ext,
|
const WiimoteEmu::ReportFeatures& rptf, int ext,
|
||||||
const wiimote_key key)
|
const wiimote_key key)
|
||||||
{
|
{
|
||||||
@ -650,14 +651,16 @@ static void SetWiiInputDisplayString(int remoteID, u8* const data,
|
|||||||
|
|
||||||
std::string display_str = StringFromFormat("R%d:", remoteID + 1);
|
std::string display_str = StringFromFormat("R%d:", remoteID + 1);
|
||||||
|
|
||||||
u8* const coreData = rptf.core ? (data + rptf.core) : nullptr;
|
const u8* const coreData = rptf.core ? (data + rptf.core) : nullptr;
|
||||||
u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr;
|
const u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr;
|
||||||
u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr;
|
const u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr;
|
||||||
u8* const extData = rptf.ext ? (data + rptf.ext) : nullptr;
|
const u8* const extData = rptf.ext ? (data + rptf.ext) : nullptr;
|
||||||
|
|
||||||
if (coreData)
|
if (coreData)
|
||||||
{
|
{
|
||||||
wm_buttons buttons = *(wm_buttons*)coreData;
|
wm_buttons buttons;
|
||||||
|
std::memcpy(&buttons, coreData, sizeof(buttons));
|
||||||
|
|
||||||
if (buttons.left)
|
if (buttons.left)
|
||||||
display_str += " LEFT";
|
display_str += " LEFT";
|
||||||
if (buttons.right)
|
if (buttons.right)
|
||||||
@ -684,10 +687,12 @@ static void SetWiiInputDisplayString(int remoteID, u8* const data,
|
|||||||
// A few bits of accelData are actually inside the coreData struct.
|
// A few bits of accelData are actually inside the coreData struct.
|
||||||
if (accelData)
|
if (accelData)
|
||||||
{
|
{
|
||||||
wm_accel* dt = (wm_accel*)accelData;
|
wm_accel dt;
|
||||||
display_str += StringFromFormat(" ACC:%d,%d,%d", dt->x << 2 | buttons.acc_x_lsb,
|
std::memcpy(&dt, accelData, sizeof(dt));
|
||||||
dt->y << 2 | buttons.acc_y_lsb << 1,
|
|
||||||
dt->z << 2 | buttons.acc_z_lsb << 1);
|
display_str +=
|
||||||
|
StringFromFormat(" ACC:%d,%d,%d", dt.x << 2 | buttons.acc_x_lsb,
|
||||||
|
dt.y << 2 | buttons.acc_y_lsb << 1, dt.z << 2 | buttons.acc_z_lsb << 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +769,7 @@ static void SetWiiInputDisplayString(int remoteID, u8* const data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: CPU Thread
|
// NOTE: CPU Thread
|
||||||
void CheckPadStatus(GCPadStatus* PadStatus, int controllerID)
|
void CheckPadStatus(const GCPadStatus* PadStatus, int controllerID)
|
||||||
{
|
{
|
||||||
s_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
|
s_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
|
||||||
s_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
|
s_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
|
||||||
@ -800,7 +805,7 @@ void CheckPadStatus(GCPadStatus* PadStatus, int controllerID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: CPU Thread
|
// NOTE: CPU Thread
|
||||||
void RecordInput(GCPadStatus* PadStatus, int controllerID)
|
void RecordInput(const GCPadStatus* PadStatus, int controllerID)
|
||||||
{
|
{
|
||||||
if (!IsRecordingInput() || !IsUsingPad(controllerID))
|
if (!IsRecordingInput() || !IsUsingPad(controllerID))
|
||||||
return;
|
return;
|
||||||
@ -813,8 +818,8 @@ void RecordInput(GCPadStatus* PadStatus, int controllerID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: CPU Thread
|
// NOTE: CPU Thread
|
||||||
void CheckWiimoteStatus(int wiimote, u8* data, const WiimoteEmu::ReportFeatures& rptf, int ext,
|
void CheckWiimoteStatus(int wiimote, const u8* data, const WiimoteEmu::ReportFeatures& rptf,
|
||||||
const wiimote_key key)
|
int ext, const wiimote_key key)
|
||||||
{
|
{
|
||||||
SetWiiInputDisplayString(wiimote, data, rptf, ext, key);
|
SetWiiInputDisplayString(wiimote, data, rptf, ext, key);
|
||||||
|
|
||||||
@ -822,7 +827,7 @@ void CheckWiimoteStatus(int wiimote, u8* data, const WiimoteEmu::ReportFeatures&
|
|||||||
RecordWiimote(wiimote, data, rptf.size);
|
RecordWiimote(wiimote, data, rptf.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordWiimote(int wiimote, u8* data, u8 size)
|
void RecordWiimote(int wiimote, const u8* data, u8 size)
|
||||||
{
|
{
|
||||||
if (!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
if (!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
||||||
return;
|
return;
|
||||||
|
@ -156,8 +156,8 @@ void ChangeWiiPads(bool instantly = false);
|
|||||||
void SetReadOnly(bool bEnabled);
|
void SetReadOnly(bool bEnabled);
|
||||||
|
|
||||||
bool BeginRecordingInput(int controllers);
|
bool BeginRecordingInput(int controllers);
|
||||||
void RecordInput(GCPadStatus* PadStatus, int controllerID);
|
void RecordInput(const GCPadStatus* PadStatus, int controllerID);
|
||||||
void RecordWiimote(int wiimote, u8* data, u8 size);
|
void RecordWiimote(int wiimote, const u8* data, u8 size);
|
||||||
|
|
||||||
bool PlayInput(const std::string& movie_path, std::optional<std::string>* savestate_path);
|
bool PlayInput(const std::string& movie_path, std::optional<std::string>* savestate_path);
|
||||||
void LoadInput(const std::string& movie_path);
|
void LoadInput(const std::string& movie_path);
|
||||||
@ -169,8 +169,8 @@ void EndPlayInput(bool cont);
|
|||||||
void SaveRecording(const std::string& filename);
|
void SaveRecording(const std::string& filename);
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void CheckPadStatus(GCPadStatus* PadStatus, int controllerID);
|
void CheckPadStatus(const GCPadStatus* PadStatus, int controllerID);
|
||||||
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf,
|
void CheckWiimoteStatus(int wiimote, const u8* data, const struct WiimoteEmu::ReportFeatures& rptf,
|
||||||
int ext, const wiimote_key key);
|
int ext, const wiimote_key key);
|
||||||
|
|
||||||
std::string GetInputDisplay();
|
std::string GetInputDisplay();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user