enable old code to record unknown dsp opcodes to their own file

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2862 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-03 22:23:15 +00:00
parent 21348622a7
commit f72d883340
4 changed files with 24 additions and 17 deletions

View File

@ -70,6 +70,7 @@
#define DUMP_DIR "Dump" #define DUMP_DIR "Dump"
#define DUMP_TEXTURES_DIR "Textures" #define DUMP_TEXTURES_DIR "Textures"
#define DUMP_FRAMES_DIR "Frames" #define DUMP_FRAMES_DIR "Frames"
#define DUMP_DSP_DIR "DSP"
#define LOGS_DIR "Logs" #define LOGS_DIR "Logs"
#define MAIL_LOGS_DIR "Mail" #define MAIL_LOGS_DIR "Mail"
@ -127,6 +128,7 @@
#define FULL_FRAMES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_FRAMES_DIR #define FULL_FRAMES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_FRAMES_DIR
#define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP #define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
#define FULL_DUMP_TEXTURES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_TEXTURES_DIR #define FULL_DUMP_TEXTURES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_TEXTURES_DIR
#define FULL_DSP_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_DSP_DIR DIR_SEP
#define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP #define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP #define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP #define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP

View File

@ -28,7 +28,7 @@
bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc) bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc)
{ {
char szFilename[MAX_PATH]; char szFilename[MAX_PATH];
sprintf(szFilename, "%sDSP_UC_%08X.bin", FULL_DUMP_DIR, crc); sprintf(szFilename, "%sDSP_UC_%08X.bin", FULL_DSP_DUMP_DIR, crc);
FILE* pFile = fopen(szFilename, "wb"); FILE* pFile = fopen(szFilename, "wb");
if (pFile != NULL) if (pFile != NULL)
@ -55,8 +55,8 @@ bool DisasmUCodeDump(u32 crc)
{ {
char binFile[MAX_PATH]; char binFile[MAX_PATH];
char txtFile[MAX_PATH]; char txtFile[MAX_PATH];
sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DUMP_DIR, crc); sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DSP_DUMP_DIR, crc);
sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DUMP_DIR, crc); sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DSP_DUMP_DIR, crc);
FILE* t = fopen(txtFile, "wb"); FILE* t = fopen(txtFile, "wb");
if (t != NULL) if (t != NULL)
{ {
@ -80,13 +80,9 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
{ {
if (Temp & 0x1) if (Temp & 0x1)
{
Temp = (Temp >> 1) ^ 0xEDB88320; Temp = (Temp >> 1) ^ 0xEDB88320;
}
else else
{
Temp >>= 1; Temp >>= 1;
}
} }
CRC = (CRC >> 8) ^ Temp; CRC = (CRC >> 8) ^ Temp;
@ -95,11 +91,11 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
return(CRC ^ 0xFFFFFFFF); return(CRC ^ 0xFFFFFFFF);
} }
// TODO make this useful :p
bool DumpCWCode(u32 _Address, u32 _Length) bool DumpCWCode(u32 _Address, u32 _Length)
{ {
char filename[256]; char filename[256];
sprintf(filename, "%sDSP_UCode.bin", FULL_DUMP_DIR); sprintf(filename, "%sDSP_UCode.bin", FULL_DSP_DUMP_DIR);
FILE* pFile = fopen(filename, "wb"); FILE* pFile = fopen(filename, "wb");
if (pFile != NULL) if (pFile != NULL)
@ -111,10 +107,8 @@ bool DumpCWCode(u32 _Address, u32 _Length)
} }
fclose(pFile); fclose(pFile);
return(true); return true;
} }
return(false); return false;
} }

View File

@ -455,6 +455,8 @@ char* gd_dis_opcode(gd_globals_t* gdg)
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output) bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output)
{ {
gd_dis_open_unkop();
FILE* in; FILE* in;
u32 size; u32 size;
@ -484,6 +486,8 @@ bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output)
gdg->buffer = NULL; gdg->buffer = NULL;
gdg->buffer_size = 0; gdg->buffer_size = 0;
gd_dis_close_unkop();
return true; return true;
} }
@ -493,7 +497,10 @@ void gd_dis_close_unkop()
int i, j; int i, j;
u32 count = 0; u32 count = 0;
uo = fopen("uo.bin", "wb"); char filename[MAX_PATH];
sprintf(filename, "%sUnkOps.bin", FULL_DSP_DUMP_DIR);
uo = fopen(filename, "wb");
if (uo) if (uo)
{ {
@ -501,7 +508,8 @@ void gd_dis_close_unkop()
fclose(uo); fclose(uo);
} }
uo = fopen("unkopc.txt", "w"); sprintf(filename, "%sUnkOps.txt", FULL_DSP_DUMP_DIR);
uo = fopen(filename, "w");
if (uo) if (uo)
{ {
@ -532,8 +540,9 @@ void gd_dis_close_unkop()
void gd_dis_open_unkop() void gd_dis_open_unkop()
{ {
FILE* uo; FILE* uo;
char filename[MAX_PATH];
uo = fopen("uo.bin", "rb"); sprintf(filename, "%sUnkOps.bin", FULL_DSP_DUMP_DIR);
uo = fopen(filename, "rb");
if (uo) if (uo)
{ {

View File

@ -45,4 +45,6 @@ typedef struct gd_globals_t
char* gd_dis_opcode(gd_globals_t* gdg); char* gd_dis_opcode(gd_globals_t* gdg);
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output); bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output);
void gd_dis_close_unkop();
void gd_dis_open_unkop();
const char* gd_dis_get_reg_name(u16 reg); const char* gd_dis_get_reg_name(u16 reg);