virtual ::osiris::uint32 read( void * v, ::osiris::uint32 size ) const { ::osiris::PythonState __pystate(getPythonThreadState()); if( ::osiris::PythonOverride func_read = this->get_override( "read" ) ) return func_read( v, size ); else{ __pystate.leave(); return this->::osiris::File::read( v, size ); } }
static bool _entprop_extract_CTFBot_m_nMission_func3(uintptr_t *off) { void *func = CTFBotScenarioMonitor_DesiredScenarioAndClassAction; size_t check1_base = 0x0000; uint8_t check1[] = { 0x55, // +0000 push ebp 0x89, 0xe5, // +0001 mov ebp,esp 0x57, // +0003 push edi 0x56, // +0004 push esi 0x53, // +0005 push ebx 0x83, 0xec, ANY_BYTE // +0006 sub esp,0x?? 0x8b, 0x5d, 0x0c, // +0009 mov ebx,DWORD PTR [ebp+0xc] 0x8b, 0x83, ANY_DWORD // +000C mov eax,DWORD PTR [ebx+off] 0x83, 0xf8, 0x02, // +0012 cmp eax,0x2 0x0f, 0x84, ANY_DWORD // +0015 je 0x???????? 0x83, 0xf8, 0x03, // +001B cmp eax,0x3 0x0f, 0x84, ANY_DWORD // +001E je 0x???????? }; size_t runs[][2] = { { 0x0000, 0x0008 }, { 0x0009, 0x0005 }, { 0x0012, 0x0005 }, { 0x001b, 0x0005 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs) / sizeof(*runs), runs)) { return false; } uintptr_t extracted[1]; func_read(func, 0x000e, sizeof(extracted[0]), &extracted[0]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static bool _entprop_extract_CTFBot_m_nMission_func2(uintptr_t *off) { void *func = CTFBot_IsAllowedToPickUpFlag; size_t check1_base = 0x0070; uint8_t check1[] = { 0x8b, 0x83, ANY_DWORD // +0070 mov eax,DWORD PTR [ebx+off] 0x8b, 0x75, 0xfc, // +0076 mov esi,DWORD PTR [ebp-0x4] 0x8b, 0x5d, 0xf8, // +0079 mov ebx,DWORD PTR [ebp-0x8] 0x85, 0xc0, // +007C test eax,eax 0x0f, 0x94, 0xc2, // +007E sete dl 0x89, 0xec, // +0081 mov esp,ebp 0x89, 0xd0, // +0083 mov eax,edx }; size_t runs[][2] = { { 0x0070, 0x0002 }, { 0x0076, 0x000f }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs) / sizeof(*runs), runs)) { return false; } uintptr_t extracted[1]; func_read(func, 0x0072, sizeof(extracted[0]), &extracted[0]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static bool _entprop_extract_CTFBot_m_nMission_func4(uintptr_t *off) { void *func = CMissionPopulator_UpdateMission; size_t check1_base = 0x0163; uint8_t check1[] = { 0x8b, 0x4d, 0x0c, // +0163 mov ecx,DWORD PTR [ebp+0xc] 0x39, 0x88, ANY_DWORD // +0166 cmp DWORD PTR [eax+off],ecx 0x0f, 0x94, 0xc0, // +016C sete al 0x0f, 0xb6, 0xc0, // +016F movzx eax,al 0x01, 0xc6, // +0172 add esi,eax }; size_t runs[][2] = { { 0x0163, 0x0005 }, { 0x016c, 0x0008 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs) / sizeof(*runs), runs)) { return false; } uintptr_t extracted[1]; func_read(func, 0x0168, sizeof(extracted[0]), &extracted[0]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static bool _entprop_extract_CTFBot_m_nMission_func5(uintptr_t *off) { void *func = CMissionPopulator_UpdateMissionDestroySentries; size_t check1_base = 0x04c6; uint8_t check1[] = { 0x83, 0xb8, ANY_DWORD 0x02, // +04C6 cmp DWORD PTR [eax+off],0x2 0x75, ANY_BYTE // +04CD jne 0x?? }; size_t runs[][2] = { { 0x04c6, 0x0002 }, { 0x04cc, 0x0002 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs) / sizeof(*runs), runs)) { return false; } uintptr_t extracted[1]; func_read(func, 0x04c8, sizeof(extracted[0]), &extracted[0]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static void cvbs_debug_store(char *buf) { unsigned int ret = 0; unsigned long addr, start, end, value, length, old; unsigned int argc; char *p = NULL, *para = NULL, *argv[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; char *str_type = NULL; unsigned int i, cmd; unsigned int (*func_read)(unsigned int) = NULL; void (*func_write)(unsigned int, unsigned int) = NULL; unsigned int (*func_getb)(unsigned int, unsigned int, unsigned int) = NULL; void (*func_setb)(unsigned int, unsigned int, unsigned int, unsigned int) = NULL; p = kstrdup(buf, GFP_KERNEL); for (argc = 0; argc < 6; argc++) { para = strsep(&p, " "); if (para == NULL) break; argv[argc] = para; } if (!strcmp(argv[0], "r")) cmd = CMD_REG_READ; else if (!strcmp(argv[0], "rb")) cmd = CMD_REG_READ_BITS; else if (!strcmp(argv[0], "dump")) cmd = CMD_REG_DUMP; else if (!strcmp(argv[0], "w")) cmd = CMD_REG_WRITE; else if (!strcmp(argv[0], "wb")) cmd = CMD_REG_WRITE_BITS; else if (!strncmp(argv[0], "clkdump", strlen("clkdump"))) cmd = CMD_CLK_DUMP; else if (!strncmp(argv[0], "clkmsr", strlen("clkmsr"))) cmd = CMD_CLK_MSR; else if (!strncmp(argv[0], "bist", strlen("bist"))) cmd = CMD_BIST; else if (!strncmp(argv[0], "help", strlen("help"))) cmd = CMD_HELP; else { print_info("[%s] invalid cmd = %s!\n", __func__, argv[0]); goto DEBUG_END; } switch (cmd) { case CMD_REG_READ: if (argc != 3) { print_info("[%s] cmd_reg_read format: r c/h/v address_hex\n", __func__); goto DEBUG_END; } func_type_map(argv[1]); ret = kstrtoul(argv[2], 16, &addr); print_info("read %s[0x%x] = 0x%x\n", str_type, (unsigned int)addr, func_read(addr)); break; case CMD_REG_READ_BITS: if (argc != 5) { print_info("[%s] cmd_reg_read_bits format:\n" "\trb c/h/v address_hex start_dec length_dec\n", __func__); goto DEBUG_END; } func_type_map(argv[1]); ret = kstrtoul(argv[2], 16, &addr); ret = kstrtoul(argv[3], 10, &start); ret = kstrtoul(argv[4], 10, &length); if (length == 1) print_info("read_bits %s[0x%x] = 0x%x, bit[%d] = 0x%x\n", str_type, (unsigned int)addr, func_read(addr), (unsigned int)start, func_getb(addr, start, length)); else print_info("read_bits %s[0x%x] = 0x%x, bit[%d-%d] = 0x%x\n", str_type, (unsigned int)addr, func_read(addr), (unsigned int)start+(unsigned int)length-1, (unsigned int)start, func_getb(addr, start, length)); break; case CMD_REG_DUMP: if (argc != 4) { print_info("[%s] cmd_reg_dump format: dump c/h/v start_dec end_dec\n", __func__); goto DEBUG_END; } func_type_map(argv[1]); ret = kstrtoul(argv[2], 16, &start); ret = kstrtoul(argv[3], 16, &end); for (i = start; i <= end; i++) print_info("%s[0x%x] = 0x%x\n", str_type, i, func_read(i)); break; case CMD_REG_WRITE: if (argc != 4) { print_info("[%s] cmd_reg_write format: w value_hex c/h/v address_hex\n", __func__); goto DEBUG_END; } func_type_map(argv[2]); ret = kstrtoul(argv[1], 16, &value); ret = kstrtoul(argv[3], 16, &addr); func_write(addr, value); print_info("write %s[0x%x] = 0x%x\n", str_type, (unsigned int)addr, (unsigned int)value); break; case CMD_REG_WRITE_BITS: if (argc != 6) { print_info("[%s] cmd_reg_wrute_bits format:\n" "\twb value_hex c/h/v address_hex start_dec length_dec\n", __func__); goto DEBUG_END; } func_type_map(argv[2]); ret = kstrtoul(argv[1], 16, &value); ret = kstrtoul(argv[3], 16, &addr); ret = kstrtoul(argv[4], 10, &start); ret = kstrtoul(argv[5], 10, &length); old = func_read(addr); func_setb(addr, value, start, length); print_info("write_bits %s[0x%x] old = 0x%x, new = 0x%x\n", str_type, (unsigned int)addr, (unsigned int)old, func_read(addr)); break; case CMD_CLK_DUMP: dump_clk_registers(); break; case CMD_CLK_MSR: /* todo */ print_info("cvbs: debug_store: clk_msr todo!\n"); break; case CMD_BIST: if (argc != 2) { print_info("[%s] cmd_bist format:\n" "\tbist 0/1/2/3/off\n", __func__); goto DEBUG_END; } bist_test_store(argv[1]); break; case CMD_HELP: print_info("command format:\n" "\tr c/h/v address_hex\n" "\trb c/h/v address_hex start_dec length_dec\n" "\tdump c/h/v start_dec end_dec\n" "\tw value_hex c/h/v address_hex\n" "\twb value_hex c/h/v address_hex start_dec length_dec\n" "\tbist 0/1/2/3/off\n" "\tclkdump\n"); break; default: break; } DEBUG_END: kfree(p); return; }
int main(int argc, char *argv[]) { void (*OldSig)(int); OldSig=signal(SIGINT,SIG_IGN); printf("nn************************************************************rn"); printf("* zFTP *rn"); printf("************************************************************rn"); printf(" Copyright (c) 2005rn"); printf(" All rights reserved.rn"); printf(" By Ji Surn"); if(argc > 0) { printf("nPlease use 'connect <system name> <user>' command to connect to a FTPserverrn"); printf("For anonymous user, please leave <user> blank.rn"); } //Main loop starts; //Checks on keyboard i/o for interaction and socket communication. int exit=0; char command[1024]; printf("nzftp>"); while(!exit) { if( ReadCommand ) { printf("nzftp>"); fflush(stdout); } if( !CheckFds(command) ) continue; switch(check_cmd(command) ) { case READ: func_read(command); break; case WRITE: func_write(command); break; case BINARY: func_binary_mode(); break; case ASCII: func_ascii_mode(); break; case CLOSE: func_close(); break; case CONNECT: func_connect(command); break; case CD: func_cdir(command); break; case DELETE: func_delete(command); break; case PWD: func_pwd(command); break; case LS: func_list(command); break; case HELP: func_help(command); break; case SHELL: func_Shell_cmd(command); break; case EXIT: exit = 1; if( flag_connected ) func_close(); break; default: if(command[0] == 0 ) ; else printf("Invalid command: %sn",command); break; } } (void)signal(SIGINT,OldSig); return 0; }
float *load_sound_aiff_mem(const uint8_t *data, size_t data_len, size_t *sample_count, int *channels, int *samplerate) { uint8_t *p; int chunk_size, bit_depth, byte_depth, compression=0; size_t i, full_count; float *output, vol; int32_t (*func_read)(const uint8_t *, size_t *) = read_byte8s; // Common chunk p = memmem(data, data_len, "COMM", 4); if (p==NULL) { fprintf_rl(stderr, "In load_sound_aiff_mem(): No COMM tag found, not a valid AIFF file.\n"); return NULL; } p = &p[4]; chunk_size = read_BE32(p, &p); *channels = read_BE16(p, &p); *sample_count = read_BE32(p, &p); bit_depth = read_BE16(p, &p); *samplerate = nearbyint(read_BE80_float_to_double(p, &p)); if (chunk_size > 18) // if there's a compression specified { if (strncmp(p, "sowt", 4)==0) compression = 1; // LE snd if (strncmp(p, "fl32", 4)==0) compression = 2; // BE float snd if (strncmp(p, "FL32", 4)==0) compression = 2; // BE float snd if (strncmp(p, "fl64", 4)==0) compression = 3; // BE double snd } // Prepare decoding parameters full_count = *sample_count * (size_t) *channels; byte_depth = ceil_rshift(bit_depth, 3); // bytes per sample vol = 1.f / (float) (1LL << 8*byte_depth); // volume multiplier switch (byte_depth) { case 2: func_read = compression==1 ? read_LE16s : read_BE16s; break; case 3: func_read = compression==1 ? read_LE24s : read_BE24s; break; case 4: func_read = compression==1 ? read_LE32 : read_BE32; break; } // Sound data p = memmem(data, data_len, "SSND", 4); if (p==NULL) { fprintf_rl(stderr, "In load_sound_aiff_mem(): No SSND tag found, not a valid AIFF file.\n"); return NULL; } p = &p[16]; output = calloc(*sample_count, *channels * sizeof(float)); switch (compression) { case 0: // integer BE case 1: // integer LE for (i=0; i < full_count; i++) output[i] = func_read(&p[i * byte_depth], NULL) * vol; break; case 2: // float BE for (i=0; i < full_count; i++) output[i] = u32_as_float(read_BE32(&p[i * 4], NULL)); break; case 3: // double BE for (i=0; i < full_count; i++) output[i] = u64_as_double(read_BE64(&p[i * 8], NULL)); break; } return output; }
SliderVComp::SliderVComp( Client & client ) { name = "SliderV"; func_register = [ &client = client ] ( ) { client.resource_mgr.reg_pool< SliderVData >( num_comp_default ); return 0; }; func_alloc = [ &client = client ] ( PComp * comp ) { comp->anchor = { 0.5f, 0.5f }; comp->dim = { 32, 128 }; auto data = comp->add_data< SliderVData >( ); data->cnt_remesh = 0; data->is_label_visible = true; data->ratio = 0.0f; data->value = 0.0f; data->lower = 0.0f; data->upper = 1.0f; data->width_bar = 8; data->func_read = func_null; data->func_write = func_null; auto resizable = comp->add_comp( "Resizable", "Resizable", [ &client = client ] ( PComp * comp ) { auto data = comp->get < ResizableComp::ResizableData >( ); data->func_resize = [ ] ( PComp * comp ) { comp->dim = comp->parent->dim; comp->offset = -comp->dim / 2; return 0; }; return 0; } ); data->comp_border = resizable->add_comp( "Border", "BorderImage", [ &client = client, data ] ( PComp * comp ) { data->data_border = comp->get< BorderImageComp::BorderImageData >( ); data->data_border->padding_border = 4; data->data_border->set_texture( client, "Gui", "Default/SliderBG", 8 ); auto overable = comp->add_comp( "Overable", "Overable", [ &client = client, data ] ( PComp * comp ) { auto data_over = comp->get< OverableComp::OverableData >( ); data_over->func_enter = [ &client = client, data ] ( PComp * comp ) { data->data_border->color = { 0.5f, 0.5f, 0.5f, 1.0f }; if( data->is_label_visible ) { data->comp_label_bottom->is_visible = true; data->comp_label_top->is_visible = true; } comp->page->is_remesh = true; return 0; }; data_over->func_exit = [ &client = client, data ] ( PComp * comp ) { data->data_border->color = { 1.0f, 1.0f, 1.0f, 1.0f }; if( data->is_label_visible ) { data->comp_label_bottom->is_visible = false; data->comp_label_top->is_visible = false; } comp->page->is_remesh = true; return 0; }; return 0; } ); auto clickable = comp->add_comp( "Clickable", "Clickable", [ &client = client, data ] ( PComp * comp ) { auto data_click = comp->get< ClickableComp::ClickableData >( ); data_click->func_hold = [ &client = client, data ] ( PComp * comp ) { int posl_mouse = client.input_mgr.get_mouse( ).y - ( comp->page->pos.y + data->comp_bar->pos.y ); if( posl_mouse < 0 ) { posl_mouse = 0; } else if( posl_mouse > data->length_bar ) { posl_mouse = data->length_bar; } data->set_ratio( posl_mouse / data->length_bar ); data->func_write( comp ); comp->page->is_remesh = true; return 0; return 0; }; return 0; } ); return 0; } ); data->comp_bar = comp->add_comp( "Bar", "BorderImage", [ &client = client, data ] ( PComp * comp ) { data->data_bar = comp->get< BorderImageComp::BorderImageData >( ); data->data_bar->padding_border = 4; data->data_bar->set_texture( client, "Gui", "Default/SliderBG", 8 ); return 0; } ); data->comp_label_title = comp->add_comp( "TitleLabel", "Label", [ &client = client, data ] ( PComp * comp ) { comp->is_visible = true; comp->anchor = { 0.5f, 1.0f }; comp->offset = { 0.0f, 3.0f }; data->data_label_title = comp->get< LabelComp::LabelData >( ); data->data_label_title->size_text = 12; data->data_label_title->alignment_v = LabelComp::LabelData::AlignVertical::AV_Top; data->data_label_title->alignment_h = LabelComp::LabelData::AlignHorizontal::AH_Center; data->data_label_title->text = "Title"; return 0; } ); data->comp_label_bottom = comp->add_comp( "BottomLabel", "Label", [ &client = client, data ] ( PComp * comp ) { comp->is_visible = false; comp->anchor = { 1.0f, 0.0f }; comp->offset = { 3.0f, 1.0f }; data->data_label_left = comp->get< LabelComp::LabelData >( ); data->data_label_left->size_text = 10; data->data_label_left->alignment_v = LabelComp::LabelData::AlignVertical::AV_Top; data->data_label_left->alignment_h = LabelComp::LabelData::AlignHorizontal::AH_Right; data->data_label_left->text = "Bottom"; return 0; } ); data->comp_label_top = comp->add_comp( "TopLabel", "Label", [ &client = client, data ] ( PComp * comp ) { comp->is_visible = false; comp->anchor = { 1.0f, 1.0f }; comp->offset = { 3.0f, -1.0f }; data->data_label_right = comp->get< LabelComp::LabelData >( ); data->data_label_right->size_text = 10; data->data_label_right->alignment_v = LabelComp::LabelData::AlignVertical::AV_Bottom; data->data_label_right->alignment_h = LabelComp::LabelData::AlignHorizontal::AH_Right; data->data_label_right->text = "Top"; return 0; } ); data->comp_label_value = comp->add_comp( "ValueLabel", "Label", [ &client = client, data ] ( PComp * comp ) { comp->anchor = { 1.0f, 0.5f }; comp->offset = { 3.0f, 0.0f }; data->data_label_value = comp->get< LabelComp::LabelData >( ); data->data_label_value->size_text = 12; data->data_label_value->alignment_v = LabelComp::LabelData::AlignVertical::AV_Center; data->data_label_value->alignment_h = LabelComp::LabelData::AlignHorizontal::AH_Right; data->data_label_value->text = "Value"; return 0; } ); data->comp_slider = comp->add_comp( "Slider", "BorderImage", [ &client = client, data ] ( PComp * comp ) { data->data_slider = comp->get< BorderImageComp::BorderImageData >( ); data->data_slider->padding_border = 4; data->data_slider->set_texture( client, "Gui", "Default/SliderBG", 8 ); return 0; } ); return 0; }; func_update = [ &client = client ] ( PComp * comp ) { auto data = comp->get< SliderVData >( ); data->length_bar = comp->dim.y - data->data_border->padding_border * 2; data->comp_bar->dim = { data->width_bar, data->length_bar }; data->comp_bar->offset = -data->comp_bar->dim / 2; data->comp_slider->anchor = { 0.5f, 0.5f }; data->comp_slider->dim = { comp->dim.x, data->width_bar }; data->comp_slider->offset = -data->comp_slider->dim / 2; data->comp_slider->offset.y += ( data->ratio - 0.5f ) * data->length_bar; data->func_read( comp ); if( ++data->cnt_remesh % 4 == 0 ) { comp->page->is_remesh = true; } return 0; }; }
static bool _entprop_extract_CTFBot_m_nMission_func7(uintptr_t *off) { void *func = CTraceFilterObject_ShouldHitEntity; size_t check1_base = 0x0128; uint8_t check1[] = { 0x8b, 0x81, ANY_DWORD // +0128 mov eax,DWORD PTR [ecx+off] 0x83, 0xf8, 0x02, // +012E cmp eax,0x2 0x74, ANY_BYTE // +0131 je 0x?? 0x83, 0xf8, 0x06, // +0133 cmp eax,0x6 0x0f, 0x85, ANY_DWORD // +0136 jne 0x???????? 0x31, 0xd2, // +013C xor edx,edx 0xe9, ANY_DWORD // +013E jmp 0x???????? }; size_t runs1[][2] = { { 0x0128, 0x0002 }, { 0x012e, 0x0004 }, { 0x0133, 0x0005 }, { 0x013c, 0x0003 }, }; size_t check2_base = 0x026d; uint8_t check2[] = { 0x8b, 0x83, ANY_DWORD // +026D mov eax,DWORD PTR [ebx+off] 0x83, 0xf8, 0x02, // +0273 cmp eax,0x2 0x0f, 0x84, ANY_DWORD // +0276 je 0x???????? 0x83, 0xf8, 0x06, // +027C cmp eax,0x6 0x0f, 0x85, ANY_DWORD // +027F jne 0x???????? 0x31, 0xd2, // +0285 xor edx,edx 0xe9, ANY_DWORD // +0287 jmp 0x???????? }; size_t runs2[][2] = { { 0x026d, 0x0002 }, { 0x0273, 0x0005 }, { 0x027c, 0x0005 }, { 0x0285, 0x0003 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs1) / sizeof(*runs1), runs1)) { return false; } if (!entprop_extract_verify_runs(func, check2_base, check2, sizeof(runs2) / sizeof(*runs2), runs2)) { return false; } uintptr_t extracted[2]; func_read(func, 0x012a, sizeof(extracted[0]), &extracted[0]); func_read(func, 0x026f, sizeof(extracted[1]), &extracted[1]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static bool _entprop_extract_CTFBot_m_nMission_func1(uintptr_t *off) { void *func = CTFBot_SetMission; size_t check1_base = 0x0000; uint8_t check1[] = { 0x55, // +0000 push ebp 0x89, 0xe5, // +0001 mov ebp,esp 0x53, // +0003 push ebx 0x83, 0xec, ANY_BYTE // +0004 sub esp,0x?? 0x8b, 0x5d, 0x08, // +0007 mov ebx,DWORD PTR [ebp+0x8] 0x8b, 0x45, 0x0c, // +000A mov eax,DWORD PTR [ebp+0xc] 0x80, 0x7d, 0x10, 0x00, // +000D cmp BYTE PTR [ebp+0x10],0x0 0x8b, 0x93, ANY_DWORD // +0011 mov edx,DWORD PTR [ebx+off] 0x89, 0x83, ANY_DWORD // +0017 mov DWORD PTR [ebx+off],eax 0x89, 0x93, ANY_DWORD // +001D mov DWORD PTR [ebx+off+4],edx #if 0 0x75, 0x2b, 0x8c, 0xc0, 0x73, 0x17, 0x89, 0x5d, 0x08, 0x83, 0xc4, ANY_BYTE 0x5b, 0x5d, 0xe9, CONV_LE(off1) NOP_3BYTE NOP_7BYTE 0x8c, 0xc4, ANY_BYTE 0x5b, 0x5d, 0xc3, NOP_3BYTE NOP_7BYTE 0x8b, 0x03, 0x89, 0x1c, 0x24, 0xff, 0x90, CONV_LE(off2), // vcall: CTFBot, CTFBot::GetIntentionInterface() const 0x8b, 0x10, 0x89, 0x04, 0x24, 0xff, 0x92, CONV_LE(off3) // vcall: IIntention, IIntention::Reset() 0xeb, 0xb7, #endif }; size_t runs[][2] = { { 0x0000, 0x0006 }, { 0x0007, 0x000c }, { 0x0017, 0x0002 }, { 0x001d, 0x0002 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs) / sizeof(*runs), runs)) { return false; } uintptr_t extracted[3]; func_read(func, 0x0013, sizeof(extracted[0]), &extracted[0]); func_read(func, 0x0019, sizeof(extracted[1]), &extracted[1]); func_read(func, 0x001f, sizeof(extracted[2]), &extracted[2]); extracted[2] -= 4; if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }
static bool _entprop_extract_CTFBot_m_nMission_func6(uintptr_t *off) { void *func = CFuncNavCost_IsApplicableTo; uintptr_t off1 = find_string( "server_srv.so", "mission_sentry_buster", true); uintptr_t off2 = CALC_RELJMP(func, 0x020d, CFuncNavCost_HasTag); uintptr_t off3 = find_string( "server_srv.so", "mission_sniper", true); uintptr_t off4 = CALC_RELJMP(func, 0x0235, CFuncNavCost_HasTag); uintptr_t off5 = find_string( "server_srv.so", "mission_spy", true); uintptr_t off6 = CALC_RELJMP(func, 0x0265, CFuncNavCost_HasTag); size_t check1_base = 0x008a; uint8_t check1[] = { 0x8b, 0x86, ANY_DWORD // +008A mov eax,DWORD PTR [esi+off] 0x83, 0xf8, 0x02, // +0090 cmp eax,0x2 0x0f, 0x84, ANY_DWORD // +0093 je 0x???????? 0x83, 0xf8, 0x03, // +0099 cmp eax,0x3 0x0f, 0x84, ANY_DWORD // +009C je 0x???????? 0x83, 0xf8, 0x04, // +00A2 cmp eax,0x4 0x0f, 0x84, ANY_DWORD // +00A5 je 0x???????? 0x31, 0xff, // +00AB xor edi,edi 0x83, 0xf8, 0x06, // +00AD cmp eax,0x5 0x0f, 0x84, ANY_DWORD // +00B0 je 0x???????? }; size_t runs1[][2] = { { 0x008a, 0x0002 }, { 0x0090, 0x0005 }, { 0x0099, 0x0005 }, { 0x00a2, 0x0005 }, { 0x00ab, 0x0007 }, }; size_t check2_base = 0x01f8; uint8_t check2[] = { 0xc7, 0x44, 0x24, 0x04, CONV_LE(off1) // +01F8 mov DWORD PTR [esp+0x4],str_mission_sentry_buster 0xbf, 0x01, 0x00, 0x00, 0x00, // +0200 mov edi,0x1 0x89, 0x1c, 0x24, // +0205 mov DWORD PTR [esp],ebx 0xe8, CONV_LE(off2) // +0208 call CFuncNavCost::HasTag 0x84, 0xc0, // +020D test al,al 0x0f, 0x85, ANY_DWORD // +020F jne 0x???????? 0x8b, 0x86, ANY_DWORD // +0215 mov eax,DWORD PTR [esi+off] 0xe9, ANY_DWORD // +021B jmp 0x???????? 0xc7, 0x44, 0x24, 0x04, CONV_LE(off3) // +0220 mov DWORD PTR [esp+0x4],str_mission_sniper 0xbf, 0x01, 0x00, 0x00, 0x00, // +0228 mov edi,0x1 0x89, 0x1c, 0x24, // +022D mov DWORD PTR [esp],ebx 0xe8, CONV_LE(off4) // +0230 call CFuncNavCost::HasTag 0x84, 0xc0, // +0235 test al,al 0x0f, 0x85, ANY_DWORD // +0237 jne 0x???????? 0x8b, 0x86, ANY_DWORD // +023D mov eax,DWORD PTR [esi+off] 0xe9, ANY_DWORD // +0243 jmp 0x???????? NOP_1BYTE NOP_7BYTE 0xc7, 0x44, 0x24, 0x04, CONV_LE(off5) // +0250 mov DWORD PTR [esp+0x4],str_mission_spy 0xbf, 0x01, 0x00, 0x00, 0x00, // +0258 mov edi,0x1 0x89, 0x1c, 0x24, // +025D mov DWORD PTR [esp],ebx 0xe8, CONV_LE(off6) // +0260 call CFuncNavCost::HasTag 0x84, 0xc0, // +0265 test al,al 0x0f, 0x85, ANY_DWORD // +0267 jne 0x???????? 0x8b, 0x86, ANY_DWORD // +026D mov eax,DWORD PTR [esi+off] 0xe9, ANY_DWORD // +0273 jmp 0x???????? }; size_t runs2[][2] = { { 0x01f8, 0x0019 }, { 0x0215, 0x0002 }, { 0x021b, 0x0001 }, { 0x0220, 0x0019 }, { 0x023d, 0x0002 }, { 0x0243, 0x0001 }, { 0x0250, 0x0019 }, { 0x026d, 0x0002 }, { 0x0273, 0x0001 }, }; if (!entprop_extract_verify_runs(func, check1_base, check1, sizeof(runs1) / sizeof(*runs1), runs1)) { return false; } if (!entprop_extract_verify_runs(func, check2_base, check2, sizeof(runs2) / sizeof(*runs2), runs2)) { return false; } uintptr_t extracted[4]; func_read(func, 0x008c, sizeof(extracted[0]), &extracted[0]); func_read(func, 0x0217, sizeof(extracted[1]), &extracted[1]); func_read(func, 0x023f, sizeof(extracted[2]), &extracted[2]); func_read(func, 0x026f, sizeof(extracted[3]), &extracted[3]); if (!entprop_extract_ensure_match(__func__, sizeof(extracted) / sizeof(*extracted), extracted)) { return false; } *off = extracted[0]; return true; }