PKSM icon indicating copy to clipboard operation
PKSM copied to clipboard

Rewrite PKSM Bridge protocol to support dynamic file size.

Open mrhappyasthma opened this issue 3 years ago • 8 comments

This commit introduces the PKSM Bridge Protocol (v1), which is a simple protocol on top of the TCP connection to allow for future changes through versioning and transmitting dynamic file sizes.

NOTE: This commit adds new strings. I just put them all in english for now. I'll need assistance from the community to translate them all into the respective languages.

This logic will also need to be brought to Checkpoint, which will be proposed separately.

The pksmbridge_api and pksmbridge_tcp files are generic and could benefit from being pulled into their own dependency repo. Otherwise similar logic needs to be implemented across any clients that want to send/receive files using the same protocol.

TESTED: Tested using this build of PKSM and a build of Checkpoint (for Switch) using the same protocol files. Sent across Pokemon Sword, modified the boxes and sent it back. Then I confirmed that the pokemon were updated at both ends of the round-trip.

mrhappyasthma avatar Jun 20 '22 22:06 mrhappyasthma

Finally revived this after the long disruption that as COVID.

Please let me know what feedback and thoughts people have. I'm open to changes and suggestions.

Thanks!

mrhappyasthma avatar Jun 20 '22 22:06 mrhappyasthma

Hi! I really like the way this seems to work, abstracting all of that away. I have one major follow-up question: would you happen to have a way to make this interruptible from the receiving end? The way it currently works is by completely blocking on the PKSM side, which isn't very user-friendly. If not, this is still a great upgrade from the previous version, and thank you so much for it. Also, don't worry about the conflicts, I should be able to handle that myself

piepie62 avatar Sep 12 '22 20:09 piepie62

I haven't looked into it, but I don't see why it wouldn't be possible. (I think a nice progress bar would also go a long way. Right now you're just locked up until it either fails or completes after some time.)

I'm still fairly new to 3DS programming, but I'm happy to look into it.

Would you prefer to roll that up in to this PR? Or to handle that as a subsequent improvement?

mrhappyasthma avatar Sep 15 '22 19:09 mrhappyasthma

The 3DS side can be easily handled; I'm thinking providing a "should cancel" and a "report progress" callback should be sufficient? I just have no idea how to do non-blocking socket reads

piepie62 avatar Sep 15 '22 20:09 piepie62

If I understand correctly, select allows for checking if there's data to read and setting a timeout. I haven't tried it, so I might be wrong in that it can't do that or that it's not available on 3DS.

SNBeast avatar Sep 16 '22 22:09 SNBeast