Core: Simplify Memory::GetString
This commit is contained in:
parent
48f52b9662
commit
130f57df91
|
@ -279,19 +279,18 @@ void ReadBigEData(u8 *data, const u32 em_address, const u32 size)
|
||||||
memcpy(data, src, size);
|
memcpy(data, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetString(std::string& _string, const u32 em_address)
|
std::string GetString(u32 em_address)
|
||||||
{
|
{
|
||||||
char stringBuffer[2048];
|
std::string str;
|
||||||
char *string = stringBuffer;
|
|
||||||
char c;
|
char c;
|
||||||
u32 addr = em_address;
|
|
||||||
while ((c = Read_U8(addr)))
|
while ((c = Read_U8(em_address)) != '\0')
|
||||||
{
|
{
|
||||||
*string++ = c;
|
str += c;
|
||||||
addr++;
|
em_address++;
|
||||||
}
|
}
|
||||||
*string++ = '\0';
|
|
||||||
_string = stringBuffer;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPointer must always return an address in the bottom 32 bits of address space, so that 64-bit
|
// GetPointer must always return an address in the bottom 32 bits of address space, so that 64-bit
|
||||||
|
|
|
@ -118,7 +118,7 @@ void Write_U64_Swap(const u64 _Data, const u32 _Address);
|
||||||
// Useful helper functions, used by ARM JIT
|
// Useful helper functions, used by ARM JIT
|
||||||
void Write_F64(const double _Data, const u32 _Address);
|
void Write_F64(const double _Data, const u32 _Address);
|
||||||
|
|
||||||
void GetString(std::string& _string, const u32 _Address);
|
std::string GetString(u32 em_address);
|
||||||
|
|
||||||
void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t size);
|
void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t size);
|
||||||
void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size);
|
void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size);
|
||||||
|
|
|
@ -369,8 +369,7 @@ void ExecuteCommand(u32 _Address)
|
||||||
u32 Mode = Memory::Read_U32(_Address + 0x10);
|
u32 Mode = Memory::Read_U32(_Address + 0x10);
|
||||||
DeviceID = getFreeDeviceId();
|
DeviceID = getFreeDeviceId();
|
||||||
|
|
||||||
std::string DeviceName;
|
std::string DeviceName = Memory::GetString(Memory::Read_U32(_Address + 0xC));
|
||||||
Memory::GetString(DeviceName, Memory::Read_U32(_Address + 0xC));
|
|
||||||
|
|
||||||
WARN_LOG(WII_IPC_HLE, "Trying to open %s as %d", DeviceName.c_str(), DeviceID);
|
WARN_LOG(WII_IPC_HLE, "Trying to open %s as %d", DeviceName.c_str(), DeviceID);
|
||||||
if (DeviceID >= 0)
|
if (DeviceID >= 0)
|
||||||
|
|
Loading…
Reference in New Issue