Skip to content

reimplement: PathFindingState methods that are 100% - #266

Open
gynt wants to merge 2 commits into
mainfrom
reimpl/PathFindingState-100
Open

gynt wants to merge 2 commits into
mainfrom
reimpl/PathFindingState-100

Conversation

@gynt

@gynt gynt commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@TheRedDaemon
TheRedDaemon self-requested a review October 15, 2026 20:27
{
int* piVar2;
int iVar1 = 1;
piVar2 = &this->climbData[1].type;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you try to clean the loop and type access here?

Comment on lines +21 to +28
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
0x27420, '\0', (void*)((int)(DAT_TileMapState::instance.PathConnectionLayer)));
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
0x13a10, '\0', (void*)((int)(DAT_TileMapState::instance.PathLinkageLayer)));
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
0x27420, '\0', (void*)((int)(DAT_TileMapState::instance.CertainPathLayer)));
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
0x27420, '\0', (void*)((int)(DAT_TileMapState::instance.WalkLayer)));

@TheRedDaemon TheRedDaemon Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do these numbers have a meaning? Magic numbers?
If these are just the sizes of the objects, you can try sizeof, that also creates a relationship.

this->calculations = this->calculations + 1;
int _index = 0;
this->searchQueue.readIndex = 0;
if (this->searchQueue.writeIndex != 0) {

@TheRedDaemon TheRedDaemon Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same thing: Can you try to clean the loop?

Comment thread AGENTS.md
handwritten assembly the frame pointer says nothing about the optimisation level: reimplement the handwritten part as
inline asm and leave the rest at `/O2`. Checking the prologue settles it - values kept in registers across the entry
tests mean `/O2`. Taking the `/Od` reading instead took `findLinkageBasedPathOrWalkRadius` from 5.1% to 2.8%, where
the same body without the pragma reaches 49.2%. When it really is `/Od`, add `#pragma optimize(, off)`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you had a case that needed \Od?

return;
}
this->searchQueue.readIndex = this->searchQueue.readIndex + 1;
if (0x13a10 <= (int)this->searchQueue.readIndex) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Magic number again?

This branch has not been deployed

No deployments
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