summaryrefslogtreecommitdiff
path: root/src/SSystem/SComponent/c_phase.cpp
blob: cff68d70960d3d746678b4abb44fba937b3954f5 (plain)
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
//
// Generated by dtk
// Translation Unit: c_phase.cpp
//

#include "SSystem/SComponent/c_phase.h"
#include "dolphin/types.h"

/* 802451B4-802451C0       .text cPhs_Reset__FP30request_of_phase_process_class */
void cPhs_Reset(request_of_phase_process_class* pPhase) {
    pPhase->id = 0;
}

/* 802451C0-802451D0       .text cPhs_Set__FP30request_of_phase_process_classPPFPv_i */
void cPhs_Set(request_of_phase_process_class* pPhase, cPhs__Handler* pHandlerTable) {
    pPhase->mpHandlerTable = pHandlerTable;
    pPhase->id = 0;
}

/* 802451D0-802451F8       .text cPhs_UnCompleate__FP30request_of_phase_process_class */
void cPhs_UnCompleate(request_of_phase_process_class* pPhase) {
    pPhase->mpHandlerTable = NULL;
    cPhs_Reset(pPhase);
}

/* 802451F8-80245208       .text cPhs_Compleate__FP30request_of_phase_process_class */
cPhs_State cPhs_Compleate(request_of_phase_process_class* pPhase) {
    pPhase->mpHandlerTable = NULL;
    return cPhs_COMPLEATE_e;
}

/* 80245208-80245268       .text cPhs_Next__FP30request_of_phase_process_class */
cPhs_State cPhs_Next(request_of_phase_process_class* pPhase) {
    if (const cPhs__Handler* handlerTable = pPhase->mpHandlerTable) {
        pPhase->id++;
        cPhs__Handler handler = handlerTable[pPhase->id];

        // Double null check here actually matters for emitted assembly.
        // Wee old compilers.
        if (handler == NULL || handler == NULL) {
            return cPhs_Compleate(pPhase);
        } else {
            return cPhs_LOADING_e;
        }
    }

    return cPhs_COMPLEATE_e;
}

/* 80245268-8024533C       .text cPhs_Do__FP30request_of_phase_process_classPv */
cPhs_State cPhs_Do(request_of_phase_process_class* pPhase, void* pUserData) {
    cPhs__Handler * handler = pPhase->mpHandlerTable;

    if (handler) {
        handler += pPhase->id;
        int newStep = (*handler)(pUserData);

        switch (newStep) {
        case cPhs_LOADING_e:
            return cPhs_Next(pPhase);
        case cPhs_NEXT_e:
            return cPhs_Next(pPhase) == cPhs_LOADING_e ? cPhs_NEXT_e : cPhs_COMPLEATE_e;
        case cPhs_COMPLEATE_e:
            return cPhs_Compleate(pPhase);
        case cPhs_STOP_e:
            cPhs_UnCompleate(pPhase);
            return cPhs_STOP_e;
        case cPhs_ERROR_e:
            cPhs_UnCompleate(pPhase);
            return cPhs_ERROR_e;
        case cPhs_INIT_e:
        default:
            return newStep;
        }
    }
    
    return cPhs_Compleate(pPhase);
}

/* 8024533C-80245364       .text cPhs_Handler__FP30request_of_phase_process_classPPFPv_iPv */
cPhs_State cPhs_Handler(request_of_phase_process_class* pPhase, cPhs__Handler* pHandlerTable,
                 void* pUserData) {
    pPhase->mpHandlerTable = pHandlerTable;
    return cPhs_Do(pPhase, pUserData);
}