| 1 | /* |
| 2 | * Glide64 - Glide video plugin for Nintendo 64 emulators. |
| 3 | * Copyright (c) 2002 Dave2001 |
| 4 | * Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | //**************************************************************** |
| 22 | // |
| 23 | // Glide64 - Glide Plugin for Nintendo 64 emulators |
| 24 | // Project started on December 29th, 2001 |
| 25 | // |
| 26 | // Authors: |
| 27 | // Dave2001, original author, founded the project in 2001, left it in 2002 |
| 28 | // Gugaman, joined the project in 2002, left it in 2002 |
| 29 | // Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002 |
| 30 | // Hiroshi 'KoolSmoky' Morii, joined the project in 2007 |
| 31 | // |
| 32 | //**************************************************************** |
| 33 | // |
| 34 | // To modify Glide64: |
| 35 | // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me. |
| 36 | // * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all. |
| 37 | // |
| 38 | //**************************************************************** |
| 39 | |
| 40 | #define SELECTED_NONE 0x00000000 |
| 41 | #define SELECTED_TRI 0x00000001 |
| 42 | #define SELECTED_TEX 0x00000002 |
| 43 | |
| 44 | typedef struct TEX_INFO_t |
| 45 | { |
| 46 | wxUint32 cur_cache[2]; // Current cache # |
| 47 | wxUint8 format; |
| 48 | wxUint8 size; |
| 49 | wxUint32 width, height; |
| 50 | wxUint16 line, wid; |
| 51 | wxUint8 palette; |
| 52 | wxUint8 clamp_s, clamp_t; |
| 53 | wxUint8 mirror_s, mirror_t; |
| 54 | wxUint8 mask_s, mask_t; |
| 55 | wxUint8 shift_s, shift_t; |
| 56 | wxUint16 ul_s, ul_t, lr_s, lr_t; |
| 57 | wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t; |
| 58 | float scale_s, scale_t; |
| 59 | int tmu; |
| 60 | } TEX_INFO; |
| 61 | |
| 62 | typedef struct TRI_INFO_t |
| 63 | { |
| 64 | wxUint32 nv; // Number of vertices |
| 65 | VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline |
| 66 | wxUint32 cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering |
| 67 | wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both |
| 68 | wxUint32 geom_mode; // geometry mode flags |
| 69 | wxUint32 othermode_h; // setothermode_h flags |
| 70 | wxUint32 othermode_l; // setothermode_l flags |
| 71 | wxUint32 tri_n; // Triangle number |
| 72 | wxUint32 flags; |
| 73 | |
| 74 | int type; // 0-normal, 1-texrect, 2-fillrect |
| 75 | |
| 76 | // texture info |
| 77 | TEX_INFO t[2]; |
| 78 | |
| 79 | // colors |
| 80 | wxUint32 fog_color; |
| 81 | wxUint32 fill_color; |
| 82 | wxUint32 prim_color; |
| 83 | wxUint32 blend_color; |
| 84 | wxUint32 env_color; |
| 85 | wxUint32 prim_lodmin, prim_lodfrac; |
| 86 | |
| 87 | TRI_INFO_t *pNext; |
| 88 | } TRI_INFO; |
| 89 | |
| 90 | typedef struct DEBUGGER_t |
| 91 | { |
| 92 | int capture; // Capture moment for debugging? |
| 93 | |
| 94 | wxUint32 selected; // Selected object (see flags above) |
| 95 | TRI_INFO *tri_sel; |
| 96 | |
| 97 | wxUint32 tex_scroll; // texture scrolling |
| 98 | wxUint32 tex_sel; |
| 99 | |
| 100 | // CAPTURE INFORMATION |
| 101 | wxUint8 *screen; // Screen capture |
| 102 | TRI_INFO *tri_list; // Triangle information list |
| 103 | TRI_INFO *tri_last; // Last in the list (first in) |
| 104 | |
| 105 | wxUint32 tmu; // tmu # |
| 106 | |
| 107 | wxUint32 draw_mode; |
| 108 | |
| 109 | // Page number |
| 110 | int page; |
| 111 | |
| 112 | } GLIDE64_DEBUGGER; |
| 113 | |
| 114 | #define PAGE_GENERAL 0 |
| 115 | #define PAGE_TEX1 1 |
| 116 | #define PAGE_TEX2 2 |
| 117 | #define PAGE_COLORS 3 |
| 118 | #define PAGE_FBL 4 |
| 119 | #define PAGE_OTHERMODE_L 5 |
| 120 | #define PAGE_OTHERMODE_H 6 |
| 121 | #define PAGE_TEXELS 7 |
| 122 | #define PAGE_COORDS 8 |
| 123 | #define PAGE_TEX_INFO 9 |
| 124 | |
| 125 | #define TRI_TRIANGLE 0 |
| 126 | #define TRI_TEXRECT 1 |
| 127 | #define TRI_FILLRECT 2 |
| 128 | #define TRI_BACKGROUND 3 |
| 129 | |
| 130 | extern GLIDE64_DEBUGGER _debugger; |
| 131 | |
| 132 | void debug_init (); |
| 133 | void debug_capture (); |
| 134 | void debug_cacheviewer (); |
| 135 | void debug_mouse (); |
| 136 | void debug_keys (); |
| 137 | void output (float x, float y, int scale, const char *fmt, ...); |