diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 3c50eeb8da..0bb59efd4b 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -70,6 +70,7 @@ #define DUMP_DIR "Dump" #define DUMP_TEXTURES_DIR "Textures" #define DUMP_FRAMES_DIR "Frames" +#define DUMP_DSP_DIR "DSP" #define LOGS_DIR "Logs" #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_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_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_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP #define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp index 59ebf76f17..6bbf856d58 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Tools.cpp @@ -28,7 +28,7 @@ bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc) { 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"); if (pFile != NULL) @@ -55,8 +55,8 @@ bool DisasmUCodeDump(u32 crc) { char binFile[MAX_PATH]; char txtFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DUMP_DIR, crc); - sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DUMP_DIR, crc); + sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DSP_DUMP_DIR, crc); + sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DSP_DUMP_DIR, crc); FILE* t = fopen(txtFile, "wb"); if (t != NULL) { @@ -80,13 +80,9 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) for (int j = 0; j < 8; j++) { if (Temp & 0x1) - { Temp = (Temp >> 1) ^ 0xEDB88320; - } else - { Temp >>= 1; - } } CRC = (CRC >> 8) ^ Temp; @@ -95,11 +91,11 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) return(CRC ^ 0xFFFFFFFF); } - +// TODO make this useful :p bool DumpCWCode(u32 _Address, u32 _Length) { 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"); if (pFile != NULL) @@ -111,10 +107,8 @@ bool DumpCWCode(u32 _Address, u32 _Length) } fclose(pFile); - return(true); + return true; } - return(false); + return false; } - - diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp index ff541382cd..8be950f5f2 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.cpp @@ -455,6 +455,8 @@ char* gd_dis_opcode(gd_globals_t* gdg) bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output) { + gd_dis_open_unkop(); + FILE* in; u32 size; @@ -484,6 +486,8 @@ bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output) gdg->buffer = NULL; gdg->buffer_size = 0; + gd_dis_close_unkop(); + return true; } @@ -493,7 +497,10 @@ void gd_dis_close_unkop() int i, j; 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) { @@ -501,7 +508,8 @@ void gd_dis_close_unkop() fclose(uo); } - uo = fopen("unkopc.txt", "w"); + sprintf(filename, "%sUnkOps.txt", FULL_DSP_DUMP_DIR); + uo = fopen(filename, "w"); if (uo) { @@ -532,8 +540,9 @@ void gd_dis_close_unkop() void gd_dis_open_unkop() { FILE* uo; - - uo = fopen("uo.bin", "rb"); + char filename[MAX_PATH]; + sprintf(filename, "%sUnkOps.bin", FULL_DSP_DUMP_DIR); + uo = fopen(filename, "rb"); if (uo) { diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h index f405f0fd16..7d0c47c97c 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/disassemble.h @@ -45,4 +45,6 @@ typedef struct gd_globals_t char* gd_dis_opcode(gd_globals_t* gdg); 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);