Skip to content

Parse trainer data from save file#76

Open
NotToDisturb wants to merge 1 commit intokuroppoi:masterfrom
NotToDisturb:master
Open

Parse trainer data from save file#76
NotToDisturb wants to merge 1 commit intokuroppoi:masterfrom
NotToDisturb:master

Conversation

@NotToDisturb
Copy link

The PGL profile displayed values like badges and the played time which are currently not parsed by entralinked.

This PR adds those alongside a bunch of other interesting values:

  • Trainer name
  • Trainer ID
  • Secret ID
  • Country
  • Region
  • Gender
  • Adventure time
  • Adventure start date
  • Money
  • Gym badges

Pending testing with the BW2 games.

@kuroppoi
Copy link
Owner

Looks good, I might ditch the web page in favor of an in-app GUI and display the information there.

Comment on lines 24 to 46
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realistically it probably won't ever cause problems, but you might want to release buffer when you're done with it:

if(!buffer.release()) {
logger.warn("Buffer was not deallocated!");
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally forgot, will change.

This won't cause issues for "personal" setups, but if the plan is to have multiple users (which it is) it could add up.

Comment on lines +28 to +32
public long skipTo(long n) throws IOException {
return skip(n - pointer);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious -- what happens if n - pointer is less than zero? I don't think you can go backwards in an input stream.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DIdn't bother to check but I imagine it throws the IOException. Will check.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually nevermind, it just won't move according to the implementation of skip in InputStream:

public long skip(long n) throws IOException {
        long remaining = n;
        int nr;

        if (n <= 0) {
            return 0;
        }

@NotToDisturb
Copy link
Author

I have the changes made locally, pending testing.
I also made a correction in the offset for the adventure start time, I had copied the sub offset was wrong while refactoring.

NotToDisturb added a commit to NotToDisturb/entralinked that referenced this pull request Dec 13, 2024
@kuroppoi
Copy link
Owner

Sorry, I've been meaning to take a look at this but have been a little busy lately.
Hopefully I'll be able to test it sometime in the coming weeks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think pointer should be static here :P

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is 100% wrong. Pretty funny oversight not gonna lie lol.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw I still haven't changed this lol.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on B2W2 and it seems that money & badges are stored at a different location.
Everything else seems to check out, though!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I'll look into making the change for B2W2, do you have a savefile I can test this with?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Project Pokémon has save files that are useful for testing :)

@kuroppoi
Copy link
Owner

kuroppoi commented Apr 5, 2025

I recently overhauled the UI & figured it might be cool to expand the summary page and display interesting info about the player there :)

NotToDisturb added a commit to NotToDisturb/entralinked that referenced this pull request Jul 29, 2025
@NotToDisturb
Copy link
Author

NotToDisturb commented Jul 29, 2025

Hey! Pushed a rebase to address the conflicts, but still haven't tested anything in BW2. Thanks for the pointer to Project Pokemon, let's see if I have some time tomorrow.

I wanna take a look at that new UI, but I think adding these should be a part of a new PR just so it doesn't get too big. Thoughts?

NotToDisturb added a commit to NotToDisturb/entralinked that referenced this pull request Jul 30, 2025
@NotToDisturb
Copy link
Author

Tested with a Black 2 save, these changes parse the data correctly.

Fortunately a very minor change, and the offset was already documented here.

@NotToDisturb
Copy link
Author

Realized I rebased PkmnInfoReader back to savefile, this fixes it and squashes the commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments