-
Notifications
You must be signed in to change notification settings - Fork 3
Reimpl/simple functions set 1 #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
gynt
wants to merge
19
commits into
main
Choose a base branch
from
reimpl/simple-functions-set-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1c19eea
reimplement: SHC_3BB0A8C1_0x00408EB0 100%
750cf5b
reimplement: SHC_3BB0A8C1_0x004092B0 100%
b18e206
reimplement: SHC_3BB0A8C1_0x0043FCA0 100%
847bb67
reimplement: SHC_3BB0A8C1_0x004ABD10 100%
5b4c923
reimplement: SHC_3BB0A8C1_0x00533090 100%
caab9a7
reimplement: SHC_3BB0A8C1_0x004BC620 100%
0ca4e69
reimplement: SHC_3BB0A8C1_0x00469860 100%
65674fa
reimplement: SHC_3BB0A8C1_0x00480570 100%
f90f999
reimplement: SHC_3BB0A8C1_0x00496E20 100%
9ff68e1
reimplement: SHC_3BB0A8C1_0x00424310 100%
56c355e
reimplement: SHC_3BB0A8C1_0x0043F2B0 100%
d32c9ac
reimplement: SHC_3BB0A8C1_0x004038A0 100%
8ab3b4f
reimplement: SHC_3BB0A8C1_0x0040BFD0 100%
b4278da
reimplement: SHC_3BB0A8C1_0x00434260 100%
a995a16
many 100%
159a497
remove __cdecl
2821de9
batch 2
482facf
repair vararg
0b76486
revert va_list
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #include "OpenSHC/AI/AICState.func.hpp" | ||
| #include "OpenSHC/Commands/MappersEnum.hpp" | ||
| #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_AIVState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace AI { | ||
|
|
||
| using OpenSHC::Commands::MappersEnum; | ||
| using OpenSHC::WindowsHelper::Enums::BOOLEnum; | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004ECA90 | ||
| BOOLEnum AICState::shouldNotBuildKillingPits(int playerID, MappersEnum commandBuildingType) | ||
| { | ||
| BOOLEnum _totalAbove99 = FALSE; | ||
| if (commandBuildingType == OpenSHC::Commands::M_MAPPER_KILLING_PIT) { | ||
| _totalAbove99 = 100 <= DAT_AIVState::instance.mapExtraInfo.playerTotalKillingPits[playerID]; | ||
| } | ||
| return _totalAbove99; | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #include "OpenSHC/AI/AIVState.func.hpp" | ||
| #include "OpenSHC/IO/LowLevelMemory.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace AI { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004EDC90 | ||
| void AIVState::clearTheHeatmaps() | ||
| { | ||
| MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( | ||
| 307200, '\0', (void*)((int)(this->heatMaps))); | ||
| } | ||
|
|
||
| } // namespace AI | ||
| } // namespace OpenSHC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include "OpenSHC/Audio/SFX.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Audio { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0044C400 | ||
| int SFX::ComputeCurrentPlayerRanking() | ||
| { | ||
| return MACRO_CALL(OpenSHC::Audio::SFX_Func::ComputePlayerRanking)( | ||
| DAT_GameSynchronyState::instance.currentPlayerSlotID); | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "OpenSHC/Game/GameCore.func.hpp" | ||
| #include "OpenSHC/UI/Enums/MenuViewType.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| using OpenSHC::UI::Enums::MenuViewType; | ||
| // FUNCTION: STRONGHOLDCRUSADER 0x0046B300 | ||
| void GameCore::setTabToSwitchTo() | ||
| { | ||
| if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU) { | ||
| this->secondaryActiveMenuTabToSwitchTo = this->buildmenuMenuTabToSwitchTo; | ||
| } | ||
| if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_MAP_EDITOR_LANDSCAPING) { | ||
| this->secondaryActiveMenuTabToSwitchTo.tabType = this->landscapingmenuMenuTabToSwitchTo; | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #include "OpenSHC/Game/GameCore.func.hpp" | ||
| #include "OpenSHC/UI/Enums/MenuViewType.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| using OpenSHC::UI::Enums::MenuViewType; | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0046B2F0 | ||
| void GameCore::setViewOnExitUnk() { this->currentMenuViewType = ((MenuViewType)2); } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "OpenSHC/Game/GameCore.func.hpp" | ||
| #include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0046B320 | ||
| void GameCore::swapBuildMenuTab() | ||
| { | ||
| if (this->buildmenuMenuTabToSwitchTo.tabType == OpenSHC::UI::Enums::BASMTT_SIEGETENT_SHIELD) { | ||
| this->buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_SIEGETENT_BATTERINGRAM; | ||
| return; | ||
| } | ||
| this->buildmenuMenuTabToSwitchTo = this->secondaryActiveMenuTabToSwitchTo; | ||
| } | ||
|
|
||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #include "OpenSHC/Game/GameStateStructures.func.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004586D0 | ||
| void GameStateStructures::activateTraderState() | ||
| { | ||
| this->mapAndTime.traderRelated2 = 2; | ||
| this->mapAndTime.traderRelatedCounter1 = 0; | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #include "OpenSHC/Game/GameStateStructures.func.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x00458890 | ||
| int GameStateStructures::getBatchBuyPrice(undefined4 playerID, int resourceType) | ||
| { | ||
| return this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice; | ||
| } | ||
|
|
||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include "OpenSHC/Game/GameStateStructures.func.hpp" | ||
| #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| using OpenSHC::WindowsHelper::Enums::BOOLEnum; | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004563B0 | ||
| BOOLEnum GameStateStructures::isFullIDEqualsToMinus1(int param_1) | ||
| { | ||
| return DAT_GameSynchronyState::instance.currentPlayerFullIDArray[param_1] == -1; | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #include "OpenSHC/Game/GameStateStructures.func.hpp" | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
|
|
||
|
|
||
|
|
||
| /* | ||
| decompilerscript: committed: 2025-01-30 21:57:43.216000 | ||
| */ | ||
|
|
||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004586F0 | ||
| void GameStateStructures::resetTraderState() | ||
|
|
||
| { | ||
| this->mapAndTime.traderRelated2 = 0; | ||
| this->mapAndTime.traderRelatedCounter1 = 0; | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include "OpenSHC/Globals/DAT_CurrentPlayerUnitLosses.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Game { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0044aa70 | ||
| void UpdateUnitValueLoss(int value) | ||
| { | ||
| if (0 < value) { | ||
| DAT_CurrentPlayerUnitLosses::instance += value; | ||
| } | ||
| } | ||
|
|
||
| } // namespace Game | ||
| } // namespace OpenSHC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include "OpenSHC/Global.func.hpp" | ||
| #include "OpenSHC/OS.func.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0045D060 | ||
| void Global::PrintToDestination(wchar_t* destination, wchar_t* format, ...) | ||
| { | ||
| // fixme: The calls that call PrintToDestination() use 2, 3, or 4 arguments, but the original assembly | ||
| // always uses add esp, 0xc suggesting three parameters. Currently this optimizes to a jump directly. | ||
| va_list args; | ||
| va_start(args, format); | ||
| MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include "OpenSHC/IO.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_ProtocolDefinedData.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x00487090 | ||
| byte IO::Base64EncodeCharacterLookup(char param_1) | ||
| { | ||
| if ('?' < param_1) { | ||
| return (byte)(0x3d); | ||
| } | ||
| return DAT_ProtocolDefinedData::instance.field136_0x4f4[param_1]; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
|
|
||
| #include "OpenSHC/IO/Base64State.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace IO { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x00487080 | ||
| void Base64EncodeInit(Base64State* state) | ||
| { | ||
| state->phase = 0; | ||
| *(unsigned char*)&state->carryByte = 0; | ||
| state->lineCharacterCounter = 0; | ||
| } | ||
|
|
||
| } // namespace IO | ||
| } // namespace OpenSHC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include "OpenSHC/IO.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace IO { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0041a740 | ||
| void SwapInts(int* param_1, int* param_2) | ||
| { | ||
| int temp; | ||
| temp = *param_1; | ||
| *param_1 = *param_2; | ||
| *param_2 = temp; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #include "OpenSHC/Input/MouseState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Input { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004680b0 | ||
| void MouseState::updateMouseWheelStatus(int delta) { this->mouseWheelDelta = (unsigned short)delta; } | ||
|
|
||
| } // namespace Input | ||
| } // namespace OpenSHC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #include "OpenSHC/Input.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_TutorialCurrentStep.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Input { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004BC620 | ||
| undefined4 OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; } | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My clang-format fixes this relative import to its absolute version. Why doesn't yours do the same @TheRedDaemon and what do you prefer?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agreed on using the relative import to mark the "main" header file, so this is something that should stay.
No idea on your question, though. I still use the integrated clang version of Visual Studio Code. Did you update your version recently to the newest? Maybe something was added regarding the imports?