kebabtent / pogoprotos-php

Compiled PHP protobufs for pokemon go
MIT License
22 stars 8 forks source link

Switch to different PHP generator? #8

Closed jaspervdm closed 8 years ago

jaspervdm commented 8 years ago

Currently we are using bramp/protoc-gen-php to generate the PHP files. However, there seem to be many issues with this. Maybe we should consider using protobuf-php/protobuf instead, with protobuf-php/protobuf-plugin as generator. Any input on this is welcomed!

DrDelay commented 8 years ago

Looks like the dev of this is still active, what is good, but again (I start thinking I'm doing something wrong) I can't get it to work. If I execute the tool it gets stuck (it does not abort, just does nothing anymore) here. This is on a Windows environment, I can't test it on a Linux right now. Maybe you have more luck.

jaspervdm commented 8 years ago

I managed to compile a single proto file to PHP with it (on Linux), but didnt actually try to use it. I am going on holiday tomorrow, but when I get back I will look more into it.

jaspervdm commented 8 years ago

I made a new branch, test-protobuf, that contains all compiled PHP classes with protobuf-plugin. If you feel like it, you can test them. I compiled them with the compile.php which I included

EDIT: I did some preliminary testing. I managed to login and obtain the player profile with the new classes! Will use it more after my holiday

DrDelay commented 8 years ago

This looks very good, I only had to make some minor adjustments to get it working with the rest of my project, the biggest problem was that the "new" AuthTicket contains stream-ressources, so I have to do a fseek(..., 0) each time I used them, otherwise the next request fails. But I can manage that without changing things at your side.

Still, I have a problem with the PlayerData again :laughing: I had to wrap the result of readVarint here into \POGOProtos\Enums\TutorialState::valueOf() - the add-method expects a \Protobuf\Enum. I don't want to send a PR for this change because it should probably be generated correctly by the protobuf-plugin.

Enjoy your holiday.

DrDelay commented 8 years ago

Just to make this clear because I reference this issue a lot, the second problem of this is resolved. It was a bug in the protobuf-plugin and got fixed in protobuf-php/protobuf-plugin@2ef08223cf6bebc7aa211e4d8ad4782968dd0119.

jaspervdm commented 8 years ago

I merged the test-protobuf branch into master. Once we fix the license ( #16 ) we can tag it.