Fixed a problem with Boolean in CFunction::Call.#419
Conversation
|
Hmmm. Wouldn't this be a better solution? return object(CallHelper<bool>(dcCallChar, g_pCallVM, m_ulAddr));This would ensure we only read one byte, and that everything non-zero still evaluate to |
|
I would just properly configure DynCall. By default boolean is handled as int: |
|
Even better! Assuming it doesn't change the alignment when pushing arguments though. |
You're right, it was a bit of a thoughtless fix.
Now I see that this is the source of the problem. |
|
Ran some tests and it works. The arguments are also not affected because from memory import *
@Callback(Convention.CDECL, (DataType.INT, DataType.BOOL, DataType.INT, DataType.BOOL), DataType.BOOL)
def callback(stack_data):
assert tuple(stack_data) == (1, True, 2, False)
return False
assert not callback(1, True, 2, False)But now works as intended with this branch. |
When testing is_in_field_of_view(#417), the results were incorrect(#316), so I looked into it and found that the boolean was judging the whole value of eax (e.g. -27648 was True), which seems to be giving incorrect results.
I don't think this will break any existing plugins, but I can't be sure.
Test Code: