@@ -1066,7 +1066,7 @@ private void ToolStripRefreshCheat_Click(object sender, EventArgs e)
1066
1066
1067
1067
refreshCheatSource = new CancellationTokenSource ( ) ;
1068
1068
refreshCheatTask = RefreshCheatTask ( true ) ;
1069
- refreshCheatTask . ContinueWith ( t => {
1069
+ refreshCheatTask ? . ContinueWith ( t => {
1070
1070
refreshCheatSource ? . Dispose ( ) ;
1071
1071
refreshCheatSource = null ;
1072
1072
refreshCheatTask ? . Dispose ( ) ;
@@ -1148,7 +1148,7 @@ private void AutoRefreshTimer_Tick(object sender, EventArgs e)
1148
1148
1149
1149
refreshCheatSource = new CancellationTokenSource ( ) ;
1150
1150
refreshCheatTask = RefreshCheatTask ( ) ;
1151
- refreshCheatTask . ContinueWith ( t => {
1151
+ refreshCheatTask ? . ContinueWith ( t => {
1152
1152
refreshCheatSource ? . Dispose ( ) ;
1153
1153
refreshCheatSource = null ;
1154
1154
refreshCheatTask ? . Dispose ( ) ;
@@ -1438,47 +1438,51 @@ private void CheatBatchReadMemory(int processID, Dictionary<uint, (Section Secti
1438
1438
int count = 0 ;
1439
1439
int firstDisplayedScrollingRowIndex = CheatGridView . FirstDisplayedScrollingRowIndex ;
1440
1440
bool isRefreshFinish = false ;
1441
- foreach ( ( Section Section_ , uint MinOffset , uint MaxOffset , List < ( uint OffsetAddr , int Length , int CIDX , ScanType ScanType , bool IsSign ) > CheatList ) cheat in cheatsDict . Values )
1441
+ try
1442
1442
{
1443
- refreshCheatSource . Token . ThrowIfCancellationRequested ( ) ;
1444
- byte [ ] newDatas = PS4Tool . ReadMemory ( processID , cheat . Section_ . Start + cheat . MinOffset , ( int ) cheat . MaxOffset - ( int ) cheat . MinOffset ) ;
1445
- for ( int idx = 0 ; idx < cheat . CheatList . Count ; idx ++ )
1443
+ foreach ( ( Section Section_ , uint MinOffset , uint MaxOffset , List < ( uint OffsetAddr , int Length , int CIDX , ScanType ScanType , bool IsSign ) > CheatList ) cheat in cheatsDict . Values )
1446
1444
{
1447
- count ++ ;
1448
1445
refreshCheatSource . Token . ThrowIfCancellationRequested ( ) ;
1449
- ( uint OffsetAddr , int Length , int CIDX , ScanType ScanType , bool IsSign ) = cheat . CheatList [ idx ] ;
1450
- Byte [ ] newData = new byte [ Length ] ;
1451
- Buffer . BlockCopy ( newDatas , ( int ) OffsetAddr - ( int ) cheat . MinOffset , newData , 0 , Length ) ;
1452
- Invoke ( new MethodInvoker ( ( ) =>
1446
+ byte [ ] newDatas = PS4Tool . ReadMemory ( processID , cheat . Section_ . Start + cheat . MinOffset , ( int ) cheat . MaxOffset - ( int ) cheat . MinOffset ) ;
1447
+ for ( int idx = 0 ; idx < cheat . CheatList . Count ; idx ++ )
1453
1448
{
1454
- cheatGridRowList [ CIDX ] . Cells [ ( int ) ChertCol . CheatListValue ] = ScanTool . BytesToString ( ScanType , newData , false , IsSign ) ;
1455
- if ( idx % 1000 == 0 && ( CheatAutoRefreshShowStatus || isShowStatus ) )
1449
+ count ++ ;
1450
+ refreshCheatSource . Token . ThrowIfCancellationRequested ( ) ;
1451
+ ( uint OffsetAddr , int Length , int CIDX , ScanType ScanType , bool IsSign ) = cheat . CheatList [ idx ] ;
1452
+ Byte [ ] newData = new byte [ Length ] ;
1453
+ Buffer . BlockCopy ( newDatas , ( int ) OffsetAddr - ( int ) cheat . MinOffset , newData , 0 , Length ) ;
1454
+ Invoke ( new MethodInvoker ( ( ) =>
1456
1455
{
1457
- if ( idx % 50000 == 0 )
1456
+ cheatGridRowList [ CIDX ] . Cells [ ( int ) ChertCol . CheatListValue ] = ScanTool . BytesToString ( ScanType , newData , false , IsSign ) ;
1457
+ if ( idx % 1000 == 0 && ( CheatAutoRefreshShowStatus || isShowStatus ) )
1458
1458
{
1459
- if ( firstDisplayedScrollingRowIndex != CheatGridView . FirstDisplayedScrollingRowIndex ) isRefreshFinish = false ;
1460
- if ( ! isRefreshFinish && CIDX > CheatGridView . FirstDisplayedScrollingRowIndex )
1459
+ if ( idx % 50000 == 0 )
1461
1460
{
1462
- CheatGridView . Refresh ( ) ;
1463
- isRefreshFinish = true ;
1461
+ if ( firstDisplayedScrollingRowIndex != CheatGridView . FirstDisplayedScrollingRowIndex ) isRefreshFinish = false ;
1462
+ if ( ! isRefreshFinish && CIDX > CheatGridView . FirstDisplayedScrollingRowIndex )
1463
+ {
1464
+ CheatGridView . Refresh ( ) ;
1465
+ isRefreshFinish = true ;
1466
+ }
1467
+ firstDisplayedScrollingRowIndex = CheatGridView . FirstDisplayedScrollingRowIndex ;
1464
1468
}
1465
- firstDisplayedScrollingRowIndex = CheatGridView . FirstDisplayedScrollingRowIndex ;
1469
+ ToolStripMsg . Text = string . Format ( "{0:000}%, Refresh Cheat elapsed:{1:0.00}s. {2}/{3}" ,
1470
+ ( int ) ( ( ( float ) count / cheatGridRowList . Count ) * 100 ) , tickerMajor . Elapsed . TotalSeconds , count , cheatGridRowList . Count ) ;
1466
1471
}
1472
+ } ) ) ;
1473
+ }
1474
+ Invoke ( new MethodInvoker ( ( ) =>
1475
+ {
1476
+ if ( CheatAutoRefreshShowStatus || isShowStatus )
1477
+ {
1478
+ CheatGridView . Refresh ( ) ;
1467
1479
ToolStripMsg . Text = string . Format ( "{0:000}%, Refresh Cheat elapsed:{1:0.00}s. {2}/{3}" ,
1468
1480
( int ) ( ( ( float ) count / cheatGridRowList . Count ) * 100 ) , tickerMajor . Elapsed . TotalSeconds , count , cheatGridRowList . Count ) ;
1469
1481
}
1470
1482
} ) ) ;
1471
1483
}
1472
- Invoke ( new MethodInvoker ( ( ) =>
1473
- {
1474
- if ( CheatAutoRefreshShowStatus || isShowStatus )
1475
- {
1476
- CheatGridView . Refresh ( ) ;
1477
- ToolStripMsg . Text = string . Format ( "{0:000}%, Refresh Cheat elapsed:{1:0.00}s. {2}/{3}" ,
1478
- ( int ) ( ( ( float ) count / cheatGridRowList . Count ) * 100 ) , tickerMajor . Elapsed . TotalSeconds , count , cheatGridRowList . Count ) ;
1479
- }
1480
- } ) ) ;
1481
1484
}
1485
+ catch ( Exception ex ) { InputBox . MsgBox ( "CheatBatchReadMemory" , ex . Message , "Cheat Batch Read Memory error occurred" ) ; }
1482
1486
}
1483
1487
1484
1488
/// <summary>
0 commit comments