diff --git a/duel_build.py b/duel_build.py index 5303085..5cc43ba 100644 --- a/duel_build.py +++ b/duel_build.py @@ -85,7 +85,7 @@ typedef uint32 (*card_reader)(uint32, struct card_data*); void set_card_reader(card_reader f); typedef byte* (*script_reader)(const char*, int*); -typedef uint32 (*message_handler)(void*, uint32); +typedef uint32 (*message_handler)(intptr_t, uint32); extern "Python" uint32 message_handler_callback (void *, int32); void set_message_handler(message_handler f); extern "Python" byte *script_reader_callback(const char *, int *); @@ -95,7 +95,7 @@ void end_duel(ptr pduel); void get_log_message(ptr pduel, byte* buf); int32 get_message(ptr pduel, byte* buf); -int32 process(ptr pduel); +uint32 process(ptr pduel); void new_card(ptr pduel, uint32 code, uint8 owner, uint8 playerid, uint8 location, uint8 sequence, uint8 position); void new_tag_card(ptr pduel, uint32 code, uint8 owner, uint8 location); void set_player_info(ptr pduel, int32 playerid, int32 lp, int32 startcount, int32 drawcount); diff --git a/ygo/utils.py b/ygo/utils.py index dc3b279..828d0d9 100644 --- a/ygo/utils.py +++ b/ygo/utils.py @@ -13,6 +13,9 @@ except ImportError: DUEL_AVAILABLE = False +PROCESSOR_FLAG = 0xf0000000 +PROCESSOR_END = 0x20000000 + def parse_lflist(filename): lst = {} @@ -36,9 +39,10 @@ def parse_lflist(filename): def process_duel(d): while d.started: res = d.process() - if res & 0x20000: + flag = res & PROCESSOR_FLAG + if flag & PROCESSOR_END: break - elif res & 0x10000 and res != 0x10000: + elif flag & 0x10000000 and res != 0x10000000: if d.keep_processing: d.keep_processing = False continue