AMMediaboard: Deduplicate code into AMMBCommandModifyMyIPaddr.
This commit is contained in:
1 parent
ce85c4d81d
commit
0713045d4f
1 file changed
+18
-29
@@ -894,6 +894,21 @@ static void AMMBCommandSetSockOpt(u32 parameter_offset, u32 network_buffer_base)
|
|||||||
s_media_buffer_32[1] = ret;
|
s_media_buffer_32[1] = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AMMBCommandModifyMyIPaddr(u32 parameter_offset, u32 network_buffer_base)
|
||||||
|
{
|
||||||
|
const u32 net_buffer_offset = s_media_buffer_32[parameter_offset] - network_buffer_base;
|
||||||
|
|
||||||
|
if (!NetworkCMDBufferCheck(net_buffer_offset, MAX_IPV4_STRING_LENGTH))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* ip_address = reinterpret_cast<char*>(s_network_command_buffer + net_buffer_offset);
|
||||||
|
|
||||||
|
NOTICE_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: modifyMyIPaddr({})",
|
||||||
|
fmt::string_view(ip_address, MAX_IPV4_STRING_LENGTH));
|
||||||
|
}
|
||||||
|
|
||||||
static void FileWriteData(Memory::MemoryManager& memory, File::IOFile* file, u32 seek_pos,
|
static void FileWriteData(Memory::MemoryManager& memory, File::IOFile* file, u32 seek_pos,
|
||||||
u32 address, std::size_t length)
|
u32 address, std::size_t length)
|
||||||
{
|
{
|
||||||
@@ -1324,21 +1339,8 @@ u32 ExecuteCommand(std::array<u32, 3>& dicmd_buf, u32* diimm_buf, u32 address, u
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AMMBCommand::ModifyMyIPaddr:
|
case AMMBCommand::ModifyMyIPaddr:
|
||||||
{
|
AMMBCommandModifyMyIPaddr(2, NetworkCommandAddress2);
|
||||||
const u32 net_buffer_offset = s_media_buffer_32[2] - NetworkCommandAddress2;
|
|
||||||
|
|
||||||
if (!NetworkCMDBufferCheck(net_buffer_offset, MAX_IPV4_STRING_LENGTH))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* ip_address =
|
|
||||||
reinterpret_cast<char*>(s_network_command_buffer + net_buffer_offset);
|
|
||||||
|
|
||||||
NOTICE_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: modifyMyIPaddr({})\n",
|
|
||||||
fmt::string_view(ip_address, MAX_IPV4_STRING_LENGTH));
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case AMMBCommand::GetLastError:
|
case AMMBCommand::GetLastError:
|
||||||
{
|
{
|
||||||
const auto fd = GetHostSocket(GuestSocket(s_media_buffer_32[2]));
|
const auto fd = GetHostSocket(GuestSocket(s_media_buffer_32[2]));
|
||||||
@@ -1665,21 +1667,8 @@ u32 ExecuteCommand(std::array<u32, 3>& dicmd_buf, u32* diimm_buf, u32 address, u
|
|||||||
AMMBCommandSetSockOpt(10, NetworkCommandAddress1);
|
AMMBCommandSetSockOpt(10, NetworkCommandAddress1);
|
||||||
break;
|
break;
|
||||||
case AMMBCommand::ModifyMyIPaddr:
|
case AMMBCommand::ModifyMyIPaddr:
|
||||||
{
|
AMMBCommandModifyMyIPaddr(10, NetworkCommandAddress1);
|
||||||
const u32 net_buffer_offset = s_media_buffer_32[10] - NetworkCommandAddress1;
|
break;
|
||||||
|
|
||||||
if (!NetworkCMDBufferCheck(net_buffer_offset, MAX_IPV4_STRING_LENGTH))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* ip_address =
|
|
||||||
reinterpret_cast<char*>(s_network_command_buffer + net_buffer_offset);
|
|
||||||
|
|
||||||
NOTICE_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: modifyMyIPaddr({})\n",
|
|
||||||
fmt::string_view(ip_address, MAX_IPV4_STRING_LENGTH));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Empty reply
|
// Empty reply
|
||||||
case AMMBCommand::InitLink:
|
case AMMBCommand::InitLink:
|
||||||
NOTICE_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: InitLink");
|
NOTICE_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: InitLink");
|
||||||
|
|||||||
Reference in new issue
Block a user