1<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4<meta http-equiv="Content-Style-Type" content="text/css" /> 5<title>ctr_GxCommandAnalyzer</title> 6<style type="text/css"> 7<!-- 8body { 9/* 10 font-size : 10pt; 11*/ 12 font-weight : normal; 13 color : #000000; 14 margin : 8px; 15} 16 17div { 18 width : 98%; 19 white-space : nowrap; 20} 21 22div.title { 23 text-align : left; 24 font-weight : bold; 25/* 26 font-size : 16pt; 27*/ 28 font-size : 150%; 29 color : #202020; 30 border-style : double; 31 border-width : 8px; 32 /* タイトルを囲む枠線の色を指定 */ 33 border-color : #CD202C; 34 35 /* RVLプラットフォーム系列 */ 36/* 37 border-color : #34beed; 38*/ 39 40 /* TWLプラットフォーム系列 */ 41/* 42 border-color : #ff458f; 43*/ 44 45 margin : 4px; 46 padding : 4px; 47} 48H1 { 49 font-size : 150%; 50 font-family : Arial; 51 border-bottom-width : 5px; 52 border-bottom-style : solid; 53 border-bottom-color : #CD202C; 54 padding-bottom : 1px; 55 margin-bottom : 20px; 56 letter-spacing : normal; 57 font-weight : bold; 58} 59 60h2 { 61 font-weight : bold; 62/* 63 font-size : 16pt; 64*/ 65 font-size : 150%; 66 border-style : none none solid double; 67 border-width : 0px 0px 2px 8px; 68 /* 見出しの線の色を指定 */ 69 border-color : #CD202C; 70 71 /* RVLプラットフォーム系列 */ 72/* 73 border-color : #34beed; 74*/ 75 76 /* TWLプラットフォーム系列 */ 77/* 78 border-color : #ff458f; 79*/ 80 81 margin-left : 2px; 82 padding-left : 4px; 83} 84CODE { 85 font-family : "Courier New", monospace; 86 position : normal; 87 left : 12px; 88 font-size : 10pt; 89} 90table { 91 margin-top : 2pt; 92 margin-bottom : 2pt; 93 margin-left : 0pt; 94 margin-right : 0pt; 95 padding-left : 0pt; 96 padding-right : 0pt; 97 position : relative; 98 left : 12px; 99 font-family : Arial; 100 font-size : 10pt; 101 border-style : none none none none; 102} 103td,th { 104 padding : 2pt; 105 border-width : 2pt; 106 border-style : none none none none; 107 font-style : normal; 108 text-align : left; 109} 110td { 111 background : #e8f4f4; 112 font-weight : normal; 113} 114th { 115 background : #c0d8d8; 116 font-weight : bold; 117} 118 119p { 120 margin-left : 4px; 121} 122p.code { 123 font-family : "Courier New", monospace; 124 position : normal; 125 left : 12px; 126 font-size : 10pt; 127 background : #e8f4f4; 128} 129 130PRE 131{ 132 padding : 10px; 133 134 background : #f0f0f0; 135 border : 1px solid #ccc; 136} 137 138CODE 139{ 140/* padding : 0; 141 display : block;*/ 142 143/* SampleDemos Only */ 144 145 display : block; 146 147 border : solid gray 1px; 148 padding : 2px; 149 background-color : #f0f0f0; 150} 151 152--> 153</style> 154</head> 155 <body> 156 <h1><CODE>ctr_GxCommandAnalyzer</CODE></h1> 157 <h2>Description</h2> 158 <p> 159The <CODE>ctr_GxCommandAnalyzer</CODE> command line tool is for parsing 3D commands output from the debugger and elsewhere, and converting them into a format that is easier to view.<br>You can also use this as a GUI tool by double-clicking to open the executable file.</br><B>Note</B>: If you directly drag-and-drop to the binary icon, the tool operates as the command line version. 160 </p> 161 162<h2>How to Use (command line version)</h2> 163<h3>Format</h3> 164 <pre> $ ctr_GxCommandAnalyzer32.exe [options...] [CommandFile]</pre> 165 <h3>Options</h3> 166 <div class="section"> 167 <p> 168 <table class="table"><tbody> 169 <tr><th>Options</th> <th>Description</th></tr> 170 <tr> 171 <td>-h</td> 172 <td>Displays help.</td> 173 </tr> 174 <tr> 175 <td>-nd</td> 176 <td>Converts a physical address to a virtual address, and halts functionality that performs additional output.</td> 177 </tr> 178 <tr> 179 <td>-ni</td> 180 <td>Halts functionality that outputs an overview of the registers.</td> 181 </tr> 182 <tr> 183 <td>-sb</td> 184 <td>Displays data that was output in burst mode in simple format.</td> 185 </tr> 186 </tbody></table> 187 </p> 188 189 <p> 190After parsing, a file is saved in the format [file name]_Analyze.txt in the location of the file that was used for input. 191 </p> 192 </div> 193 194<h2>How to Use (GUI version)</h2> 195 <p> 196Open data from the <B>File</B> menu or drag-and-drop to the List View area to parse commands.</br> 197 </p> 198 <p> 199<img alt="<CODE>banner</CODE>" src="image/gxCommandAnalyzerGui.png" style="width: 768px; height: 576px" /></p> 200 <div class="section"> 201 <p> 202 <table class="table"><tbody> 203<tr><th>Number</th> <th>Description</th></tr> 204 <tr> 205 <td>1</td> 206<td>Displays the command parsing data. This is nearly the same as the data output by the console version.</br>Here are the meanings of the various columns:</br></br> 207 208Far left - Indicates whether burst transfer.</br>Line - The order in which commands are stacked.</br> Reg - The register number.</br> Data - The data entered in this register.</br> BE - The byte enable.</br> Value - Displays the virtual address when the data is an address.</br>Summary - Displays a summary of that register.</br></br> 209 210Click on the columns to sort them.</br>Right-click on a column to open a menu and choose whether to show/hide the column.</br>Click on an item to display details in the left panel.</br>Here are the meanings of the various colors for items:</br></br> 211 212Blue - Burst transfer; single register access.</br>Red - Burst transfer; consecutive register access.</br>Gray - Dummy command (BE is 0x0).</br></br> 213 214Folding is the default loading mode for burst transfer.</br>If the " + " symbol displays in the far left column, you can double-click on it to expand the view. </br>Once expanded, the " - " symbol displays. Double-click it to collapse the view. The <B>View</B> menu has a feature for expanding/collapsing all. 215 </td> 216 </tr> 217 <tr> 218 <td>2</td> 219<td>A summary of the selected register. This is the same as what is displayed in List View.</td> 220 </tr> 221 <tr> 222 <td>3</td> 223<td>Simple command editing can be performed here. Data can be edited in hexadecimal, decimal, and binary.</br>Enter data and then apply the edited changes to the command by pressing the [<B>Enter</B>] key (except when entering binary) or pressing the <B>Update</B> button.</br>Press the <B>Default</B> button to restore the command to its original state when loaded.</br>For binary, click on each digit to swap out 0/1s. Bits shown in black have not been specified for byte enable. 224 </td> 225 </tr> 226 <tr> 227 <td>4</td> 228<td>The entire range of bits that can be set for this register, displayed as buttons.</br>Place the cursor above a button to show the bits that are binary data in red (or purple if not specified by BE) and to display detailed data about that range in the lower part of the panel (explained in more detail below).</br><b>Note that if a command has been edited but the edits have not been applied (by pressing the <B>Update</B> button or otherwise), then this detailed data will not be updated either.</b> 229 </td> 230 </tr> 231 <tr> 232 <td>5</td> 233 <td> 234Shows the corresponding API of OpenGL.</br> 235 </td> 236 </tr> 237 <tr> 238 <td>6</td> 239 <td> 240Displays detailed data. The contents are nearly the same as the specification.</br> 241 </td> 242 </tr> 243 <tr> 244 <td>7</td> 245 <td> 246Displays the range of data specified by <B>Range Button</B> in hexadecimal, decimal, and binary.</br>If the register is a register that takes data such as floating-point values or addresses, that value is displayed in the <B>LocalData(Converted)</B> field.</br> 247 </td> 248 </tr> 249 <tr> 250 <td>8</td> 251 <td> 252Use this to search for registers.</br>Enter a register number and press the [<B>Enter</B>] key to select the relevant item in the List View.</br>After moving the focus to List View, press the F3 key to search for the next item in that same register.</br><b>You cannot use the Search Register feature with any sort order except the default (which is to sort by ascending Line).</b> 253 </td> 254 </tr> 255 </tbody></table> 256 </p> 257 </div> 258<p>Here is a description of the menu items.</p> 259 <div class="section"> 260 <p> 261 <table class="table"><tbody> 262<tr><th>Category</th><th>Name</th><th>Description</th></tr> 263 <tr> 264<td>File</td> 265<td>Open</td> 266<td>Opens a file.</td> 267 </tr> 268 <tr> 269 <td></td> 270<td>Save</td> 271<td>Saves the parsing results.</td> 272 </tr> 273 <tr> 274 <td></td> 275<td>Save As Command</td> 276<td>Saves the file as command data.</td> 277 </tr> 278 <tr> 279 <td></td> 280<td>Exit</td> 281<td>Exits the program.</td> 282 </tr> 283 284 <tr> 285<td>View</td> 286<td>Show All</td> 287 <td> 288Displays all data that was omitted for burst access.</br>If the command data is large in size this could take some time. 289 </td> 290 </tr> 291 <tr> 292 <td></td> 293<td>Hide All</td> 294 <td> 295Omits all data written by burst access.</br>If the command data is large in size this could take some time. 296 </td> 297 </tr> 298 <tr> 299<td>Help</td> 300<td>Version</td> 301<td>Shows the version of the DMPGL specification on which the command detailed data is based.</td> 302 </tr> 303 </tbody></table> 304 </p> 305 </div> 306 307<h3>Notes</h3> 308If the command file is too big, it can take an extremely long time to close/open burst transfers and apply command edits.</br>The specifications for your PC also matter, but in general, Nintendo recommends keeping the size of your command files to 50 KB or less.</br> 309 310 311<h2>Command Data Format</h2> 312 <p> 313The command data you are entering should have the format of a 64-bit collection of commands, comprising a 32-bit header and 32 bits of data.</br></br> 314 315If you are using PARTNER-CTR, you can output the command data from the <B>File</B> menu by selecting <B>Save binary...</B> or <B>Save binary [Size]...</B>. Use binary data that are output this way as the input file for this tool.</br></br>Use the <CODE>nngxGetCmdlistParameteri</CODE> function to get the command buffer address needed when saving the binary.</br>Get the starting address of the command buffer by specifying <CODE>NN_GX_CMDLIST_TOP_BUFADDR</CODE> for the first argument of the function.</br>Get the current address of the command buffer by specifying <CODE>NN_GX_CMDLIST_CURRENT_BUFADDR</CODE> for the argument.</br>Get the accumulated size of the command buffer by specifying <CODE>NN_GX_CMDLIST_USED_BUFSIZE</CODE>.</br>Here is an example of pseudo-code for getting the starting address of the command buffer and the post-rendering size of the command buffer: 316 317 <pre class="code"> 318void Initialize() 319{ 320 nngxInitialize(allocator, deallocator); 321 322 nngxGenCmdlists(1, &cmdList); 323 nngxBindCmdlist(cmdList); 324 nngxCmdlistStorage(0x400000, 128); 325 326 // Get starting address 327 nngxGetCmdListParameteri(NN_GX_CMDLIST_TOP_BUFADDR, &addr); 328 329 /* Initialization process */ 330} 331 332void DrawFrame() 333{ 334 /* Various processes */ 335 336 // Rendering functions 337 Draw(); 338 339 // Get size 340 nngxGetCmdListParameteri(NN_GX_CMDLIST_USED_BUFSIZE, &size); 341 342 // When getting current address 343 //nngxGetCmdListParameteri(NN_GX_CMDLIST_CURRENT_BUFADDR, &addr); 344} 345 </pre> 346 347Pass the address and size obtained with this code to the parameters for <B>Save binary [Size]...</B> and output to get command data in a format that can be used by this tool.</br>If you use <B>Save binary...</B> to output the command data, get the current address for the command buffer by specifying <CODE>NN_GX_CMDLIST_CURRENT_BUFADDR</CODE> for the first argument of the <CODE>nngxGetCmdListParameteri</CODE> function. 348 349 </p> 350<h3>Notes</h3> 351・ Note that writing to the command buffer generally takes place when render functions are executing.</br>・ If you are using a command-jump subroutine, write the jump-destination commands separately. (The parsing itself is done separately.) </br>・ If you are duplicating command lists, confirm that the buffer you want to output is storing the bound command list.</br>・If you are using burst access, write out all the necessary data. If there is not enough data, you will not be able to load it. 352<h2>Example Output</h2> 353 <pre class="code"> 3540x041 : 0x0045E000 (BE: 0x7) viewport settings (width) 3550x042 : 0x38111112 (BE: 0xF) viewport settings (width) 3560x043 : 0x00469000 (BE: 0x7) viewport settings (height) 3570x044 : 0x3747AE14 (BE: 0xF) viewport settings (height) 3580x068 : 0x00000000 (BE: 0xF) viewport settings register (x/y) 359BurstSequence 3 times (BE: 0xF) 360 0x065 : 0x00000003 scissoring settings (false/true) 361 0x066 : 0x00000000 scissoring settings (x/y) 362 0x067 : 0x018F00EF scissoring settings (width/height) 3630x111 : 0x00000001 (BE: 0xF) framebuffer cache flush 3640x110 : 0x00000001 (BE: 0xF) framebuffer cache tag clearing 365BurstSequence 4 times (BE: 0xF) 366 0x200 : 0x0402C048 [0x14160240] Shared base address for array of all vertices 367 0x201 :0x0000000B Internal vertex attribute type (Attributes 0 - 7) 368 0x202 :0x00000000 Internal vertex attribute type (Attributes 8 - 11, mask, number of attributes) 369 0x203 :0x00000004 [0x00000004] Address offset for load array 0</pre> 370 371<p>0x200 :0x0402C048 [0x14160240] Shared base address for array of all vertices</p> 372<p>In this example, <B>0x200</B> is the register number, <B>0x0402C048</B> is the data content, <B>[0x14160240]</B> is the value of the data content converted to a virtual address, and <B>Shared base address for array of all vertices</B> is the description for that register.</p> 373 374 <h2>Location</h2> 375 <pre> $CTRSDK_ROOT/tools/ComandlineTools/ctr_GxCommandAnalyzer/ctr_GxCommandAnalyzer32.exe </pre> 376 <h2>Revision History</h2> 377 <div class="section"> 378 <dl class="history"> 379 <dt>2011/2/13</dt> 380<dd>Added description of the GUI version.<br /> 381 </dd> 382 <dt>2011/12/29</dt> 383<dd>Added description of the command data format.<br /> 384 </dd> 385 <dt>2011/12/8</dt> 386 <dd>Initial version.<br /> 387 </dd> 388 </dl> 389 </div> 390 <hr><p>CONFIDENTIAL</p></body> 391</html>