Thread: VirtualDub2
View Single Post
Old 20th August 2016, 22:58   #96  |  Link
b2kguga
Registered User
 
Join Date: Jul 2016
Posts: 21
Skeh i read it, but i´m having trouble identifying where some routines starts and ends and preview is enabled and the correct usage of RedoSystem. I mean, after using UndoSystem the program seems to start all routines again, but which functions are passed 1st ?

Sorry for the bad english, but it may be better i explain in examples.

I´m giving a try building a new version of LogoAway. So far, the rebuild is doing well. I´m doing it in assembly and debugging it also with my own assembler. One of the things i´m having difficulties to understand is that inside my ConfigDialog it have a call to the toggle function of Vdub.

Apparently it restarts he execution of other Vdub starter functions such as:
RunProc, EndProc, StartProc etc.

I wanted to know the order that these functions are called. This is because the controls i´m using needs the values to be update and, therefore, needed to reload (and destroy) old memory allocated. This is causing the dialog to flick the preview window.

Code:
Proc ConfigDlgProc:
    Arguments @Adressee, @Message, @wParam, @lParam
    Local @mfd, @fa
    Uses ebx, esi, edi, ecx, edx

    call 'USER32.GetWindowLongA' D@Adressee, &DWL_USER
    mov D@mfd eax
(...)
    ...If D@Message = &WM_COMMAND ; User action

        If D@mfd <> 0
            call On_WmCommand D@Adressee, D@wParam, D@lParam, D@mfd
        Else
            xor eax eax
        End_If
(...)EndP
; inside WM_Command the controls are used as:
Code:
(...)
    ...Else_If D@wParam = IDC_EDIT_LOGO_BORDER_WIDTH ; Border Size (Width)

        call IFilterPreviewUndoSystem D@fa
        ; ImgWidth= Pos+BorderWidth
        lea eax D@lpTranslated
        call 'USER32.GetDlgItemInt' D@hDlg, IDC_EDIT_LOGO_BORDER_WIDTH, eax, &FALSE
(...)
        call IFilterPreviewRedoSystem D@fa

    ...Else_If D@wParam = IDC_EDIT_LOGO_BORDER_HEIGHT
(...)
    ..Else_if D@wParam = IDC_BTN_SHOW_PREVIEW

        call IFilterPreviewToggle D@fa, D@hBtn
        xor eax eax
(...)
What is happenning is that when i set the new width or height of the logo, the preview is flickering because the plugin is restarted and the memory is allocated/deallocated.

Code:
Proc EndProc:
    Arguments @fa, @ff
    Uses esi, edi, ebx
(...)
 ; used to deallocate memory
EndP
Code:
Proc StartProc:
    Arguments @fa, @ff
    Local @BWidth, @BHeight, @TmpMemData, @GradientSize, @MemSize2, @MemSize3, @MemSize4, @MemSize5,
          @ErrorMessage
    Uses ebx, esi, edi

    mov eax D@fa
    mov esi D$eax+FilterActivation.filter_dataDis
(...)
; this is where to allocate the memory
EndP
Code:
Proc RunProc:
    Arguments @fa, @ff
    Local @ImgWidth, @WithBorderNorth, @WithBorderEast, @WithBorderSouth, @WithBorderWest, @CurSrcframe, @IsKeyFrameSet, @Counter
    Uses ebx, esi, edi
(...)
; this is where the plugin actually works.
EndP
The problem is that, when activating the preview the plugin stops the execution, and starts again on EndProc (To delete the memory), StartProc (to allocate the memory again) and on Runproc (to run the previewed data)

I wanted to know the order of the functions where undosystem uses to reload.

I mnean, undosystem seems to run again on all the functions pointed by the FilterDefinition structure, but i´m not sure the order the pointers are being called once undosystem and RedoSystem are activated.

Code:
[FilterDefinition:
 FilterDefinition.next: D$ &NULL
 FilterDefinition.prev: D$ &NULL
 FilterDefinition.module: D$ &NULL
 FilterDefinition.name: D$ Sz_PluginName
 FilterDefinition.desc: D$ Sz_Description
 FilterDefinition.maker: D$ Sz_Author
 FilterDefinition.private_data: D$ &NULL
 FilterDefinition.inst_data_size: D$ Size_Of_FilterData
 FilterDefinition.initProc: D$ InitProc
 FilterDefinition.deinitProc: D$ 0;DeInitProc
 FilterDefinition.runProc: D$ RunProc
 FilterDefinition.paramProc: D$ ParamProc
 FilterDefinition.ConfigProc: D$ ConfigProc
 FilterDefinition.StringProc: D$ StringProc
 FilterDefinition.StartProc: D$ StartProc
 FilterDefinition.EndProc: D$ EndProc
 FilterDefinition.script_obj: D$ VDXScriptObject
 FilterDefinition.fssProc: D$ FssProc
 FilterDefinition.stringProc2: D$ StringProc2
 FilterDefinition.serializeProc: D$ &NULL
 FilterDefinition.deserializeProc: D$ &NULL
 FilterDefinition.copyProc: D$ &NULL
 FilterDefinition.prefetchProc: D$ &NULL
 FilterDefinition.copyProc2: D$ &NULL
 FilterDefinition.prefetchProc2: D$ &NULL
 FilterDefinition.eventProc: D$ &NULL
 FilterDefinition.accelRunProc: D$ &NULL
 FilterDefinition.mSourceCountLowMinus1: D$ &NULL
 FilterDefinition.mSourceCountHighMinus1: D$ &NULL
 FilterDefinition.mpStaticAboutProc: D$ &NULL
 FilterDefinition.mpStaticConfigureProc: D$ &NULL]
I´m asking this because i want to avoid the flickering and the only solution i can find is making the allocation and deallocation of memory be inside RunProc function using a flag to check if we are really running the plugin or only using it on preview mode.

The documentation says that the place to allocate and deallocate memory is on StartProc and EndProc and maybe i need to do those allocs/deallocs in other places.

This is what i´ve built so far

Last edited by b2kguga; 20th August 2016 at 23:01.
b2kguga is offline   Reply With Quote