Skip to content

构造函数,在特定指令数下,Hotfix之后,会提示指令目标无效 #711

@wuxiongbin

Description

@wuxiongbin

VerificationException: Error in XLuaTest.TestHotfix:XLuaTest.TestHotfix:.ctor (int,int,long) Invalid instruction target fffffff5

测试代码如下,Hotfix之后,newTestHotfix对象,必定出现,经调试发现,特定指令长度下必出现,
构造函数在Hotfix之后,需要对指令重新计算下偏移再进行长度处理
在此行数上重新计算下指令偏移量,即可修复,
image

InstructionHelp.txt
[Hotfix]
public class TestHotfix
{
static int Test(int type)
{
return 0;
}

    int index = 0;
    int currencyType = 0;
    int currencyConfigLO = 0;

    public TestHotfix(int type, int code, long amount)
    {
        currencyType = code;

        switch (currencyType)
        {
        case 0:
            currencyConfigLO = Test(1);
            break;
        case 1:
            currencyConfigLO = Test(2);
            break;
        case 2:
            currencyConfigLO = Test(3);
            break;
        case 3:
            currencyConfigLO = Test(4);
            break;
        case 4:
            currencyConfigLO = Test(5);
            break;
        case 5:
            currencyConfigLO = Test(9);
            break;
        case 6:
            currencyConfigLO = Test(7);
            break;
        case 7:
            currencyConfigLO = Test(10);
            break;
        case 8:
            currencyConfigLO = Test(11);
            break;
        default:
            break;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions