| 149 | } |
| 150 | |
| 151 | void Dump_Disassemble(u32 start, u32 end, const char * p_file_name) |
| 152 | { |
| 153 | IO::Filename file_path; |
| 154 | |
| 155 | // Cute hack - if the end of the range is less than the start, |
| 156 | // assume it is a length to disassemble |
| 157 | if (end < start) |
| 158 | end = start + end; |
| 159 | |
| 160 | if (p_file_name == NULL || strlen(p_file_name) == 0) |
| 161 | { |
| 162 | Dump_GetDumpDirectory(file_path, ""); |
| 163 | IO::Path::Append(file_path, "dis.txt"); |
| 164 | } |
| 165 | else |
| 166 | { |
| 167 | IO::Path::Assign(file_path, p_file_name); |
| 168 | } |
| 169 | |
| 170 | u8 * p_base; |
| 171 | if (!Memory_GetInternalReadAddress(start, (void**)&p_base)) |
| 172 | { |
| 173 | DBGConsole_Msg(0, "[Ydis: Invalid base 0x%08x]", start); |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | FILE * fp( fopen(file_path, "w") ); |
| 178 | if (fp == NULL) |
| 179 | return; |
| 180 | |
| 181 | DBGConsole_Msg(0, "Disassembling from 0x%08x to 0x%08x ([C%s])", start, end, file_path); |
| 182 | |
| 183 | const OpCode * op_start( reinterpret_cast< const OpCode * >( p_base ) ); |
| 184 | const OpCode * op_end( reinterpret_cast< const OpCode * >( p_base + (end-start) ) ); |
| 185 | |
| 186 | Dump_DisassembleMIPSRange(fp, start, op_start, op_end); |
| 187 | |
| 188 | fclose(fp); |
| 189 | } |
| 190 | #endif |
| 191 | |
| 192 | #ifndef DAEDALUS_SILENT |
no test coverage detected