added a SHIT ton of modules

This commit is contained in:
st committed 2026-10-14 00:10:39 -05:00
1 parent b1634d195c
commit 361892bf0b
64 files changed
+5346 -482

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include "../src/modules/server_hud.h"
inline void test_server_hud() {
assert(xp_math::next(0)==7 && xp_math::next(15)==37 && xp_math::next(16)==42);
assert(xp_math::next(30)==112 && xp_math::next(31)==121 && xp_math::remaining(28,.5f)==51);
assert(xp_math::remaining(0,1)==0 && xp_math::remaining(0,0)==7);
alignas(8) unsigned char attrs[80]{},values[272]{};uint32_t keys[]{4,5};
auto put=[](unsigned char* p,size_t off,auto value){memcpy(p+off,&value,sizeof(value));};
put(attrs,0,uintptr_t(keys));put(attrs,8,uintptr_t(keys+2));put(attrs,24,uintptr_t(values));put(attrs,32,uintptr_t(values+272));
put(values,0x70,28.f);put(values,136+0x70,.3f);put(values,0x7c,0.f);
int level;float progress;assert(world::read_xp_values(uintptr_t(attrs),level,progress) && level==28 && progress==.3f);
put(values,136+0x70,std::numeric_limits<float>::quiet_NaN());assert(!world::read_xp_values(uintptr_t(attrs),level,progress));
put(values,136+0x70,1.1f);assert(!world::read_xp_values(uintptr_t(attrs),level,progress));
struct node {uintptr_t next=0,previous=0;unsigned char uuid_and_entry[40]{};std::string name;};
static_assert(offsetof(node,name)==56);node head,a,b;a.name="Zoe";b.name="Alex";
head.next=uintptr_t(&a);a.next=uintptr_t(&b);b.next=uintptr_t(&head);
uintptr_t map[]{0,uintptr_t(&head),2};std::vector<std::string> names;
assert(world::read_roster_map(uintptr_t(map),names) && names==std::vector<std::string>({"Alex","Zoe"}));
b.next=uintptr_t(&a);assert(!world::read_roster_map(uintptr_t(map),names));b.next=uintptr_t(&head);
map[2]=1025;assert(!world::read_roster_map(uintptr_t(map),names));map[2]=0;head.next=uintptr_t(&head);
assert(world::read_roster_map(uintptr_t(map),names) && names.empty());
// Sparse UI views report capacity from their actual ItemStack vector.
alignas(8) unsigned char view[0x110]{},getter[]{0x48,0x8b,0x81,0x08,0x01,0,0};uintptr_t vt[5]{};vt[4]=uintptr_t(getter);
put(view,0,uintptr_t(vt));put(view,0x100,uintptr_t(0x100000));put(view,0x108,uintptr_t(0x100000+54*152));
assert(inventory_tools::view_count(uintptr_t(view))==54);
put(view,0x108,uintptr_t(0x100000+27*152));assert(inventory_tools::view_count(uintptr_t(view))==27);
put(view,0x108,uintptr_t(0x100001));assert(inventory_tools::view_count(uintptr_t(view))==-1);
getter[0]=0;assert(inventory_tools::view_count(uintptr_t(view))==-1);
ImGui::CreateContext();auto& io=ImGui::GetIO();io.DisplaySize={1280,720};io.DeltaTime=.016f;
io.Fonts->AddFontDefault();unsigned char* pixels;int w,h;io.Fonts->GetTexDataAsRGBA32(&pixels,&w,&h);
ImGui::NewFrame();g_menu_open=true;
world::frame frame;frame.valid=true;frame.stamp=GetTickCount64();frame.xp_known=true;frame.xp_level=28;frame.xp_progress=.3f;frame.roster_known=true;
for(int i=0;i<25;++i)frame.online_players.push_back("player "+std::to_string(i));world::publish(frame);
tab_list list;xp_progress_hud xp;list.on_render();xp.on_render();assert(list.hud_size().x==360 && xp.hud_size().y==54);
world::publish({});list.on_render();xp.on_render();list.on_disable();xp.on_disable();
assert(!world::collect_roster && !world::collect_xp);
ImGui::Render();auto* data=ImGui::GetDrawData();assert(data->TotalVtxCount>100);
for(int i=0;i<data->CmdListsCount;++i)for(auto& v:data->CmdLists[i]->VtxBuffer)assert(std::isfinite(v.pos.x) && std::isfinite(v.pos.y));
g_menu_open=false;ImGui::DestroyContext();
std::cout<<"PASS: sparse container capacity, online roster integrity, XP attributes/boundaries and HUD geometry\n";
}