// Integration test: the verified FOV prologue with a controlled 70-degree return. // Exercises the real signature scanner, MinHook trampoline, and module lifecycle. #include #include #include #include "../src/modules/fov_changer.h" #include "../src/modules/viewmodel.h" #include "../src/modules/sprint_latch.h" #include "../src/modules/crosshair_animation.h" #include "../src/modules/crosshair.h" #include "../src/modules/villager_trade.h" #include "../src/modules/trade_profile.h" #include "../src/gui/notifications.h" #include "../src/input.h" #include "window_branding_tests.h" #include "menu_input_tests.h" #include "lowercase_font_tests.h" #include "startup_intro_tests.h" #include "style_widget_tests.h" #include "sigscan_tests.h" #pragma section(".fvtest", read, execute) #pragma comment(linker, "/SECTION:.fvtest,ER") __declspec(allocate(".fvtest")) unsigned char fixture[] = {0x56, 0x57, 0x53, 0x48, 0x83, 0xec, 0x60, 0x44, 0x0f, 0x29, 0x44, 0x24, 0x50, 0x0f, 0x29, 0x7c, 0x24, 0x40, 0x0f, 0x29, 0x74, 0x24, 0x30, 0x44, 0x89, 0xc3, 0x0f, 0x28, 0xf1, 0x48, 0x89, 0xce, 0x45, 0x84, 0xc0, 0x0f, 0x84, 0x23, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x86, 0x88, 0x11, 0x00, 0x00, 0x48, 0x8b, 0x88, 0xf8, 0x03, 0x00, 0x00, 0x48, 0x8b, 0x01, 0x48, 0x8b, 0x80, 0xd8, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x54, 0x24, 0x28, 0x41, 0xb8, 0x2f, 0x00, 0x00, 0x00, 0xf3, 0x0f, 0x10, 0x05, 0x18, 0x00, 0x00, 0x00, 0x0f, 0x28, 0x74, 0x24, 0x30, 0x0f, 0x28, 0x7c, 0x24, 0x40, 0x44, 0x0f, 0x28, 0x44, 0x24, 0x50, 0x48, 0x83, 0xc4, 0x60, 0x5b, 0x5f, 0x5e, 0xc3, 0x00, 0x00, 0x8c, 0x42}; __declspec(allocate(".fvtest")) unsigned char duplicate[sizeof(fixture)] = {}; #include "separate_hand_fixture.h" #include "viewmodel_fixture.h" #include "native_crosshair_fixture.h" static void write_code(unsigned char* target, const unsigned char* bytes, size_t size); static void identity(float* m) { memset(m, 0, sizeof(float) * 16); m[0] = m[5] = m[10] = m[15] = 1.f; } static bool close_float(float a, float b) { return std::fabs(a - b) < 0.00001f; } static float main_seen[16], offhand_seen[16], after_offhand[16]; static unsigned char test_item[0x30]{}; static void __fastcall offhand_callback(void*, void* context, void*, void*) { std::memcpy(offhand_seen, game::viewmodel_world_matrix(context), sizeof(offhand_seen)); } static void __fastcall hands_callback(void*, void* context, void* source, unsigned char) { float* matrix = game::viewmodel_world_matrix(context); // Reproduce the real renderer consuming its distinct input matrix. if (source) std::memcpy(matrix,source,16*sizeof(float)); std::memcpy(main_seen, matrix, sizeof(main_seen)); // An item/blocking animation applied after the shared hand transform. const float animation[] = {0, 2, 0}, rotation[] = {0, 0, 0}; game::transform_viewmodel(matrix, animation, rotation); using call_fn = void(__fastcall*)(void*, void*, void*, void*); reinterpret_cast(static_cast(offhand_call_fixture))(nullptr, context, nullptr, test_item); std::memcpy(after_offhand, matrix, sizeof(after_offhand)); } static void test_viewmodel() { uintptr_t callback = reinterpret_cast(&hands_callback); write_code(hands_fixture + hands_callback_offset, reinterpret_cast(&callback), sizeof(callback)); callback = reinterpret_cast(&offhand_callback); write_code(offhand_fixture + offhand_callback_offset, reinterpret_cast(&callback), sizeof(callback)); const int32_t displacement = static_cast(offhand_fixture - (offhand_call_fixture + offhand_call_offset + 18)); write_code(offhand_call_fixture + offhand_call_offset + 14, reinterpret_cast(&displacement), sizeof(displacement)); assert(sigscan::find(sigs::render_hands,true)==hands_fixture); assert(sigscan::find(sigs::render_offhand_item,true)==offhand_fixture); test_item[0x23]=1; unsigned char renderer[0x178]{}, context[0x30]{}, render[0x20]{}, screen[0xc0]{}; float matrix[16]; identity(matrix); float* map[]={matrix}; *reinterpret_cast(context+0x28)=render; *reinterpret_cast(render+0x18)=screen; *reinterpret_cast(screen+0x88)=map; *reinterpret_cast(screen+0x90)=1; *reinterpret_cast(screen+0xa0)=1; void* vtable[0x100]{}; void* client=vtable; *reinterpret_cast(renderer+0x170)=&client; viewmodel module; using draw_fn=void(__fastcall*)(void*,void*,void*,unsigned char); auto draw=reinterpret_cast(static_cast(hands_fixture)); module.set_enabled(true); assert(module.enabled()); module.settings()[0].float_value=0.5f; module.settings()[1].float_value=-0.25f; module.settings()[6].float_value=-0.75f; module.settings()[7].float_value=0.4f; // The earlier working direct hand hook must continue to apply sliders. using bob_fn=void(__fastcall*)(void*,float*,float); unsigned char bob_renderer[0x1200]{}; float bob_matrix[16];identity(bob_matrix); module.on_render(); reinterpret_cast(static_cast(hand_fixture))(bob_renderer,bob_matrix,0.5f); assert(close_float(bob_matrix[12],1.5f) && close_float(bob_matrix[13],-0.25f)); module.on_frame_end(); // Invalidate previous-frame bob snapshots. module.on_render(); draw(renderer,context,nullptr,0x21); assert(close_float(main_seen[12],0.5f) && close_float(main_seen[13],-0.25f)); assert(close_float(offhand_seen[12],-0.75f) && close_float(offhand_seen[13],2.4f)); assert(close_float(after_offhand[12],0.5f) && close_float(after_offhand[13],1.75f)); assert(matrix[12]==0 && matrix[13]==0 && matrix[0]==1); // Scope restores shared matrix. float distinct_source[16];identity(distinct_source); draw(renderer,context,distinct_source,0x23); assert(close_float(main_seen[12],0.5f)); assert(close_float(offhand_seen[12],-0.75f)); assert(distinct_source[12]==0); // Never alter the caller's input matrix. for(int axis=0;axis<3;++axis) { for(int i=0;i<12;++i) module.settings()[i].float_value=0; module.settings()[3+axis].float_value=90.f; module.on_render();draw(renderer,context,nullptr,0x21); // Offhand remains neutral with its own original animation, independent of main rotation. assert(close_float(offhand_seen[0],1) && close_float(offhand_seen[5],1) && close_float(offhand_seen[10],1)); if(axis==0) assert(close_float(main_seen[6],1) && close_float(main_seen[9],-1)); if(axis==1) assert(close_float(main_seen[2],-1) && close_float(main_seen[8],1)); if(axis==2) assert(close_float(main_seen[1],1) && close_float(main_seen[4],-1)); module.settings()[3+axis].float_value=0; module.settings()[9+axis].float_value=90; module.on_render();draw(renderer,context,nullptr,0x21); assert(main_seen[0]==1 && main_seen[5]==1 && main_seen[10]==1); if(axis==0) assert(close_float(offhand_seen[6],1) && close_float(offhand_seen[9],-1)); if(axis==1) assert(close_float(offhand_seen[2],-1) && close_float(offhand_seen[8],1)); if(axis==2) assert(close_float(offhand_seen[1],1) && close_float(offhand_seen[4],-1)); } module.settings()[12].bool_value=false; module.settings()[0].float_value=1; module.on_render();draw(renderer,context,nullptr,0x21); assert(close_float(main_seen[12],1) && close_float(offhand_seen[12],1)); for(int i=0;i<10;++i) { module.set_enabled(false);identity(matrix);draw(renderer,context,nullptr,0x21); assert(main_seen[12]==0 && offhand_seen[12]==0); module.set_enabled(true);identity(matrix);draw(renderer,context,nullptr,0x21); assert(close_float(main_seen[12],1)); } module.set_enabled(false); } static void test_crosshair_animation() { using namespace crosshair_animation; for(int easing=0;easing<5;++easing) { assert(ease(0,easing)==0 && ease(1,easing)==1); float previous=0; for(int i=0;i<=100;++i) { const float value=ease(i/100.f,easing);assert(value>=previous && value<=1);previous=value; } channel slow,fast; for(int i=0;i<60;++i) slow.update(1.f/60,true,0,false,0.75f,easing); for(int i=0;i<144;++i) fast.update(1.f/144,true,0,false,0.75f,easing); assert(std::fabs(slow.current-fast.current)<0.0001f); channel reactive; for(int i=0;i<60;++i) reactive.update(1.f/60,true,1,true,2,easing); assert(reactive.current==1); for(int i=0;i<60;++i) reactive.update(1.f/60,true,1,false,2,easing); assert(reactive.current==0); assert(reactive.update(0.1f,false,1,true,2,easing)==0); double phase=0; for(int i=0;i<60;++i) spin(phase,1.f/60,true,90,easing); assert(std::fabs(phase-0.25)<0.0001); assert(spin(phase,0.1f,false,90,easing)==0 && phase==0); } } struct fake_trade_io : villager_trade::io { std::vector> events; int downs=0,ups=0,reads=0,stock_reads=0; bool held=false,exhausted=false,stock_empty=false,read_ok=true,release_ok=true; bool move(villager_trade::point p) override {events.push_back({'m',p});return true;} bool button(bool down) override { if(!down && !release_ok) return false; if(down) {++downs;held=true;}else {++ups;held=false;}return true; } bool pixel(villager_trade::point,uint32_t& color) override { ++reads;color=exhausted ? 0x993434 : 0x111111;return read_ok; } bool stock(const villager_trade::config&,bool& found) override {++stock_reads;found=stock_empty;return read_ok;} }; static void test_villager_trade() { using namespace villager_trade; assert(color_near(0xBA370F,0xBA370F,0)); assert(color_near(0xBC390F,0xBA370F,2)); assert(!color_near(0xBD390F,0xBA370F,2)); assert(red_score(0xBA370F)==131); config settings;settings.row={10,20};settings.button={30,40};settings.stock={50,60};settings.stock_check=true;settings.max_trades=3; auto run=[](engine& trading,fake_trade_io& input) {for(int i=0;i<1000 && trading.running();++i) trading.tick(i*0.01,input);assert(!trading.running());}; fake_trade_io input;engine trading; assert(trading.start(settings,0));run(trading,input); assert(trading.result()==reason::completed && trading.count()==3); assert(input.downs==7 && input.ups==7 && !input.held && input.stock_reads==3 && input.reads==4); assert(input.events[0].second.x==10 && input.events[1].second.x==30 && input.events[2].second.x==10); fake_trade_io empty;empty.exhausted=true; trading.start(settings,0);run(trading,empty); assert(trading.result()==reason::out_of_materials && trading.count()==0 && empty.downs==1 && !empty.held); fake_trade_io sold_out;sold_out.stock_empty=true; trading.start(settings,0);run(trading,sold_out); assert(trading.result()==reason::out_of_stock && sold_out.downs==1 && sold_out.ups==1); fake_trade_io failed;failed.read_ok=false; trading.start(settings,0);run(trading,failed); assert(trading.result()==reason::read_failed && !failed.held); fake_trade_io cancel; trading.start(settings,0);trading.tick(0,cancel);trading.tick(0.01,cancel); assert(cancel.held); cancel.release_ok=false;trading.stop(cancel); assert(!trading.running() && !trading.start(settings,0)); cancel.release_ok=true;trading.release_pending(cancel); assert(!cancel.held && cancel.ups==1 && trading.start(settings,0)); trading.stop(cancel); fake_trade_io disabled_checks;disabled_checks.read_ok=false; settings.stock_check=false;settings.material_check=false; trading.start(settings,0);run(trading,disabled_checks); assert(trading.result()==reason::completed && disabled_checks.reads==0 && disabled_checks.stock_reads==0); } static int native_crosshair_draws=0; static void __fastcall native_crosshair_callback(void* a,void* b,void* c,void* d) { assert(a==reinterpret_cast(1) && b==reinterpret_cast(2) && c==reinterpret_cast(3) && d==reinterpret_cast(4)); ++native_crosshair_draws; } static void test_crosshair_render() { const uintptr_t callback=reinterpret_cast(&native_crosshair_callback); write_code(native_crosshair_fixture+native_crosshair_callback_offset, reinterpret_cast(&callback),sizeof(callback)); using native_draw_fn=void(__fastcall*)(void*,void*,void*,void*); auto native_draw=reinterpret_cast(static_cast(native_crosshair_fixture)); auto draw_native=[&] { native_draw(reinterpret_cast(1),reinterpret_cast(2), reinterpret_cast(3),reinterpret_cast(4)); }; ImGui::CreateContext(); ImGuiIO& io=ImGui::GetIO(); io.IniFilename=nullptr; io.DisplaySize=ImVec2(800,600); io.DeltaTime=1.f/60; unsigned char* pixels;int width,height; io.Fonts->GetTexDataAsRGBA32(&pixels,&width,&height); crosshair cross; draw_native();assert(native_crosshair_draws==1); auto setting_named=[&](const char* name)->setting& { for(auto& value:cross.settings()) if(value.name==name) return value; assert(false);return cross.settings().front(); }; cross.set_enabled(true); draw_native();assert(native_crosshair_draws==1); // Native drawing suppressed only while enabled. for(int frame=0;frame<4;++frame) { if(frame==1) { setting_named("gradient").bool_value=true; setting_named("gradient color").color[0]=0; setting_named("spin").bool_value=true; setting_named("dynamic gap").bool_value=true; setting_named("dynamic length").bool_value=true; } if(frame==2) { setting_named("gradient").bool_value=false; setting_named("spin").bool_value=false; setting_named("dynamic gap").bool_value=false; setting_named("dynamic length").bool_value=false; } if(frame==3) { setting_named("black outline").bool_value=true; setting_named("outline width").float_value=2; setting_named("center dot").bool_value=true; setting_named("spin").bool_value=true; } ImGui::NewFrame();cross.on_render(); ImDrawList* draw=ImGui::GetBackgroundDrawList(); if(frame<3) assert(draw->VtxBuffer.Size==16 && draw->IdxBuffer.Size==24); else { assert(draw->VtxBuffer.Size>32 && draw->IdxBuffer.Size>48); bool black=false; for(const auto& vertex:draw->VtxBuffer) if(vertex.col==IM_COL32(0,0,0,255)) black=true; assert(black); } for(const auto& vertex:draw->VtxBuffer) assert(std::isfinite(vertex.pos.x) && std::isfinite(vertex.pos.y)); for(auto index:draw->IdxBuffer) assert(indexVtxBuffer.Size); if(frame==1) { assert(draw->VtxBuffer[0].col!=draw->VtxBuffer[1].col); assert(std::fabs(draw->VtxBuffer[0].pos.y-draw->VtxBuffer[1].pos.y)>0.1f); } else if(frame<3) { assert(draw->VtxBuffer[0].col==draw->VtxBuffer[1].col); assert(close_float(draw->VtxBuffer[0].pos.x,404) && close_float(draw->VtxBuffer[1].pos.x,412)); } ImGui::Render(); } cross.set_enabled(false); draw_native();assert(native_crosshair_draws==2); for(int i=0;i<5;++i) { cross.set_enabled(true);draw_native();assert(native_crosshair_draws==2+i); cross.set_enabled(false);draw_native();assert(native_crosshair_draws==3+i); } notifications::items.clear(); // Entry/exit match the reference's half-second eased slide; timers count down. notifications::toast timed;timed.born=10;timed.duration=3; auto motion=notifications::animate(timed,10); assert(motion.slide==1 && motion.alpha==1 && motion.remaining==1); motion=notifications::animate(timed,10.25); assert(close_float(motion.slide,.25f)); motion=notifications::animate(timed,11.5); assert(motion.slide==0 && close_float(motion.remaining,.5f)); motion=notifications::animate(timed,13.25); assert(close_float(motion.slide,.75f) && close_float(motion.alpha,.25f) && motion.remaining==0); motion=notifications::animate(timed,13.5); assert(motion.slide==1 && motion.alpha==0); timed.title="macro";timed.body="running"; assert(notifications::message(timed)=="macro: running"); timed.title.clear();assert(notifications::message(timed)=="running"); timed.body.clear();assert(notifications::message(timed).empty()); timed.duration=0;motion=notifications::animate(timed,100); assert(motion.slide==0 && motion.alpha==1); notifications::push("Trading","1 / 500 trade attempts",notifications::kind::info,0,"trade",0.1f); notifications::push("Trading","2 / 500 trade attempts",notifications::kind::info,0,"trade",0.2f); assert(notifications::items.size()==1 && notifications::items[0].progress==0.2f); notifications::push("Trade row saved","Client position: 814, 425",notifications::kind::success,3); notifications::push("Out of stock","Trading stopped and mouse released.",notifications::kind::warning,3); for(auto& item:notifications::items) item.born-=0.4; ImGui::NewFrame();notifications::draw(); assert(ImGui::GetForegroundDrawList()->VtxBuffer.Size>0); for(const auto& vertex:ImGui::GetForegroundDrawList()->VtxBuffer) assert(std::isfinite(vertex.pos.x) && std::isfinite(vertex.pos.y)); ImGui::Render(); assert(close_float(notifications::items.front().y,5.f)); assert(notifications::items[1].y>notifications::items[0].y); assert(notifications::items[2].y>notifications::items[1].y); notifications::dismiss("trade");assert(notifications::items[0].duration>0); const double dismissed_duration=notifications::items[0].duration; notifications::dismiss("trade");assert(notifications::items[0].duration==dismissed_duration); for(auto& item:notifications::items) item.born-=20; ImGui::NewFrame();notifications::draw();assert(notifications::items.empty());ImGui::Render(); // All four types, wrapped text, and keyed progress updates render without restarting entry. notifications::push("Working","A long notification body that should wrap across more than one line in the card.",notifications::kind::info,0,"live",.3f); const double live_born=notifications::items[0].born; notifications::push("Working","Updated progress",notifications::kind::info,0,"live",.7f); assert(notifications::items[0].born==live_born); notifications::dismiss("live"); notifications::push("Working","Resumed",notifications::kind::info,0,"live",.8f); assert(!notifications::items[0].dismissed && notifications::items[0].duration==0); for(auto type:{notifications::kind::info,notifications::kind::success,notifications::kind::warning,notifications::kind::error}) { notifications::items.clear(); notifications::push("Status","Multiple lines\nwith a timer",type,3); notifications::items[0].born-=1; ImGui::NewFrame();notifications::draw();ImGui::Render(); assert(ImGui::GetDrawData()->TotalVtxCount>0); for(const auto& vertex:ImGui::GetForegroundDrawList()->VtxBuffer) assert(std::isfinite(vertex.pos.x) && std::isfinite(vertex.pos.y)); } notifications::items.clear(); ImGui::DestroyContext(); } static void test_sprint() { sprint_latch latch; bool physically_down[256]{}; std::vector> events; bool success = true; auto physical = [&](int key) { return physically_down[key]; }; auto send = [&](int key, bool down) { if (success) events.emplace_back(key,down); return success; }; latch.update(true,VK_LCONTROL,physical,send); latch.update(true,VK_LCONTROL,physical,send); assert(events.size()==1 && latch.held_key()==VK_LCONTROL); latch.update(false,0,physical,send); assert(events.size()==2 && !events.back().second && latch.held_key()==0); physically_down[VK_LCONTROL]=true; latch.update(true,VK_LCONTROL,physical,send); assert(events.size()==2 && latch.held_key()==0); physically_down[VK_LCONTROL]=false; latch.update(true,VK_LCONTROL,physical,send); latch.update(true,VK_RCONTROL,physical,send); assert(events[3]==std::make_pair(VK_LCONTROL,false) && events[4]==std::make_pair(VK_RCONTROL,true)); success=false; latch.update(false,0,physical,send); assert(latch.held_key()==VK_RCONTROL); // Retry a failed key-up rather than losing ownership. success=true; latch.update(false,0,physical,send); assert(latch.held_key()==0); latch.update(true,VK_LCONTROL,physical,send); physically_down[VK_LCONTROL]=true; const auto before=events.size(); latch.update(false,0,physical,send); assert(latch.held_key()==0 && events.size()==before); // No release of a physical key. const LPARAM previous=SetMessageExtraInfo(static_cast(input::sprint_input_tag)); input::observe_message(nullptr,WM_KEYDOWN,VK_CONTROL,0); assert(!input::physical_keys[VK_LCONTROL]); SetMessageExtraInfo(previous); input::observe_message(nullptr,WM_KEYDOWN,VK_CONTROL,0); assert(input::physical_keys[VK_LCONTROL]); input::observe_message(nullptr,WM_KILLFOCUS,0,0); assert(!input::physical_keys[VK_LCONTROL]); } static void write_code(unsigned char* target, const unsigned char* bytes, size_t size) { DWORD old; assert(VirtualProtect(target, size, PAGE_EXECUTE_READWRITE, &old)); memcpy(target, bytes, size); DWORD ignored; assert(VirtualProtect(target, size, old, &ignored)); FlushInstructionCache(GetCurrentProcess(), target, size); } #include "profile_tests.h" #include "world_tests.h" #include "media_glint_tests.h" #include "inventory_tests.h" #include "anti_afk_tests.h" #include "server_hud_tests.h" #include "hud_grid_tests.h" #include "qol_tests.h" #include "performance_tests.h" #include "world_weather_tests.h" #include "debug_metrics_tests.h" int main() { test_debug_metrics(); test_sigscan_ranges(); test_lowercase_fonts(); test_startup_intro(); test_style_widgets(); menu_input_test::run(); test_window_branding(); test_qol_readers();test_qol_state();test_qol_event_forwarding();test_qol_modules();test_performance();test_world_weather();test_world_weather(D3D_DRIVER_TYPE_HARDWARE); test_profiles(); test_world_math_and_hooks(); test_world_filter(); test_world_huds(); test_media_and_glint(); test_inventory_tools(); test_anti_afk(); test_server_hud(); test_hud_grid(); // Fail closed on zero or multiple executable matches. assert(sigscan::find(sigs::get_fov, true) == fixture); write_code(duplicate, fixture, sizeof(fixture)); assert(sigscan::find(sigs::get_fov, true) == nullptr); unsigned char zero = 0; write_code(duplicate, &zero, 1); write_code(fixture, &zero, 1); assert(sigscan::find(sigs::get_fov, true) == nullptr); unsigned char push_rsi = 0x56; write_code(fixture, &push_rsi, 1); assert(MH_Initialize() == MH_OK); test_viewmodel(); test_sprint(); test_crosshair_animation(); test_villager_trade(); test_crosshair_render(); write_code(duplicate, fixture, sizeof(fixture)); { fov_changer unavailable; unavailable.set_enabled(true); assert(!unavailable.enabled()); } write_code(duplicate, &zero, 1); write_code(fixture, &zero, 1); { fov_changer unavailable; unavailable.set_enabled(true); assert(!unavailable.enabled()); } write_code(fixture, &push_rsi, 1); { fov_changer module; using getter = float(__fastcall*)(void*, float, bool); auto get_fov = reinterpret_cast(static_cast(fixture)); // Match the pointer reads in the verified game's function entry. alignas(16) unsigned char renderer[0x1200] = {}; alignas(16) unsigned char context[0x400] = {}; void* options_vtable[0x100] = {}; void* options = options_vtable; *reinterpret_cast(renderer + 0x1188) = context; *reinterpret_cast(context + 0x3f8) = &options; assert(!module.enabled()); assert(get_fov(renderer, 0.5f, true) == 70.f); module.set_enabled(true); assert(module.enabled()); assert(get_fov(renderer, 0.5f, true) == 90.f); assert(get_fov(renderer, 0.5f, false) == 70.f); module.settings()[0].float_value = 110.f; module.on_render(); assert(get_fov(renderer, 0.5f, true) == 110.f); module.settings()[0].float_value = 200.f; module.on_render(); assert(get_fov(renderer, 0.5f, true) == 130.f); module.settings()[0].float_value = 1.f; module.on_render(); assert(get_fov(renderer, 0.5f, true) == 30.f); module.settings()[0].float_value = std::numeric_limits::quiet_NaN(); module.on_render(); assert(get_fov(renderer, 0.5f, true) == 90.f); for (int i = 0; i < 10; ++i) { module.set_enabled(false); assert(get_fov(renderer, 0.5f, true) == 70.f); module.set_enabled(true); assert(get_fov(renderer, 0.5f, true) == 90.f); } module.set_enabled(false); assert(get_fov(renderer, 0.5f, true) == 70.f); // Zoom shares the verified hook and must work with FOV changer disabled, // compose with its override, and leave hand projection untouched. zoom_effect::magnification=4.f; const float zoomed=get_fov(renderer,0.5f,true); assert(zoomed>0 && zoomed<30 && std::abs(zoomed-zoom_effect::apply(70,4))<.001f); assert(get_fov(renderer,0.5f,false)==70.f); module.set_enabled(true); assert(std::abs(get_fov(renderer,0.5f,true)-zoom_effect::apply(90,4))<.001f); module.set_enabled(false); zoom_effect::magnification=1; assert(get_fov(renderer,0.5f,true)==70.f); assert(zoom_effect::apply(70,std::numeric_limits::quiet_NaN())==70); assert(MH_Uninitialize() == MH_OK); } std::cout << "PASS: unique/missing/ambiguous signatures, actual hook/trampoline, " "FOV and independent main/offhand transforms/restoration, sprint ownership/release/rebinding, " "physical versus injected input, crosshair rendering/native suppression, villager trading stops/cancellation, animated notifications\n"; }