diff options
| author | bushing <bushing@gmail.com> | 2008-12-08 05:25:12 +0000 |
|---|---|---|
| committer | bushing <bushing@gmail.com> | 2008-12-08 05:25:12 +0000 |
| commit | 901fe7c00fec5e2aaf55d184edbcb6d092345d52 (patch) | |
| tree | a1d207a639c02dd34a4285a9c757799f2379ea2b /Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp | |
| parent | 9146b9b261c34f476c9f83934e6da6a463ad51c7 (diff) | |
set svn:eol-style=native for Plugins/**.cpp
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1441 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp index 5401bab086..e88de886f3 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Tools.cpp @@ -1,93 +1,93 @@ -// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "Common.h"
-#include "Globals.h"
-
-#include "gdsp_interpreter.h"
-
-bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc)
-{
- char szFilename[MAX_PATH];
- sprintf(szFilename, "c:\\_\\DSP_UC_%08X.bin", crc);
- FILE* pFile = fopen(szFilename, "wb");
-
- if (pFile != NULL)
- {
- fwrite(g_dspInitialize.pGetMemoryPointer(_Address), _Length, 1, pFile);
- fclose(pFile);
- return(true);
- }
- else
- {
- PanicAlert("Cant open file (%s) to dump UCode!!", szFilename);
- }
-
- return(false);
-}
-
-
-uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
-{
- unsigned long CRC = 0xFFFFFFFF;
-
- while (_pLength--)
- {
- unsigned long Temp = (unsigned long)((CRC & 0xFF) ^ *_pBuffer++);
-
- for (int j = 0; j < 8; j++)
- {
- if (Temp & 0x1)
- {
- Temp = (Temp >> 1) ^ 0xEDB88320;
- }
- else
- {
- Temp >>= 1;
- }
- }
-
- CRC = (CRC >> 8) ^ Temp;
- }
-
- return(CRC ^ 0xFFFFFFFF);
-}
-
-
-bool DumpCWCode(uint32 _Address, uint32 _Length)
-{
- FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb");
-
- if (pFile != NULL)
- {
- for (size_t i = _Address; i < _Address + _Length; i++)
- {
- uint16 val = Common::swap16(g_dsp.iram[i]);
- fprintf(pFile, " cw 0x%04x \n", val);
- }
-
- fclose(pFile);
- return(true);
- }
-
- return(false);
-}
-
-
+// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include <stdio.h> +#include <stdlib.h> + +#include "Common.h" +#include "Globals.h" + +#include "gdsp_interpreter.h" + +bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc) +{ + char szFilename[MAX_PATH]; + sprintf(szFilename, "c:\\_\\DSP_UC_%08X.bin", crc); + FILE* pFile = fopen(szFilename, "wb"); + + if (pFile != NULL) + { + fwrite(g_dspInitialize.pGetMemoryPointer(_Address), _Length, 1, pFile); + fclose(pFile); + return(true); + } + else + { + PanicAlert("Cant open file (%s) to dump UCode!!", szFilename); + } + + return(false); +} + + +uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) +{ + unsigned long CRC = 0xFFFFFFFF; + + while (_pLength--) + { + unsigned long Temp = (unsigned long)((CRC & 0xFF) ^ *_pBuffer++); + + for (int j = 0; j < 8; j++) + { + if (Temp & 0x1) + { + Temp = (Temp >> 1) ^ 0xEDB88320; + } + else + { + Temp >>= 1; + } + } + + CRC = (CRC >> 8) ^ Temp; + } + + return(CRC ^ 0xFFFFFFFF); +} + + +bool DumpCWCode(uint32 _Address, uint32 _Length) +{ + FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb"); + + if (pFile != NULL) + { + for (size_t i = _Address; i < _Address + _Length; i++) + { + uint16 val = Common::swap16(g_dsp.iram[i]); + fprintf(pFile, " cw 0x%04x \n", val); + } + + fclose(pFile); + return(true); + } + + return(false); +} + + |
