common: move ssappendf in DisR59000asm.cpp

Legacy function to print EE opcode. It doesn't worth an extra file.
This commit is contained in:
Gregory Hainaut 2017-02-01 17:38:58 +01:00
parent 965fccaff0
commit 6d7b1f9dbd
6 changed files with 34 additions and 65 deletions

View File

@ -86,7 +86,6 @@
<ClCompile Include="..\..\src\Utilities\pxRadioPanel.cpp" />
<ClCompile Include="..\..\src\Utilities\pxStaticText.cpp" />
<ClCompile Include="..\..\src\Utilities\StringHelpers.cpp" />
<ClCompile Include="..\..\src\Utilities\vssprintf.cpp" />
<ClCompile Include="..\..\src\Utilities\wxAppWithHelpers.cpp" />
<ClCompile Include="..\..\src\Utilities\wxGuiTools.cpp" />
<ClCompile Include="..\..\src\Utilities\wxHelpers.cpp" />

View File

@ -59,9 +59,6 @@
<ClCompile Include="..\..\src\Utilities\StringHelpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Utilities\vssprintf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Utilities\wxAppWithHelpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -233,12 +233,3 @@ extern wxString operator+(const wxString &str1, const FastFormatUnicode &str2);
extern wxString operator+(const wxChar *str1, const FastFormatUnicode &str2);
extern wxString operator+(const FastFormatUnicode &str1, const wxString &str2);
extern wxString operator+(const FastFormatUnicode &str1, const wxChar *str2);
//////////////////////////////////////////////////////////////////////////////////////////
// Custom internal sprintf functions, which are ASCII only (even in UNICODE builds)
//
// These functions are useful since they are ASCII always, even under Unicode. Typically
// even in a unicode app.
extern void ssappendf(std::string &dest, const char *format, ...);

View File

@ -42,7 +42,6 @@ set(UtilitiesSources
StringHelpers.cpp
ThreadingDialogs.cpp
ThreadTools.cpp
vssprintf.cpp
wxAppWithHelpers.cpp
wxGuiTools.cpp
wxHelpers.cpp

View File

@ -1,51 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2015 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 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 for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "PrecompiledHeader.h"
// Note: std::vsnprintf requires C++11 (and the function must return the total
// number of characters which would have been written even if a truncation occured)
// Note2: Code is only used in debugger (perf is not important)
static void vssappendf(std::string &dest, const char *format, va_list args)
{
char first_try[128]; // this function is called 99% (100%?) of the times for small string
va_list args_copy;
va_copy(args_copy, args);
s32 size = std::vsnprintf(first_try, 128, format, args_copy) + 1;
va_end(args_copy);
if (size < 0)
return;
if (size < 128) {
dest += first_try;
return;
}
std::vector<char> output;
output.resize(size + 1);
std::vsnprintf(output.data(), size, format, args);
dest += output.data();
}
void ssappendf(std::string &dest, const char *format, ...)
{
va_list args;
va_start(args, format);
vssappendf(dest, format, args);
va_end(args);
}

View File

@ -29,6 +29,40 @@
// Note only a subset of the opcodes are supported. It is intended as a cheap debugger
//#define PRINT_REG_CONTENT
// Note: Perf is not important
static void vssappendf(std::string &dest, const char *format, va_list args)
{
char first_try[128]; // this function is called 99% (100%?) of the times for small string
va_list args_copy;
va_copy(args_copy, args);
s32 size = std::vsnprintf(first_try, 128, format, args_copy) + 1;
va_end(args_copy);
if (size < 0)
return;
if (size < 128) {
dest += first_try;
return;
}
std::vector<char> output;
output.resize(size + 1);
std::vsnprintf(output.data(), size, format, args);
dest += output.data();
}
void ssappendf(std::string &dest, const char *format, ...)
{
va_list args;
va_start(args, format);
vssappendf(dest, format, args);
va_end(args);
}
unsigned long opcode_addr;
u32 disasmOpcode;
bool disSimplify;