Code: Select all
void G::FillEditor( void )
{
SetTime();
if ( isEdit ) return;
mSetEditor = 1;
editRow = edit_G->GetGridCursorRow();
editCol = edit_G->GetGridCursorCol();
edit_G->GetViewStart( &editX, &editY );
NewHook();
edit_G->Freeze();
++editIsRecursing;
s8 ramNo = editRam_D->GetSelection();
u64 ramStart = 0u;
u64 ramEnd = 0u;
u32 useSize = mGetRam( ramStart, ramEnd, ramNo );
if ( useSize == 0u ) return;
u64 byte = GetHex( editGet_TXT->GetValue() );
if ( byte > 0u )
{
while ( ( byte % 0x10 ) > 0 ) byte--;
while ( ( byte % 0x100 ) > 0 ) byte -= 0x10;
}
u32 divByte = byte + 0x100;
u8* ram8 = new u8[ useSize ];
u16* ram16 = reinterpret_cast< u16* >( ram8 );
if ( hookApp )
{
GetRamX( appHandle, ramStart + byte, ram8, useSize );
}
else
{
bin_BF.Seek( ramStart + byte, wxFromStart );
bin_BF.Read( ram8, useSize );
}
wxChar cAscii;
xStr sAscii;
xStr cUnicode;
xStr sUnicode;
xStr text;
bool getUnicode = false;
edit_G->DeleteRows( 0, edit_G->GetRows(), false );
u32 i = 0u, i16 = 0u, row = 0u, col = 0u;
isJustFilled = true;
editRePainting = 0;
edit_G->AppendRows( 0x30, false );
for ( ; ( row < 0x30 && byte < divByte && i < useSize ); ++row )
{
text.Printf( hex64, byte + i );
edit_G->SetRowLabelValue( row, text );
sAscii.Clear();
sUnicode.Clear();
for ( col = 0u; ( col < 16u && i < useSize ); ++col, ++i )
{
cAscii = ram8[ i ];
sAscii += cAscii;
getUnicode = false;
if ( getUnicode )
{
cUnicode.FromUTF8( reinterpret_cast< char* >( &ram16[ i16 ] ) );
sUnicode += cUnicode;
getUnicode = false;
++i16;
}
else getUnicode = true;
text.Printf( hex8, ram8[ i ] );
edit_G->SetCellValue( row, col, text );
}
edit_G->SetCellValue( row, 16, sAscii );
edit_G->SetCellValue( row, 17, sUnicode );
}
delete [] ram8;
DelHook();
--editIsRecursing;
edit_G->Thaw();
mSetEditor = 2;
}
// Idle Function
if ( editAdd > 0u && panelIndex == 3 )
{
doEvent = true;
if ( now >= editUntil )
{
FillEditor();
}
}
if ( mSetEditor > 0 )
{
edit_G->ClearSelection();
edit_G->SetGridCursor( editRow, editCol );
edit_G->Scroll( editX, editY );
if ( mSetEditor == 3 ) mSetEditor = 0;
if ( mSetEditor == 2 ) mSetEditor = 3;
}