Skip to content

Commit

Permalink
Support new ygopro core
Browse files Browse the repository at this point in the history
The new core starting from 16c4d4b255aebafcb76763ea627d5bd302ac636d has a different API.
  • Loading branch information
tspivey committed Mar 17, 2024
1 parent f8e6b98 commit f1a8c55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions duel_build.py
Expand Up @@ -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 *);
Expand All @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions ygo/utils.py
Expand Up @@ -13,6 +13,9 @@
except ImportError:
DUEL_AVAILABLE = False

PROCESSOR_FLAG = 0xf0000000
PROCESSOR_END = 0x20000000

def parse_lflist(filename):

lst = {}
Expand All @@ -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
Expand Down

0 comments on commit f1a8c55

Please sign in to comment.