Ejemplo n.º 1
0
/// JSON-based structure data access
/// --------------------------------
int struct_get(void *dest, size_t dest_size, void *src, json_t *spec)
{
	if(!dest || !dest_size || !src || !spec) {
		return -1;
	}
	{
		size_t offset = json_object_get_hex(spec, "offset");
		size_t size = json_object_get_hex(spec, "size");
		// Default to architecture word size
		if(!size) {
			size = sizeof(size_t);
		};
		if(size > dest_size) {
			return -2;
		}
		ZeroMemory(dest, dest_size);
		memcpy(dest, (char*)src + offset, size);
	}
	return 0;
}
Ejemplo n.º 2
0
int update_notify_thcrap(void)
{
	const size_t SELF_MSG_SLOT = (size_t)self_body;
	self_result_t ret = SELF_NO_UPDATE;
	json_t *run_cfg = runconfig_get();

	json_t *patches = json_object_get(run_cfg, "patches");
	size_t i;
	json_t *patch_info;
	uint32_t min_build = 0;
	json_array_foreach(patches, i, patch_info) {
		auto cur_min_build = json_object_get_hex(patch_info, "thcrap_version_min");
		min_build = max(min_build, cur_min_build);
	}
Ejemplo n.º 3
0
int BP_th06_music_title_in_game(x86_reg_t *regs, json_t *bp_info)
{
	static size_t track = 0;

	// Parameters
	// ----------
	size_t *stage = (size_t*)json_object_get_register(bp_info, regs, "stage");
	int offset = json_object_get_hex(bp_info, "offset");
	const char **str = (const char**)json_object_get_register(bp_info, regs, "str");
	// ----------

	if (stage) {
		track = *stage * 2;
	}
	if (str && *str) {
		music_title_print(str, NULL, track + offset, track + offset);
	}
	return 1;
}
Ejemplo n.º 4
0
void* func_get(const char *name)
{
	return (void*)json_object_get_hex(funcs, name);
}