Skip to content

Core: Use long commit hash instead of abbreviating#5307

Merged
neobrain merged 1 commit intoFEX-Emu:mainfrom
crueter:long-hash
Feb 26, 2026
Merged

Core: Use long commit hash instead of abbreviating#5307
neobrain merged 1 commit intoFEX-Emu:mainfrom
crueter:long-hash

Conversation

@crueter
Copy link
Copy Markdown
Collaborator

@crueter crueter commented Feb 13, 2026

Fixes #5230

Basically just stores it as an array of uint8_t.
Hopefully FEX never reaches SHA1 collisions so
this should (TM) never collide.

Signed-off-by: crueter crueter@eden-emu.dev

Comment thread FEXCore/Source/Interface/Core/CodeCache.cpp Outdated
@bylaws
Copy link
Copy Markdown
Collaborator

bylaws commented Feb 13, 2026

Will need accompanying proton changes

@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 13, 2026

Done, assuming you refer to the steam VERSIONS file

Comment thread CMakeLists.txt Outdated
Comment thread FEXCore/Source/Interface/Core/CodeCache.cpp Outdated
Comment thread CMakeLists.txt Outdated
Comment thread FEXCore/include/git_version.h.in Outdated
@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 13, 2026

A potentially notable edge case: odd-numbered hash lengths don't work here:

static constexpr std::array<uint8_t, 20> GIT_HASH = {0x12, 0x34, 0x56, a};

Could be solved by padding with a singular 0 if the length is odd?

@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 14, 2026

wait, could just use a list

@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 14, 2026

Okay, technically it isn't "correct" per se, but it's all I think is necessary for an edge case like this

static constexpr std::array<uint8_t, 20> GIT_HASH = {0x12, 0x34, 0x56, 0xa};

Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread FEXCore/Source/Interface/Core/CodeCache.cpp Outdated
Comment thread FEXCore/Source/Interface/Core/CodeCache.cpp
@neobrain
Copy link
Copy Markdown
Member

A potentially notable edge case: odd-numbered hash lengths don't work here:

What's the problem and how did you solve it?

@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 16, 2026

The previous problem was caused by implanting a 0x, every two positions, which ended up leaving a dangling letter/number at the end

To solve it, I just used ; to just construct a list and then use TRANSFORM and JOIN to convert it to an array-like initializer

...and now I solved it by adding another case in the regex for that. yay!

Copy link
Copy Markdown
Member

@neobrain neobrain left a comment

Choose a reason for hiding this comment

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

Just noting for reference that this should be tested on arm64 and that the unrelated changes should be confirmed functional as pointed out in my other comments.

@neobrain
Copy link
Copy Markdown
Member

Thanks, looks all good now - could you squash the patches together appropriately?

Fixes FEX-Emu#5230

Basically just stores it as an array of `uint8_t`, and automatically
pads it out to 24 bytes. Hopefully FEX never reaches SHA1 collisions so
this should (TM) never collide.

Note: I have no idea how fmt will handle that format string with an
array of uint8_t.

Signed-off-by: crueter <crueter@eden-emu.dev>
@crueter
Copy link
Copy Markdown
Collaborator Author

crueter commented Feb 26, 2026

done

Copy link
Copy Markdown
Member

@neobrain neobrain left a comment

Choose a reason for hiding this comment

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

Re-tested this against my WIP code caching patches, all working fine. Thanks again for picking this up!

@neobrain neobrain merged commit 6027247 into FEX-Emu:main Feb 26, 2026
13 checks passed
@crueter crueter deleted the long-hash branch February 26, 2026 20:02
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.

Code cache makes assumption about git short hash length being 8 characters.

3 participants