# Path: lib/VMRepresentation.py
# def get_vmr():
#     """
#     Get the VMR instance.
#     :return: vmr
#     """
#     global vmr
#     if vmr is None:
#         vmr = VMRepresentation()
#     return vmr
# 
# class VMContext(object):
#     def __init__(self):
#         self.code_start = BADADDR
#         self.code_end = BADADDR
#         self.base_addr = BADADDR
#         self.vm_addr = BADADDR


from idaapi import Form, BADADDR
from lib.VMRepresentation import get_vmr, VMContext
    def OnButtonNop(self, code=0):
        pass

def Show():
    settings = SettingsView()
    settings.Compile()
    vmr = get_vmr()
    vm_ctx = vmr.vm_ctx

    settings.iCodeStart.value = vm_ctx.code_start
    settings.iCodeEnd.value = vm_ctx.code_end
    settings.iBaseAddr.value = vm_ctx.base_addr
    settings.iVMAddr.value = vm_ctx.vm_addr

    settings.rGreedyCluster.checked = vmr.greedy
    settings.rShowBB.checked = vmr.bb
    settings.iClusterHeu.value = vmr.cluster_magic

    settings.iInOut.value = vmr.in_out
    settings.iClu.value = vmr.clu
    settings.iPaMa.value = vmr.pa_ma
    settings.iMeUs.value = vmr.mem_use
    settings.iSta.value = vmr.static

    settings.rStepInSysLibs.checked = vmr.sys_libs
    settings.rFuncParams.checked = vmr.extract_param

    if settings.Execute() == 0:  # Cancel
        settings.Free()
    else:  # Confirm

# Path: lib/VMRepresentation.py
# def get_vmr():
#     """
#     Get the VMR instance.
#     :return: vmr
#     """
#     global vmr
#     if vmr is None:
#         vmr = VMRepresentation()
#     return vmr
# 
# class VMContext(object):
#     def __init__(self):
#         self.code_start = BADADDR
#         self.code_end = BADADDR
#         self.base_addr = BADADDR
#         self.vm_addr = BADADDR


# Path: ui/SettingsWindow.py
from idaapi import Form, BADADDR
from lib.VMRepresentation import get_vmr, VMContext

    def OnButtonNop(self, code=0):
        pass

def Show():
    settings = SettingsView()
    settings.Compile()
    vmr = get_vmr()
    vm_ctx = vmr.vm_ctx

    settings.iCodeStart.value = vm_ctx.code_start
    settings.iCodeEnd.value = vm_ctx.code_end
    settings.iBaseAddr.value = vm_ctx.base_addr
    settings.iVMAddr.value = vm_ctx.vm_addr

    settings.rGreedyCluster.checked = vmr.greedy
    settings.rShowBB.checked = vmr.bb
    settings.iClusterHeu.value = vmr.cluster_magic

    settings.iInOut.value = vmr.in_out
    settings.iClu.value = vmr.clu
    settings.iPaMa.value = vmr.pa_ma
    settings.iMeUs.value = vmr.mem_use
    settings.iSta.value = vmr.static

    settings.rStepInSysLibs.checked = vmr.sys_libs
    settings.rFuncParams.checked = vmr.extract_param

    if settings.Execute() == 0:  # Cancel
        settings.Free()
    else:  # Confirm

        vmr = get_vmr()