@echo off
setlocal
set EMUDIR=%~dp0
if "%EMUDIR:~-1%"=="\" set EMUDIR=%EMUDIR:~0,-1%
set WORKSPACE=%~1
if "%WORKSPACE%"=="" set WORKSPACE=D:\vscode-workspace\xbox-dvd-tools-v2
set FW=%WORKSPACE%\firmware\GDR-8050L\8050L_fw_plaintext_256k.bin
set OUT=gdr8050l_partition_watch_v102_clearstops_trace.csv

echo [RUN] GDR-8050L partition/auth watch, clear preset stops
echo [RUN] workspace=%WORKSPACE%
echo [RUN] fw=%FW%
echo [RUN] out=%OUT%

python "%EMUDIR%\run_direct_firmware.py" ^
  --workspace "%WORKSPACE%" ^
  --model GDR-8050L ^
  --bin "%FW%" ^
  --base 0x90000000 ^
  --entry 0x90000020 ^
  --max-cycles 300000 ^
  --preset gdr8050l-packet-full-cdb ^
  --clear-preset-stops ^
  --packet-cdb mode-select-auth-xbox ^
  --packet-data-out 00 1A 00 00 00 00 00 00 3E 12 01 01 01 D1 01 DC A2 E7 C8 ED 00 00 00 00 00 00 00 00 ^
  --auth-watch ^
  --watchpoint 0x000005CD:1@access ^
  --watchpoint 0x0000071E:1@access ^
  --watchpoint 0x00000722:1@access ^
  --watchpoint 0x00000724:1@access ^
  --watchpoint 0x0000076D:2@access ^
  --watchpoint 0x0000077C:4@access ^
  --watchpoint 0x000007F8:2@access ^
  --watchpoint 0x0000D95C:1@access ^
  --breakpoint 0x9001B9D5 ^
  --breakpoint 0x9001BA03 ^
  --breakpoint 0x9001BA0C ^
  --breakpoint 0x9001BC28 ^
  --breakpoint 0x9001BC38 ^
  --breakpoint 0x9001BC3B ^
  --breakpoint 0x9001BC3E ^
  --breakpoint 0x9001CFB1 ^
  --breakpoint 0x9001CFCA ^
  --breakpoint 0x9001D05B ^
  --breakpoint 0x9001D086 ^
  --breakpoint 0x9001EF37 ^
  --breakpoint 0x9001EF54 ^
  --breakpoint 0x9001EF66 ^
  --breakpoint 0x9001EE44 ^
  --breakpoint 0x9001EE4A ^
  --breakpoint 0x9001B71B ^
  --breakpoint 0x9001B75F ^
  --breakpoint 0x9001B764 ^
  --breakpoint 0x90021696 ^
  --trace-csv "%OUT%" ^
  --trace-summary

endlocal
