mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 11:48:16 +00:00
change mem read/write APIs to use void*
Don't force the user to use uint8_t pointers, or cast their pointers-to-other-objects to uint8_t* when calling these APIs.
This commit is contained in:
parent
2b4caeed37
commit
f6cecf45d2
2 changed files with 8 additions and 4 deletions
|
@ -313,7 +313,7 @@ uc_err uc_reg_read(uc_engine *uc, int regid, void *value);
|
||||||
for detailed error).
|
for detailed error).
|
||||||
*/
|
*/
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_mem_write(uc_engine *uc, uint64_t address, const uint8_t *bytes, size_t size);
|
uc_err uc_mem_write(uc_engine *uc, uint64_t address, const void *bytes, size_t size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read a range of bytes in memory.
|
Read a range of bytes in memory.
|
||||||
|
@ -329,7 +329,7 @@ uc_err uc_mem_write(uc_engine *uc, uint64_t address, const uint8_t *bytes, size_
|
||||||
for detailed error).
|
for detailed error).
|
||||||
*/
|
*/
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_mem_read(uc_engine *uc, uint64_t address, uint8_t *bytes, size_t size);
|
uc_err uc_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Emulate machine code in a specific duration of time.
|
Emulate machine code in a specific duration of time.
|
||||||
|
|
8
uc.c
8
uc.c
|
@ -331,8 +331,10 @@ static bool check_mem_area(uc_engine *uc, uint64_t address, size_t size)
|
||||||
|
|
||||||
|
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_mem_read(uc_engine *uc, uint64_t address, uint8_t *bytes, size_t size)
|
uc_err uc_mem_read(uc_engine *uc, uint64_t address, void *_bytes, size_t size)
|
||||||
{
|
{
|
||||||
|
uint8_t *bytes = _bytes;
|
||||||
|
|
||||||
if (!check_mem_area(uc, address, size))
|
if (!check_mem_area(uc, address, size))
|
||||||
return UC_ERR_MEM_READ;
|
return UC_ERR_MEM_READ;
|
||||||
|
|
||||||
|
@ -359,8 +361,10 @@ uc_err uc_mem_read(uc_engine *uc, uint64_t address, uint8_t *bytes, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
UNICORN_EXPORT
|
UNICORN_EXPORT
|
||||||
uc_err uc_mem_write(uc_engine *uc, uint64_t address, const uint8_t *bytes, size_t size)
|
uc_err uc_mem_write(uc_engine *uc, uint64_t address, const void *_bytes, size_t size)
|
||||||
{
|
{
|
||||||
|
const uint8_t *bytes = _bytes;
|
||||||
|
|
||||||
if (!check_mem_area(uc, address, size))
|
if (!check_mem_area(uc, address, size))
|
||||||
return UC_ERR_MEM_WRITE;
|
return UC_ERR_MEM_WRITE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue