mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 17:08:11 +00:00
update jave binding to follow apit change of uc_mem_read and uc_mem_write
This commit is contained in:
parent
39f4ee88ce
commit
1843a96321
2 changed files with 15 additions and 13 deletions
|
@ -43,20 +43,22 @@ public interface UnicornConst {
|
||||||
public static final int UC_ERR_VERSION = 5;
|
public static final int UC_ERR_VERSION = 5;
|
||||||
public static final int UC_ERR_MEM_READ = 6;
|
public static final int UC_ERR_MEM_READ = 6;
|
||||||
public static final int UC_ERR_MEM_WRITE = 7;
|
public static final int UC_ERR_MEM_WRITE = 7;
|
||||||
public static final int UC_ERR_CODE_INVALID = 8;
|
public static final int UC_ERR_MEM_FETCH = 8;
|
||||||
public static final int UC_ERR_HOOK = 9;
|
public static final int UC_ERR_CODE_INVALID = 9;
|
||||||
public static final int UC_ERR_INSN_INVALID = 10;
|
public static final int UC_ERR_HOOK = 10;
|
||||||
public static final int UC_ERR_MAP = 11;
|
public static final int UC_ERR_INSN_INVALID = 11;
|
||||||
public static final int UC_ERR_WRITE_PROT = 12;
|
public static final int UC_ERR_MAP = 12;
|
||||||
public static final int UC_ERR_READ_PROT = 13;
|
public static final int UC_ERR_WRITE_PROT = 13;
|
||||||
public static final int UC_ERR_EXEC_PROT = 14;
|
public static final int UC_ERR_READ_PROT = 14;
|
||||||
public static final int UC_ERR_INVAL = 15;
|
public static final int UC_ERR_EXEC_PROT = 15;
|
||||||
|
public static final int UC_ERR_INVAL = 16;
|
||||||
public static final int UC_MEM_READ = 16;
|
public static final int UC_MEM_READ = 16;
|
||||||
public static final int UC_MEM_WRITE = 17;
|
public static final int UC_MEM_WRITE = 17;
|
||||||
public static final int UC_MEM_READ_WRITE = 18;
|
public static final int UC_MEM_READ_WRITE = 18;
|
||||||
public static final int UC_MEM_WRITE_PROT = 19;
|
public static final int UC_MEM_EXEC = 19;
|
||||||
public static final int UC_MEM_READ_PROT = 20;
|
public static final int UC_MEM_WRITE_PROT = 20;
|
||||||
public static final int UC_MEM_EXEC_PROT = 21;
|
public static final int UC_MEM_READ_PROT = 21;
|
||||||
|
public static final int UC_MEM_EXEC_PROT = 22;
|
||||||
public static final int UC_HOOK_INTR = 32;
|
public static final int UC_HOOK_INTR = 32;
|
||||||
public static final int UC_HOOK_INSN = 33;
|
public static final int UC_HOOK_INSN = 33;
|
||||||
public static final int UC_HOOK_CODE = 34;
|
public static final int UC_HOOK_CODE = 34;
|
||||||
|
|
|
@ -319,7 +319,7 @@ JNIEXPORT void JNICALL Java_unicorn_Unicorn_mem_1write
|
||||||
uc_engine *eng = getEngine(env, self);
|
uc_engine *eng = getEngine(env, self);
|
||||||
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
|
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
|
||||||
jsize size = (*env)->GetArrayLength(env, bytes);
|
jsize size = (*env)->GetArrayLength(env, bytes);
|
||||||
uc_err err = uc_mem_write(eng, (uint64_t)address, (uint8_t *)array, (size_t)size);
|
uc_err err = uc_mem_write(eng, (uint64_t)address, array, (size_t)size);
|
||||||
|
|
||||||
if (err != UC_ERR_OK) {
|
if (err != UC_ERR_OK) {
|
||||||
throwException(env, err);
|
throwException(env, err);
|
||||||
|
@ -339,7 +339,7 @@ JNIEXPORT jbyteArray JNICALL Java_unicorn_Unicorn_mem_1read
|
||||||
|
|
||||||
jbyteArray bytes = (*env)->NewByteArray(env, (jsize)size);
|
jbyteArray bytes = (*env)->NewByteArray(env, (jsize)size);
|
||||||
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
|
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
|
||||||
uc_err err = uc_mem_read(eng, (uint64_t)address, (uint8_t *)array, (size_t)size);
|
uc_err err = uc_mem_read(eng, (uint64_t)address, array, (size_t)size);
|
||||||
if (err != UC_ERR_OK) {
|
if (err != UC_ERR_OK) {
|
||||||
throwException(env, err);
|
throwException(env, err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue