tools+csdk: 恢复脱敏后脚本的可运行性——resume_android.ps1 的 adb 改为探测已知安装位置、resume_rev.ps1 对临时分析脚本加存在性守卫、legacy demo 两个 C 程序的日志/快照路径改用 getenv("TEMP") 运行时解析(原硬编码本机路径本就不可移植)

This commit is contained in:
ZXCLI
2026-10-08 01:29:57 +08:00
parent ce885926fe
commit b0807cde31
4 changed files with 35 additions and 5 deletions
+12 -2
View File
@@ -16,6 +16,7 @@
#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <libusb.h>
@@ -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();
+7 -1
View File
@@ -10,6 +10,7 @@
#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
/* ---- 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");