Path: blob/master/libmupen64plus/mupen64plus-video-z64/src/disasm.cpp
2 views
/*1* z642*3* Copyright (C) 2007 ziggy4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License along16* with this program; if not, write to the Free Software Foundation, Inc.,17* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.18*19**/2021#include "z64.h"22#include <stdio.h>2324static const char *image_format[] = { "RGBA", "YUV", "CI", "IA", "I", "???", "???", "???" };25static const char *image_size[] = { "4-bit", "8-bit", "16-bit", "32-bit" };2627static const int rdp_command_length[64] =28{298, // 0x00, No Op308, // 0x01, ???318, // 0x02, ???328, // 0x03, ???338, // 0x04, ???348, // 0x05, ???358, // 0x06, ???368, // 0x07, ???3732, // 0x08, Non-Shaded Triangle3832+16, // 0x09, Non-Shaded, Z-Buffered Triangle3932+64, // 0x0a, Textured Triangle4032+64+16, // 0x0b, Textured, Z-Buffered Triangle4132+64, // 0x0c, Shaded Triangle4232+64+16, // 0x0d, Shaded, Z-Buffered Triangle4332+64+64, // 0x0e, Shaded+Textured Triangle4432+64+64+16,// 0x0f, Shaded+Textured, Z-Buffered Triangle458, // 0x10, ???468, // 0x11, ???478, // 0x12, ???488, // 0x13, ???498, // 0x14, ???508, // 0x15, ???518, // 0x16, ???528, // 0x17, ???538, // 0x18, ???548, // 0x19, ???558, // 0x1a, ???568, // 0x1b, ???578, // 0x1c, ???588, // 0x1d, ???598, // 0x1e, ???608, // 0x1f, ???618, // 0x20, ???628, // 0x21, ???638, // 0x22, ???648, // 0x23, ???6516, // 0x24, Texture_Rectangle6616, // 0x25, Texture_Rectangle_Flip678, // 0x26, Sync_Load688, // 0x27, Sync_Pipe698, // 0x28, Sync_Tile708, // 0x29, Sync_Full718, // 0x2a, Set_Key_GB728, // 0x2b, Set_Key_R738, // 0x2c, Set_Convert748, // 0x2d, Set_Scissor758, // 0x2e, Set_Prim_Depth768, // 0x2f, Set_Other_Modes778, // 0x30, Load_TLUT788, // 0x31, ???798, // 0x32, Set_Tile_Size808, // 0x33, Load_Block818, // 0x34, Load_Tile828, // 0x35, Set_Tile838, // 0x36, Fill_Rectangle848, // 0x37, Set_Fill_Color858, // 0x38, Set_Fog_Color868, // 0x39, Set_Blend_Color878, // 0x3a, Set_Prim_Color888, // 0x3b, Set_Env_Color898, // 0x3c, Set_Combine908, // 0x3d, Set_Texture_Image918, // 0x3e, Set_Mask_Image928 // 0x3f, Set_Color_Image93};9495int rdp_dasm(UINT32 * rdp_cmd_data, int rdp_cmd_cur, int length, char *buffer)96{97//int i;98int tile;99const char *format, *size;100char sl[32], tl[32], sh[32], th[32];101char s[32], t[32];//, w[32];102char dsdx[32], dtdy[32];103#if 0104char dsdx[32], dtdx[32], dwdx[32];105char dsdy[32], dtdy[32], dwdy[32];106char dsde[32], dtde[32], dwde[32];107char yl[32], yh[32], ym[32], xl[32], xh[32], xm[32];108char dxldy[32], dxhdy[32], dxmdy[32];109char rt[32], gt[32], bt[32], at[32];110char drdx[32], dgdx[32], dbdx[32], dadx[32];111char drdy[32], dgdy[32], dbdy[32], dady[32];112char drde[32], dgde[32], dbde[32], dade[32];113#endif114UINT32 r,g,b,a;115116UINT32 cmd[64];117UINT32 command;118119if (length < 8)120{121sprintf(buffer, "ERROR: length = %d\n", length);122return 0;123}124125cmd[0] = rdp_cmd_data[rdp_cmd_cur+0];126cmd[1] = rdp_cmd_data[rdp_cmd_cur+1];127128tile = (cmd[1] >> 24) & 0x7;129sprintf(sl, "%4.2f", (float)((cmd[0] >> 12) & 0xfff) / 4.0f);130sprintf(tl, "%4.2f", (float)((cmd[0] >> 0) & 0xfff) / 4.0f);131sprintf(sh, "%4.2f", (float)((cmd[1] >> 12) & 0xfff) / 4.0f);132sprintf(th, "%4.2f", (float)((cmd[1] >> 0) & 0xfff) / 4.0f);133134format = image_format[(cmd[0] >> 21) & 0x7];135size = image_size[(cmd[0] >> 19) & 0x3];136137r = (cmd[1] >> 24) & 0xff;138g = (cmd[1] >> 16) & 0xff;139b = (cmd[1] >> 8) & 0xff;140a = (cmd[1] >> 0) & 0xff;141142command = (cmd[0] >> 24) & 0x3f;143//printf("command %x\n", command);144switch (command)145{146case 0x00: sprintf(buffer, "No Op"); break;147case 0x08:148sprintf(buffer, "Tri_NoShade (%08X %08X)", cmd[0], cmd[1]); break;149case 0x0a:150sprintf(buffer, "Tri_Tex (%08X %08X)", cmd[0], cmd[1]); break;151case 0x0c:152sprintf(buffer, "Tri_Shade (%08X %08X)", cmd[0], cmd[1]); break;153case 0x0e:154sprintf(buffer, "Tri_TexShade (%08X %08X)", cmd[0], cmd[1]); break;155case 0x09:156sprintf(buffer, "TriZ_NoShade (%08X %08X)", cmd[0], cmd[1]); break;157case 0x0b:158sprintf(buffer, "TriZ_Tex (%08X %08X)", cmd[0], cmd[1]); break;159case 0x0d:160sprintf(buffer, "TriZ_Shade (%08X %08X)", cmd[0], cmd[1]); break;161case 0x0f:162sprintf(buffer, "TriZ_TexShade (%08X %08X)", cmd[0], cmd[1]); break;163164#if 0165case 0x08: // Tri_NoShade166{167int lft = (command >> 23) & 0x1;168169if (length < rdp_command_length[command])170{171sprintf(buffer, "ERROR: Tri_NoShade length = %d\n", length);172return 0;173}174175cmd[2] = rdp_cmd_data[rdp_cmd_cur+2];176cmd[3] = rdp_cmd_data[rdp_cmd_cur+3];177cmd[4] = rdp_cmd_data[rdp_cmd_cur+4];178cmd[5] = rdp_cmd_data[rdp_cmd_cur+5];179cmd[6] = rdp_cmd_data[rdp_cmd_cur+6];180cmd[7] = rdp_cmd_data[rdp_cmd_cur+7];181182sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);183sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);184sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);185sprintf(xl, "%4.4f", (float)(cmd[2] / 65536.0f));186sprintf(dxldy, "%4.4f", (float)(cmd[3] / 65536.0f));187sprintf(xh, "%4.4f", (float)(cmd[4] / 65536.0f));188sprintf(dxhdy, "%4.4f", (float)(cmd[5] / 65536.0f));189sprintf(xm, "%4.4f", (float)(cmd[6] / 65536.0f));190sprintf(dxmdy, "%4.4f", (float)(cmd[7] / 65536.0f));191192sprintf(buffer, "Tri_NoShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);193break;194}195case 0x0a: // Tri_Tex196{197int lft = (command >> 23) & 0x1;198199if (length < rdp_command_length[command])200{201sprintf(buffer, "ERROR: Tri_Tex length = %d\n", length);202return 0;203}204205for (i=2; i < 24; i++)206{207cmd[i] = rdp_cmd_data[rdp_cmd_cur+i];208}209210sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);211sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);212sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);213sprintf(xl, "%4.4f", (float)((INT32)cmd[2] / 65536.0f));214sprintf(dxldy, "%4.4f", (float)((INT32)cmd[3] / 65536.0f));215sprintf(xh, "%4.4f", (float)((INT32)cmd[4] / 65536.0f));216sprintf(dxhdy, "%4.4f", (float)((INT32)cmd[5] / 65536.0f));217sprintf(xm, "%4.4f", (float)((INT32)cmd[6] / 65536.0f));218sprintf(dxmdy, "%4.4f", (float)((INT32)cmd[7] / 65536.0f));219220sprintf(s, "%4.4f", (float)(INT32)((cmd[ 8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);221sprintf(t, "%4.4f", (float)(INT32)(((cmd[ 8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);222sprintf(w, "%4.4f", (float)(INT32)((cmd[ 9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);223sprintf(dsdx, "%4.4f", (float)(INT32)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);224sprintf(dtdx, "%4.4f", (float)(INT32)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);225sprintf(dwdx, "%4.4f", (float)(INT32)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);226sprintf(dsde, "%4.4f", (float)(INT32)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);227sprintf(dtde, "%4.4f", (float)(INT32)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);228sprintf(dwde, "%4.4f", (float)(INT32)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);229sprintf(dsdy, "%4.4f", (float)(INT32)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);230sprintf(dtdy, "%4.4f", (float)(INT32)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);231sprintf(dwdy, "%4.4f", (float)(INT32)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);232233234buffer+=sprintf(buffer, "Tri_Tex %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);235buffer+=sprintf(buffer, " ");236buffer+=sprintf(buffer, " S: %s, T: %s, W: %s\n", s, t, w);237buffer+=sprintf(buffer, " ");238buffer+=sprintf(buffer, " DSDX: %s, DTDX: %s, DWDX: %s\n", dsdx, dtdx, dwdx);239buffer+=sprintf(buffer, " ");240buffer+=sprintf(buffer, " DSDE: %s, DTDE: %s, DWDE: %s\n", dsde, dtde, dwde);241buffer+=sprintf(buffer, " ");242buffer+=sprintf(buffer, " DSDY: %s, DTDY: %s, DWDY: %s\n", dsdy, dtdy, dwdy);243break;244}245case 0x0c: // Tri_Shade246{247int lft = (command >> 23) & 0x1;248249if (length < rdp_command_length[command])250{251sprintf(buffer, "ERROR: Tri_Shade length = %d\n", length);252return 0;253}254255for (i=2; i < 24; i++)256{257cmd[i] = rdp_cmd_data[i];258}259260sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);261sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);262sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);263sprintf(xl, "%4.4f", (float)((INT32)cmd[2] / 65536.0f));264sprintf(dxldy, "%4.4f", (float)((INT32)cmd[3] / 65536.0f));265sprintf(xh, "%4.4f", (float)((INT32)cmd[4] / 65536.0f));266sprintf(dxhdy, "%4.4f", (float)((INT32)cmd[5] / 65536.0f));267sprintf(xm, "%4.4f", (float)((INT32)cmd[6] / 65536.0f));268sprintf(dxmdy, "%4.4f", (float)((INT32)cmd[7] / 65536.0f));269sprintf(rt, "%4.4f", (float)(INT32)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);270sprintf(gt, "%4.4f", (float)(INT32)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);271sprintf(bt, "%4.4f", (float)(INT32)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);272sprintf(at, "%4.4f", (float)(INT32)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);273sprintf(drdx, "%4.4f", (float)(INT32)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);274sprintf(dgdx, "%4.4f", (float)(INT32)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);275sprintf(dbdx, "%4.4f", (float)(INT32)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);276sprintf(dadx, "%4.4f", (float)(INT32)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);277sprintf(drde, "%4.4f", (float)(INT32)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);278sprintf(dgde, "%4.4f", (float)(INT32)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);279sprintf(dbde, "%4.4f", (float)(INT32)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);280sprintf(dade, "%4.4f", (float)(INT32)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);281sprintf(drdy, "%4.4f", (float)(INT32)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);282sprintf(dgdy, "%4.4f", (float)(INT32)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);283sprintf(dbdy, "%4.4f", (float)(INT32)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);284sprintf(dady, "%4.4f", (float)(INT32)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);285286buffer+=sprintf(buffer, "Tri_Shade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);287buffer+=sprintf(buffer, " ");288buffer+=sprintf(buffer, " R: %s, G: %s, B: %s, A: %s\n", rt, gt, bt, at);289buffer+=sprintf(buffer, " ");290buffer+=sprintf(buffer, " DRDX: %s, DGDX: %s, DBDX: %s, DADX: %s\n", drdx, dgdx, dbdx, dadx);291buffer+=sprintf(buffer, " ");292buffer+=sprintf(buffer, " DRDE: %s, DGDE: %s, DBDE: %s, DADE: %s\n", drde, dgde, dbde, dade);293buffer+=sprintf(buffer, " ");294buffer+=sprintf(buffer, " DRDY: %s, DGDY: %s, DBDY: %s, DADY: %s\n", drdy, dgdy, dbdy, dady);295break;296}297case 0x0e: // Tri_TexShade298{299int lft = (command >> 23) & 0x1;300301if (length < rdp_command_length[command])302{303sprintf(buffer, "ERROR: Tri_TexShade length = %d\n", length);304return 0;305}306307for (i=2; i < 40; i++)308{309cmd[i] = rdp_cmd_data[rdp_cmd_cur+i];310}311312sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);313sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);314sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);315sprintf(xl, "%4.4f", (float)((INT32)cmd[2] / 65536.0f));316sprintf(dxldy, "%4.4f", (float)((INT32)cmd[3] / 65536.0f));317sprintf(xh, "%4.4f", (float)((INT32)cmd[4] / 65536.0f));318sprintf(dxhdy, "%4.4f", (float)((INT32)cmd[5] / 65536.0f));319sprintf(xm, "%4.4f", (float)((INT32)cmd[6] / 65536.0f));320sprintf(dxmdy, "%4.4f", (float)((INT32)cmd[7] / 65536.0f));321sprintf(rt, "%4.4f", (float)(INT32)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);322sprintf(gt, "%4.4f", (float)(INT32)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);323sprintf(bt, "%4.4f", (float)(INT32)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);324sprintf(at, "%4.4f", (float)(INT32)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);325sprintf(drdx, "%4.4f", (float)(INT32)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);326sprintf(dgdx, "%4.4f", (float)(INT32)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);327sprintf(dbdx, "%4.4f", (float)(INT32)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);328sprintf(dadx, "%4.4f", (float)(INT32)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);329sprintf(drde, "%4.4f", (float)(INT32)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);330sprintf(dgde, "%4.4f", (float)(INT32)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);331sprintf(dbde, "%4.4f", (float)(INT32)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);332sprintf(dade, "%4.4f", (float)(INT32)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);333sprintf(drdy, "%4.4f", (float)(INT32)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);334sprintf(dgdy, "%4.4f", (float)(INT32)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);335sprintf(dbdy, "%4.4f", (float)(INT32)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);336sprintf(dady, "%4.4f", (float)(INT32)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);337338sprintf(s, "%4.4f", (float)(INT32)((cmd[24] & 0xffff0000) | ((cmd[28] >> 16) & 0xffff)) / 65536.0f);339sprintf(t, "%4.4f", (float)(INT32)(((cmd[24] & 0xffff) << 16) | (cmd[28] & 0xffff)) / 65536.0f);340sprintf(w, "%4.4f", (float)(INT32)((cmd[25] & 0xffff0000) | ((cmd[29] >> 16) & 0xffff)) / 65536.0f);341sprintf(dsdx, "%4.4f", (float)(INT32)((cmd[26] & 0xffff0000) | ((cmd[30] >> 16) & 0xffff)) / 65536.0f);342sprintf(dtdx, "%4.4f", (float)(INT32)(((cmd[26] & 0xffff) << 16) | (cmd[30] & 0xffff)) / 65536.0f);343sprintf(dwdx, "%4.4f", (float)(INT32)((cmd[27] & 0xffff0000) | ((cmd[31] >> 16) & 0xffff)) / 65536.0f);344sprintf(dsde, "%4.4f", (float)(INT32)((cmd[32] & 0xffff0000) | ((cmd[36] >> 16) & 0xffff)) / 65536.0f);345sprintf(dtde, "%4.4f", (float)(INT32)(((cmd[32] & 0xffff) << 16) | (cmd[36] & 0xffff)) / 65536.0f);346sprintf(dwde, "%4.4f", (float)(INT32)((cmd[33] & 0xffff0000) | ((cmd[37] >> 16) & 0xffff)) / 65536.0f);347sprintf(dsdy, "%4.4f", (float)(INT32)((cmd[34] & 0xffff0000) | ((cmd[38] >> 16) & 0xffff)) / 65536.0f);348sprintf(dtdy, "%4.4f", (float)(INT32)(((cmd[34] & 0xffff) << 16) | (cmd[38] & 0xffff)) / 65536.0f);349sprintf(dwdy, "%4.4f", (float)(INT32)((cmd[35] & 0xffff0000) | ((cmd[39] >> 16) & 0xffff)) / 65536.0f);350351352buffer+=sprintf(buffer, "Tri_TexShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);353buffer+=sprintf(buffer, " ");354buffer+=sprintf(buffer, " R: %s, G: %s, B: %s, A: %s\n", rt, gt, bt, at);355buffer+=sprintf(buffer, " ");356buffer+=sprintf(buffer, " DRDX: %s, DGDX: %s, DBDX: %s, DADX: %s\n", drdx, dgdx, dbdx, dadx);357buffer+=sprintf(buffer, " ");358buffer+=sprintf(buffer, " DRDE: %s, DGDE: %s, DBDE: %s, DADE: %s\n", drde, dgde, dbde, dade);359buffer+=sprintf(buffer, " ");360buffer+=sprintf(buffer, " DRDY: %s, DGDY: %s, DBDY: %s, DADY: %s\n", drdy, dgdy, dbdy, dady);361362buffer+=sprintf(buffer, " ");363buffer+=sprintf(buffer, " S: %s, T: %s, W: %s\n", s, t, w);364buffer+=sprintf(buffer, " ");365buffer+=sprintf(buffer, " DSDX: %s, DTDX: %s, DWDX: %s\n", dsdx, dtdx, dwdx);366buffer+=sprintf(buffer, " ");367buffer+=sprintf(buffer, " DSDE: %s, DTDE: %s, DWDE: %s\n", dsde, dtde, dwde);368buffer+=sprintf(buffer, " ");369buffer+=sprintf(buffer, " DSDY: %s, DTDY: %s, DWDY: %s\n", dsdy, dtdy, dwdy);370break;371}372#endif373case 0x24:374case 0x25:375{376if (length < 16)377{378sprintf(buffer, "ERROR: Texture_Rectangle length = %d\n", length);379return 0;380}381cmd[2] = rdp_cmd_data[rdp_cmd_cur+2];382cmd[3] = rdp_cmd_data[rdp_cmd_cur+3];383sprintf(s, "%4.4f", (float)(INT16)((cmd[2] >> 16) & 0xffff) / 32.0f);384sprintf(t, "%4.4f", (float)(INT16)((cmd[2] >> 0) & 0xffff) / 32.0f);385sprintf(dsdx, "%4.4f", (float)(INT16)((cmd[3] >> 16) & 0xffff) / 1024.0f);386sprintf(dtdy, "%4.4f", (float)(INT16)((cmd[3] >> 16) & 0xffff) / 1024.0f);387388if (command == 0x24)389sprintf(buffer, "Texture_Rectangle %d, %s, %s, %s, %s, %s, %s, %s, %s", tile, sh, th, sl, tl, s, t, dsdx, dtdy);390else391sprintf(buffer, "Texture_Rectangle_Flip %d, %s, %s, %s, %s, %s, %s, %s, %s", tile, sh, th, sl, tl, s, t, dsdx, dtdy);392393break;394}395case 0x26: sprintf(buffer, "Sync_Load"); break;396case 0x27: sprintf(buffer, "Sync_Pipe"); break;397case 0x28: sprintf(buffer, "Sync_Tile"); break;398case 0x29: sprintf(buffer, "Sync_Full"); break;399case 0x2d: sprintf(buffer, "Set_Scissor %s, %s, %s, %s", sl, tl, sh, th); break;400case 0x2e: sprintf(buffer, "Set_Prim_Depth %04X, %04X", (cmd[1] >> 16) & 0xffff, cmd[1] & 0xffff); break;401case 0x2f: sprintf(buffer, "Set_Other_Modes %08X %08X", cmd[0], cmd[1]); break;402case 0x30: sprintf(buffer, "Load_TLUT %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;403case 0x32: sprintf(buffer, "Set_Tile_Size %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;404case 0x33: sprintf(buffer, "Load_Block %d, %03X, %03X, %03X, %03X", tile, (cmd[0] >> 12) & 0xfff, cmd[0] & 0xfff, (cmd[1] >> 12) & 0xfff, cmd[1] & 0xfff); break;405case 0x34: sprintf(buffer, "Load_Tile %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;406case 0x35: sprintf(buffer, "Set_Tile %d, %s, %s, %d, %04X", tile, format, size, ((cmd[0] >> 9) & 0x1ff) * 8, (cmd[0] & 0x1ff) * 8); break;407case 0x36: sprintf(buffer, "Fill_Rectangle %s, %s, %s, %s", sh, th, sl, tl); break;408case 0x37: sprintf(buffer, "Set_Fill_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;409case 0x38: sprintf(buffer, "Set_Fog_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;410case 0x39: sprintf(buffer, "Set_Blend_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;411case 0x3a: sprintf(buffer, "Set_Prim_Color %d, %d, R: %d, G: %d, B: %d, A: %d", (cmd[0] >> 8) & 0x1f, cmd[0] & 0xff, r, g, b, a); break;412case 0x3b: sprintf(buffer, "Set_Env_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;413case 0x3c: sprintf(buffer, "Set_Combine %08X %08X", cmd[0], cmd[1]); break;414case 0x3d: sprintf(buffer, "Set_Texture_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break;415case 0x3e: sprintf(buffer, "Set_Mask_Image %08X", cmd[1]); break;416case 0x3f: sprintf(buffer, "Set_Color_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break;417default: sprintf(buffer, "??? (%08X %08X)", cmd[0], cmd[1]); break;418}419420return rdp_command_length[command];421}422423424