| 901 | } |
| 902 | |
| 903 | void 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; |
nothing calls this directly
no test coverage detected