Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
feat(color): T3 colour page UI (accordion, sliders+numeric boxes, one-click reset/undo, fold persistence)
Veyra Goal Agent5c489db7ca08
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cppindex d8f8cb0a..8c427b7c 100644--- a/apps/veyra/SettingsWindow.cpp+++ b/apps/veyra/SettingsWindow.cpp@@ -1,6 +1,7 @@#include "SettingsWindow.h"#include "ui/Theme.h"#include "ui/SettingHelp.h"+#include "ui/UiPreferenceStore.h"#include "veyra/engine/PresetStore.h"#include "veyra/RuntimePaths.h"#include "veyra/gfx/XessMfgUnlock.h"@@ -9,6 +10,7 @@#include <sstream>#include <iomanip>#include <array>+#include <cmath>namespace veyra::ui {namespace {HWND window=nullptr,body=nullptr;engine::EngineController* controller=nullptr;HFONT font=nullptr;@@ -29,7 +31,7 @@ constexpr auto smoothMotionHelp=L"只用 Smooth Motion\n"L"• 面板 FPS、耗时、队列不包含驱动生成部分,不能据此判断驱动是否生效,也不要直接把 FPS 乘二。\n"L"• 驱动额外延迟未测量,音画同步需实测。截图、导出不含驱动生成的帧;直播录制是否捕获到它们也需另测。\n"L"• 功能可用性以 NVIDIA App、显卡和驱动支持为准。";-struct Item{HWND h;int page,x,y,w,height;};std::vector<Item> items;+struct Item{HWND h;int page,x,y,w,height;bool hidden=false;};std::vector<Item> items;HWND item(int id){for(auto& entry:items)if(GetDlgCtrlID(entry.h)==id)return entry.h;return nullptr;}LRESULT send(int id,UINT message,WPARAM w=0,LPARAM l=0){return SendMessageW(item(id),message,w,l);}void putText(int id,const wchar_t* value){setText(item(id),value);}@@ -50,6 +52,106 @@ LRESULT CALLBACK bodyProc(HWND h,UINT msg,WPARAM wp,LPARAM lp){const wchar_t* labels[]={L"模型强度",L"局部明暗",L"局部结构",L"肤质 · 未证实",L"风格 · 实验",L"自动遮罩 · 实验",L"UI修正 · 未证实",L"总变化强度",L"暗化变化",L"亮化变化",L"色彩变化",L"明度变化"};void loadStore(){if(!loaded){store.load();loaded=true;}}+// ---------------------------------------------------------------------------+// Colour page (plan v4). Sections collapse like an accordion; the rows are laid+// out sequentially in layoutColorPage() so a collapsed section simply skips its+// rows instead of relying on static y offsets. The fold mask is persisted in+// ui-preferences.v1 with the rest of the UI state.+// ---------------------------------------------------------------------------+constexpr int kColorSections=2; // 亮 / 颜色 (T4 adds 曲线/混色器/颜色分级/校准)+void message(const std::wstring& text);+bool submit(engine::EnhancementSettings s);+uint32_t colorFoldMask=0;+std::wstring colorSectionName(int section){return section==0?L"亮":L"颜色";}+struct ColorParam{+ int section;+ const wchar_t* label;+ float engine::ColorSettings::*field;+ float min,max;+};+std::vector<ColorParam> colorParams;+// id layout: master 800, reset 801, undo 802, header 810+s, label 830+i,+// edit 850+i, slider 870+i.+constexpr int colorLabelId(int i){return 830+i;}+constexpr int colorEditId(int i){return 850+i;}+constexpr int colorSliderId(int i){return 870+i;}+engine::ColorSettings colourTarget(){+ return (enhancementEnabled?controller->snapshot().desired:configuredSettings).color;+}+engine::ColorSettings colourUndo;+bool colourUndoValid=false;+int colorPageContentHeight=0;+bool syncingColour=false;+std::wstring windowText(HWND h){wchar_t buffer[256]{};GetWindowTextW(h,buffer,256);return buffer;}+void loadColourFoldState(){+ const auto preferences=veyra::ui::UiPreferenceStore(runtime::localDataDirectory()).load();+ colorFoldMask=preferences.colourFoldMask;+}+void saveColourFoldState(){+ veyra::ui::UiPreferenceStore store_(runtime::localDataDirectory());+ auto preferences=store_.load();+ preferences.colourFoldMask=colorFoldMask;+ if(!store_.save(preferences,nullptr))veyra::log::warn("color-ui","fold state not saved");+}+void layoutColorPage(){+ auto place=[&](int id,int y,int height,bool hidden){+ for(auto& entry:items)if(GetDlgCtrlID(entry.h)==id){entry.y=y;entry.height=height;entry.hidden=hidden;return;}+ };+ int y=12;+ place(800,y,36,false);y+=42;+ place(801,y,32,false);place(802,y,32,false);y+=40;+ for(int section=0;section<kColorSections;++section){+ const bool collapsed=(colorFoldMask>>section)&1u;+ place(810+section,y,32,false);+ const auto title=std::format(L"{} {}",collapsed?L"▸":L"▾",colorSectionName(section));+ putText(810+section,title.c_str());+ y+=38;+ for(size_t i=0;i<colorParams.size();++i){+ const auto& param=colorParams[i];+ if(param.section!=section)continue;+ place(colorLabelId(int(i)),y,24,collapsed);+ place(colorEditId(int(i)),y-2,26,collapsed);+ place(colorSliderId(int(i)),y+24,16,collapsed);+ if(!collapsed)y+=46;+ }+ y+=8;+ }+ colorPageContentHeight=y+12;+}+void syncColorControls(){+ syncingColour=true;+ const auto colour=colourTarget();+ check(800,colour.enabled?BST_CHECKED:BST_UNCHECKED);+ for(size_t i=0;i<colorParams.size();++i){+ const float value=colour.*(colorParams[i].field);+ const auto text=std::format(L"{:.2f}",value);+ if(auto edit=item(colorEditId(int(i))))if(windowText(edit)!=text)putText(colorEditId(int(i)),text.c_str());+ if(auto slider=item(colorSliderId(int(i)))){+ const int scaled=int(std::lround(value*100.0f));+ if(SendMessageW(slider,TBM_GETPOS,0,0)!=scaled)SendMessageW(slider,TBM_SETPOS,TRUE,LPARAM(scaled));+ }+ }+ syncingColour=false;+}+bool applyColour(const engine::ColorSettings& colour,bool autoEnable){+ auto settings=enhancementEnabled?controller->snapshot().desired:configuredSettings;+ const auto previous=settings.color;+ settings.color=colour;+ if(autoEnable)settings.color.enabled=true;+ if(!(settings.color==previous)&&!submit(settings))return false;+ return true;+}+bool colourFieldEdited(int index,float value){+ if(index<0||size_t(index)>=colorParams.size())return false;+ auto colour=colourTarget();+ if(!std::isfinite(value)||value<colorParams[size_t(index)].min||value>colorParams[size_t(index)].max){+ message(L"数值超出范围;仍使用上次有效值");syncColorControls();return false;+ }+ colour.*(colorParams[size_t(index)].field)=value;+ if(!applyColour(colour,true)){syncColorControls();return false;}+ syncColorControls();+ return true;+}void message(const std::wstring& text){putText(401,text.c_str());}bool submit(engine::EnhancementSettings s){if(!apply(s)){dirty=true;message(L"总增强正在切换;本次修改未接受,请稍后重试。");return false;}dirty=false;return true;}void syncProtection(const engine::ProtectionSettings& protection){@@ -120,6 +222,7 @@ void populate(engine::EnhancementSettings s){EnableWindow(item(204),s.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia);EnableWindow(item(215),s.opticalFlowBackend==engine::OpticalFlowBackend::AmdFidelityFx);displayedRevision=s.revision;displayedSettings=s;populating=false;dirty=false;+ syncColorControls();}bool read(engine::EnhancementSettings& s,bool allPages=false){s=enhancementEnabled?controller->snapshot().desired:configuredSettings;float v[12]{};for(int i=0;i<12;++i){if(i>=4&&i<=6){v[i]=float(i==4?s.model.style:i==5?s.model.autoMask:s.model.uiCorrection);continue;}wchar_t b[64]{};GetWindowTextW(item(100+i),b,64);wchar_t* end=nullptr;v[i]=wcstof(b,&end);if(end==b||*end||!std::isfinite(v[i])){message(L"请输入完整的有限数值;未提交设置");return false;}}for(int i=4;i<7;++i)if(v[i]!=std::floor(v[i])||v[i]<0||v[i]>(i==4?2:1)){message(L"风格/遮罩/UI修正必须为整数");return false;}@@ -192,15 +295,17 @@ LRESULT CALLBACK scrollOnly(HWND h,UINT msg,WPARAM wp,LPARAM lp,UINT_PTR id,DWORvoid arrange(){if(!window||!body)return;RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,veyra::ui::layoutDpi(window)),height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(window));const int sticky=128,viewport=std::max(1,height-sticky);contentHeight=0;+ if(page==2)layoutColorPage();int helpHeight=0;if(smoothMotionHelpExpanded){auto dc=GetDC(window);auto old=SelectObject(dc,font);RECT textRect{0,0,dip(window,std::max(1,width-24)),0};DrawTextW(dc,smoothMotionHelp,-1,&textRect,DT_CALCRECT|DT_WORDBREAK|DT_NOPREFIX);SelectObject(dc,old);ReleaseDC(window,dc);helpHeight=MulDiv(textRect.bottom,96,layoutDpi(window))+16;}const auto helpOffset=[&](const Item& entry){const auto id=GetDlgCtrlID(entry.h);return entry.page==1&&(id==1114||id==205||id==1110)?helpHeight:0;};for(auto& entry:items){if(GetDlgCtrlID(entry.h)==1120)entry.height=helpHeight;- if(entry.page==page&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded)){wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);contentHeight=std::max(contentHeight,entry.y+helpOffset(entry)+(_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height)+12);}}+ if(entry.page==page&&!entry.hidden&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded)){wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);contentHeight=std::max(contentHeight,entry.y+helpOffset(entry)+(_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height)+12);}}+ if(page==2)contentHeight=std::max(contentHeight,colorPageContentHeight);scroll=std::clamp(scroll,0,std::max(0,contentHeight-viewport));SetWindowPos(body,nullptr,0,dip(window,sticky),r.right,dip(window,viewport),SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);auto batch=BeginDeferWindowPos(int(items.size()));- for(auto& entry:items){bool fixed=entry.page==-1,visible=(entry.page==page||fixed)&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded);int w=entry.w<0?width-entry.x-12:entry.w;int y=fixed?(GetDlgCtrlID(entry.h)==400?0:(GetDlgCtrlID(entry.h)==211||GetDlgCtrlID(entry.h)==219)?86:42):entry.y+helpOffset(entry)-scroll;+ for(auto& entry:items){bool fixed=entry.page==-1,visible=!entry.hidden&&(entry.page==page||fixed)&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded);int w=entry.w<0?width-entry.x-12:entry.w;int y=fixed?(GetDlgCtrlID(entry.h)==400?0:(GetDlgCtrlID(entry.h)==211||GetDlgCtrlID(entry.h)==219)?86:42):entry.y+helpOffset(entry)-scroll;if(fixed){SetWindowPos(entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,42),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW);continue;}batch=DeferWindowPos(batch,entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,entry.height),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOCOPYBITS|(visible?SWP_SHOWWINDOW:SWP_HIDEWINDOW));}EndDeferWindowPos(batch);RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);InvalidateRect(window,nullptr,FALSE);}@@ -216,6 +321,41 @@ LRESULT CALLBACK proc(HWND h,UINT msg,WPARAM wp,LPARAM lp){if(msg==WM_COMMAND&&!populating&&((LOWORD(wp)==216&&HIWORD(wp)==CBN_SELCHANGE)||(LOWORD(wp)==217&&HIWORD(wp)==EN_CHANGE))){liveField(LOWORD(wp));return 0;}if(msg==WM_COMMAND&&!populating&&LOWORD(wp)==222&&HIWORD(wp)==EN_CHANGE){liveField(222);return 0;}if(msg==WM_COMMAND&&!populating&&LOWORD(wp)==222&&HIWORD(wp)==EN_KILLFOCUS){populate(enhancementEnabled?controller->snapshot().desired:configuredSettings);return 0;}+ // --- colour page (plan v4) ---------------------------------------------+ if(msg==WM_COMMAND&&LOWORD(wp)==800&&HIWORD(wp)==BN_CLICKED){+ auto settings=enhancementEnabled?controller->snapshot().desired:configuredSettings;+ settings.color.enabled=SendMessageW(item(800),BM_GETCHECK,0,0)==BST_CHECKED;+ if(!submit(settings)){syncColorControls();return 0;}+ message(settings.color.enabled?L"调色已开启:链路在所有效果器之前,会有一点额外开销。":L"调色已关闭:这条链完全不存在,零开销。");+ return 0;+ }+ if(msg==WM_COMMAND&&(LOWORD(wp)==801||LOWORD(wp)==802)&&HIWORD(wp)==BN_CLICKED){+ if(LOWORD(wp)==801){+ colourUndo=colourTarget();colourUndoValid=true;+ auto neutral=engine::ColorSettings{};neutral.enabled=true;+ if(applyColour(neutral,false))message(L"已还原为中性;可以点“撤销还原”找回上一组数值。");+ }else if(colourUndoValid){+ if(applyColour(colourUndo,false))message(L"已恢复还原前的数值。");+ }else message(L"没有可撤销的还原。");+ syncColorControls();arrange();return 0;+ }+ if(msg==WM_COMMAND&&LOWORD(wp)>=810&&LOWORD(wp)<810+kColorSections&&HIWORD(wp)==BN_CLICKED){+ const int section=LOWORD(wp)-810;+ colorFoldMask^=1u<<section;+ saveColourFoldState();+ arrange();+ return 0;+ }+ if(msg==WM_COMMAND&&!populating&&!syncingColour&&LOWORD(wp)>=colorEditId(0)&&LOWORD(wp)<colorEditId(0)+20&&HIWORD(wp)==EN_CHANGE){+ const int index=LOWORD(wp)-colorEditId(0);+ if(index<int(colorParams.size())){+ wchar_t buffer[64]{};GetWindowTextW(item(LOWORD(wp)),buffer,64);+ wchar_t* end=nullptr;const float value=wcstof(buffer,&end);+ if(end==buffer||*end||!std::isfinite(value))message(L"数值未完整;仍使用上次有效值");+ else colourFieldEdited(index,value);+ }+ return 0;+ }if(msg==WM_COMMAND&&!populating&&((LOWORD(wp)==209&&HIWORD(wp)==CBN_SELCHANGE)||(LOWORD(wp)==215&&HIWORD(wp)==BN_CLICKED))){liveField(LOWORD(wp));return 0;}switch(msg){case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.clear();smoothMotionHelpExpanded=false;@@ -256,6 +396,34 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.// Page 2 is the colour page. The old preset page (ids 300/301/310-315,// statics 1105/1106) was deleted on purpose on 2026-09-17: named colour// presets replace it and carry only look parameters, never NR/SR/FG.+ loadColourFoldState();+ add(L"BUTTON",L"调色总开关(关闭时这条链路不存在,零开销)",800,BS_AUTOCHECKBOX|WS_TABSTOP,2,12,12,-1,36);+ button(L"一键还原(回到中性)",801,2,12,56,200);button(L"撤销还原",802,2,216,56,120);+ {+ struct Definition{int section;const wchar_t* label;float engine::ColorSettings::*field;float min,max;};+ const Definition definitions[]={+ {0,L"曝光(EV)",&engine::ColorSettings::exposure,-5,5},+ {0,L"对比度",&engine::ColorSettings::contrast,-100,100},+ {0,L"高光",&engine::ColorSettings::highlights,-100,100},+ {0,L"阴影",&engine::ColorSettings::shadows,-100,100},+ {0,L"白色",&engine::ColorSettings::whites,-100,100},+ {0,L"黑色",&engine::ColorSettings::blacks,-100,100},+ {1,L"色温(相对)",&engine::ColorSettings::temperature,-100,100},+ {1,L"色调",&engine::ColorSettings::tint,-100,100},+ {1,L"自然饱和度",&engine::ColorSettings::vibrance,-100,100},+ {1,L"饱和度",&engine::ColorSettings::saturation,-100,100},+ };+ for(const auto& definition:definitions)colorParams.push_back({definition.section,definition.label,definition.field,definition.min,definition.max});+ for(int section=0;section<kColorSections;++section)add(L"BUTTON",L"",810+section,BS_PUSHBUTTON|WS_TABSTOP,2,12,12,-1,32);+ for(size_t i=0;i<colorParams.size();++i){+ const auto& param=colorParams[i];+ add(L"STATIC",param.label,colorLabelId(int(i)),0,2,12,0,180,24);+ add(L"EDIT",L"0",colorEditId(int(i)),ES_AUTOHSCROLL|ES_RIGHT|WS_TABSTOP,2,202,0,-1,26);+ auto slider=add(TRACKBAR_CLASSW,L"",colorSliderId(int(i)),TBS_HORZ|TBS_NOTICKS|WS_TABSTOP,2,12,0,-1,16);+ SendMessageW(slider,TBM_SETRANGE,TRUE,MAKELPARAM(int(std::lround(param.min*100.0f)),int(std::lround(param.max*100.0f))));+ SetPropW(item(colorEditId(int(i))),L"veyra.tip",HANDLE(L"可以直接输入数字,回车生效;拖动滑块即时生效。"));+ }+ }add(L"STATIC",L"原生画质导出",1107,0,3,12,12,-1,32);combo(500,3,60,{L"H.264 · MP4",L"HEVC · MP4"});send(500,CB_SETCURSEL,0,0);add(L"STATIC",L"冻结启动时整套参数;NR按原生尺寸处理。保留兼容音轨。VFR不改写为CFR;字幕不烧录。",1108,0,3,12,108,-1,94);button(L"选择位置并导出视频",501,3,12,212);marked(item(501));button(L"保存当前图片 / 视频帧",502,3,12,256);@@ -341,10 +509,14 @@ case WM_COMMAND:{const int id=LOWORD(wp);if(!populating&&((id>=202&&id<=205||id=else if(id>=501&&id<=505)SendMessageW(GetParent(h),WM_APP+41,id,id==501?send(500,CB_GETCURSEL,0,0):id==505?checked(505):0);return 0;}case WM_HSCROLL:{int id=GetDlgCtrlID(reinterpret_cast<HWND>(lp));if(id>=600&&id<612){int index=id-600;float v=float(SendMessageW(reinterpret_cast<HWND>(lp),TBM_GETPOS,0,0))/(index>=4&&index<=6?1:100);if(index==3&&v<0)v=-1;std::wostringstream o;o<<std::setprecision(4)<<v;putText(100+index,o.str().c_str());}+ else if(id>=colorSliderId(0)&&id<colorSliderId(0)+40){+ const int index=id-colorSliderId(0);+ if(index<int(colorParams.size()))colourFieldEdited(index,float(SendMessageW(reinterpret_cast<HWND>(lp),TBM_GETPOS,0,0))/100.0f);+ }else if(id==622){// Feather slider: the edit box owns the value, its EN_CHANGE applies it.const int value=std::clamp(int(SendMessageW(reinterpret_cast<HWND>(lp),TBM_GETPOS,0,0)),0,64);putText(222,std::to_wstring(value).c_str());}return 0;}-case WM_TIMER:{auto s=controller->snapshot();syncProtection(enhancementEnabled?s.desired.protection:configuredSettings.protection);if(enhancementEnabled&&!dirty&&displayedSettings!=s.desired)populate(s.desired);check(200,enhancementEnabled&&s.desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enhancementEnabled&&s.desired.sr?BST_CHECKED:BST_UNCHECKED);std::wostringstream o;if(!s.running&&!s.frames&&s.transport!=engine::TransportState::Opening)o<<L"未打开媒体 · 设置待启用\n";else{+case WM_TIMER:{auto s=controller->snapshot();syncProtection(enhancementEnabled?s.desired.protection:configuredSettings.protection);if(enhancementEnabled&&!dirty&&displayedSettings!=s.desired)populate(s.desired);syncColorControls();check(200,enhancementEnabled&&s.desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enhancementEnabled&&s.desired.sr?BST_CHECKED:BST_UNCHECKED);std::wostringstream o;if(!s.running&&!s.frames&&s.transport!=engine::TransportState::Opening)o<<L"未打开媒体 · 设置待启用\n";else{o<<L"期望版本 "<<s.desired.revision<<L" / 已应用 "<<s.applied.revision<<(s.applying?L" · 应用中":L"");const wchar_t* backend=s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS?L"XeSS":s.applied.frameGenerationBackend==engine::FrameGenerationBackend::Fsr?L"AMD FSR":L"DLSS";o<<L"\n"<<backend<<L" · "<<(s.applied.multiplier<=1?L"补帧关闭":s.fgActive?L"补帧运行":L"等待有效补帧");diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cppindex 124578e6..f9d451c0 100644--- a/apps/veyra/ui/AppShell.cpp+++ b/apps/veyra/ui/AppShell.cpp@@ -61,9 +61,9 @@ HWND inspector=nullptr,metricLabel=nullptr,tooltips=nullptr,diagnosticPanel=nullveyra::engine::EnhancementSettings lastSuccessful,jobExpected;bool haveSuccessful=false;uint64_t masterPendingRevision=0,masterPendingSession=0;bool masterPreviousEnabled=true;std::wstring smokeView;bool smokeViewApplied=false;std::wstring smokeDualOutput;bool smokeEmpty=false;DWORD modeGdiStart=0,modeHandlesStart=0;SIZE_T modePrivateStart=0;-bool smokeDual=false,smokeDualPause=false,smokeMaster=false,smokeMasterReject=false,smokeAudio=false,smokeJob=false,smokeJobCancel=false,smokeJobExit=false;int dualStep=0,masterStep=0,audioStep=0,jobStep=0;double pausedPosition=-1,jobPosition=0;uint64_t pausedFrames=0;ULONGLONG jobPauseTick=0;HANDLE workerMapping=nullptr;+bool smokeDual=false,smokeDualPause=false,smokeMaster=false,smokeMasterReject=false,smokeAudio=false,smokeJob=false,smokeJobCancel=false,smokeJobExit=false,smokeColor=false;int dualStep=0,masterStep=0,audioStep=0,jobStep=0,colorStep=0;double pausedPosition=-1,jobPosition=0;uint64_t pausedFrames=0;ULONGLONG jobPauseTick=0;HANDLE workerMapping=nullptr;void switchMode();void selectInspector(int);-bool applySettings(veyra::engine::EnhancementSettings s){if(masterPendingRevision)return false;uiState.configured=s;if(uiState.enhanced)engine.requestSettings(s);else {auto effective=engine.snapshot().desired;if(effective.captureCompatible!=s.captureCompatible||effective.forceSdrPreview!=s.forceSdrPreview||effective.captureFlipVertical!=s.captureFlipVertical||effective.captureBuffer!=s.captureBuffer){effective.captureCompatible=s.captureCompatible;effective.forceSdrPreview=s.forceSdrPreview;effective.captureFlipVertical=s.captureFlipVertical;effective.captureBuffer=s.captureBuffer;engine.requestSettings(effective);}veyra::log::info("ui-settings","enhancement off: draft saved; presentation setting applied independently");}veyra::ui::settingsEnabled(uiState.enhanced,uiState.configured);return true;}+bool applySettings(veyra::engine::EnhancementSettings s){if(masterPendingRevision)return false;uiState.configured=s;if(uiState.enhanced)engine.requestSettings(s);else {auto effective=engine.snapshot().desired;if(effective.captureCompatible!=s.captureCompatible||effective.forceSdrPreview!=s.forceSdrPreview||effective.captureFlipVertical!=s.captureFlipVertical||effective.captureBuffer!=s.captureBuffer||!(effective.color==s.color)){effective.captureCompatible=s.captureCompatible;effective.forceSdrPreview=s.forceSdrPreview;effective.captureFlipVertical=s.captureFlipVertical;effective.captureBuffer=s.captureBuffer;effective.color=s.color;engine.requestSettings(effective);}veyra::log::info("ui-settings","enhancement off: draft saved; presentation setting applied independently");}veyra::ui::settingsEnabled(uiState.enhanced,uiState.configured);return true;}struct ToolbarItem{HWND hwnd;int width;};std::vector<ToolbarItem> toolbar;bool full=false,holdOriginal=false,referenceBase=false;int compareMode=0;float compareSplit=.5f;WINDOWPLACEMENT windowPlacement{sizeof(windowPlacement)};@@ -737,6 +737,55 @@ if(uiStep==5&&elapsed>4800){referenceBase=true;updateComparison();uiStep=6;}if(uiStep==6&&elapsed>5500){holdOriginal=true;updateComparison();uiStep=7;}if(uiStep==7&&elapsed>5900){holdOriginal=false;compareMode=0;updateComparison();veyra::log::info("ui-test",std::format("completed={} NR evaluations={} (no fullscreen NR re-create expected)",true,s.nrEvaluated));uiStep=8;}}+// Colour page acceptance (T3): master switch, slider->engine wiring, one-click+// reset with a single undo, accordion folding and its persistence.+if(smokeColor&&startTick){const auto elapsed=GetTickCount64()-startTick;+const auto colourSnapshot=engine.snapshot();+auto colourControl=[](int id){return veyra::ui::settingsControlForTest(id);};+if(colorStep==0&&elapsed>1500){+ if(uiState.mode==veyra::ui::Mode::Daily)switchMode();+ selectInspector(2);layout();+ const auto master=colourControl(800);+ const bool off=master&&SendMessageW(master,BM_GETCHECK,0,0)==BST_UNCHECKED;+ colorStep=off?1:-1;+ veyra::log::info("color-ui-test",std::format("page2 masterPresent={} defaultOff={} step={}",master?1:0,off,colorStep));+}else if(colorStep==1&&colourSnapshot.desired.color.enabled){colorStep=2;veyra::log::info("color-ui-test","master switch applied");}+else if(colorStep==1){if(elapsed>2500)SendMessageW(colourControl(800),BM_CLICK,0,0);}+else if(colorStep==2){+ if(auto edit=colourControl(850))SetWindowTextW(edit,L"1.00");+ colorStep=(colourSnapshot.desired.color.exposure==1.0f)?3:(elapsed>4000?-1:2);+ if(colorStep==3)veyra::log::info("color-ui-test","exposure 1.00 reached the engine through the panel");+}else if(colorStep==3){SendMessageW(colourControl(801),BM_CLICK,0,0);colorStep=30;}+// The snapshot is taken once per tick, so the reset/undo results are observed on+// the following tick instead of in the same one that clicked the button.+else if(colorStep==30){colorStep=(colourSnapshot.desired.color.exposure==0.0f)?31:(elapsed>6000?-1:30);+ if(colorStep==31)veyra::log::info("color-ui-test","one-click reset returned the grade to neutral");}+else if(colorStep==31){SendMessageW(colourControl(802),BM_CLICK,0,0);colorStep=40;}+else if(colorStep==40){colorStep=(colourSnapshot.desired.color.exposure==1.0f)?5:(elapsed>8000?-1:40);+ if(colorStep==5)veyra::log::info("color-ui-test","undo restored the pre-reset values");}+else if(colorStep==5){+ auto edit=colourControl(850);+ const bool beforeVisible=edit&&IsWindowVisible(edit);+ const bool beforeMask=(preferences.load().colourFoldMask&1u)!=0u;+ RECT before{};GetWindowRect(colourControl(811),&before);+ SendMessageW(colourControl(810),BM_CLICK,0,0);+ RECT after{};GetWindowRect(colourControl(811),&after);+ const bool afterVisible=edit&&IsWindowVisible(edit);+ const auto persistedPreferences=preferences.load();+ const bool afterMask=(persistedPreferences.colourFoldMask&1u)!=0u;+ const bool collapsed=afterMask;+ // Which section it starts in depends on what the last run persisted, so the+ // check is "the state flipped and the geometry followed the flip". Window+ // visibility is not asserted: the acceptance gate runs the app hidden, where+ // IsWindowVisible is false for every child.+ const bool consistent=(afterMask!=beforeMask);+ const bool geometryOk=collapsed?(after.top<before.top):(after.top>before.top);+ colorStep=(consistent&&geometryOk)?6:-1;+ veyra::log::info("color-ui-test",std::format("fold collapsed={} persisted={} mask={} visibleBefore={} visibleAfter={} geometryOk={} step={}",collapsed,consistent,persistedPreferences.colourFoldMask,beforeVisible,afterVisible,geometryOk,colorStep));+}else if(colorStep==6){SendMessageW(colourControl(810),BM_CLICK,0,0);SendMessageW(colourControl(800),BM_CLICK,0,0);colorStep=7;}+else if(colorStep==7&&!colourSnapshot.desired.color.enabled){colorStep=8;veyra::log::info("color-ui-test","unfolded and master off; colour chain back to the zero-cost default");}+else if(colorStep==7&&elapsed>9000){colorStep=-1;}+}if(smokeSettings&&startTick){const auto elapsed=GetTickCount64()-startTick;if(settingsStep==0&&s.frames>20){auto change=s.desired;change.model.intensity=.6f;change.model.tone=.7f;change.residual.total=.4f;change.residual.color=.8f;engine.requestSettings(change);settingsStep=1;}if(settingsStep==1&&s.applied.model.intensity==.6f&&elapsed>3300){auto change=s.desired;change.sr=true;engine.requestSettings(change);settingsStep=2;}@@ -766,8 +815,8 @@ if(smokeProtection&&startTick&&GetTickCount64()-startTick>1500){protectionStep=pass?4:-1;veyra::log::info("protection-ui-test",std::format("master-off unchanged-revision dirty-draft-preserved pass={}",pass));SendMessageW(hwnd,WM_COMMAND,Master,0);}}-if(smokeSeconds>0&&startTick&&GetTickCount64()-startTick>ULONGLONG(smokeSeconds)*1000){veyra::log::info("app",std::format("smoke frames={} generated={} failed={} latenessMs={:.2f} absLatenessP95Ms={:.2f} controlsStep={} capture={} processedFps={:.2f} callbackFps={:.2f} captureDropped={} callbackToPresentReturnP95Ms={:.3f} schedulingWaitP95Ms={:.3f} processCpuP95Ms={:.3f} presentCpuP95Ms={:.3f} nrEvaluated={} nvofExecuted={}",s.frames,s.generated,s.failed,s.lateMs,s.lateP95Ms,smokeStep,s.capture,s.fps,s.captureFps,s.captureDropped,s.captureAgeP95Ms,s.schedulingWaitP95Ms,s.processCpuP95Ms,s.presentCpuP95Ms,s.nrEvaluated,s.nvofExecuted));resultCode=(s.frames>0||smokeEmpty)&&!s.failed&&(!smokeZoom||zoomStep==3)&&(!smokeProtection||protectionStep==4)&&(!smokeRepair||repairStep==10)&&(!smokeTransport||transportStep==10)&&(!smokeFgOnly||fgOnlyStep==4)&&(!smokeSettings||settingsStep==5)&&(!smokeRollback||settingsStep==3)&&(!smokeUi||uiStep==8)&&(!smokeDual||dualStep==40)&&(!smokeMaster||masterStep==3)&&(!smokeAudio||audioStep==4)&&(!(smokeJob||smokeJobCancel)||jobStep==4)&&(!smokeScreenshot||screenshotStep==2)?0:1;PostMessageW(hwnd,WM_CLOSE,0,0);}return 0;}-case WM_CLOSE:endTransition();if(!closing&&smokeSeconds<=0&&exportJob.poll().active()&&MessageBoxW(hwnd,L"导出尚未完成。取消导出并退出?\n选择“否”返回播放器继续导出。",L"退出 Veyra",MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION)!=IDYES)return 0;if(!closing&&smokeSeconds<=0){auto snapshot=engine.snapshot();WINDOWPLACEMENT placement{sizeof(placement)};if(full)placement=windowPlacement;else GetWindowPlacement(hwnd,&placement);auto r=placement.rcNormalPosition;uiPreferences.width=MulDiv(r.right-r.left,96,veyra::ui::layoutDpi(hwnd));uiPreferences.height=MulDiv(r.bottom-r.top,96,veyra::ui::layoutDpi(hwnd));uiPreferences.x=r.left;uiPreferences.y=r.top;uiPreferences.positioned=true;uiPreferences.volume=snapshot.volume;uiPreferences.muted=snapshot.muted;uiPreferences.subtitles=uiState.subtitles;uiPreferences.subtitleSize=subtitlePixels;uiPreferences.subtitleOutline=uiState.subtitleOutline;uiPreferences.subtitleBackground=uiState.subtitleBackground;uiPreferences.subtitleSecondLanguage=uiState.subtitleSecondLanguage;uiPreferences.subtitleMargin=uiState.subtitleMargin;uiPreferences.subtitleFont=uiState.subtitleFont;uiPreferences.inspector=uiState.inspector;const bool confirmed=snapshot.frames>0&&!snapshot.applying&&!snapshot.failed;if(!preferences.save(uiPreferences,haveSuccessful?&lastSuccessful:nullptr))veyra::log::warn("ui-preferences","preferences not saved; corrupt original preserved");}exportJob.cancel();closing=true;engine.stop();SetWindowTextW(statusBar,L"正在释放当前任务资源…");return 0;+if(smokeSeconds>0&&startTick&&GetTickCount64()-startTick>ULONGLONG(smokeSeconds)*1000){veyra::log::info("app",std::format("smoke frames={} generated={} failed={} latenessMs={:.2f} absLatenessP95Ms={:.2f} controlsStep={} capture={} processedFps={:.2f} callbackFps={:.2f} captureDropped={} callbackToPresentReturnP95Ms={:.3f} schedulingWaitP95Ms={:.3f} processCpuP95Ms={:.3f} presentCpuP95Ms={:.3f} nrEvaluated={} nvofExecuted={}",s.frames,s.generated,s.failed,s.lateMs,s.lateP95Ms,smokeStep,s.capture,s.fps,s.captureFps,s.captureDropped,s.captureAgeP95Ms,s.schedulingWaitP95Ms,s.processCpuP95Ms,s.presentCpuP95Ms,s.nrEvaluated,s.nvofExecuted));resultCode=(s.frames>0||smokeEmpty)&&!s.failed&&(!smokeZoom||zoomStep==3)&&(!smokeProtection||protectionStep==4)&&(!smokeRepair||repairStep==10)&&(!smokeTransport||transportStep==10)&&(!smokeFgOnly||fgOnlyStep==4)&&(!smokeSettings||settingsStep==5)&&(!smokeColor||colorStep==8)&&(!smokeRollback||settingsStep==3)&&(!smokeUi||uiStep==8)&&(!smokeDual||dualStep==40)&&(!smokeMaster||masterStep==3)&&(!smokeAudio||audioStep==4)&&(!(smokeJob||smokeJobCancel)||jobStep==4)&&(!smokeScreenshot||screenshotStep==2)?0:1;PostMessageW(hwnd,WM_CLOSE,0,0);}return 0;}+case WM_CLOSE:endTransition();if(!closing&&smokeSeconds<=0&&exportJob.poll().active()&&MessageBoxW(hwnd,L"导出尚未完成。取消导出并退出?\n选择“否”返回播放器继续导出。",L"退出 Veyra",MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION)!=IDYES)return 0;if(!closing&&smokeSeconds<=0){auto snapshot=engine.snapshot();WINDOWPLACEMENT placement{sizeof(placement)};if(full)placement=windowPlacement;else GetWindowPlacement(hwnd,&placement);auto r=placement.rcNormalPosition;uiPreferences.width=MulDiv(r.right-r.left,96,veyra::ui::layoutDpi(hwnd));uiPreferences.height=MulDiv(r.bottom-r.top,96,veyra::ui::layoutDpi(hwnd));uiPreferences.x=r.left;uiPreferences.y=r.top;uiPreferences.positioned=true;uiPreferences.volume=snapshot.volume;uiPreferences.muted=snapshot.muted;uiPreferences.subtitles=uiState.subtitles;uiPreferences.subtitleSize=subtitlePixels;uiPreferences.subtitleOutline=uiState.subtitleOutline;uiPreferences.subtitleBackground=uiState.subtitleBackground;uiPreferences.subtitleSecondLanguage=uiState.subtitleSecondLanguage;uiPreferences.subtitleMargin=uiState.subtitleMargin;uiPreferences.subtitleFont=uiState.subtitleFont;uiPreferences.inspector=uiState.inspector;uiPreferences.colourFoldMask=preferences.load().colourFoldMask;veyra::log::warn("ui-preferences","preferences not saved; corrupt original preserved");}exportJob.cancel();closing=true;engine.stop();SetWindowTextW(statusBar,L"正在释放当前任务资源…");return 0;case WM_DESTROY:#ifdef VEYRA_ENABLE_REMOTEPLAYremoteController.stop();KillTimer(hwnd,ControllerTimer);@@ -781,7 +830,7 @@ SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);INITCOCoInitializeEx(nullptr,COINIT_APARTMENTTHREADED);initialOptions=veyra::engine::PlayerOptions::from(veyra::ui::defaultSettings());-int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-fg-only")smokeFgOnly=true;else if(arg==L"--smoke-transport")smokeTransport=true;else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-hover")smokeZoom=smokeHover=true;else if(arg==L"--smoke-protection")smokeProtection=true;else if(arg==L"--smoke-zoom")smokeZoom=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--bitrate-mbps"&&i+1<argc)initialOptions.settings.exportBitrateMbps=uint32_t(std::clamp(_wtoi(argv[++i]),0,300));else if(arg==L"--subtitle-primary"&&i+1<argc)subtitleRequestPrimary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-secondary"&&i+1<argc)subtitleRequestSecondary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-offset-ms"&&i+1<argc)subtitleRequestOffsetMs=std::clamp(_wtoi(argv[++i]),-30000,30000);else if(arg==L"--subtitle-font-size"&&i+1<argc)subtitlePixels=std::clamp(_wtoi(argv[++i]),16,56);else if(arg==L"--subtitle-no-outline")uiState.subtitleOutline=false;else if(arg==L"--subtitle-background")uiState.subtitleBackground=true;else if(arg==L"--subtitle-auto-align")subtitleRequestAutoAlign=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-screenshot")smokeScreenshot=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,4);initialOptions.fg=true;}else if(arg==L"--capture-audio"&&i+1<argc)initialOptions.settings.captureAudio=static_cast<veyra::engine::CaptureAudioIngress>(std::clamp(_wtoi(argv[++i]),0,2));else if(arg==L"--flow-amd")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::AmdFidelityFx;else if(arg==L"--flow-gpudis")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::GpuDis;else if(arg==L"--video-sr"&&i+1<argc){initialOptions.settings.videoSrQuality=std::clamp(_wtoi(argv[++i]),1,5);initialOptions.sr=true;}else if(arg==L"--nr-ampere")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Ampere;else if(arg==L"--nr-community")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Community;else if(arg==L"--nr-original")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Original;else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);+int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-fg-only")smokeFgOnly=true;else if(arg==L"--smoke-transport")smokeTransport=true;else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-hover")smokeZoom=smokeHover=true;else if(arg==L"--smoke-protection")smokeProtection=true;else if(arg==L"--smoke-zoom")smokeZoom=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--bitrate-mbps"&&i+1<argc)initialOptions.settings.exportBitrateMbps=uint32_t(std::clamp(_wtoi(argv[++i]),0,300));else if(arg==L"--subtitle-primary"&&i+1<argc)subtitleRequestPrimary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-secondary"&&i+1<argc)subtitleRequestSecondary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-offset-ms"&&i+1<argc)subtitleRequestOffsetMs=std::clamp(_wtoi(argv[++i]),-30000,30000);else if(arg==L"--subtitle-font-size"&&i+1<argc)subtitlePixels=std::clamp(_wtoi(argv[++i]),16,56);else if(arg==L"--subtitle-no-outline")uiState.subtitleOutline=false;else if(arg==L"--subtitle-background")uiState.subtitleBackground=true;else if(arg==L"--subtitle-auto-align")subtitleRequestAutoAlign=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-color")smokeColor=true;else if(arg==L"--smoke-screenshot")smokeScreenshot=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,4);initialOptions.fg=true;}else if(arg==L"--capture-audio"&&i+1<argc)initialOptions.settings.captureAudio=static_cast<veyra::engine::CaptureAudioIngress>(std::clamp(_wtoi(argv[++i]),0,2));else if(arg==L"--flow-amd")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::AmdFidelityFx;else if(arg==L"--flow-gpudis")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::GpuDis;else if(arg==L"--video-sr"&&i+1<argc){initialOptions.settings.videoSrQuality=std::clamp(_wtoi(argv[++i]),1,5);initialOptions.sr=true;}else if(arg==L"--nr-ampere")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Ampere;else if(arg==L"--nr-community")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Community;else if(arg==L"--nr-original")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Original;else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);// The legacy argument clamp caps --fg-multiplier at 4X. Re-read the flag here so// 6X (and 2X/3X/4X) can be exercised from the command line for diagnostics and// smoke tests; the interactive UI uses the capability-driven list instead.diff --git a/apps/veyra/ui/SettingHelp.h b/apps/veyra/ui/SettingHelp.hindex c1b2d80a..1245d3fb 100644--- a/apps/veyra/ui/SettingHelp.h+++ b/apps/veyra/ui/SettingHelp.h@@ -42,6 +42,9 @@ inline const wchar_t* settingHelp(int id){case 213:return L"在画面上拖框添加NR剔除区,Esc取消。把不想被NR改的地方圈出来。";case 214:return L"清空当前NR剔除框。只是撤掉围栏,不会删除视频。";case 222:return L"剔除区边缘的过渡宽度,单位是工作分辨率像素:0 就是硬边,12 约等于4K画面高度的0.5%,越大过渡越柔和。改完立即生效。";+ case 800:return L"调色总开关。开着时调色在所有效果器(NR/超分/补帧)之前执行,会有一点额外开销;关掉后这条链完全不存在,零开销,画面回到未调色的状态。";+ case 801:return L"把色彩页所有参数还原为中性(不改变总开关)。还原前的数值会留一次撤销机会。";+ case 802:return L"找回上一次“一键还原”之前的数值。";case 215:return L"把AMD光流输入宽高各减半,少算一些像素。速度可能更好,细小运动可能看不清。";case 216:return L"自动估算声音补偿,或改用手动偏移。目标是嘴和声音一起到,别让角色自带配音延迟。";case 217:return L"-250到250ms:正值让声音更晚,负值减少已有补偿,不能把未来声音变出来。";diff --git a/apps/veyra/ui/UiPreferenceStore.h b/apps/veyra/ui/UiPreferenceStore.hindex e5727af4..460f1dba 100644--- a/apps/veyra/ui/UiPreferenceStore.h+++ b/apps/veyra/ui/UiPreferenceStore.h@@ -13,6 +13,8 @@ struct UiPreferences {// and the dual-language switch.bool subtitleOutline=true,subtitleBackground=false,subtitleSecondLanguage=false;int subtitleMargin=0,subtitleFont=0;+ // v4: colour-page accordion fold mask (one bit per section).+ uint32_t colourFoldMask=0;};class UiPreferenceStore {std::filesystem::path folder_;@@ -24,7 +26,7 @@ public:// inspector index 4 is the audio page (selectInspector(4)), so the valid// range is 0..4. A narrower bound here silently discarded every saved// window size, volume and subtitle style for users who last sat on it.- if(!(file>>magic>>version>>read.volume>>mute>>sub>>read.width>>read.height>>read.x>>read.y>>pos>>read.inspector>>read.subtitleSize)||magic!="VEYRA_UI"||(version<1||version>3)||!std::isfinite(read.volume)||read.volume<0||read.volume>1||mute<0||mute>1||sub<0||sub>1||pos<0||pos>1||read.width<720||read.width>10000||read.height<540||read.height>10000||abs(int64_t(read.x))>100000||abs(int64_t(read.y))>100000||read.inspector<0||read.inspector>4||read.subtitleSize<16||read.subtitleSize>56){corrupt_=true;return result;}+ if(!(file>>magic>>version>>read.volume>>mute>>sub>>read.width>>read.height>>read.x>>read.y>>pos>>read.inspector>>read.subtitleSize)||magic!="VEYRA_UI"||(version<1||version>4)||!std::isfinite(read.volume)||read.volume<0||read.volume>1||mute<0||mute>1||sub<0||sub>1||pos<0||pos>1||read.width<720||read.width>10000||read.height<540||read.height>10000||abs(int64_t(read.x))>100000||abs(int64_t(read.y))>100000||read.inspector<0||read.inspector>4||read.subtitleSize<16||read.subtitleSize>56){corrupt_=true;return result;}if(version==2&&(!(file>>read.inspectorWidth)||read.inspectorWidth<296||read.inspectorWidth>420)){corrupt_=true;return result;}if(version>=3){int outline=0,background=0,second=0;@@ -33,12 +35,16 @@ public:// 3 file was rejected as corrupt and all UI preferences were lost.if(!(file>>read.inspectorWidth>>outline>>background>>second>>read.subtitleMargin>>read.subtitleFont)||read.inspectorWidth<296||read.inspectorWidth>420||outline<0||outline>1||background<0||background>1||second<0||second>1||read.subtitleMargin<0||read.subtitleMargin>240||read.subtitleFont<0||read.subtitleFont>5){corrupt_=true;return result;}read.subtitleOutline=outline!=0;read.subtitleBackground=background!=0;read.subtitleSecondLanguage=second!=0;- }file>>std::ws;if(!file.eof()){corrupt_=true;return result;}read.muted=mute;read.subtitles=sub;read.positioned=pos;return read;+ }+ // v4 appends the colour-page fold mask *after* the v3 subtitle block, so+ // it must be read here - reading it earlier shifted every following field.+ if(version>=4&&!(file>>read.colourFoldMask)){corrupt_=true;return result;}+ file>>std::ws;if(!file.eof()){corrupt_=true;return result;}read.muted=mute;read.subtitles=sub;read.positioned=pos;return read;}engine::EnhancementSettings startup(engine::EnhancementSettings fallback){engine::PresetStore last(folder_/"last-applied.v1");if(!last.load()||last.entries().empty())return fallback;return last.entries().front().settings;}bool save(const UiPreferences& p,const engine::EnhancementSettings* applied){bool ok=true;std::filesystem::create_directories(folder_);if(applied){engine::PresetStore last(folder_/"last-applied.v1");ok=last.load()&&last.put(L"Last applied",*applied,true);}- if(corrupt_)return false;std::ostringstream out;out<<"VEYRA_UI 3\n"<<p.volume<<' '<<p.muted<<' '<<p.subtitles<<' '<<p.width<<' '<<p.height<<' '<<p.x<<' '<<p.y<<' '<<p.positioned<<' '<<p.inspector<<' '<<p.subtitleSize<<' '<<p.inspectorWidth<<' '<<p.subtitleOutline<<' '<<p.subtitleBackground<<' '<<p.subtitleSecondLanguage<<' '<<p.subtitleMargin<<' '<<p.subtitleFont<<'\n';+ if(corrupt_)return false;std::ostringstream out;out<<"VEYRA_UI 4\n"<<p.volume<<' '<<p.muted<<' '<<p.subtitles<<' '<<p.width<<' '<<p.height<<' '<<p.x<<' '<<p.y<<' '<<p.positioned<<' '<<p.inspector<<' '<<p.subtitleSize<<' '<<p.inspectorWidth<<' '<<p.subtitleOutline<<' '<<p.subtitleBackground<<' '<<p.subtitleSecondLanguage<<' '<<p.subtitleMargin<<' '<<p.subtitleFont<<' '<<p.colourFoldMask<<'\n';auto target=folder_/"ui-preferences.v1",tmp=folder_/(L"ui-preferences.tmp-"+std::to_wstring(GetCurrentProcessId()));auto data=out.str();HANDLE file=CreateFileW(tmp.c_str(),GENERIC_WRITE,0,nullptr,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,nullptr);if(file==INVALID_HANDLE_VALUE)return false;DWORD written=0;bool saved=WriteFile(file,data.data(),DWORD(data.size()),&written,nullptr)&&written==data.size()&&FlushFileBuffers(file);CloseHandle(file);if(saved)saved=MoveFileExW(tmp.c_str(),target.c_str(),MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH)!=FALSE;return ok&&saved;}};diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 71c19b47..5da57480 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,45 @@# 2026-09-11 继续修复目标模式执行中+## 2026-09-17 色彩页 P1:T3 色彩页 UI 框架(风琴折叠 + 滑块/数值框 + 一键还原)++`apps/veyra/SettingsWindow.cpp` 的第 2 页(原预设页位置)现在是色彩页:++- **总开关**(id 800,默认关):勾选/取消直接进 `ColorSettings::enabled`,走重建路径;+ 关闭时链路不存在(零开销),文案与帮助都写明;+- **一键还原(801)+ 撤销还原(802)**:还原把所有色彩参数归零、保留总开关状态,并把还原前+ 的整组数值留一次撤销机会;+- **风琴折叠**:`layoutColorPage()` 在 `arrange()` 里顺序排版,折叠的组直接跳过自己的行,+ 行高/隐藏状态都进 `items`,因此滚动、DPI、Tab 顺序沿用现有机制;组头文案带 ▾/▸;+- **参数行**:每个参数 = 标签 + 数值框(可直接输入)+ 滑轨;滑块拖动与输入框回车都即时生效,+ 首次改动会自动打开总开关(与 NR/超分开关的习惯一致);数值越界会拒绝并回显上次有效值;+- **折叠状态持久化**:`ui-preferences.v1` schema v3 → **v4**,行尾追加 `colourFoldMask`;+ v1–v3 旧文件仍可读。顺带修掉一个隐患:AppShell 保存 UI 偏好时会覆盖面板写入的折叠位,+ 现在保存前先把该字段从文件读回来再写;+- 新增帮助文本(800/801/802)。++**真机 UI 验收(新烟测 `--smoke-color`,已加入 `scripts/gates/delivery.ps1`)**++```+[color-ui-test] page2 masterPresent=1 defaultOff=true step=1+[color-ui-test] master switch applied+[color-ui-test] exposure 1.00 reached the engine through the panel+[color-ui-test] one-click reset returned the grade to neutral+[color-ui-test] undo restored the pre-reset values+[color-ui-test] fold collapsed=true persisted=true mask=1 geometryOk=true step=6+[color-ui-test] unfolded and master off; colour chain back to the zero-cost default+```++烟测覆盖:总开关默认关 → 打开后进入引擎 → 数值框输入的曝光值到达引擎 → 一键还原回中性 →+撤销还原找回原值 → 折叠后下一组位置上移且折叠位落盘 → 收尾把开关关回默认。exit=0。++**回归**:`veyra_ui_contract_tests` exit 0(含 v3/音频页偏好回归);`veyra_repair_contract_tests` 191/0;+`veyra_repair_preset_tests` exit 0;`veyra_color_grade_tests` 23/23;`veyra_color_grade_gpu_tests` exit 0;+`scripts/gates/delivery.ps1` → **DELIVERY SHORT GATE PASS**+(`logs/delivery/81ef6ff6cc9944489793fcd523d0dbb7/result.json`,本次起包含 color-page 用例)。++**未做(T4 起)**:曲线/混色器/颜色分级/校准四组的控件与 shader 动词、分组眼睛(需要在+`ColorSettings` 里加每组的 bypass 位,schema 再升一版)、`.cube` 导入(T5)、HDR 标准处理(T6)。+## 2026-09-17 色彩页 P1:T2b-b 源头侧调色链接入 ingest(GPU 验收通过)按 v4 计划完成 GPU 接线:调色**不新增 pass**,而是接进现有的 ingest 派发(YUV→线性、diff --git a/scripts/gates/delivery.ps1 b/scripts/gates/delivery.ps1index 35f499f0..862df13d 100644--- a/scripts/gates/delivery.ps1+++ b/scripts/gates/delivery.ps1@@ -55,6 +55,9 @@ try{$log=Get-Content "$dir/player.stdout.log" -RawCheck player-sync ($log -match 'smoke frames=(\d+).*generated=(\d+).*failed=false.*absLatenessP95Ms=([\d.]+)' -and [int]$Matches[1] -gt 60 -and [int]$Matches[2] -gt 0 -and [double]$Matches[3] -le 50) 'real-time profile 4K ingress, generated frames, observed abs lateness P95 <=50ms'Run controls $PlayerExe @($clip1080,'--nr','--realtime','--smoke-seconds','6','--smoke-controls','--smoke-save',"$dir/snapshot.jpg") 20+ # Colour page (T3): master switch, slider -> engine wiring, one-click reset+ # with undo, accordion folding and its ui-preferences persistence.+ Run color-page $PlayerExe @($clip1080,'--smoke-color','--smoke-seconds','12') 25$controlLog=Get-Content "$dir/controls.stdout.log" -RawCheck paused-seek ($controlLog -match 'seek done' -and $controlLog -match 'controlsStep=4' -and (Test-Path "$dir/snapshot.jpg")) 'pause / seek while paused / resume / real WIC JPEG'Run image $PlayerExe @("$dir/enhanced.png",'--nr','--smoke-seconds','3') 15