Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.

Reading GameMaster file fails #17

@iBotPeaches

Description

@iBotPeaches

So I started with simply reading in a raw response dump like this.

$raw = fopen(public_path('item_templates/raw_rpc'), 'r');

$message = new ResponseEnvelope($raw);
$gamemaster = new DownloadItemTemplatesResponse($message->getReturnsList()[0]);

This fails with

Expected wire type 0 but got 2 for type 5.

With full stack of

in WireFormat.php line 77
at WireFormat::assertWireType('2', '5') in BadgeSettings.php line 325
at BadgeSettings->readFrom(object(ReadContext)) in ItemTemplate.php line 1062
at ItemTemplate->readFrom(object(ReadContext)) in DownloadItemTemplatesResponse.php line 333
at DownloadItemTemplatesResponse->readFrom(object(ReadContext)) in AbstractMessage.php line 29
at AbstractMessage->__construct(object(Stream)) in Controller.php line 25
at Controller->postIndex(object(Request))

I began investigating this, stepping through the file as it fails here - https://github.com/jaspervdm/pogoprotos-php/blob/master/src/POGOProtos/Settings/Master/BadgeSettings.php#L325

This corresponds to - https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Settings/Master/BadgeSettings.proto

message BadgeSettings {
    .POGOProtos.Enums.BadgeType badge_type = 1;
    int32 badge_rank = 2;
    repeated int32 targets = 3;
}

Is the datatype wrong or how should I be properly handling groups? The beginning of the file I'm reading is as follows.

➜  pokemongo-dumps git:(master) ✗ protoc --decode_raw < raw_rpc | more
1: 1
2: xxxx
6 {
  1: 6
  2 {
    1: 1
  }
}
100 { [DownloadItemTemplatesResponse]
  1: 1 [sucess]
  2 { [ItemTemplate]
    1: "BADGE_BATTLE_ATTACK_WON" [template_id]
    10 { [BadgeSettings]
      1: 13 [BadgeType]
      2: 4 [BadgeRank]
      3: "\nd\350\007" [Targets (repeated)]
    }
  }
....

So it reads success, template_id, badge_type and badge_rank, then fails on number 3 (targets).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions