
    UHjk                    .   d Z ddlmZ ddlZddlmZ ddlZddlZddlZddl	Z	ddl
mZ ddlmZ e	j                  j                  d e ee      j%                         j&                               ddlmZmZmZ  ee      j%                         j0                  d   Zed	z  Zd
ZdZddddZdddddZh dZh dZ g dZ!g dZ"dg dddg dddg ddgZ#dAdZ$dAdZ%dBd Z&dBd!Z'dCd"Z(dDd#Z)dEd$Z*dFd%Z+dGd&Z,dHd'Z-dd(dId)Z.dJd*Z/dKd+Z0dLd,Z1	 	 	 	 	 	 	 	 	 	 	 	 dMd-Z2dNd.Z3dOd/Z4dPd0Z5dQd1Z6dRd2Z7dSd3Z8dTd4Z9dUd5Z:	 	 	 	 	 	 	 	 	 	 dVd6Z;dWd7Z<dXd8Z=dYd9Z>dZd:Z?	 	 	 	 	 	 	 	 	 	 d[d;Z@	 	 d\	 	 	 	 	 	 	 d]d<ZAd^d=ZBefd_d>ZCd`d?ZDeEd@k(  r eD        yy)azKScan broader coordinate encodings for map1_01a -> map2_02d exit candidates.    )annotationsN)Counter)Path)Any)offset_to_varead_sectionsva_to_offset   outmap1_01amap2_02dright"      sidexy      )topbottomleftr   >   .data.text.rdata>            r   )zstrict-source-coordinateztarget-spawn-strict-coordinatezpromotable-coordinate-owner)z7strict map1_01a source coordinate evidence for map2_02dz:strict target-spawn coordinate evidence linked to map2_02dzQpromotable coordinate owner rather than selector-script/character-descriptor dataHwanse2.exe)r   r   r   )pathfieldszout/save_scene_selectors.json)selectedPointer	fieldMaps	linkedCnszout/map_exit_candidates.json)exitCandidatesblockedTargetCandidatessamplec                    d| dS )N0x08x values    L/home/exedev/hwanse/tools/summarize_map1_01a_exit_coordinate_variant_scan.pyhex32r0   ,       c{    c                    d| dS )Nr*   02xr,   r-   s    r/   hex8r5   0   r1   r2   c                    | dz  |dz  dz  z  S N  r   r,   r   r   s     r/   pack_xyr:   4       JAJ2-..r2   c                    |dz  | dz  dz  z  S r7   r,   r9   s     r/   pack_yxr=   8   r;   r2   c                p    | j                         s|S t        j                  | j                  d            S )Nutf-8encoding)existsjsonloads	read_text)r!   fallbacks     r/   	load_jsonrG   <   s*    ;;=::dnngn677r2   c                N    | D ]   }|d   }||d   z   }||cxk  r	|k  s|c S  " y )Nrawraw_sizer,   )sectionsoffsetsectionstartends        r/   section_for_offsetrP   B   sE     gj))F S N !
 r2   c                v    t        ||      }||dz   t        |       kD  ry t        j                  d| |      d   S )N   <Ir   )r	   lenstructunpack_from)exerK   varL   s       r/   dword_at_varY   K   s?    (B'F~!c#h.dC033r2   c                   | D cg c]#  }t        |j                  d      t              r|% }}|j                  d        g }t	        |      D ]  \  }}|d   }|dz   t        |      k  r||dz      d   nd}|j                  |j                  d       d|j                  d       t        |      t        |      |||j                  d	      xs g |j                  d
      xs g d        |S c c}w )Nr#   c                    | d   S )Nr#   r,   rows    r/   <lambda>z'selector_owner_ranges.<locals>.<lambda>X   s    $5 6 r2   keyr
   i  ` group:slotr$   r%   )selectorrootHex
rootEndHexrN   rO   r$   r%   )
isinstancegetintsort	enumeraterT   appendr0   )	selectorsr]   startsrangesindexrN   rO   s          r/   selector_owner_rangesrq   R   s    cgg/0#6 	F 
 KK6K7F' 
s%&6;ai#f+6MfUQY 12S]777+,Acggfo->?U|*-3-3
 	 M's   (C0c                @    | D ]  }|d   |cxk  r|d   k  s|c S   y )NrN   rO   r,   )ro   rX   r]   s      r/   owner_for_vars   i   s5     w<2*E
*J + r2   c                0    dddddj                  | d      S )NfillBranchStateTablereadSelectedStateAndBranchselectActiveStateSlotselectMatchingRuntimeSlot)r   r   r   r   otherrh   )opcodes    r/   selection_operationr|   p   s&    $*%)	
 
c&'r2   missingc                   t               }| D ]0  }|j                  |      }|||}|t        |      xx   dz  cc<   2 t        t	        |j                                     S )Nr
   )r   rh   strdictsorteditems)rowsr`   r~   counterr]   r.   s         r/   count_fieldr   y   sc    #IG !=EE
q ! w}}'((r2   c                    t               }| D ]&  }|j                  |j                  |      xs i        ( t        t	        |j                                     S N)r   updaterh   r   r   r   )r   r`   r   r]   s       r/   merge_count_mapsr      sG    #IG +swws|)r*+w}}'((r2   c                    | dz  }|t         v ry|r,|j                  d      dk(  rd|j                  d      xs g v ry|r7t        |j                  d      xs g v rt        |j                  d      xs g v ry	y
)N   save-selector-selection-opcoderd   24:0zcara_at1.cnsr%   z character-descriptor-script-wordr$   selector-script-wordzunclassified-data-word)SELECTION_OPCODESrh   SOURCETARGET)r.   ownerr{   s      r/   classify_hitr      sy    T\F""/:&&0^		R]H^Hdbd5e1EIIk28b9fS^I_Iece>f%#r2   c                   t        ||      }||d   t        vry t        ||      }|y t        ||      }|dz  }|dz	  dz  }	|dz	  dz  }
||d   z
  dz  dk(  }t	        |      |d   |t	        |      |dz  |dz	  t        |      t        ||      d	d
	}|r%|j                  |d   |d   |d   |d   d d d       |t        v r0|j                  t        |      t        |
      t        |	      d       g }t        |dz
  |dz   d      D ]I  }t        | ||      }||j                  t	        |      t	        |      t        |dz        ||k(  d       K ||d<   |S )Nnamer      r   rI   rR   r   r8   F)	vaHexrM   dwordAlignedvalueHexu16Lou16HilowOpcodeHexclassificationpromotableCoordinateEvidencerd   re   r$   r%   )ownerSelectorownerRootHexownerFieldMapsownerLinkedCnsSample)selectionOperationselectionBufferOffsetHexstreamPlus1Hex   )r   r   r   isHitcontextRows)rP   SCAN_SECTIONSr   rs   r0   r5   r   r   r   r|   rangerY   rl   )rW   rK   owner_rangesrL   r.   rM   rX   r   r{   stream_plus_1stream_plus_2alignedr]   contextitem_vavalue_ats                   r/   hit_rowr      s    62G'&/>	h	'B	zr*ET\FaZ4'Mb[D(M&!+q0Gr6?%L"V&ue4(-
C 

":.!),#K0$)+$6r$:	
 	 ""

"5f"=(,](;"=1
 	
 GdBIq1 	sHg67^h D1]	
 			 !CJr2   c                p   t        j                  d|      }g }i }d}d}		 | j                  ||	      }
|
dk  rnQ|
dz   }	t        | |||
|      }|0|j	                  |       |j                  |d   d      dz   ||d   <   |d   r|dz  }i|D cg c]  }|j                  d      dv r| }}|D cg c]  }|j                  d      d	k(  s| }}|D cg c]  }|j                  d      d
k(  s| }}|D cg c]  }|j                  d      du s| }}|D cg c]  }|j                  d      du r| }}i d|dt        |      dt        |      d|dt        t        |j                                     dt        |      dt        |      dt        |      dt        |d      dt        |dd      dt        |d      dt        |d      dt        |d      dt        |      dt        |      dt        |      dk(  dt        |      dk(  d |d d! iS c c}w c c}w c c}w c c}w c c}w )"NrS   r   Tr
   rM   r   r   >   0:01:02:0r   r   r   r   labelr   hitCountalignedHitCountsectionCountsinterestingHitCountcurrentRootHitCountcharacterDescriptorHitCountclassificationCountsr   ownerSelectorCountsunownedr}   interestingClassificationCountscurrentRootClassificationCounts'characterDescriptorClassificationCountspromotableHitCountinterestingPromotableHitCountallHitsNonPromotableallInterestingHitsNonPromotablehits   )rU   packfindr   rl   rh   r0   rT   r   r   r   r   )rW   rK   r   r   r.   patternr   section_countsaligned_countsearchrL   r]   interestingcurrent_root_hitscharacter_descriptor_hitspromotable_hitsinteresting_promotable_hitss                    r/   
scan_valuer      s    kk$&GD%'NMF
'6*A:!c8\65A;C)7););C	NA)NQR)Rs9~&~QM  77?#'DD 	K  )-R0HE0QRR04 [8PTZ8Z [ [&*^scgg6T.UY].]s^O^"#7712d: 	# #E%L 	CI 	=	
 	f^%9%9%;<= 	s;/ 	s#45 	&s+D'E 	D2B C 	{4)T 	*;{DT+U 	*;7HJZ+[ 	2;%4
" 	c/2#$ 	(-H)I%& 	O 4 9'( 	*3/J+Kq+P)* 	CR +  S [^#s0   H/H$	H$H)-H)7H.H.H3c                `   dj                  d |D              }g }d}	 | j                  ||      }|dk  r	 |S |dz   }t        ||      }t        ||      }|||d   t        vrH|j                  t        |      |d   ||d   z
  dz  dk(  |D 	cg c]  }	t        |	       c}	d       c c}	w )	Nr2   c              3  H   K   | ]  }t        j                  d |        yw)rS   N)rU   r   .0r.   s     r/   	<genexpr>z scan_sequence.<locals>.<genexpr>  s     DEv{{4/Ds    "r   r
   r   rI   rR   )r   rM   r   	valuesHex)joinr   rP   r   r   rl   r0   )
rW   rK   valuesr   r   r   rL   rM   rX   r.   s
             r/   scan_sequencer     s    hhDVDDGDF
'6*A: K !$Xv6(F+:GFO=,P2Yv#gen49Q>4:;5%,;	
 	  <s   B+c                    | j                  d      xs i }t        j                  | j                  d      d      t        |j                  d      xs d      t        |j                  d      xs d      fS )Ntiler   c   r   r   r   )rh   
SIDE_ORDERri   )	candidater   s     r/   candidate_sort_keyr     s`    == &BDy}}V,b1DHHSMQDHHSMQ r2   c                   g }| D ]q  }|j                  d      t        k7  r|j                  d      xs g D ]<  }|j                  d      xs i }g |j                  d      xs g |j                  d      xs g }t        d |j                  d      xs g D        d       }t        |v stt	        |j                  d      t
              st	        |j                  d	      t
              s|j                  |j                  d
      |j                  d      |j                  d	      d|j                  d      xs i |j                  d      ||j                  d      |j                  d      d       ? t |rt        |t              S ddddi d d d dddddi d d d dddddi d d d dt        d
   t        d   t        d	   di d d d dgS )Nmapr&   r(   r'   selectorTargetCandidatesc              3  P   K   | ]  }|j                  d       t        k(  r|   yw)targetN)rh   r   )r   hints     r/   r   z1exit_candidates_from_map_exits.<locals>.<genexpr>1  s)      !xx)V3 s   $&targetHintsr   r   r   r9   span	standable	reviewUrltrialUrl)r   r   r   r   
targetHintr   r   r_   r   r   r   )r   r   r   r   r   r   r   r   /   r   r      )
rh   r   nextr   rg   ri   rl   r   r   
RIGHT_EXIT)map_exit_candidates
candidates
source_rowr   r(   targetstarget_hints          r/   exit_candidates_from_map_exitsr   %  s   J) 
>>% F*#(89?R 	I]]8,2F-- 9:@b-- :;ArG %.]]=%A%GR K  Z

3%E*U[U_U_`cUdfiJj!!%MM&1"(**S/

3H%MM&17R!'K!8"-!*{!; )j 9# 	4 j&899q! r" b! 6" oJsO<+ r2   c                   t        |       }|D ]n  }|j                  d      xs i }|j                  d      t        d   k(  s4|j                  d      t        d   k(  sP|j                  d      t        d   k(  sl|c S  |d   S )Nr   r   r   r   )r   rh   r   )r   r   r   r   s       r/   candidate_from_map_exitsr   b  s    /0CDJ 	}}V$*MM&!Z%77C0C0 b>r2   c                t    | dk(  rd||dz
  fS | dk(  rd||dz   fS | dk(  rd|dz
  |fS | dk(  rd	|dz   |fS d
||fS )Nr   zoutside-top tiler
   r   zoutside-bottom tiler   zoutside-left tiler   zoutside-right tilezoutside tiler,   r   s      r/   outside_tiler   o  sp    u}!1a!e++x$aQ..v~"AE1,,w#QUA--1ar2   c                   t        || |      \  }}}| dz  }|dz  }|dz
  }|dz
  }	|dz   }
|dz   }|dz  }|dz  }|dz   }|dz   }|dz   }|dz   }|dz   }|dz   }dt        | |      fdt        | |      fdt        | dz   |dz         fdt        | dz   |dz         f| d	t        ||      f| d
t        ||      fdt        ||      fdt        ||      fdt        ||	      fdt        ||	      fdt        |
|      fdt        |
|      f| dt        ||      f| dt        ||      fdt        ||      fdt        ||      fdt        ||      fdt        ||      f| dt        ||      f| dt        ||      fgS )Nr   r   r   zexact tile x,yzexact tile y,xzone-based tile x,yr
   zone-based tile y,x x,y y,xzpixel x*16,y*16zpixel y*16,x*16z$runtime pixel origin x*16-16,y*16-16z$runtime pixel origin y*16-16,x*16-16z"runtime pixel center x*16+8,y*16+8z"runtime pixel center y*16+8,x*16+8z pixel x*16,y*16z pixel y*16,x*16z screen-bias pixel x*16+24,y*16+8z screen-bias pixel y*16+8,x*16+24z(screen-bias pixel center x*16+32,y*16+16z(screen-bias pixel center y*16+16,x*16+32z! screen-bias pixel x*16+24,y*16+8z! screen-bias pixel y*16+8,x*16+24)r   r:   r=   )r   r   r   outside_label	outside_x	outside_ypixel_xpixel_yorigin_xorigin_ycenter_xcenter_youtside_pixel_xoutside_pixel_yscreen_origin_xscreen_origin_yscreen_center_xscreen_center_youtside_screen_origin_xoutside_screen_origin_ys                       r/   variant_valuesr  {  s   *6tQ*B'M9i"fG"fG|H|H{H{H"nO"nOlOkO%)O%)O-2-1	71a=)	71a=)	wq1ua!e45	wq1ua!e45?$	I!>??$	I!>?	GGW56	GGW56	/81LM	/81LM	-wx/JK	-wx/JK?*	+W_o-VW?*	+W_o-VW	+W_o-VW	+W_o-VW	3W_o5^_	3W_o5^_?;	<gF]_v>wx?;	<gF]_v>wx) r2   c                    t               }g }| D ]4  \  }}}||f}||v r|j                  |       |j                  |||f       6 |S r   )setaddrl   )pointsseenr   r   r   r   r`   s          r/   unique_pointsr    sZ    5DD #q!!f$;UAqM"# Kr2   c                   | j                  d      xs i }|j                  d      }|j                  d      }|j                  d      }|j                  d      }|j                  d      }t        d ||||fD              sg S |dk(  rt        d	||fd
||fd||fd||fg      S |dk(  rt        d	||fd
||fd||fd||fg      S g S )Nr   axisfromtoperpendicularFromperpendicularToc              3  <   K   | ]  }t        |t                y wr   )rg   ri   r   s     r/   r   z%span_corner_points.<locals>.<genexpr>  s     h%z%%hs   r   zspan min/minzspan max/minzspan min/maxzspan max/maxr   )rh   allr  )r   r   r  rN   rO   perpendicular_startperpendicular_ends          r/   span_corner_pointsr&    s   == &BD88FDHHVE
((4.C((#67!23hE3@SUf3ghh	s{U$78S"56U$56S"34	
  	 s{0%8.60#6.4	
  	 Ir2   c                *   g }t        |      D ]  \  }}}|j                  t        | ||| dt        ||                   ||d|d   d<   d|d   d<   |j                  t        | ||| dt	        ||                   ||d|d   d<   d|d   d<    |S )	Nr  r9   r   pointxypackedOrderr  yx)r&  rl   r   r:   r=   )rW   rK   r   r   r   corner_labelr   r   s           r/   span_bound_scansr-    s     D0; 'aJsHl|nD<QSZ[\^_S`ab"#!,R"&RJsHl|nD<QSZ[\^_S`ab"#!,R"&R' Kr2   c           
        t        |      }|sg S |D cg c]  \  }}}|
 }}}|D cg c]  \  }}}|
 }}}t        |      t        |      f}	t        |      t        |      f}
dt        |	 t        |
 gfdt	        |	 t	        |
 gfg}g }|D ]K  \  }}t        | ||      }|j                  ||D cg c]  }t        |       c}t        |      |d d d       M |S c c}}w c c}}w c c}w )Nzspan min,max x,y sequencezspan min,max y,x sequence   )r   r   r   r   )	r&  minmaxr:   r=   r   rl   r0   rT   )rW   rK   r   r  _r   xsr   ys	min_point	max_point	sequencesr   r   r   r   r.   s                    r/   span_sequence_scansr8    s   	*F	!	"1a!	"B	"!	"1a!	"B	"R#b'"IR#b'"I	$w	':GY<O&PQ	$w	':GY<O&PQI D" vS(F34:;5%,;D	"I	
 	 K# 
#	" <s   CC$1C*c                    |dv r| |dz
  f| |f| |dz   fg}n| dz
  |f| |f| dz   |fg}|dk(  r|D cg c]  \  }}t        ||       c}}S |D cg c]  \  }}t        ||       c}}S c c}}w c c}}w )N>   r   r   r
   r+  )r=   r:   )r   r   r   packed_orderr  pxpys          r/   axis_sequence_valuesr=    s      a!e*q!fq!a%j1q5!*q!fq1uaj1t.45FBB55*01BGBO11 61s   A+A1c                T    t        | |dz
        t        | |dz
        t        | |      gS )Nr   r
   )r=   r9   s     r/   opcode_sequence_valuesr?    s+    Aq1uwq!a%0'!Q-@@r2   c                   g }t        |dz
  |dz         D ]  }t        |dz
  |dz         D ]  }t        ||      }t        | ||d| d| |      }	|	d   D 
cg c]  }
|
j                  d      dk(  s|
 }}
|sN|j	                  ||d	t        |      t        |      |d d
 t        d |D              d         |S c c}
w )Nr      r   zneighbor y,x ,r   r   r   r9   rR   c              3  D   K   | ]  }|j                  d       dk(    yw)r   r   Nrz   r   r]   s     r/   r   z1neighborhood_current_root_hits.<locals>.<genexpr>  s'       1Hsv9I1JNn1n  1Hs    )tileInterpretedAsXyyxPackedHexr   
sampleHitsallSamplesAreOpcodeShaped)r   r=   r   rh   rl   r0   rT   r#  )rW   rK   r   r   r   r   nxnyr.   scanr]   current_hitss               r/   neighborhood_current_root_hitsrM     s    DAE1q5! Aq1u% 	BBOEc8\]2$aPRt;TV[\D+/<]C377?;SW\;\C]L]KK-/b'9$U|'*<'8*2A.-0  1H  {G  1H  .H 	 K ^s   B=/B=c                	   |d   }|d   }|d   }|j                  d      xs d}t        |||      D 	cg c]  \  }}	t        | ||||	       }
}}	|
d   }|
d   }|d   D cg c]  }|j                  d	      d
k(  r| }}|d   D cg c]  }|j                  d	      dk(  r| }}t        | |t	        |||d            }t        | |t	        |||d            }t        | |t        ||            }t        | |||      }t        | ||      }|j                  d      xs i }g }t        |j                  d      t              rt        |j                  d      t              r|d   }|d   }|j                  d      xs d}t        |||      D 	cg c]Q  \  }}	i t        | ||d| |	      d|j                  d      ||||j                  d      |j                  d      diS }}}	t        d |D              }t        d |D              }i d|d||dd|j                  d      xs i d|j                  d      d|rs|j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      dni d|j                  d      d|j                  d      d|
d|d|d |d!t        d" |
D              d#t        d$ |
D              d%t        d& |
D              d't        |      d(t        d) |D              d*t        d+ |D              i d,t        d- |D              d.t        d/ |D              d0t        |d1      d2t        |d3      d4t        |d5      d6t        |d7      d8t        |d9      d:|d;|d<|dk(  d=|dk(  d>t        d? |D              d@t        dA |D              dBt        dC |D              dDt        dE |D              dF|dG   dHt        |      |dG   t        |      |t        | ||||      t        |      |d dI t        |      |d dI t        |      |d dI dJdJdKS c c}	}w c c}w c c}w c c}	}w )LNr   r   r   r   exitr   r
   r   r   r   r   r)  r+  r   r   ztarget spawn targetSpawnr   autoTrigger)r   r   r   r   r   rQ  c              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>A        ,&) !,   c              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>D        814+,8rU  r9   r   projectionDelta)r   r   r   r   r   rQ  rY  r   r   variantScanstargetSpawnVariantScansspanBoundScansspanSequenceScansr   c              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>[       "O#3'<#="OrU  r   c              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>\  r`  rU  r   c              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>]  s     *_RU3/L+M*_rU  targetSpawnVariantScanCounttargetSpawnHitCountc              3  &   K   | ]	  }|d      ywr   Nr,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>_       "Qs3z?"QrU  targetSpawnInterestingHitCountc              3  &   K   | ]	  }|d      ywr_  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>`       -gSc2G.H-grU  targetSpawnCurrentRootHitCountc              3  &   K   | ]	  }|d      ywrb  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>a  rl  rU  &targetSpawnCharacterDescriptorHitCountc              3  &   K   | ]	  }|d      ywrd  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>b       5w]`c:W6X5wrU  targetSpawnClassificationCountsr   targetSpawnOwnerSelectorCountsr   *targetSpawnInterestingClassificationCountsr   *targetSpawnCurrentRootClassificationCountsr   2targetSpawnCharacterDescriptorClassificationCountsr   targetSpawnPromotableHitCount(targetSpawnInterestingPromotableHitCounttargetSpawnAllHitsNonPromotable*targetSpawnAllInterestingHitsNonPromotablespanBoundHitCountc              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>u  s      GSZ GrU  spanBoundCurrentRootHitCountc              3  &   K   | ]	  }|d      ywrb  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>v       +]3C0E,F+]rU  $spanBoundCharacterDescriptorHitCountc              3  &   K   | ]	  }|d      ywrd  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>w  s     3m[^C8U4V3mrU  spanSequenceHitCountc              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z&summarize_candidate.<locals>.<genexpr>x  s     #NC
O#NrU  exactXyHitCountr   "exactXyCharacterDescriptorHitCountr/  F)exactYxHitCountexactYxCurrentRootHitCountcurrentRootYxHitsneighborhoodCurrentRootYxHitsxyRowSequenceHitCountxyRowSequenceHitsyxAxisSequenceHitCountyxAxisSequenceHitsyxOpcodeSequenceHitCountyxOpcodeSequenceHits(targetSpawnStrictCoordinateEvidenceFoundstrictCoordinateEvidenceFound)rh   r  r   r   r=  r?  r-  r8  rg   ri   sumrT   r   rM  )rW   rK   r   r   r   r   r   r   r   r.   scansexact_xyexact_yxr]   current_root_yx_hitsexact_xy_character_hitsxy_axis_sequenceyx_axis_sequenceyx_opcode_sequence
span_scansspan_sequencesr   target_spawn_scanstarget_xtarget_ytarget_side!target_spawn_promotable_hit_count-target_spawn_interesting_promotable_hit_counts                               r/   summarize_candidater    s;    VDS	AS	A== *FDWefgijlpWqr|ueZX|UEBrErQxHQxH'77?#u, 	 
  '77?#v- 	  %S(4HAtUY4Z[$S(4HAtUY4Z[&sH6LQPQ6RS!#xyIJ(h	BN---3K+//#&,KOOC<PRU1Vs#s#!oof-9 !/x; O
 u
S(LM%:QSXY
)ooh7'!!!,!=#.??=#A 

 
 ), ,-?, )% 58 88J8 51@@aa @ 		f%+@ 	Y]];/	@
 	  "ooh/OOF+%%$5&??=9*/@A
 !@ 	Y]];/@ 	IMM*-@  	!@" 	"#5#@$ 	*%@& 	^'@( 	s"O"OO)@* 	s"O"OO+@, 	&s*_Y^*_'_-@. 	&s+='>/@0 	s"Q>P"QQ1@2 	)#-gTf-g*g3@4 	)#-gTf-g*g5@6 	1#5wdv5w2w7@8 	*+;<NPf+g9@: 	)*:;MOd*e;@< 	56F-7
=@D 	56F-7
E@L 	=>N5?
M@T 	()JU@V 	34aW@X 	*+LPQ+QY@Z 	56cgh6h[@\ 	S GJ GG]@^ 	'+]R\+](]_@` 	/3mbl3m0ma@b 	#N~#N Nc@d 	8J/e@f 	-c2I.Jg@h $J/&)*>&?1)GXWcefhi)j!$%5!6-cr2"%&6"7.s3$'(:$; 23B 749).@ @U s
s   Q7"Q=RARc                
   t        |       }||nt        t        dz  g       }||nt        t        dz  g       }t        |      }t	        |      }|D cg c]  }t        | |||       }}t        |      }t        d |D        |d         }|D 	
cg c]  }	|	d   D ]  }
i |
|	d   |	d   d  }}	}
|D 	
cg c]  }	|	d	   D ]  }
i |
|	d   |	d   d  }}	}
|D 	
cg c]  }	|	d
   D ]  }
i |
|	d   |	d   d  }}	}
|D 	
cg c]?  }	|	j                  d      xs g D ]%  }
i |
|	d   |	d   |	j                  d      xs i d' A }}	}
t        d |D              }t        d |D              }t        |d      }t        |d      }t        |d      }t        |d      }t        |d      }|D 
cg c]  }
|
j                  d      xs g D ]k  }|j                  d      dk(  rU|
j                  d      |
j                  d      |
j                  d      |
j                  d      |
j                  d      d|m  }}
}|d   D 	cg c]  }	|	j                  d      d k(  r|	 }}	|D 	cg c]  }	|	j                  d      d!k(  r|	 }}	i d"t        |      d#t        |      d$t        |      d%t        |      d&|d'   d(|d)   d*|d+   d,t        |      d-t        |      d.t        |      d/t        d0 |D              d1t        |      d2t        d3 |D              d4t        d5 |D              d6t        d7 |D              d8t        d9 |D              d:||||||||d;k(  |d;k(  d<d<d=d>}d?j                  d@ |D              }dAt        |       dB| dC}i dDt        dEt        d"t        |      dF|dG|dH|dI|dJt        |dK L      d|d|d1t        |      d2t        dM |D              d4t        dN |D              d6t        dO |D              d8t        dP |D              d:|dQ|i dR|dS|dT|dU|dV|dW|d;k(  dX|d;k(  dYd<d	|d
|dZ|d$t        |      d%t        |      d[t        d\ |D              d-t        |      d/t        d] |D              d^d<i d'|d'   d)|d)   d_|d_   d+|d+   d|d   d`|d`   da|db|db   dc|dc   dd|dd   de|de   dfd<dgdhdidhdjd<dkd<dlt         t"        t$        t        t$              |dmS c c}w c c}
}	w c c}
}	w c c}
}	w c c}
}	w c c}}
w c c}	w c c}	w )nNsave_scene_selectors.jsonmap_exit_candidates.jsonc              3     K   | ]9  }|d    t         d    k(  r(|d   d   t         d   k(  r|d   d   t         d   k(  r| ; yw)r   r   r   r   N)r   rD  s     r/   r   z build_summary.<locals>.<genexpr>  sS      	
6{j00FC JsO3FC JsO3 	
s   ?Ar   rZ  r   r   )candidateSidecandidateTiler\  r]  r[  rP  )r  r  rP  c              3  &   K   | ]	  }|d      ywrS  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  rT  rU  c              3  &   K   | ]	  }|d      ywrW  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  rX  rU  r   r   r   r   r   r   r   r   r  r  r   r(  r   )r  r  r   r(  r   r  r   r   r   candidateCountvariantScanCountspanBoundScanCountspanSequenceScanCountlegacyRightExactXyHitCountr  -legacyRightExactXyCharacterDescriptorHitCountr  %legacyRightExactYxCurrentRootHitCountr  )legacyRightExactYxSelectionOpcodeHitCountspanCurrentRootHitCount%spanCurrentRootSelectorScriptHitCountr  c              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>       #SC
O#SrU  re  rf  c              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  ri  rU  rj  c              3  &   K   | ]	  }|d      ywr_  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  rl  rU  rm  c              3  &   K   | ]	  }|d      ywrb  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  rl  rU  ro  c              3  &   K   | ]	  }|d      ywrd  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  rq  rU  rr  r   FzRall current-root/descriptor hits are VM script words, not strict coordinate tables)rs  rt  ru  rv  rw  rx  ry  rz  r  r  r   , c              3  N   K   | ]  }|d     d|d   d    d|d   d      yw)r    r   r   rB  r   Nr,   rD  s     r/   r   z build_summary.<locals>.<genexpr>  sA      ! v;-qVS)*!CK,<+=>!   #%zA broader scan of all z' map1_01a -> map2_02d exit candidates (a  ) still does not produce strict source hotspot evidence. The scan covers tile, one-based tile, outside tile, tile*16 pixel, runtime pixel origin, runtime pixel center, screen-bias projection, target-spawn coordinate variants, and outside pixel encodings, plus span corner/bounds encodings. The legacy right-exit exact x,y packed value appears only inside the cara_at1 descriptor script, not a map1_01a event table. The legacy right-exit y,x packed value has hits in the current selector root, but every current-root hit decodes as a save-selector selection opcode row with low opcode 0x13 and selection offset 0x22. Span-corner scalar values do appear in the current selector root, but no min/max span sequence is present and the current-root hits classify as selector script words rather than a strict coordinate table. Target-spawn variants also resolve their current-root hits to selector script words and their descriptor hits to cara_at1 character script words, with no promotable coordinate hit. That is VM control data, not a coordinate table. Keep map1_01a -> map2_02d blocked until a strict source hotspot, runtime trace, or equivalent trigger proof is found.sourcer   r   r   legacyRightExitCandidatecandidateSummariesbestCandidatec                    | d   | d   fS )Nr   r   r,   r\   s    r/   r^   zbuild_summary.<locals>.<lambda>!  s    3G\C]_bcx_yBz r2   r_   c              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>%  ri  rU  c              3  &   K   | ]	  }|d      ywr_  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>&  rl  rU  c              3  &   K   | ]	  }|d      ywrb  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>'  rl  rU  c              3  &   K   | ]	  }|d      ywrd  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>(  rq  rU  rs  rt  ru  rv  rw  rx  ry  rz  r  spanCurrentRootHitsr}  c              3  &   K   | ]	  }|d      ywrb  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr><  r  rU  c              3  &   K   | ]	  }|d      ywrh  r,   rD  s     r/   r   z build_summary.<locals>.<genexpr>>  r  rU  &spanBoundStrictCoordinateEvidenceFoundr  r  falsePositiveSummaryr  r  r  r  r  controlPathProofStatusblockedpromotionStatus
proofFoundexitCoordinateVariantProofFound"failedExitCoordinateVariantGateIds)missingEvidenceevidenceRefsevidenceRefCount
conclusion)r   rG   OUTrq   r   r  r   r   rh   r  r   rT   r   r   r   r1  'FAILED_EXIT_COORDINATE_VARIANT_GATE_IDS(EXIT_COORDINATE_VARIANT_MISSING_EVIDENCE%EXIT_COORDINATE_VARIANT_EVIDENCE_REFS)rW   rm   r   rK   r   r   r   candidate_summariesright_summaryr]   rK  r  r  r8  r  r  r  "target_spawn_classification_counts"target_spawn_owner_selector_counts.target_spawn_interesting_classification_counts/target_spawn_current_root_classification_counts7target_spawn_character_descriptor_classification_countshitspan_current_root_hitsright_yx_selection_hitsspan_selector_script_hitsfalse_positive_summarycandidate_labelsr  s                                r/   build_summaryr    s+	   
 S!H&2		#HcBceg8hI1D1P-V_`c  gA  aA  CE  WF(3L/0CDJ $ 	C<C  ))<=I	
.	
 	BM ''  	M4L#f+FLLE  '()  	M4L#f+FLLJ  '+,  	M4L#f+FLL  '	 GG56<"	 	
	
 [ [77=17R		
		
	 	 ), ,-?, )% 58 88J8 51 *::LNd)e&)9:LNc)d&5E)62 7G)73 ?O1?;  88F#)r 77?#u, "XXo6!XXo6XXg&XXg&,	
 	
	
  %%8977#$(HH 	 
 .!77#$(>> 	! !!#12!CJ! 	c*o! 	 %8!9	!
 	%m4E&F! 	8Gk9l! 	0?[1\! 	4S9P5Q! 	"3'=#>! 	05N1O! 	#S?R#S S! 	&s+='>! 	s"Q>P"QQ! 	)#-gTf-g*g! 	)#-gTf-g*g!  	1#5wdv5w2w!!" 	*+M#!$ +M6d6eC)J4a+LPQ+Q9Q>49).nA!D yy !&! 
 !%8!9 : ; H	H <&<&< 	#12< 	j	<
 	Y< 	#I< 	1< 	06z{< 	< 	"#5< 	&s+='>< 	s"Q>P"QQ< 	)#-gTf-g*g< 	)#-gTf-g*g< 	1#5wdv5w2w<  	*+M!<" 	)*L#<$ 	56d%<& 	56e'<( 	=C+<. 	()J/<0 	34a1<2 	*+LPQ+Q3<4 	59Q>7<: 	3E;<< 	*=<> 	0?<@ 	5A<B 	c*oC<D 	 %8!9E<F 	'+]R\+](]G<H 	"3'=#>I<J 	#S?R#S SK<L 	1%M<N 	=):;O<P 	-m<`.aQ<R 	=):;S<T 	%m4P&QU<V 	]+>?W<X 	(7V)WY<Z 	 6[<\ 	 /F!G]<^ 	]+>?_<` 	#M2L$Ma<b 	.D Ec<d 	(e<f 	!)g<h 	9i<j 	ek<l 	*5m<n 	-.Uo<p D= EF w< <K


	<!s2   T# T(9 T.! T4	AT:5B
U 	U,Uc                   | d   }|d   }| j                  d      xs g }| j                  d      xs i }g }dD ]X  }|j                  dt        j                  |       dt        j                  t	        |j                  |                   d       Z g }|D ]=  }|d   }	|j                  d	      xs i }
|
r7|
j                  d
       d|
j                  d       d|
j                  d       nd}|j                  dj                  g dt        j                  |d
          d|	d    d|	d    dt        j                  |       d|d    d|d    d|d    d|j                  d       d|j                  d       d|d    d|d    d|d    d|d    d|d    d|d    d|d     d|d!    d             @ g }| d"   D ]  }|j                  d#      xs i }|j                  d	      xs i }
|j                  d$       d|j                  d       d|j                  d       }|
j                  d
       d|
j                  d       d|
j                  d       }d%j                  d& |d'   j                         D              xs d}t        j                  |j                  d(      xs i d)*      }t        j                  |j                  d+      xs i d)*      }|j                  dt        j                  |       dt        j                  |       dt        j                  |d,          dt        j                  |d-          d|d.    d|d    d|d    dt        j                  |       dt        j                  |       d|j                  d/       dt        j                  |       d        g }| d0   D ]  }|j                  d#      xs i }|j                  d$       d|j                  d       d|j                  d       }d%j                  d1 |d'   j                         D              xs d}|j                  dt        j                  |       dt        j                  |d,          dt        j                  |d-          d|d.    d|d    d|d    dt        j                  |       d        g }| d2   D ]7  }|j                  d#      xs i }|j                  d3      xs i }|j                  d$       d|j                  d       d|j                  d       }d%j                  d4 |d'   j                         D              xs d}|j                  dt        j                  |       dt        j                  |d,          d|j                  d       d|j                  d       d5t        j                  |d-          d|d.    d|d    d|d    dt        j                  |       d       : g }| d6   D ]  }|j                  d#      xs i }|j                  d$       d|j                  d       d|j                  d       }|j                  dt        j                  |       dt        j                  |d,          dt        j                  d%j                  |d7                d|d.    d	        g }| d8   D ]]  }|j                  d#      xs i }|j                  d$       d|j                  d       d|j                  d       }|j                  dt        j                  |       dt        j                  t	        |j                  d,                   dt        j                  t	        |j                  d9                   dt        j                  t	        |j                  d-                   dt        j                  t	        |j                  d:                   dt        j                  t	        |j                  d;                   d       ` g }| d<   D ]  }|j                  d=t        j                  |d9          dt        j                  |d-          dt        j                  |d:          dt        j                  |j                  d>d             dt        j                  |j                  d?d             dt        j                  |d;          d        d@j                  g dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUt        j                  | dV          dWt        j                  | dX          dY| j                  dZt        |             d[t        j                  |d
          d\|d    d|d    d]| d    d^| d_    d`t        j                  | da          dbdc| dd    det        j                  d%j                  | df                dgt        | dh          di| j                  dj       db	dkt        j                  | dl          dmdndodp | dh   D        dqdrds|dtdudv|dtdwdx|dtdydz|xs d{gdtd|d}|xs d~gdtdd|xs dgdtdd|xs dgdtdd|dtddd      S )Nr   r   r  r  )r  r  r  r  r  r  r  r  r  r  r  re  rf  rj  rm  ro  ru  rv  rw  rx  rz  r  r  r   z<tr><td>z	</td><td>z
</td></tr>rP  r   r  r   rB  r   - z</td><td><code>z</code></td><td><code>z</code></td><td>r   r   r   rf  /rm  r{  r}  r  r  r  r  r  r  r[  r  r  r  c              3  0   K   | ]  \  }}| d |   yw=Nr,   r   r`   r.   s      r/   r   zhtml_page.<locals>.<genexpr>       ]*#uuAeW-]   r   r   T)	sort_keysr   r   r   r   r   rZ  c              3  0   K   | ]  \  }}| d |   ywr  r,   r  s      r/   r   zhtml_page.<locals>.<genexpr>  r  r  r\  r(  c              3  0   K   | ]  \  }}| d |   ywr  r,   r  s      r/   r   zhtml_page.<locals>.<genexpr>  r  r  z / r]  r   r  r   r   r   r  z<tr><td><code>r   r   
z<!doctype html>z<html lang="en">z<head>z  <meta charset="utf-8">zF  <meta name="viewport" content="width=device-width, initial-scale=1">z6  <title>map1_01a Exit Coordinate Variant Scan</title>z	  <style>zg    :root { color-scheme: dark; font-family: system-ui, sans-serif; background: #101010; color: #eee; }z&    body { margin: 0; padding: 24px; }z,    h1 { margin: 0 0 8px; font-size: 24px; }z/    h2 { margin: 24px 0 8px; font-size: 18px; }z<    p { max-width: 1120px; color: #bbb; line-height: 1.45; }z[    table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 13px; }zi    th, td { border-bottom: 1px solid #303030; padding: 7px 8px; text-align: left; vertical-align: top; }zF    th { position: sticky; top: 0; background: #181818; color: #ddd; }z    code { color: #d7f0ff; }z
  </style>z</head>z<body>z0  <h1>map1_01a Exit Coordinate Variant Scan</h1>z  <p>route r  z -&gt; r   z; candidate count: r  z; legacy right candidate z <code>z</code>; exact x,y hits z; exact y,x current root hits r  z; promotion status <code>r  z</code>.</p>z  <p>proof found <code>r  z4</code>; failed exit coordinate variant gates <code>r  z&</code>; missing evidence count <code>r  z</code>; evidence refs <code>r  z  <p>r  z</p>z  <h2>Missing Evidence</h2>z  <ul>c              3  N   K   | ]  }d t        j                  |       d  yw)z    <li>z</li>N)htmlescape)r   items     r/   r   zhtml_page.<locals>.<genexpr>  s#     	U$HT[[&'u
-	Ur  z  </ul>z!  <h2>False-Positive Summary</h2>zE  <table><thead><tr><th>check</th><th>result</th></tr></thead><tbody>z  </tbody></table>z  <h2>Candidate Summary</h2>ah    <table><thead><tr><th>side</th><th>tile</th><th>target spawn</th><th>interesting hits</th><th>current root</th><th>character script</th><th>target spawn hits/current</th><th>span hits</th><th>span current root</th><th>span sequence</th><th>exact x,y</th><th>exact y,x</th><th>x,y sequence</th><th>y,x sequence</th><th>opcode sequence</th></tr></thead><tbody>z  <h2>Variant Scans</h2>z  <table><thead><tr><th>candidate</th><th>variant</th><th>value</th><th>hits</th><th>current root</th><th>character script</th><th>sections</th></tr></thead><tbody>z%  <h2>Target Spawn Variant Scans</h2>z  <table><thead><tr><th>candidate</th><th>target spawn</th><th>variant</th><th>value</th><th>hits</th><th>current root</th><th>character script</th><th>current classes</th><th>character classes</th><th>promotable</th><th>sections</th></tr></thead><tbody>z5<tr><td colspan="11">No target-spawn scans.</td></tr>z  <h2>Span/Bounds Scans</h2>z  <table><thead><tr><th>candidate</th><th>span variant</th><th>point/value</th><th>hits</th><th>current root</th><th>character script</th><th>sections</th></tr></thead><tbody>z3<tr><td colspan="7">No span/bounds scans.</td></tr>z  <h2>Span Sequence Scans</h2>zg  <table><thead><tr><th>candidate</th><th>sequence</th><th>values</th><th>hits</th></tr></thead><tbody>z5<tr><td colspan="4">No span sequence scans.</td></tr>z!  <h2>Span Current Root Hits</h2>z  <table><thead><tr><th>candidate</th><th>span variant</th><th>va</th><th>value</th><th>low opcode</th><th>classification</th></tr></thead><tbody>z8<tr><td colspan="6">No span current-root hits.</td></tr>z-  <h2>Legacy Right Current Root y,x Hits</h2>z  <table><thead><tr><th>va</th><th>value</th><th>low opcode</th><th>operation</th><th>offset</th><th>classification</th></tr></thead><tbody>z</body>z</html>)
rh   rl   r  r  r   r   r   rC   dumpsrT   )summaryr   r   r   false_positivefalse_positive_rowsr`   candidate_rowsr]   row_tiletarget_spawntarget_spawn_texttarget_spawn_rowscandidate_tilecandidate_labeltarget_labelrK   current_classescharacter_classesvariant_rows	span_rowsr(  span_sequence_rowsspan_current_hit_rowshit_rowss                            r/   	html_pager  X  s3   $IVD128bJ[[!78>BN 
4 	"";;s#$ %;;s>#5#5c#:;<= >	
5
@ N 
v;ww}-3  '(,*:*:3*?)@,BRBRSVBWAXY!$ 	 	   ;;s6{+,-!#'()1#8 %6789 ,-.	/	
 ,-.
/ 4567 77012 34 58GG<\4]3^_ *+,- 5678 -./0 ()*+ ()*+ ./01 /012 1234	

4 01 
17Rww}-3 WW_56a8J8J38O7PPQR`RdRdehRiQjk&**6231\5E5Ec5J4K1\M]M]^aMbLcd99]O@T@Z@Z@\]]dad**SWW-N%O%USUaef JJGG=>D"
 	  ;;/0 1\23 4;;s7|,- .S_56 7z?# $,-. /456 7_56 7%678 977/01 2;;x() *	

4 L~& 
17R WW_56a8J8J38O7PPQR`RdRdehRiQjk99]O@T@Z@Z@\]]dad;;/0 1;;s7|,- .S_56 7z?# $,-. /456 7;;x() *
	
	
 I'( 
17R &B WW_56a8J8J38O7PPQR`RdRdehRiQjk99]O@T@Z@Z@\]]dad;;/0 1;;s7|,- .3(%))C.)9T[[Z=Y<Z [z?# $,-. /456 7;;x() *
	

  *+ 

17R WW_56a8J8J38O7PPQR`RdRdehRiQjk!!;;/0 1;;s7|,- .TYYs;/?%@AB Cz?# $		


 ,- 
17R WW_56a8J8J38O7PPQR`RdRdehRiQjk$$;;/0 1;;s3777#3456 7S)9%:;< =S)<%=>? @S)@%ABC D;;s377+;#<=>? @		

 H*+ 

S\23 4S_56 7S%89: ;;;sww';SABC DSWW-G%MNO P;;s#3456 7		


 99 ??? 	? 	#	?
 	Q? 	A? 	? 	r? 	1? 	7? 	:? 	G? 	f? 	t? 	Q?  	'!?" 	#?$ 	%?& 	'?( 	;)?* dkk'("345WT[[QYIZ=[<\\opwp{p{  }M  OR  S]  O^  q_  p`  `y  z~  zE  zE  FO  PV  FW  zX  yY  Y`  ae  fi  aj  `k  kl  mq  ru  mv  lw  wO  PW  Xi  Pj  Ok  kI  JQ  Rn  Jo  Ip  pI  JN  JU  JU  V]  ^o  Vp  Jq  Ir  r~  	+?, "',"7!88lmqmxmxy}  zC  zC  DK  Lp  Dq  zr  ns  mt  tZ  [^  _f  gx  _y  [z  Z{  {X  Y`  Yd  Yd  ew  Yx  Xy  yE  	F-?. GL12348/?0 	&1?2 	3?4 
V'BS:T	U5?6 	7?8 	,9?: 	P;?< 
=?> 	??@ 	'A?B 	sC?D 
E?F 	G?H 	#I?J 	oK?L 
M?N 	O?P 	0Q?R 	IS?T 
X WXU?V 	W?X 	'Y?Z 	z[?\ 
NMN]?^ 	_?` 	)a?b 	rc?d 
Y!X Ye?f 	g?h 	,i?j 	]k?l  
_$^#_m?n 	o?p 	8q?r 	Ws?t 
u?v 	w?x 	y?z 	{?| 	}? ? ?r2   c                    |j                  dd       |dz  j                  t        j                  | dd      dz   d	       y )
NT)parentsexist_ok*map1_01a_exit_coordinate_variant_scan.jsonF)rB  rb   )ensure_ascii
separatorsr  r?   r@   )mkdir
write_textrC   r  )r  out_dirs     r/   write_outputsr  =  sD    MM$M.;;GG

7:FM H r2   c                 F   t        j                  t              } | j                  dt        t
        dz         | j                  dt        t        dz         | j                  dt        t        dz         | j                  d	t        t               | j                         }t        |j                  j                         t        |j                  g       t        |j                  g             }t        ||j                         t!        d
|j                  dz          y )N)descriptionz--exer    )typedefaultz--selectorsr  z--map-exitsr  z	--out-dirz/wrote map1_01a exit coordinate variant scan -> r  )argparseArgumentParser__doc__add_argumentr   ROOTr  
parse_argsr  rW   
read_bytesrG   rm   	map_exitsr  r  print)parserargsr  s      r/   mainr)  E  s    $$9F
dD=4HI
D#@[:[\
D#@Z:Z[
$<D$.."%$.."%G
 '4<<(	;DLLKw<w;x
yzr2   __main__)r.   ri   returnr   )r   ri   r   ri   r+  ri   )r!   r   rF   r   r+  r   )rK   
list[dict]rL   ri   r+  dict | None)rW   bytesrK   r,  rX   ri   r+  z
int | None)rm   r,  r+  r,  )ro   r,  rX   ri   r+  r-  )r{   ri   r+  r   )r   r,  r`   r   r~   z
str | Noner+  dict[str, int])r   r,  r`   r   r+  r/  )r.   ri   r   r-  r+  r   )rW   r.  rK   r,  r   r,  rL   ri   r.   ri   r+  r-  )rW   r.  rK   r,  r   r,  r   r   r.   ri   r+  r   )rW   r.  rK   r,  r   	list[int]r+  r,  )r   r   r+  ztuple[int, int, int])r   r,  r+  r,  )r   r,  r+  r   )r   r   r   ri   r   ri   r+  ztuple[str, int, int])r   ri   r   ri   r   r   r+  zlist[tuple[str, int]])r  list[tuple[str, int, int]]r+  r1  )r   r   r+  r1  )
rW   r.  rK   r,  r   r,  r   r   r+  r,  )rW   r.  rK   r,  r   r   r+  r,  )
r   ri   r   ri   r   r   r:  r   r+  r0  )r   ri   r   ri   r+  r0  )rW   r.  rK   r,  r   r,  r   ri   r   ri   r+  r,  )
rW   r.  rK   r,  r   r,  r   r   r+  r   )NN)rW   r.  rm   list[dict] | Noner   r2  r+  r   )r  r   r+  r   )r  r   r  r   r+  None)r+  r3  )Fr   
__future__r   r  collectionsr   r  rC   rU   syspathlibr   typingr   r!   insertr   __file__resolveparentprobe_exe_scene_tablesr   r   r	   r  r"  r  r   r   r   r   r   r   r  r  r  r0   r5   r:   r=   rG   rP   rY   rq   rs   r|   r   r   r   r   r   r   r   r   r   r   r  r  r&  r-  r8  r=  r?  rM  r  r  r  r  r)  __name__r,   r2   r/   <module>r?     sy   Q "      
   3tH~--/667 8 L L H~''*
Ul		BR0
!Q;
,, + '
, ( &BC,8ef+7no) %//84. FJ 	))$0f9	99 9 	9
 9 
9x,:z
	 %P	4	  	
 "02A&t	tt t 	t
 
tr $(-1K	K K +K 
	K\bJ 25 {  zF r2   