
    {Ljn1                        d Z ddlmZ ddlZddlZddlmZ ddlmZ  ee	      j                         j                  d   Zedz  Zedz  Zdd	Zdd
ZddZddZddZddZedk(  r e        yy)aI  Classify the remaining source frontier for status/comment selector byte +0.

The consumer side is now strong: after `40 1b 01 00`, `object+0xa8` points at
0x004576d8 and `40 14` reads `object+0xa8+0` to choose chapter/status-comment
groups.  The missing proof is not that consumer; it is the upstream writer of
the first byte in that backing block.

This report consolidates the adjacent evidence so later passes do not promote
the wrong thing:

* base bind routes are grounded, but they do not write the byte value;
* direct x86 absolute writes to +0 are absent;
* object-VM dynamic target +0 writers exist elsewhere, but not in status/menu;
* save/load restores the whole backing block and can populate +0 from disk, but
  is not a live scenario/chapter producer;
* selected-root selector bytes at +2/+3 belong to a different route layer.
    )annotationsN)Path)Any   outwebc                    	 t        j                  t        | z  j                  d            }t        |t              r|S i S # t        $ r i cY S w xY w)Nutf-8encoding)jsonloadsOUT	read_textFileNotFoundError
isinstancedict)namedatas     Ctools/build_status_comment_selector_value_source_frontier_review.py	load_jsonr       sS    zz3:00'0BC dD)41r1  	s   ,A AAc                b    t        |       }|j                  d      }t        |t              r|S i S )Nsummary)r   getr   r   )r   r   values      r   r   r   (   s-    T?DHHYEud+533    c                V    t        j                  | dd      S t        |       d      S )N T)quote)htmlescapestr)r   s    r   hr#   .   s%    ;;U]r$GGE
$GGr   c                    t        d      } t        d      }t        d      }t        d      }t        d      }t        d      }t        d      }t        d      }t        d	      }t        d
      }	dddd|j                  d       d|j                  d       d|j                  d       dddddd| j                  d       d| j                  d       d| j                  d       ddd d!dd"|j                  d#       d$|j                  d%       d&|j                  d'       d(|j                  d)       d*|j                  d+       
d,dd-d.dd/|j                  d0       d1|j                  d2       d3|j                  d4       d5|j                  d6       d7|j                  d8       
d9dd:d;dd<|j                  d=       d>|j                  d?       d@|j                  dA       dBddCdDdEdF|	j                  dG       dH|	j                  dI       dJ|	j                  dK       dL|	j                  dM       dNdg}
|
D cg c]  }|dO   dPvs| }}|
D cg c]  }|dO   dQv r| }}g dR}dSdTg dUdVdW|j                  dXdY      t        |j                  d            xr t        |j                  dZ            |j                  d[      d\k(  t        |j                  dZ            t        | j                  d            t        |j                  d]            t        |j                  d0            t        |j                  d8            t        |
      t        |      d^d_|
||d`S c c}w c c}w )aNz'status_comment_backing_writer_scan.jsonz+status_comment_backing_base_ref_review.jsonz*status_comment_base_bind_route_review.jsonz3status_comment_indirect_selector_writer_review.jsonz1status_comment_target0_writer_context_review.jsonz+status_comment_selector_meaning_review.jsonz,status_comment_producer_boundary_review.jsonz.selected_root_live_writer_frontier_review.jsonz-selected_scene_text_root_consumer_review.jsonz&global_mode_state_frontier_review.jsonztext/status consumer sourceconsumer-grounded-not-writerhighz40 1b mode1 route=textStatusOpcodeHexz payload uses=mode1PayloadUseCountz; selector source grounded=selectorSourceGroundedznThis proves where the value is read: object+0xa8+0 after base bind to 0x004576d8. It does not write the value.)	candidatestatus
confidenceevidencedecisionz direct x86 store to 0x004576d8+0z	not-foundzhigh-negativezoffset0 refs=offset0RefCountz; write-like=offset0WriteLikeCountz; direct writer proven=offset0WriterProvenzSNo absolute direct write to the selector byte is present in the current .text scan.z1object-VM dynamic selector writers 0x8c/0x8d/0x8fzexcluded-for-status-commentzdynamic candidates=dynamicWriterCandidateCountz
; target0=target0CandidateCountz; status-menu target0=target0InStatusMenuPayloadCountz; status-comment target0="target0InStatusCommentPayloadCountz; promoted target0 context=statusCommentWriterPromotedzTarget +0 dynamic writes are real in other active-object contexts, but their roots are field/battle object-local. They are not the status/comment story selector writer.z"persistent save/load block restorez&can-populate-on-load-not-live-producerzblock transfer refs=blockTransferArgCountz; restore function=saveLoaderRestoreFunctionVaHexz; state block= saveLoaderRestoreStateBlockVaHexz size="saveLoaderRestoreStateBlockSizeHexz; route promoted=.saveLoaderRestoreConsumerRouteProducerPromotedz0x00423319 loads/saves the 0x72-byte block, so +0 can come from persisted state after load. This is excluded as the live chapter/scenario writer.z"selected-root selector bytes +2/+3zdifferent-route-layerzselector byte writer grounded=selectorByteWriterGroundedz ; selected-root writer grounded=selectedRootWriterGroundedz; route producer promoted=routeProducerPromotedzThe +2/+3 selector bytes reconstruct selected roots. They are adjacent in the backing block but are not the +0 chapter/status-comment selector.z'cross-domain global mode/state frontierzno-live-producer-promotedzmedium-high-negativezcross-domain functions=crossDomainFunctionCountz; review required=reviewRequiredCountz; promoted producers=promotedProducerCountz; save/load bridge found=saveLoadRestoreBridgeFoundzBroad scene/menu/field/encounter intersections did not reveal a live writer. The strongest intersection remains save/load restore, already excluded as live producer.r+   >   r%   >   writer-groundedlive-writer-promoted)zjLook for an indirect or block writer that populates 0x004576d8+0 without an absolute 0x004576d8 immediate.zvPrefer upstream scenario/chapter state transitions over status-menu payloads: current payloads only consume the value.zIf a future pass inspects 0x00423319 again, keep it classified as load/save restore unless it proves a live gameplay caller and value transition.zA useful static target is code that writes a compact story/chapter byte and then later copies/serializes the 0x72 backing block.r   z;hwanse-status-comment-selector-value-source-frontier-review)z/out/status_comment_selector_meaning_review.jsonz.out/status_comment_base_bind_route_review.jsonz+out/status_comment_backing_writer_scan.jsonz7out/status_comment_indirect_selector_writer_review.jsonz5out/status_comment_target0_writer_context_review.jsonz2out/selected_root_live_writer_frontier_review.jsonz1out/selected_scene_text_root_consumer_review.jsonz*out/global_mode_state_frontier_review.json
0x004576d80x00meaningCandidatez.story/chapter selector for status/menu context!statusCommentPayloadMode1UseFoundobjectA8BackingBaseBindCount   )statusCommentSelectorIndirectWriterProvenzThe status/comment selector byte +0 is still writer-unresolved. Its consumer meaning is high-confidence story/chapter selection, but direct stores, local dynamic writers, selected-root primitives, and save/load restore do not prove a live writer.)selectorBackingBaseVaHexselectorOffsetHexrG   consumerGroundedbaseBindGroundedbaseRouteGroundeddirectWriterFounddynamicStatusWriterFoundsaveLoadCanPopulatesaveLoadPromotedAsLiveWritercandidateCountpromotedLiveWriterCountr.   )versionkindsourceArtifactsr   
candidatesexcludedOrNonWriterCandidatesnextFrontier)r   r   boollen)backing_writer	base_refs
base_routeindirecttarget0_contextmeaningproducerselected_rootselected_sceneglobal_moderZ   rowexcludedpromotednext_frontiers                  r   buildrm   2   sv   FGNEFIEFJLMHQROCDGEFHLMMLMNBCK 74 $Z^^4I%J$K L  */E FG H,,4LL9Q,R+SU
/	
 <!) 2 23D EF G,001HIJ K((6(:(:;P(Q'RT n
	
 M3)%hll3P&Q%R S#<<(?@A B''/||4U'V&W X**2,,7[*\)] ^,,;,?,?@],^+_	aI	
" >> &y}}5L'M&N O$$2$6$67W$X#Y Z-112TUV W&**+OPQ R""0"4"45e"f!g	iH	
" >- 01B1BC_1`0a b11>1B1BC_1`0a b++8+<+<=T+U*VX
m	
 C10)+//:T*U)V W##.??3H#I"J K&&1oo6M&N%O P**5//:V*W)XZk	
QWJr  *cS]Bb-bcHc!x=GG 	H 
M M	
 )5!' ',>@p q $X\\2J%K L  !KQUV`VdVd  fI  WJ  RK ).L MQR R!%jnn5X&Y!Z!%n&8&89N&O!P(,X\\:e-f(g#'	6M(N#O,01C1CDt1u,v!*o'*8}^
& !)1%E# # ds   =M$
M$M)c                    dj                  d | d   j                         D              }dj                  d | d   D              }dj                  d | d   D              }d| d	| d
| dS )Nr   c              3  X   K   | ]"  \  }}d t        |       dt        |       d $ yw)z<div class='card'><b>z
</b><span>z</span></div>Nr#   ).0kvs      r   	<genexpr>zrender_html.<locals>.<genexpr>   s3      Aq  !vZ!v]Cs   (*r   c              3     K   | ]R  }d t        |d          dt        |d          dt        |d          dt        |d          dt        |d	          d
 T yw)z<tr><td><b>r*   z</b></td><td>r+   z<br><small>r,   z</small></td><td>r-   z	</td><td>r.   z
</td></tr>Nrp   )rq   ri   s     r   rt   zrender_html.<locals>.<genexpr>   s       	C$%& 'X Ac,.?,@+A BZ!" #Z!" #		s   AArZ   c              3  :   K   | ]  }d t        |       d  yw)z<li>z</li>Nrp   )rq   items     r   rt   zrender_html.<locals>.<genexpr>   s     NagYe,Ns   r\   u  <!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Status Comment Selector Value Source Frontier</title>
<style>
  :root { color-scheme: light dark; }
  body { margin:24px; font-family:system-ui,-apple-system,Segoe UI,sans-serif; line-height:1.45; }
  h1 { margin:0 0 8px; font-size:24px; }
  .muted { color:#667085; }
  .cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; margin:16px 0; }
  .card { border:1px solid #d0d5dd; border-radius:8px; padding:10px 12px; background:rgba(127,127,127,.05); }
  .card b { display:block; color:#667085; font-size:12px; }
  .card span { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
  .scroll { overflow-x:auto; }
  table { width:100%; border-collapse:collapse; }
  th,td { border:1px solid #d0d5dd; padding:7px 8px; vertical-align:top; }
  th { text-align:left; background:rgba(127,127,127,.08); }
  small { color:#667085; }
  code { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
</style>
<h1>Status Comment Selector Value Source Frontier</h1>
<p class="muted"><code>0x004576d8+0</code> selector의 소비 증거와 writer 후보/배제 후보를 분리합니다.</p>
<div class="cards">z</div>
<div class="scroll"><table>
<thead><tr><th>candidate</th><th>status</th><th>evidence</th><th>decision</th></tr></thead>
<tbody>z3</tbody>
</table></div>
<h2>Next Frontier</h2>
<ul>z</ul>
)joinitems)r   cardscandidate_rowsfrontiers       r   render_htmlr}      s    GG O))+ E WW  % N wwNn9MNNH, 7  	  J 9 r   c                 X   t               } t        j                  d       t        j                  d       t        dz  j	                  t        j                  | dd      dz   d	       t        d
z  j	                  t        |       d	       t        d| d   d    d| d   d    d       y )NT)exist_okz9status_comment_selector_value_source_frontier_review.jsonFrJ   )ensure_asciiindent
r
   r   z9status_comment_selector_value_source_frontier_review.htmlz>wrote status comment selector value source frontier (consumer=r   rN   z	, writer=rV   ))	rm   r   mkdirWEB
write_textr   dumpsr}   print)r   s    r   mainr      s    7DIItIIItIFFRR

4eA6= S  	FFRRD S  
	)_%7894	?SlCmBnno	qr   __main__)r   r"   returndict[str, Any])r   r   r   r"   )r   r   )r   r   r   r"   )r   None)__doc__
__future__r   r    r   pathlibr   typingr   __file__resolveparentsROOTr   r   r   r   r#   rm   r}   r   __name__ r   r   <module>r      s   " #     H~''*
Ul
Ul24HUp,^$ zF r   