Permalink
Browse files

common: move ssappendf in DisR59000asm.cpp

Legacy function to print EE opcode. It doesn't worth an extra file.
  • Loading branch information...
1 parent 965fcca commit 6d7b1f9dbdc8d71502fe96302ec4eefc7a103f55 @gregory38 gregory38 committed Feb 1, 2017
@@ -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" />
@@ -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>
@@ -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, ...);
@@ -42,7 +42,6 @@ set(UtilitiesSources
StringHelpers.cpp
ThreadingDialogs.cpp
ThreadTools.cpp
- vssprintf.cpp
wxAppWithHelpers.cpp
wxGuiTools.cpp
wxHelpers.cpp
@@ -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);
-}
@@ -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;
@danilaml
danilaml Feb 1, 2017

Could as well be std::vector<char> output(size + 1);, couldn't it?

+ 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;

0 comments on commit 6d7b1f9

Please sign in to comment.