isledecomp / isle

A work-in-progress decompilation of LEGO Island (1997)
1.78k stars 89 forks source link

Beta match* MxStreamer #1099

Closed disinvite closed 2 months ago

disinvite commented 2 months ago
if (find(m_controllers.begin(), m_controllers.end(), p_stream) == m_controllers.end()) {
    m_controllers.push_back(p_stream);
    return SUCCESS;
}

This is closer to what we have in the assembly; if we know we reached the end of the list without a match, skip straight to the push_back call. With find broken out to match the beta, the jump distance is a little off, but I don't think it will present a problem because we are just checking against end() twice. I didn't test so hopefully this is the case!

                     LAB_1008e75d                                    XREF[1]:     1008e746(j)  
1008e75d c7 45 cc        MOV        dword ptr [EBP + local_38],0x0
1008e764 8d 45 cc        LEA        EAX=>local_38,[EBP + -0x34]
1008e767 89 45 c0        MOV        dword ptr [EBP + local_44],EAX
1008e76a 8b 45 c0        MOV        EAX,dword ptr [EBP + local_44]
1008e76d 50              PUSH       EAX
1008e76e 8b 4d 08        MOV        this,dword ptr [EBP + param_1]
1008e771 e8 2b 5f        CALL       thunk_FUN_1007dc20
         f7 ff

I marked where this should go once we figure it out, or maybe someone has an idea now.