From b0807cde313417c36e0568eb465f9938e406b841 Mon Sep 17 00:00:00 2001 From: ZXCLI Date: Thu, 8 Oct 2026 01:29:57 +0800 Subject: [PATCH] =?UTF-8?q?tools+csdk:=20=E6=81=A2=E5=A4=8D=E8=84=B1?= =?UTF-8?q?=E6=95=8F=E5=90=8E=E8=84=9A=E6=9C=AC=E7=9A=84=E5=8F=AF=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=80=A7=E2=80=94=E2=80=94resume=5Fandroid.ps1=20?= =?UTF-8?q?=E7=9A=84=20adb=20=E6=94=B9=E4=B8=BA=E6=8E=A2=E6=B5=8B=E5=B7=B2?= =?UTF-8?q?=E7=9F=A5=E5=AE=89=E8=A3=85=E4=BD=8D=E7=BD=AE=E3=80=81resume=5F?= =?UTF-8?q?rev.ps1=20=E5=AF=B9=E4=B8=B4=E6=97=B6=E5=88=86=E6=9E=90?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=8A=A0=E5=AD=98=E5=9C=A8=E6=80=A7=E5=AE=88?= =?UTF-8?q?=E5=8D=AB=E3=80=81legacy=20demo=20=E4=B8=A4=E4=B8=AA=20C=20?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=97=A5=E5=BF=97/=E5=BF=AB?= =?UTF-8?q?=E7=85=A7=E8=B7=AF=E5=BE=84=E6=94=B9=E7=94=A8=20getenv("TEMP")?= =?UTF-8?q?=20=E8=BF=90=E8=A1=8C=E6=97=B6=E8=A7=A3=E6=9E=90=EF=BC=88?= =?UTF-8?q?=E5=8E=9F=E7=A1=AC=E7=BC=96=E7=A0=81=E6=9C=AC=E6=9C=BA=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=9C=AC=E5=B0=B1=E4=B8=8D=E5=8F=AF=E7=A7=BB=E6=A4=8D?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- csdk/tools/legacy/mag160c_demo.c | 14 ++++++++++++-- csdk/tools/legacy/mag160c_demo_usb0.c | 8 +++++++- tools/resume_android.ps1 | 10 +++++++++- tools/resume_rev.ps1 | 8 +++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/csdk/tools/legacy/mag160c_demo.c b/csdk/tools/legacy/mag160c_demo.c index a8a60d5..2716093 100644 --- a/csdk/tools/legacy/mag160c_demo.c +++ b/csdk/tools/legacy/mag160c_demo.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -340,7 +341,16 @@ static int init_camera(void) { int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) { (void)hprev; (void)cmd; (void)show; - g_log = fopen("%TEMP%/opencode/demo_log.txt", "w"); + /* Log/snapshot under %TEMP%, resolved at runtime (the original archived + version hard-coded a per-machine absolute path that breaks elsewhere). */ + static char logpath[MAX_PATH], bmppath[MAX_PATH]; + const char *tmp = getenv("TEMP"); + if (!tmp || !*tmp) tmp = "."; + snprintf(logpath, sizeof(logpath) - 1, "%s\\mag160c_demo_log.txt", tmp); + logpath[sizeof(logpath) - 1] = 0; + snprintf(bmppath, sizeof(bmppath) - 1, "%s\\mag160c_render_test.bmp", tmp); + bmppath[sizeof(bmppath) - 1] = 0; + g_log = fopen(logpath, "w"); if (g_log) { fprintf(g_log, "demo start\n"); fflush(g_log); } libusb_init(&g_usb); @@ -468,7 +478,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) { } render(g_frame); if ((g_frame_count % 200) == 0) { - FILE *tf = fopen("%TEMP%/opencode/render_test.bmp", "wb"); + FILE *tf = fopen(bmppath, "wb"); if (tf) { fwrite(g_bmp, 1, sizeof(g_bmp), tf); fclose(tf); } } DWORD now = GetTickCount(); diff --git a/csdk/tools/legacy/mag160c_demo_usb0.c b/csdk/tools/legacy/mag160c_demo_usb0.c index b5172af..2c5565f 100644 --- a/csdk/tools/legacy/mag160c_demo_usb0.c +++ b/csdk/tools/legacy/mag160c_demo_usb0.c @@ -10,6 +10,7 @@ #include #include #include +#include /* ---- libusb-win32 (libusb0) API ---------------------------------------- */ typedef struct usb_bus { @@ -319,7 +320,12 @@ static int init_camera(void) { int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) { (void)hprev; (void)cmd; (void)show; - g_log = fopen("%TEMP%/opencode/demo_usb0_log.txt", "w"); + static char logpath[MAX_PATH]; + const char *tmp = getenv("TEMP"); + if (!tmp || !*tmp) tmp = "."; + snprintf(logpath, sizeof(logpath) - 1, "%s\\mag160c_demo_usb0_log.txt", tmp); + logpath[sizeof(logpath) - 1] = 0; + g_log = fopen(logpath, "w"); if (g_log) { fprintf(g_log, "demo start\n"); fflush(g_log); } HMODULE l0 = LoadLibraryA("libusb0.dll"); diff --git a/tools/resume_android.ps1 b/tools/resume_android.ps1 index bfbc31d..73b836c 100644 --- a/tools/resume_android.ps1 +++ b/tools/resume_android.ps1 @@ -9,7 +9,15 @@ Write-Host "Gradle: 工程wrapper android\gradlew.bat (JDK 21: C:\Tools\jdk-21)" Write-Host "SDK: $(Test-Path "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe")" Write-Host "=== 2. 设备 ===" -adb devices +# adb: PATH first, then the known SDK install locations +$adb = Get-Command adb -ErrorAction SilentlyContinue +if (-not $adb) { + foreach ($cand in @("C:\Tools\android-sdk\platform-tools\adb.exe", + "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe")) { + if (Test-Path $cand) { $adb = $cand; break } + } +} +if ($adb) { & $adb devices } else { Write-Host "!!! adb 未找到(确认 Android SDK platform-tools 已安装)" } Write-Host "=== 3. 构建 ===" Push-Location $andr diff --git a/tools/resume_rev.ps1 b/tools/resume_rev.ps1 index 13a9c22..d31e602 100644 --- a/tools/resume_rev.ps1 +++ b/tools/resume_rev.ps1 @@ -56,6 +56,12 @@ if (-not (Test-Path "$pairsDir\pair_000.raw")) { } else { Write-Host "官方数据已存在, 跳过" } Write-Host "=== 8. 对比 ===" -python "%TEMP%\compare_live.py" +# compare_live.py was an ad-hoc analysis helper of the original session and is +# not shipped with the repo (临时分析脚本不入库); the step is skipped gracefully. +if (Test-Path "$env:TEMP\compare_live.py") { + python "$env:TEMP\compare_live.py" +} else { + Write-Host "跳过: %TEMP%\compare_live.py 不存在(一次性分析脚本,重新生成后再跑)" +} Write-Host "=== 完成。下一步见 analysis\session_state.md ==="