mirror of
https://github.com/wiiu-env/libiosuhax.git
synced 2024-11-30 13:04:16 +01:00
Add IOSUHAX_kern_write32 and IOSUHAX_kern_read32
This commit is contained in:
parent
1a996516ac
commit
69532cf9d9
@ -69,6 +69,9 @@ int IOSUHAX_memwrite(uint32_t address, const uint8_t * buffer, uint32_t size); /
|
||||
int IOSUHAX_memread(uint32_t address, uint8_t * out_buffer, uint32_t size); // IOSU external output
|
||||
int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size); // IOSU internal memcpy only
|
||||
|
||||
int IOSUHAX_kern_write32(uint32_t address, uint32_t value);
|
||||
int IOSUHAX_kern_read32(uint32_t address, uint32_t* out_buffer, uint32_t count);
|
||||
|
||||
int IOSUHAX_SVC(uint32_t svc_id, uint32_t * args, uint32_t arg_cnt);
|
||||
|
||||
int IOSUHAX_FSA_Open();
|
||||
|
@ -158,6 +158,44 @@ int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size)
|
||||
return IOS_Ioctl(iosuhaxHandle, IOCTL_MEMCPY, io_buf, 3 * sizeof(uint32_t), 0, 0);
|
||||
}
|
||||
|
||||
int IOSUHAX_kern_write32(uint32_t address, uint32_t value)
|
||||
{
|
||||
if(iosuhaxHandle < 0)
|
||||
return iosuhaxHandle;
|
||||
|
||||
ALIGN(0x20) uint32_t io_buf[0x20 >> 2];
|
||||
io_buf[0] = address;
|
||||
io_buf[1] = value;
|
||||
|
||||
return IOS_Ioctl(iosuhaxHandle, IOCTL_KERN_WRITE32, io_buf, 2 * sizeof(uint32_t), 0, 0);
|
||||
}
|
||||
|
||||
int IOSUHAX_kern_read32(uint32_t address, uint32_t* out_buffer, uint32_t count)
|
||||
{
|
||||
if(iosuhaxHandle < 0)
|
||||
return iosuhaxHandle;
|
||||
|
||||
ALIGN(0x20) uint32_t io_buf[0x20 >> 2];
|
||||
io_buf[0] = address;
|
||||
|
||||
void* tmp_buf = NULL;
|
||||
|
||||
if(((uintptr_t)out_buffer & 0x1F) || ((count * 4) & 0x1F))
|
||||
{
|
||||
tmp_buf = (uint32_t*)memalign(0x20, ROUNDUP((count * 4), 0x20));
|
||||
if(!tmp_buf)
|
||||
return -2;
|
||||
}
|
||||
|
||||
int res = IOS_Ioctl(iosuhaxHandle, IOCTL_KERN_READ32, io_buf, sizeof(address), tmp_buf ? tmp_buf : out_buffer, count * 4);
|
||||
|
||||
if(res >= 0 && tmp_buf)
|
||||
memcpy(out_buffer, tmp_buf, count * 4);
|
||||
|
||||
free(tmp_buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
int IOSUHAX_SVC(uint32_t svc_id, uint32_t * args, uint32_t arg_cnt)
|
||||
{
|
||||
if(iosuhaxHandle < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user