Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
Fix viewer positions when changing watch list (#32)
Browse files Browse the repository at this point in the history
* Reworked memory caret to move freely and wrap.

* Added mouse wheel scroll to mem viewer.

* Increased range of pg up/down keys on mem viewer.

* Copy & Paste feature for achievement conditions.
replaced Clone Selected.

* set watched address box.

* Fix viewer positions when changing watch list
  • Loading branch information
GameDragon2k committed Dec 1, 2017
1 parent 75bec99 commit bc9b140
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion RA_Integration/RA_Dlg_Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ void MemoryViewerControl::SetCaretPos()
int linePosition = (subAddress & ~(0xF)) / (0x10) + 4;

if ( linePosition < 0 || linePosition > (int)m_nDisplayedLines - 1)

{
destroyEditCaret();
return;
Expand Down Expand Up @@ -1170,19 +1171,28 @@ INT_PTR Dlg_Memory::MemoryProc( HWND hDlg, UINT nMsg, WPARAM wParam, LPARAM lPar
wchar_t sAddr[ 64 ];
if( ComboBox_GetLBText( hMemWatch, nSel, sAddr ) > 0 )
{
ByteAddress nAddr = static_cast<ByteAddress>( std::strtoul( Narrow( sAddr ).c_str() + 2, nullptr, 16 ) );
ByteAddress nAddr = static_cast<ByteAddress>( std::strtoul( Narrow( sAddr ).c_str(), nullptr, 16 ) );
const CodeNotes::CodeNoteObj* pSavedNote = m_CodeNotes.FindCodeNote( nAddr );
if( pSavedNote != NULL && pSavedNote->Note().length() > 0 )
SetDlgItemText( hDlg, IDC_RA_MEMSAVENOTE, Widen( pSavedNote->Note() ).c_str() );

MemoryViewerControl::setAddress((nAddr & ~(0xf)) - ((int)(MemoryViewerControl::m_nDisplayedLines / 2) << 4) + (0x50));
}
}

Invalidate();
return TRUE;
}
case CBN_EDITCHANGE:
{
OnWatchingMemChange();

wchar_t sAddrWide[ 64 ];
GetDlgItemText( hDlg, IDC_RA_WATCHING, sAddrWide, 64 );
ByteAddress nAddr = static_cast<ByteAddress>(std::strtoul(Narrow(sAddrWide).c_str(), nullptr, 16));
MemoryViewerControl::setAddress((nAddr & ~(0xf)) - ((int)(MemoryViewerControl::m_nDisplayedLines / 2) << 4) + (0x50));
return TRUE;
}

default:
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion RA_Integration/RA_Dlg_Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MemoryViewerControl

public:
static unsigned short m_nActiveMemBank;
static unsigned int m_nDisplayedLines;

private:
static HFONT m_hViewerFont;
Expand All @@ -37,7 +38,6 @@ class MemoryViewerControl
static unsigned int m_nDataSize;
static unsigned int m_nEditAddress;
static unsigned int m_nEditNibble;
static unsigned int m_nDisplayedLines;

static bool m_bHasCaret;
static unsigned int m_nCaretWidth;
Expand Down

0 comments on commit bc9b140

Please sign in to comment.