少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#pragma once
#include "../CommonDef.h"
#include "../metadata/MetadataDef.h"
 
namespace hybridclr
{
    namespace interpreter
    {
 
        // from obj or arg
        enum class LocationDataType
        {
            I1,
            U1,
            I2,
            U2,
            U8,
            S_N,  // struct size = 3,5,6,7, > 8, size is described by stackObjectSize
        };
 
        union StackObject
        {
            uint64_t __u64;
            void* ptr; // can't adjust position. will raise native_invoke init args bugs.
            bool b;
            int8_t i8;
            uint8_t u8;
            int16_t i16;
            uint16_t u16;
            int32_t i32;
            uint32_t u32;
            int64_t i64;
            uint64_t u64;
            float f4;
            double f8;
            Il2CppObject* obj;
            Il2CppString* str;
            Il2CppObject** ptrObj;
        };
 
        static_assert(sizeof(StackObject) == 8, "requrie 8 bytes");
 
 
        enum class ExceptionFlowType
        {
            Exception,
            Catch,
            Leave,
        };
 
        struct InterpMethodInfo;
 
        struct ExceptionFlowInfo
        {
            ExceptionFlowType exFlowType;
            int32_t throwOffset;
            Il2CppException* ex;
            int32_t nextExClauseIndex;
            int32_t leaveTarget;
        };
 
        struct InterpFrame
        {
            const InterpMethodInfo* method;
            StackObject* stackBasePtr;
            int32_t oldStackTop;
            void* ret;
            byte* ip;
 
            ExceptionFlowInfo* exFlowBase;
            int32_t exFlowCount;
            int32_t exFlowCapaticy;
 
            int32_t oldLocalPoolBottomIdx;
 
            ExceptionFlowInfo* GetCurExFlow() const
            {
                return exFlowCount > 0 ? exFlowBase + exFlowCount - 1 : nullptr;
            }
 
            ExceptionFlowInfo* GetPrevExFlow() const
            {
                return exFlowCount > 1 ? exFlowBase + exFlowCount - 2 : nullptr;
            }
        };
 
        struct InterpExceptionClause
        {
            metadata::CorILExceptionClauseType flags;
            int32_t tryBeginOffset;
            int32_t tryEndOffset;
            int32_t handlerBeginOffset;
            int32_t handlerEndOffset;
            int32_t filterBeginOffset;
            Il2CppClass* exKlass;
        };
 
        struct MethodArgDesc
        {
            LocationDataType type;
            uint32_t stackObjectSize;
            bool passbyValWhenInvoke;
        };
 
        struct InterpMethodInfo
        {
            const MethodInfo* method;
            MethodArgDesc* args;
            uint32_t argCount;
            uint32_t argStackObjectSize;
            byte* codes;
            uint32_t codeLength;
            uint32_t maxStackSize; // args + locals + evalstack size
            uint32_t localVarBaseOffset;
            uint32_t evalStackBaseOffset;
            uint32_t localStackSize; // args + locals StackObject size
            std::vector<uint64_t> resolveDatas;
            std::vector<InterpExceptionClause*> exClauses;
            bool initLocals;
        };
    }
}