MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / createLines

Method createLines

pcsx2/DebugTools/DisassemblyManager.cpp:903–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901}
902
903void DisassemblyData::createLines()
904{
905 lines.clear();
906 lineAddresses.clear();
907
908 u32 pos = address;
909 u32 end = address+size;
910 u32 maxChars = DisassemblyManager::getMaxParamChars();
911
912 std::string currentLine;
913 u32 currentLineStart = pos;
914
915 int lineCount = 0;
916 if (type == DATATYPE_ASCII)
917 {
918 bool inString = false;
919 while (pos < end)
920 {
921 u8 b = r5900Debug.Read8(pos++);
922 if (b >= 0x20 && b <= 0x7F)
923 {
924 if (currentLine.size()+1 >= maxChars)
925 {
926 if (inString)
927 currentLine += "\"";
928
929 DataEntry entry = {currentLine,pos-1-currentLineStart,lineCount++};
930 lines[currentLineStart] = entry;
931 lineAddresses.push_back(currentLineStart);
932
933 currentLine = "";
934 currentLineStart = pos-1;
935 inString = false;
936 }
937
938 if (!inString)
939 currentLine += "\"";
940 currentLine += (char)b;
941 inString = true;
942 } else {
943 char buffer[64];
944 if (pos == end && b == 0)
945 StringUtil::Strlcpy(buffer, "0", std::size(buffer));
946 else
947 std::snprintf(buffer, std::size(buffer), "0x%02X", b);
948
949 if (currentLine.size()+strlen(buffer) >= maxChars)
950 {
951 if (inString)
952 currentLine += "\"";
953
954 DataEntry entry = {currentLine,pos-1-currentLineStart,lineCount++};
955 lines[currentLineStart] = entry;
956 lineAddresses.push_back(currentLineStart);
957
958 currentLine = "";
959 currentLineStart = pos-1;
960 inString = false;

Callers

nothing calls this directly

Calls 11

StrlcpyFunction · 0.85
sizeFunction · 0.50
clearMethod · 0.45
Read8Method · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
Read16Method · 0.45
Read32Method · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected