Checkorder tool to keep functions in original binary order (#228)

* First commit of order tool

* More flexible match on module name. Bugfix on blank_or_comment

* Report inexact offset comments in verbose mode. Bugfix for exact regex

* Refactor checkorder into reusable isledecomp module

* Find bad comments in one pass, add awareness of TEMPLATE

* Refactor of state machine to prepare for reccmp integration

* Use isledecomp lib in reccmp

* Build isledecomp in GH actions, fix mypy complaint

* Ensure unit test cpp files will be ignored by reccmp

* Allow multiple offset markers, pep8 cleanup

* Remove unused variable

* Code style, remove unneeded module and TODO

* Final renaming and type hints

* Fix checkorder issues, add GH action and enforce (#2)

* Fix checkorder issues

* Add GH action

* Test error case

* Works

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
MS
2023-11-21 03:44:45 -05:00
committed by GitHub
parent 714d36b57d
commit 1ae3b07dc2
84 changed files with 4021 additions and 3209 deletions

View File

@@ -6,11 +6,34 @@
#include <process.h>
// OFFSET: LEGO1 0x100bf690
MxResult MxThread::Run()
// OFFSET: LEGO1 0x100b8bb0
MxTickleThread::MxTickleThread(MxCore* p_target, int p_frequencyMS)
{
m_semaphore.Release(1);
return SUCCESS;
m_target = p_target;
m_frequencyMS = p_frequencyMS;
}
// Match except for register allocation
// OFFSET: LEGO1 0x100b8c90
MxResult MxTickleThread::Run()
{
MxTimer* timer = Timer();
int lastTickled = -m_frequencyMS;
while (IsRunning()) {
int currentTime = timer->GetTime();
if (currentTime < lastTickled) {
lastTickled = -m_frequencyMS;
}
int timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled;
if (timeRemainingMS <= 0) {
m_target->Tickle();
timeRemainingMS = 0;
lastTickled = currentTime;
}
Sleep(timeRemainingMS);
}
return MxThread::Run();
}
// OFFSET: LEGO1 0x100bf510
@@ -42,6 +65,12 @@ MxResult MxThread::Start(int p_stack, int p_flag)
return result;
}
// OFFSET: LEGO1 0x100bf660
void MxThread::Sleep(MxS32 p_milliseconds)
{
::Sleep(p_milliseconds);
}
// OFFSET: LEGO1 0x100bf670
void MxThread::Terminate()
{
@@ -55,38 +84,9 @@ unsigned MxThread::ThreadProc(void* p_thread)
return static_cast<MxThread*>(p_thread)->Run();
}
// OFFSET: LEGO1 0x100bf660
void MxThread::Sleep(MxS32 p_milliseconds)
// OFFSET: LEGO1 0x100bf690
MxResult MxThread::Run()
{
::Sleep(p_milliseconds);
}
// OFFSET: LEGO1 0x100b8bb0
MxTickleThread::MxTickleThread(MxCore* p_target, int p_frequencyMS)
{
m_target = p_target;
m_frequencyMS = p_frequencyMS;
}
// Match except for register allocation
// OFFSET: LEGO1 0x100b8c90
MxResult MxTickleThread::Run()
{
MxTimer* timer = Timer();
int lastTickled = -m_frequencyMS;
while (IsRunning()) {
int currentTime = timer->GetTime();
if (currentTime < lastTickled) {
lastTickled = -m_frequencyMS;
}
int timeRemainingMS = (m_frequencyMS - currentTime) + lastTickled;
if (timeRemainingMS <= 0) {
m_target->Tickle();
timeRemainingMS = 0;
lastTickled = currentTime;
}
Sleep(timeRemainingMS);
}
return MxThread::Run();
m_semaphore.Release(1);
return SUCCESS;
}