News:

RIP GoReds

Main Menu

PHP RBI Stat extractor (and an editor question)

Started by Turd, 04/20/09, 01:40:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Turd

#20
Good to know.  Your code wasn't that hard to follow either, I did professional PHP development (and currently do C#) so the Perl translation was pretty easy to make...

Your idea for extracting ind. stats out of a movie is intriguing...far beyond my game hacking abilities at this time, but sounds interesting...

P.S. Nightwulf,  do you know if the starting pitcher is stored somewhere in the final save state? I envision if it is it's an index of 0-3 or something like that...for our league we require different SP's for each series game, and it'd be cool to have this show up on our box score...

Gantry

Glad to see this thread out there, as I too have been meaning to answer tecmoturd's email.  Welcome and keep up with this work!  Good to see some further development in this area...

Turd

Yes, sorry for hitting you from different angles, (email, PM, and posting on the forum). I just wasn't sure what method you guys would see, and I'm excited to take a break from Tecmo for a while and focus on my other favorite game.

Turd

Extractor available in first post.  I tried to write some notes inside the header of the class...if anyone has any trouble or has issues, please find me on AIM and I'd be glad to walk you through it.  There definitely could be errors, as this was written in about two evenings when I was up way later than I should have been :)

nightwulf

Quote from: tecmoturd on 04/21/09, 01:06:53 PM
P.S. Nightwulf,  do you know if the starting pitcher is stored somewhere in the final save state? I envision if it is it's an index of 0-3 or something like that...for our league we require different SP's for each series game, and it'd be cool to have this show up on our box score...

Technically, no. The current "away" pitcher data is stored at $0600-$060F, and the current "home" pitcher data at $0610-$061F (RAM offsets, obviously). Once a new pitcher is brought in, the data at that location is overwritten.

That said -- the game does need to keep track of starting pitcher usage because they can't be used in consecutive games. I've not looked for it yet, but somewhere in RAM there must be a flag to indicate that a pitcher can't be used in the next game. Unfortunately, that still doesn't help you if the player chooses a relief pitcher to start.

ultimate7

Quote from: nightwulf on 04/21/09, 10:37:46 PM
Unfortunately, that still doesn't help you if the player chooses a relief pitcher to start.

Everyone is just against Attez here aren't they
Quote from: Dårky on 11/02/10, 12:04:50 AM
The Raiders are a successful organization

Gantry

Quote from: tecmoturd on 04/21/09, 09:28:41 PM
Yes, sorry for hitting you from different angles, (email, PM, and posting on the forum). I just wasn't sure what method you guys would see, and I'm excited to take a break from Tecmo for a while and focus on my other favorite game.

Please do, I am pretty bad with getting back to people and nightwulf isn't on as much anymore.  So for something this RBI-relevant I'm glad you kept trying. 

nightwulf

Quote from: Gantry on 04/21/09, 11:01:51 PM
Please do, I am pretty bad with getting back to people and nightwulf isn't on as much anymore.  So for something this RBI-relevant I'm glad you kept trying. 

Who said I'm not around? Maybe I just haven't had anything to say since August ...

Turd

So what's considered a RP then, anyone in the 2-4 spot? In our league, we require you to start a #1 or #2 for each game, so if we just had the index for the starting pitcher at the beginning of the game, I could display that on our box score.  Not a huge deal, would just be cool...

TβG

Quote from: Nacho on 03/15/16, 10:17:08 AMWe've had babe drafts. We've had a sandwich draft. We can have our babes and eat sandwiches, too.

Turd

Awesome, perhaps what Nightwulf said would work, at least in our case. Maybe choosing a RP to start actually still puts that information in the rom, and the game ignores it if it isn't one of the SPs.  That'd be ideal...

BeefMaster

Quote from: tecmoturd on 04/22/09, 10:31:16 AM
Awesome, perhaps what Nightwulf said would work, at least in our case. Maybe choosing a RP to start actually still puts that information in the rom, and the game ignores it if it isn't one of the SPs.  That'd be ideal...

It depends on if you use more than one of the two SPs in the same game - the "SPs can't pitch in consecutive games" rule applies to any appearance, not just a start, so if you bring one of your SPs in as a reliever, both of them would show up in the "already pitched" list (or be flagged, or however the game stores that data).
"Nobody in football should be called a genius. A genius is a guy like Norman Einstein." - Joe Theismann

Turd


nightwulf

Here's how the pitcher thing works. Watch the following values in RAM:

0x0640 - 0x064F (away team)
0x0650 - 0x065F (home team)


The whole 0x064x line stores the current batting lineup for the away team, and 0x065x for the home team. The 16 values correspond to the 16 players on the team. For example, if you start a game as the away team choosing the first pitcher (pitcher 0), your lineup would look like this:

0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 09 00 00 00

Remember that team data in ROM is stored as the first eight players (the starters) followed by the four pinch hitters followed by the four pitchers. If you took out the first pitcher and picked the third (first reliever, pitcher 2), the lineup would change to:

0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 FF 00 09 00

Note that the pitcher you just removed had his lineup spot changed to 0xFF. This is a flag value used to indicate that that player is no longer available.

So, in your end-game save states you can read those values to determine which pitchers were used and the current pitcher (as of the game end). If you restrict your league play to one starting pitcher, you can tell which one was used, but not when.

Incidentally, you can also tell which batters were taken out of the lineup and which pinch hitters were used, but again without any information about who replaced who or when.

Turd


Turd

I assume 09 = the active pitcher? So, am I correct in the following?

SP2, relieved at some point by RP2:
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 00 FF 00 09

SP2, pitched whole game
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 09 00 00 00 (or would it be xFF'd at game's end because he couldn't be used, even though he was never subbed out)

RP1, relieved by SP1
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 09 00 00 00 (would RP1 be xFF'd or x00'd)

I should really have you show me how you found this stuff...might be a good time to learn how to use that debugger. I was always interested in doing so, just never been brave enough, or had a kind soul to assist me.

nightwulf

Maybe I should explain this better. Those 16 bytes (0x0640-0x064F) represent the 16 players on the away team. Each byte's value can represent one of three things:

00: the player is not currently in use, and is available to use
01-09: the player is currently in use, and the number represents his place in the batting order
FF: the player has been used and can no longer be used

So ...

Quote from: tecmoturd on 04/23/09, 08:56:25 AM
I assume 09 = the active pitcher?

Usually. Technically 09 would represent the player currently batting ninth. That would be the active pitcher the vast majority of the time. The only problem that comes to mind is a walk-off home run by a pinch hitter in the ninth spot. I'll need to try that tonight.

Quote from: tecmoturd on 04/23/09, 08:56:25 AM
SP2, relieved at some point by RP2:
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 00 FF 00 09

Yes.

Quote from: tecmoturd on 04/23/09, 08:56:25 AM
SP2, pitched whole game
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 09 00 00 00 (or would it be xFF'd at game's end because he couldn't be used, even though he was never subbed out)

No. The above would be pitcher 0 (first starting pitcher) remaining in the whole game. It wouldn't be FF if he was active the entire game, but I'm sure you realize that after I gave an explanation that made more sense.

Quote from: tecmoturd on 04/23/09, 08:56:25 AM
RP1, relieved by SP1
0x0640> 01 02 03 04 05 06 07 08 00 00 00 00 09 00 00 00 (would RP1 be xFF'd or x00'd)

No. RP1 relieved by SP1 would look like this:
0x064C> 09 00 FF 00
assuming no other pitchers were used.

Quote from: tecmoturd on 04/23/09, 08:56:25 AM
I should really have you show me how you found this stuff...might be a good time to learn how to use that debugger. I was always interested in doing so, just never been brave enough, or had a kind soul to assist me.

Step one is learning 6502.

Turd

That does make more sense. So to gather that SP1 was the starter:

09 00 00 00 (pitched the whole game)
or
FF in first slot and one of the remaining three slots would have the 09 (pitched and was subbed)

I also didn't realize that if you start an RP, he'd be unavailable to start the next game.  Interesting...I learn so much about the game I never knew when I was a kid...

Thanks for the explanation...

nightwulf

Quote from: tecmoturd on 04/23/09, 11:30:06 AM
That does make more sense. So to gather that SP1 was the starter:

09 00 00 00 (pitched the whole game)
or
FF in first slot and one of the remaining three slots would have the 09 (pitched and was subbed)

Sure. To be specific, I'd say "0x064C is non-zero and 0x064D is zero." Pitcher 0 was used, pitcher 1 was not. Within the rules of your league (one SP per game), that would hold true.

Quote from: tecmoturd on 04/23/09, 11:30:06 AM
I also didn't realize that if you start an RP, he'd be unavailable to start the next game.  Interesting...I learn so much about the game I never knew when I was a kid...

The RPs can always start. By "not available," I mean available within that game, not the series. A used RP is not available to pitch in a single game once they've been used, but they can always pitch the next.

Turd

I was just about to say, what if you subbed in the second SP...but you're right, that violates our league rules.

Just for educational purposes, wouldn't that situation look like:

FF 09 00 00

This will be good. Now I can display the SP for the game on the box score. Booyah.