Providing current position of cursor while playing & Optimize key status #145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi maintainers, this is my first try on golang.
This pull request aims at providing current position of cursor while playing and optimize reading key status.
JSON changes
The
hitEvent
loads hit event frames from last UpdateTime to current time, about 7 to 15 frames.X
andY
is the position in game hit window, same as the replay frames in.osr
files.How I read
I read these data from game frame memory. This area of memory may have different signature pattern, so I doesn't uses pattern defination like
sig:"xx xx"
ormem:"[xx]"
to read.I just defined the signature in
resolveHitEventAddress()
function.When playing, frame count of hit event in memory increased following game time, while watching replay, the frames all loads to memory at the start.
So I maintain
var hitEventFrame []hitEvent
to tempory store frames. At every UpdateTime, it will decide which slice to return based on the current game time and the previous game time. Code at here.Optimize key status
When reading this part of memory, I found that the hit event frames in memory also records key status. This block of memory is next to cursor position.
So I removed previous way of reading key status and introduced a new way here btw.
Game Mode compatibility
X and Y position works in all modes.
0
, means pressed left side key,320
means none keys pressed,640
means pressed right side key.0
to512
.0101
or1111
in 4k.Also works either single and multiplayer mode.
More functions
hitEventFrame
just like this if-else branch, so maybe we can addPlayMode
field toGameplayValues
to show if player watching replay or playing.