From 735139aa3b2045af5461eec42d97fb7b25c6f61a Mon Sep 17 00:00:00 2001 From: YourMJK Date: Tue, 30 Jan 2024 01:02:59 +0100 Subject: [PATCH 1/2] Fix wrong index for adjusting PCS composition objects during WDS window manipulation --- main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 1fae52d..730bbcd 100644 --- a/main.cpp +++ b/main.cpp @@ -970,12 +970,12 @@ int main(int32_t argc, char** argv) wds.windows[i].WindowsVerPos -= (cmd.crop.top + corrVer); } - if (corrVer != 0) { - pcs.compositionObject[i].objectVerPos -= corrVer; - fixPCS = true; - } - if (corrHor != 0) { - pcs.compositionObject[i].objectHorPos -= corrHor; + if (corrVer != 0 || corrHor != 0) { + for (int j = 0; j < pcs.numCompositionObject; j++) { + if (pcs.compositionObject[j].windowID != wds.windows[i].windowID) continue; + pcs.compositionObject[j].objectVerPos -= corrVer; + pcs.compositionObject[j].objectHorPos -= corrHor; + } fixPCS = true; } } From 093328b71cab3828bcd48df2cbe3cf2ad6297a49 Mon Sep 17 00:00:00 2001 From: YourMJK Date: Tue, 30 Jan 2024 01:03:41 +0100 Subject: [PATCH 2/2] Fix typo "offeset" --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 730bbcd..5743651 100644 --- a/main.cpp +++ b/main.cpp @@ -739,7 +739,7 @@ int main(int32_t argc, char** argv) t_PCS pcs = {}; t_PDS pds = {}; - size_t offesetCurrPCS = 0; + size_t offsetCurrPCS = 0; bool fixPCS = false; std::vector cutMerge_compositionNumberToSave = {}; @@ -803,7 +803,7 @@ int main(int32_t argc, char** argv) //std::printf("PCS\r\n"); if (doCrop || cmd.addZero || cmd.cutMerge.doCutMerge) { pcs = ReadPCS(&buffer[start + HEADER_SIZE]); - offesetCurrPCS = start; + offsetCurrPCS = start; if (doCrop) { screenRect.x = 0 + cmd.crop.left; @@ -981,7 +981,7 @@ int main(int32_t argc, char** argv) } if (fixPCS) { - WritePCS(pcs, &buffer[offesetCurrPCS + HEADER_SIZE]); + WritePCS(pcs, &buffer[offsetCurrPCS + HEADER_SIZE]); } WriteWDS(wds, &buffer[start + HEADER_SIZE]);