883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
22 lines
2.8 KiB
C++
22 lines
2.8 KiB
C++
#include "gateway/gameobject_queries.hpp"
|
|
#include <algorithm>
|
|
#include <bit>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
using namespace gateway;
|
|
static void check(bool value,const char* why){if(!value){std::cerr<<why<<'\n';std::exit(1);}}
|
|
static bool held(const GameObjectTemplateProjection& p,GameObjectTemplateHold why,int field=-1){return std::any_of(p.held.begin(),p.held.end(),[&](auto issue){return issue.reason==why && (field<0||issue.source_field==field);});}
|
|
int main(){
|
|
constexpr uint32_t entry=1734;constexpr uint64_t source=(uint64_t(0xf110)<<48)|(uint64_t(entry)<<24)|41;
|
|
GameObjectTemplateReply input;input.entry=entry;input.found=true;input.type=19;input.display=310;input.names={"Mailbox","Alternate","",""};
|
|
GameObjectTemplateBinding binding;binding.source_guid=source;binding.entry=entry;binding.realm=70;binding.map=0;binding.request_generation=9;binding.current_generation=9;binding.native_guid=forever_game_object_guid(source,entry,70,0);binding.template_size=1.5f;binding.native_display_id=674;
|
|
unsigned reference_calls=0;binding.references=[&](auto,uint32_t)->std::optional<uint32_t>{++reference_calls;return std::nullopt;};
|
|
auto p=forever_gameobject_template(input,binding);check(p.packet && p.held.empty(),"reviewed mailbox not projected");check(reference_calls==0,"mailbox accidentally used chest references");
|
|
Reader h(p.packet->body);check(h.le(4)==entry,"entry changed");check(unpack_guid(h,16)==Bytes(binding.native_guid.begin(),binding.native_guid.end()),"typed binding changed");check(h.le(1)==0x80,"original allow bit changed");auto size=h.le(4);auto bytes=h.take(size);h.end();
|
|
Reader r(bytes);check(r.le(4)==19 && r.le(4)==674,"subtype/display changed");for(auto& name:input.names)check(r.cstring(255)==name,"name changed");for(unsigned i=0;i<3;++i)check(r.cstring(255).empty(),"extra native text invented");for(unsigned i=0;i<35;++i)check(r.le(4)==0,"empty/default native mailbox data not zero");check(r.le(4)==std::bit_cast<uint32_t>(1.5f),"caller reviewed size lost");check(r.le(1)==0 && r.le(4)==0 && r.le(4)==0,"quest/tuning/level invented");r.end();
|
|
for(unsigned field=0;field<24;++field){auto unknown=input;unknown.data[field]=1;auto result=forever_gameobject_template(unknown,binding);check(!result.packet && held(result,GameObjectTemplateHold::UnmappedMailboxField,int(field)),"unknown source mailbox word silently projected");}
|
|
auto b=binding;b.native_display_id.reset();p=forever_gameobject_template(input,b);check(!p.packet && held(p,GameObjectTemplateHold::DisplayClosure),"raw model ID treated as closure");
|
|
b=binding;b.template_size.reset();p=forever_gameobject_template(input,b);check(!p.packet && held(p,GameObjectTemplateHold::TemplateSize),"missing authoritative size defaulted");
|
|
std::cout<<"PASS mailbox family original shared framing/defaults and unknown-field/display/size gates\n";
|
|
}
|