IPC_HLE/stm: Clean up naming

Switches to the new naming conventions.
This commit is contained in:
Léo Lam 2016-09-18 23:41:43 +02:00
parent faf202f0f6
commit 5fb17a9014
2 changed files with 55 additions and 55 deletions

View File

@ -4,37 +4,37 @@
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::Open(u32 _CommandAddress, u32 _Mode) IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::Open(u32 command_address, u32 mode)
{ {
INFO_LOG(WII_IPC_STM, "STM immediate: Open"); INFO_LOG(WII_IPC_STM, "STM immediate: Open");
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); Memory::Write_U32(GetDeviceID(), command_address + 4);
m_Active = true; m_Active = true;
return GetDefaultReply(); return GetDefaultReply();
} }
IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::Close(u32 _CommandAddress, bool _bForce) IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::Close(u32 command_address, bool force)
{ {
INFO_LOG(WII_IPC_STM, "STM immediate: Close"); INFO_LOG(WII_IPC_STM, "STM immediate: Close");
if (!_bForce) if (!force)
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, command_address + 4);
m_Active = false; m_Active = false;
return GetDefaultReply(); return GetDefaultReply();
} }
IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 _CommandAddress) IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 command_address)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 parameter = Memory::Read_U32(command_address + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 buffer_in = Memory::Read_U32(command_address + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 buffer_in_size = Memory::Read_U32(command_address + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 buffer_out = Memory::Read_U32(command_address + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 buffer_out_size = Memory::Read_U32(command_address + 0x1C);
// Prepare the out buffer(s) with zeroes as a safety precaution // Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values // to avoid returning bad values
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(buffer_out, 0, buffer_out_size);
u32 ReturnValue = 0; u32 return_value = 0;
switch (Parameter) switch (parameter)
{ {
case IOCTL_STM_RELEASE_EH: case IOCTL_STM_RELEASE_EH:
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
@ -49,9 +49,9 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 _CommandAddress)
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes) case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING"); INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING");
// DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_STM); // DumpCommands(buffer_in, buffer_in_size / 4, LogTypes::WII_IPC_STM);
// Memory::Write_U32(1, BufferOut); // Memory::Write_U32(1, buffer_out);
// ReturnValue = 1; // return_value = 1;
break; break;
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes) case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
@ -61,74 +61,74 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 _CommandAddress)
default: default:
{ {
_dbg_assert_msg_(WII_IPC_STM, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter); _dbg_assert_msg_(WII_IPC_STM, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", parameter);
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
DEBUG_LOG(WII_IPC_STM, " Parameter: 0x%x", Parameter); DEBUG_LOG(WII_IPC_STM, " parameter: 0x%x", parameter);
DEBUG_LOG(WII_IPC_STM, " InBuffer: 0x%08x", BufferIn); DEBUG_LOG(WII_IPC_STM, " InBuffer: 0x%08x", buffer_in);
DEBUG_LOG(WII_IPC_STM, " InBufferSize: 0x%08x", BufferInSize); DEBUG_LOG(WII_IPC_STM, " InBufferSize: 0x%08x", buffer_in_size);
DEBUG_LOG(WII_IPC_STM, " OutBuffer: 0x%08x", BufferOut); DEBUG_LOG(WII_IPC_STM, " OutBuffer: 0x%08x", buffer_out);
DEBUG_LOG(WII_IPC_STM, " OutBufferSize: 0x%08x", BufferOutSize); DEBUG_LOG(WII_IPC_STM, " OutBufferSize: 0x%08x", buffer_out_size);
} }
break; break;
} }
// Write return value to the IPC call // Write return value to the IPC call
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); Memory::Write_U32(return_value, command_address + 0x4);
return GetDefaultReply(); return GetDefaultReply();
} }
IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::Open(u32 _CommandAddress, u32 _Mode) IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::Open(u32 command_address, u32 mode)
{ {
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); Memory::Write_U32(GetDeviceID(), command_address + 4);
m_Active = true; m_Active = true;
return GetDefaultReply(); return GetDefaultReply();
} }
IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::Close(u32 _CommandAddress, bool _bForce) IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::Close(u32 command_address, bool force)
{ {
m_EventHookAddress = 0; m_event_hook_address = 0;
INFO_LOG(WII_IPC_STM, "STM eventhook: Close"); INFO_LOG(WII_IPC_STM, "STM eventhook: Close");
if (!_bForce) if (!force)
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, command_address + 4);
m_Active = false; m_Active = false;
return GetDefaultReply(); return GetDefaultReply();
} }
IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(u32 _CommandAddress) IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(u32 command_address)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 parameter = Memory::Read_U32(command_address + 0x0C);
if (Parameter != IOCTL_STM_EVENTHOOK) if (parameter != IOCTL_STM_EVENTHOOK)
{ {
ERROR_LOG(WII_IPC_STM, "Bad IOCtl in CWII_IPC_HLE_Device_stm_eventhook"); ERROR_LOG(WII_IPC_STM, "Bad IOCtl in CWII_IPC_HLE_Device_stm_eventhook");
Memory::Write_U32(FS_EINVAL, _CommandAddress + 4); Memory::Write_U32(FS_EINVAL, command_address + 4);
return GetDefaultReply(); return GetDefaultReply();
} }
// IOCTL_STM_EVENTHOOK waits until the reset button or power button // IOCTL_STM_EVENTHOOK waits until the reset button or power button
// is pressed. // is pressed.
m_EventHookAddress = _CommandAddress; m_event_hook_address = command_address;
return GetNoReply(); return GetNoReply();
} }
void CWII_IPC_HLE_Device_stm_eventhook::ResetButton() void CWII_IPC_HLE_Device_stm_eventhook::ResetButton()
{ {
if (!m_Active || m_EventHookAddress == 0) if (!m_Active || m_event_hook_address == 0)
{ {
// If the device isn't open, ignore the button press. // If the device isn't open, ignore the button press.
return; return;
} }
// The reset button returns STM_EVENT_RESET. // The reset button returns STM_EVENT_RESET.
u32 BufferOut = Memory::Read_U32(m_EventHookAddress + 0x18); u32 buffer_out = Memory::Read_U32(m_event_hook_address + 0x18);
Memory::Write_U32(STM_EVENT_RESET, BufferOut); Memory::Write_U32(STM_EVENT_RESET, buffer_out);
// Fill in command buffer. // Fill in command buffer.
Memory::Write_U32(FS_SUCCESS, m_EventHookAddress + 4); Memory::Write_U32(FS_SUCCESS, m_event_hook_address + 4);
Memory::Write_U32(IPC_REP_ASYNC, m_EventHookAddress); Memory::Write_U32(IPC_REP_ASYNC, m_event_hook_address);
Memory::Write_U32(IPC_CMD_IOCTL, m_EventHookAddress + 8); Memory::Write_U32(IPC_CMD_IOCTL, m_event_hook_address + 8);
// Generate a reply to the IPC command. // Generate a reply to the IPC command.
WII_IPC_HLE_Interface::EnqueueReply(m_EventHookAddress); WII_IPC_HLE_Interface::EnqueueReply(m_event_hook_address);
} }

View File

@ -31,36 +31,36 @@ enum
}; };
// The /dev/stm/immediate // The /dev/stm/immediate
class CWII_IPC_HLE_Device_stm_immediate : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_stm_immediate final : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_stm_immediate(u32 device_id, const std::string& device_name)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(device_id, device_name)
{ {
} }
~CWII_IPC_HLE_Device_stm_immediate() override = default; ~CWII_IPC_HLE_Device_stm_immediate() override = default;
IPCCommandResult Open(u32 _CommandAddress, u32 _Mode) override; IPCCommandResult Open(u32 command_address, u32 mode) override;
IPCCommandResult Close(u32 _CommandAddress, bool _bForce) override; IPCCommandResult Close(u32 command_address, bool force) override;
IPCCommandResult IOCtl(u32 _CommandAddress) override; IPCCommandResult IOCtl(u32 command_address) override;
}; };
// The /dev/stm/eventhook // The /dev/stm/eventhook
class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_stm_eventhook final : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_stm_eventhook(u32 device_id, const std::string& device_name)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName), m_EventHookAddress(0) : IWII_IPC_HLE_Device(device_id, device_name)
{ {
} }
~CWII_IPC_HLE_Device_stm_eventhook() override = default; ~CWII_IPC_HLE_Device_stm_eventhook() override = default;
IPCCommandResult Open(u32 _CommandAddress, u32 _Mode) override; IPCCommandResult Open(u32 command_address, u32 mode) override;
IPCCommandResult Close(u32 _CommandAddress, bool _bForce) override; IPCCommandResult Close(u32 command_address, bool force) override;
IPCCommandResult IOCtl(u32 _CommandAddress) override; IPCCommandResult IOCtl(u32 command_address) override;
void ResetButton(); void ResetButton();
// STATE_TO_SAVE // STATE_TO_SAVE
u32 m_EventHookAddress; u32 m_event_hook_address = 0;
}; };