Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show extended scan preview for strings. #122

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Source/Common/MemoryCommon.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "MemoryCommon.h"

#include <bitset>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <sstream>
Expand Down Expand Up @@ -624,13 +625,23 @@ std::string formatMemoryToString(const char* memory, const MemType type, const s
}
case Common::MemType::type_string:
{
int actualLength = 0;
for (actualLength; actualLength < length; ++actualLength)
std::string text;
for (std::string::size_type i{0}; i < length; ++i)
{
if (*(memory + actualLength) == 0x00)
const char c{memory[i]};
if (c == '\0')
break;

if (std::isprint(c))
{
text.push_back(c);
}
else
{
text += "�";
}
}
return std::string(memory, actualLength);
return text;
}
case Common::MemType::type_byteArray:
{
Expand Down
3 changes: 2 additions & 1 deletion Source/MemoryScanner/MemoryScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ std::string MemScanner::getFormattedScannedValueAt(const int index) const
bool aramAccessible = DolphinComm::DolphinAccessor::isARAMAccessible();
u32 offset = Common::dolphinAddrToOffset(m_resultsConsoleAddr.at(index), aramAccessible);
u32 ramIndex = Common::offsetToCacheIndex(offset, aramAccessible);
return Common::formatMemoryToString(&m_scanRAMCache[ramIndex], m_memType, m_memSize, m_memBase,
const size_t length{m_memType == Common::MemType::type_string ? ~0ULL : m_memSize};
return Common::formatMemoryToString(&m_scanRAMCache[ramIndex], m_memType, length, m_memBase,
!m_memIsSigned, Common::shouldBeBSwappedForType(m_memType));
}

Expand Down