423
423
const char DELIM = '\t';
424
424
AddressWatcher Temp;
425
Temp.Address = 0; // default values
426
429
fgets(Str_Tmp,1024,WatchFile);
427
430
sscanf(Str_Tmp,"%c%*s",&mode);
428
//if ((mode == '1' && !(SegaCD_Started)) || (mode == '2' && !(_32X_Started)))
431
// strcpy(Device,(mode > '1')?"32X":"SegaCD");
432
// sprintf(Str_Tmp,"Warning: %s not started. \nWatches for %s addresses will be ignored.",Device,Device);
433
// MessageBox(MESSAGEBOXPARENT,Str_Tmp,"Possible Device Mismatch",MB_OK);
436
432
fgets(Str_Tmp,1024,WatchFile);
437
433
sscanf(Str_Tmp,"%d%*s",&WatchAdd);
438
434
WatchAdd+=WatchCount;
439
435
for (int i = WatchCount; i < WatchAdd; i++)
444
fgets(Str_Tmp,1024,WatchFile);
438
memset(Str_Tmp, 0, 1024);
441
fgets(Str_Tmp, 1024, WatchFile);
445
442
} while (Str_Tmp[0] == '\n');
446
sscanf(Str_Tmp,"%*05X%*c%04X%*c%c%*c%c%*c%d",&(Temp.Address),&(Temp.Size),&(Temp.Type),&(Temp.WrongEndian));
447
Temp.WrongEndian = 0;
448
char *Comment = strrchr(Str_Tmp,DELIM) + 1;
449
*strrchr(Comment,'\n') = '\0';
450
InsertWatch(Temp,Comment);
443
sscanf(Str_Tmp, "%*05X%*c%04X%*c%c%*c%c%*c%*c", &(Temp.Address), &(Temp.Size), &(Temp.Type));
444
Temp.WrongEndian = false;
445
char *Comment = strrchr(Str_Tmp, DELIM);
449
char *CommentEnd = strrchr(Comment, '\n');
453
InsertWatch(Temp, Comment);
456
// the wch file is probably corrupted
457
InsertWatch(Temp, Comment);
461
break; // the wch file is probably corrupted
453
464
fclose(WatchFile);
531
542
if(dot) *dot = 0;
532
543
if(Change_File_S(Str_Tmp, applicationPath, "Save Watches", "Watchlist (*.wch)\0*.wch\0All Files (*.*)\0*.*\0\0", "wch", RamWatchHWnd))
534
FILE *WatchFile = fopen(Str_Tmp,"r+b");
535
if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b");
545
FILE *WatchFile = fopen(Str_Tmp,"w+b");
536
546
fputc('\n',WatchFile);
537
547
strcpy(currentWatch,Str_Tmp);
538
548
RWAddRecentFile(currentWatch);
564
574
strcpy(Str_Tmp,currentWatch);
565
FILE *WatchFile = fopen(Str_Tmp,"r+b");
566
if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b");
575
FILE *WatchFile = fopen(Str_Tmp,"w+b");
567
576
fputc('\n',WatchFile);
568
577
sprintf(Str_Tmp,"%d\n",WatchCount);
569
578
fputs(Str_Tmp,WatchFile);
665
for (;WatchCount>=0;WatchCount--)
674
for (;WatchCount >= 0; WatchCount--)
667
676
free(rswatches[WatchCount].comment);
668
677
rswatches[WatchCount].comment = NULL;
672
682
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
673
683
RefreshWatchListSelectedCountControlStatus(RamWatchHWnd);