ICCA - set idle status code to 0x04 - [merged] #111

Closed
opened 2019-11-12 02:48:50 +03:00 by icex2 · 25 comments
icex2 commented 2019-11-12 02:48:50 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 12, 2019, 24:48

Merges sdvx-tyfp -> master

Stops SDVX hanging at the thankyou for playing screen

This matches what ACrealIO does.

Fixes #21

In GitLab by @darkstar on Nov 12, 2019, 24:48 _Merges sdvx-tyfp -> master_ Stops SDVX hanging at the thankyou for playing screen This matches what ACrealIO does. Fixes #21
icex2 commented 2019-11-12 03:17:57 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 12, 2019, 01:17

Not sure what determines whether the status code 1 or 4 should be returned and I don't have access to any real hardware to see what it does.

Tested this change on SDVX 4, IIDX23, IIDX26

Presumably bemanitools v4 did this too though I've no idea why its different in v5, whether the change was intentional and whether changing it like this will break anything else.

In GitLab by @darkstar on Nov 12, 2019, 01:17 Not sure what determines whether the status code 1 or 4 should be returned and I don't have access to any real hardware to see what it does. Tested this change on SDVX 4, IIDX23, IIDX26 Presumably bemanitools v4 did this too though I've no idea why its different in v5, whether the change was intentional and whether changing it like this will break anything else.
icex2 commented 2019-11-12 20:21:57 +03:00 (Migrated from github.com)

This is great. I am curious, how did you figure this out?

I would like to get this tested at least on IIDX13 as well because this was one of the first games introducing the old slotted reader and ACIO. The acio client implementation was more likely to fail with errors on IIDX13 though everything was fine on newer versions.

Afaik, bemanitools 4 used a re-implementation of the higher level acio library functions and did not implement its hooks on the acio protocol level. Therefore, this source of error was not even possible there.

This is great. I am curious, how did you figure this out? I would like to get this tested at least on IIDX13 as well because this was one of the first games introducing the old slotted reader and ACIO. The acio client implementation was more likely to fail with errors on IIDX13 though everything was fine on newer versions. Afaik, bemanitools 4 used a re-implementation of the higher level acio library functions and did not implement its hooks on the acio protocol level. Therefore, this source of error was not even possible there.
icex2 commented 2019-11-12 21:27:19 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 12, 2019, 19:27

After a while reading and debugging and seeing that it basically intercepts the calls which would go through the serial port, I wanted to compare it to what actual hardware would do. Not having any actual hardware, I compared it with what ACrealIO would do and saw that it returns a 4 rather than 1 when no card is present.

I tried that change and found it worked.

In GitLab by @darkstar on Nov 12, 2019, 19:27 After a while reading and debugging and seeing that it basically intercepts the calls which would go through the serial port, I wanted to compare it to what actual hardware would do. Not having any actual hardware, I compared it with what ACrealIO would do and saw that it returns a `4` rather than `1` when no card is present. I tried that change and found it worked.
icex2 commented 2019-11-12 22:02:17 +03:00 (Migrated from github.com)

In GitLab by @xyen on Nov 12, 2019, 20:02

Ahhhhh so that's what it was. I was planning on taking a look once I got access to my cab again, but this makes sense, nice catch.

Echoing what icex2 said, BT4 doesn't emulate the device itself which is why this is a "new" issue.

Another thing to note is that ACrealIO actually set it to 1 when using old readers, (which, given the emulation code, is how the old slotted readers actually responded), so it'd be best to change the response based on what kinda reader is detected.

Basically, add the new enum as AC_IO_ICCA_STATUS_IDLE_NEW, and change line 321 to:

        if (icca->detected_new_reader) {
            body->status_code = AC_IO_ICCA_STATUS_IDLE_NEW;
        } else {
            body->status_code = AC_IO_ICCA_STATUS_IDLE;
        }
In GitLab by @xyen on Nov 12, 2019, 20:02 Ahhhhh so that's what it was. I was planning on taking a look once I got access to my cab again, but this makes sense, nice catch. Echoing what icex2 said, BT4 doesn't emulate the device itself which is why this is a "new" issue. Another thing to note is that ACrealIO actually set it to `1` when using old readers, (which, given the emulation code, is how the old slotted readers actually responded), so it'd be best to change the response based on what kinda reader is detected. Basically, add the new enum as AC_IO_ICCA_STATUS_IDLE_NEW, and change line 321 to: ```cpp if (icca->detected_new_reader) { body->status_code = AC_IO_ICCA_STATUS_IDLE_NEW; } else { body->status_code = AC_IO_ICCA_STATUS_IDLE; } ```
icex2 commented 2019-11-12 22:07:10 +03:00 (Migrated from github.com)

@xyen's proposal is important to have the code running as either slotted or wave pass reader as far as I can tell by looking at the code? Just a minor nit here to make this part clear in the future: name the "detected_new_reader" flag to "detected_wave_pass_reader" as there are also other reader types like ICCB, ICCC (?) which I would have considered as a "new" reader. The ICCA type is kinda mixed here and, to me, caused quite some confusion in the past already.

@xyen's proposal is important to have the code running as either slotted or wave pass reader as far as I can tell by looking at the code? Just a minor nit here to make this part clear in the future: name the "detected_new_reader" flag to "detected_wave_pass_reader" as there are also other reader types like ICCB, ICCC (?) which I would have considered as a "new" reader. The ICCA type is kinda mixed here and, to me, caused quite some confusion in the past already.
icex2 commented 2019-11-12 22:13:15 +03:00 (Migrated from github.com)

In GitLab by @xyen on Nov 12, 2019, 20:13

So ICCB being treated differently is actually kinda a lie, it's that jubeat talks to the reader slightly differently, realistically icca should be renamed / split into iccx-slotted and iccx-wavepass or something, and iccb to iccx-jubeat or merged into iccx-wavepass.

ICCA/B/C all support the same messages from what I can tell. (the SDVX cab I have in fact, has an ICCB, that is talked to as listed as we emulate ICCA, but with encryption on).

In GitLab by @xyen on Nov 12, 2019, 20:13 So ICCB being treated differently is actually kinda a lie, it's that jubeat talks to the reader slightly differently, realistically icca should be renamed / split into iccx-slotted and iccx-wavepass or something, and iccb to iccx-jubeat or merged into iccx-wavepass. ICCA/B/C all support the same messages from what I can tell. (the SDVX cab I have in fact, has an ICCB, that is talked to as listed as we emulate ICCA, but with encryption on).
icex2 commented 2019-11-12 22:13:58 +03:00 (Migrated from github.com)

In GitLab by @xyen on Nov 12, 2019, 20:13

@icex2 I'd leave the naming as-is for now, and just request the change to returning different statuses based on detected type.

In GitLab by @xyen on Nov 12, 2019, 20:13 @icex2 I'd leave the naming as-is for now, and just request the change to returning different statuses based on detected type.
icex2 commented 2019-11-12 22:21:15 +03:00 (Migrated from github.com)

Oh, interesting. That sounds like the whole acio card reader related would need some slight refactoring to split this nicely (with some shared/duplicate code).
Yeah, then leave the naming as it does not solve the root issue we are facing with properly seperating this. Just have the branch to reply with a different status code for now.
I just opened an issue to keep that documented: #38

Oh, interesting. That sounds like the whole acio card reader related would need some slight refactoring to split this nicely (with some shared/duplicate code). Yeah, then leave the naming as it does not solve the root issue we are facing with properly seperating this. Just have the branch to reply with a different status code for now. I just opened an issue to keep that documented: #38
icex2 commented 2019-11-13 01:27:56 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 12, 2019, 23:27

added 1 commit

  • dceb763b - ICCA - set idle status code to 0x04 for wavepass readers

Compare with previous version

In GitLab by @darkstar on Nov 12, 2019, 23:27 added 1 commit <ul><li>dceb763b - ICCA - set idle status code to 0x04 for wavepass readers</li></ul> [Compare with previous version](/djhackers/bemanitools/merge_requests/10/diffs?diff_id=1072&start_sha=13282c0d1ff16792b8883f131cf33295b6d17bd8)
icex2 commented 2019-11-13 01:30:42 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 12, 2019, 23:30

added 1 commit

  • 8288d1f8 - ICCA - set idle status code to 0x04 for new readers

Compare with previous version

In GitLab by @darkstar on Nov 12, 2019, 23:30 added 1 commit <ul><li>8288d1f8 - ICCA - set idle status code to 0x04 for new readers</li></ul> [Compare with previous version](/djhackers/bemanitools/merge_requests/10/diffs?diff_id=1073&start_sha=dceb763b0f1d59ad53bd57f0ef99621f583e8578)
icex2 commented 2019-11-13 01:33:07 +03:00 (Migrated from github.com)

Same here, formatting.

Same here, formatting.
icex2 commented 2019-11-13 01:33:15 +03:00 (Migrated from github.com)

The formatting is broken. Please fix this by using 4 spaces as one tab. You can also just run clang-format with the included formatter file, e.g. make clang-format.

The formatting is broken. Please fix this by using 4 spaces as one tab. You can also just run clang-format with the included formatter file, e.g. make clang-format.
icex2 commented 2019-11-13 02:15:31 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 24:15

Ah rats, sorry, I'll fix that.

In GitLab by @darkstar on Nov 13, 2019, 24:15 Ah rats, sorry, I'll fix that.
icex2 commented 2019-11-13 03:53:20 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 01:53

Commented on src/main/acioemu/icca.c line 35

changed this line in version 4 of the diff

In GitLab by @darkstar on Nov 13, 2019, 01:53 Commented on [src/main/acioemu/icca.c line 35](https://github.com/djhackersdev/bemanitools/compare/6da3732968a35ea192df8fb174ed93602a2a16ba..8288d1f828c73b5deb973464dfb2e8e1f829f99b#diff-affab87058fe7f10f8cdc694a83c62e0R35) changed this line in [version 4 of the diff](/djhackers/bemanitools/merge_requests/10/diffs?diff_id=1074&start_sha=8288d1f828c73b5deb973464dfb2e8e1f829f99b#afe0e349cab0b6e39bf4435fdcb044da5be5b82e_35_35)
icex2 commented 2019-11-13 03:53:20 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 01:53

Commented on src/main/acioemu/icca.c line 323

changed this line in version 4 of the diff

In GitLab by @darkstar on Nov 13, 2019, 01:53 Commented on [src/main/acioemu/icca.c line 323](https://github.com/djhackersdev/bemanitools/compare/6da3732968a35ea192df8fb174ed93602a2a16ba..8288d1f828c73b5deb973464dfb2e8e1f829f99b#diff-affab87058fe7f10f8cdc694a83c62e0R323) changed this line in [version 4 of the diff](/djhackers/bemanitools/merge_requests/10/diffs?diff_id=1074&start_sha=8288d1f828c73b5deb973464dfb2e8e1f829f99b#afe0e349cab0b6e39bf4435fdcb044da5be5b82e_323_322)
icex2 commented 2019-11-13 03:53:20 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 01:53

added 1 commit

  • fd9b8439 - Stop SDVX hanging on thankyou for playing

Compare with previous version

In GitLab by @darkstar on Nov 13, 2019, 01:53 added 1 commit <ul><li>fd9b8439 - Stop SDVX hanging on thankyou for playing</li></ul> [Compare with previous version](/djhackers/bemanitools/merge_requests/10/diffs?diff_id=1074&start_sha=8288d1f828c73b5deb973464dfb2e8e1f829f99b)
icex2 commented 2019-11-13 04:00:41 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 02:00

Just spent a while working out why my fix didn't work any more. Turns out that when I was undoing all my debugging and experiements to get it ready to merge, I'd undone another important part. I assume I must have messed up when I tested the final code.

In addition to changing the idle status code, I'd also hard coded keypad_status to 0x03, even if keypad_started wasn't set.

From my log file, it looks like SDVX4 doesn't ever send the AC_IO_ICCA_CMD_BEGIN_KEYPAD command so this flag is never set.

Given the feedback on the first change, I've also limited the second change to when the detected_new_reader flag is set.

Both changes are required, neither alone is sufficient.

In GitLab by @darkstar on Nov 13, 2019, 02:00 Just spent a while working out why my fix didn't work any more. Turns out that when I was undoing all my debugging and experiements to get it ready to merge, I'd undone another important part. I assume I must have messed up when I tested the final code. In addition to changing the idle status code, I'd also hard coded `keypad_status` to `0x03`, even if `keypad_started` wasn't set. From my log file, it looks like SDVX4 doesn't ever send the `AC_IO_ICCA_CMD_BEGIN_KEYPAD` command so this flag is never set. Given the feedback on the first change, I've also limited the second change to when the `detected_new_reader` flag is set. Both changes are required, neither alone is sufficient.
icex2 commented 2019-11-13 04:01:40 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 02:01

Commented on src/main/acioemu/icca.c line 35

Now fixed

In GitLab by @darkstar on Nov 13, 2019, 02:01 Commented on [src/main/acioemu/icca.c line 35](https://github.com/djhackersdev/bemanitools/compare/6da3732968a35ea192df8fb174ed93602a2a16ba..8288d1f828c73b5deb973464dfb2e8e1f829f99b#diff-affab87058fe7f10f8cdc694a83c62e0R35) Now fixed
icex2 commented 2019-11-13 04:01:45 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 02:01

resolved all threads

In GitLab by @darkstar on Nov 13, 2019, 02:01 resolved all threads
icex2 commented 2019-11-13 04:01:45 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 02:01

Commented on src/main/acioemu/icca.c line 323

Fixed

In GitLab by @darkstar on Nov 13, 2019, 02:01 Commented on [src/main/acioemu/icca.c line 323](https://github.com/djhackersdev/bemanitools/compare/6da3732968a35ea192df8fb174ed93602a2a16ba..8288d1f828c73b5deb973464dfb2e8e1f829f99b#diff-affab87058fe7f10f8cdc694a83c62e0R323) Fixed
icex2 commented 2019-11-13 04:04:21 +03:00 (Migrated from github.com)

In GitLab by @darkstar on Nov 13, 2019, 02:04

Oh, and I've tested this change against IIDX(13,23,26) and SDVX(3,4)

In GitLab by @darkstar on Nov 13, 2019, 02:04 Oh, and I've tested this change against IIDX(13,23,26) and SDVX(3,4)
icex2 commented 2019-11-13 16:56:20 +03:00 (Migrated from github.com)

In GitLab by @xyen on Nov 13, 2019, 14:56

merged

In GitLab by @xyen on Nov 13, 2019, 14:56 merged
icex2 commented 2019-11-13 16:56:27 +03:00 (Migrated from github.com)

In GitLab by @xyen on Nov 13, 2019, 14:56

lgtm, merging.

In GitLab by @xyen on Nov 13, 2019, 14:56 lgtm, merging.
icex2 commented 2019-11-14 00:01:39 +03:00 (Migrated from github.com)

Well done @darkstar, thanks a lot for the fix.

Well done @darkstar, thanks a lot for the fix.
icex2 commented 2021-03-17 02:26:00 +03:00 (Migrated from github.com)

In GitLab by @xyen on Mar 17, 2021, 24:26

So, when I was testing out the wavepass readers for aciodrv, it turns out the status codes mean something slightly different for them:
1 - BUSY
2 - UID READY
4 - IDLE (or no card read)

This explains why the game gets stuck probably, as it probably thinks the reader is stuck trying to poll a card.

In GitLab by @xyen on Mar 17, 2021, 24:26 So, when I was testing out the wavepass readers for aciodrv, it turns out the status codes mean something slightly different for them: 1 - BUSY 2 - UID READY 4 - IDLE (or no card read) This explains why the game gets stuck probably, as it probably thinks the reader is stuck trying to poll a card.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Max/djhackersdev_bemanitools#111