* Implement/match more of MxCompositePresenter
* Use parameter to `DeleteAll` instead of separate function
* StartAction match
* Implement/match rest of MxCompositePresenter
* Move annotation
* Add parameter name
* Merge
* Remove junk
* Move annotation
* Fixes
* Open discussion
* Move annotations of header-implemented functions back to `.h` files
* Adjust `README.md`
* Relocate annotation
* linter
* Comment markers in headers only, rename script, update github actions
* type hint compat
* Rename github action, better argparse for linter
* Type hints, working test for byname ignore
* Move annotation
* CI rename and enable warnfail, enforce mode always on
* Two step linting
* or one step
* continue on error
* two jobs instead
* Fixes
---------
Co-authored-by: disinvite <disinvite@users.noreply.github.com>
* LegoWorldList
* Refactor list cursors
* Add decomp markers for list cursors
* Fix decomp markers
* MxRegionListCursor edit to prevent accuracy drop
* Better fix for MxRegionListCursor
* Bootstrap decomp of D3DRM rendering code
* This PR kicks off work on decompiling the D3D Retained Mode (D3DRM)
rendering part of the codebase.
* High level overview:
* There is a base IMxDirect3DRMObject class which all of the D3DRM
rendering objects inherit from. Its only virtual method is one to get
the underlying object handle.
* A hierarchy of abstract classes inherits from this base class, which
I've called "IMxDirect3DRM<class>". These classes only have pure
virtual methods on them and don't contain any data.
* Each one of the abstract classes has exactly one concrete
implementation, which I've called "MxDirect3DRM<class>". These classes
have exactly one piece of data, which is a pointer to the underlying
D3D Retained Mode object.
* If the classes need to store additional data, they store it in a
userdata blob which is attached to the D3DRM object rather than the
additional data being stored in the class itself.
* I've worked out about twice this many classes related to D3DRM
rendering so far but the PR was getting large enough as is, so I'm
cutting it here for now.
* I decomped sufficiently many methods of these classe to convince
myself that the above observations are correct. About 60% of the
decomped methods here are perfect matches, including at least one
non-trivial method per class.
* Formatting
* Restructure changes using Tgl naming / details
* Restructure the changes to use the naming that we know from Tgl.
* Fill in some parts of the implementation I couldn't initially figure
out using the details from Tgl (got more 100% matches).
* Move d3drm link requirement
* Fixups FloatMatrix -> FloatMatrix4
* Fix order
* Full fix for ordering problems
* Put back accidentally removed include.
* Fix call which should have been Release
* Use new and delete for DeepClone
* Missing Tgl:: on CreateRenderer
* Revert change to bool return value.
* Rename Something -> Unk
* Return paramter naming convention to what Tgl used
* Add scalar ddtor to verify inline destructor
* Fix order
* Change malloc/free -> new/delete in Tgl
* Remove duplicate destructor.
* Check all inline destructors
* Fix dtor comments
* Third time's the charm
* Alphabetical sort
* Decomp adjustments
* Add d3drm files to clang-format
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Adjustments to "decomp" language
* Fix a comment
* Fix accidental clang-formatting
* Fix order
* Fix order
* Remove junk
* Fix OFFSET
* Adjustments based on new suggestions
* Annotate globals
* Globals in ISLE
* More globals
* Merge from parser2 branch
* Allow prepending space for exact marker match
* To eliminate noise, require the 0x prefix on offset for marker match
* fix test from previous
* Count tab stops for indented functions to reduce MISSED_END_OF_FUNCTION noise
* FUNCTION to SYNTHETIC where needed
* Missed marker conversion on SetAtomId
* pylint cleanup, remove unused code
* Fix unexpected function end, add more unit tests
* Be more strict about synthetic name syntax
* Revert "Missed marker conversion on SetAtomId"
This reverts commit d87d665127fae7dd6e5bd48d9af14a0a829bf9e2.
* Revert "FUNCTION to SYNTHETIC where needed"
This reverts commit 8c815418d261ba8c5f67a9a2cae349fe4ac92db8.
* Implicit lookup by name for functions
* Fix VTABLE SYNTHETIC and other decomp markers
* Get vtable class name
* Vtable marker should identify struct
* No colon for SIZE comment
* Update README.md
* Update README.md
* Update CONTRIBUTING.md
* Update README.md
* Update README.md
* Update CONTRIBUTING.md
* Update README.md
* Update CONTRIBUTING.md
* Fix destructor/annotation
* Update README.md
* Update README.md
* Update README.md
* Update README.md
* Update README.md
---------
Co-authored-by: disinvite <disinvite@users.noreply.github.com>
* MxFlcPresenter: vtable70
* begin work on MxFlcPresenter's m_unk64
* Add another function that makes use of the FLIC header
* Remove space
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Implement/match remaining MxWavePresenter functions
* Name m_unk65
* Match WriteToSoundBuffer
* Remove header
* Match StreamingTickle
* Name more variables
* Give names to some things
* 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>
* Implement ViewROI and base classes
* Clean up Orientable header
* Move tgl to tgl subdirectory, and use target_include_directories
* Move classes to submodules
* Fix some missed references
* Fix/match UpdateWorldData
* Renaming / removing MxTypes / refactoring
* Consistent naming for Matrix
* Adjust format action
* Add Vector3/Vector4 to Data vector
* Add TGL comment
* Add a comment about Matrix4Impl
* Add ROI comment
---------
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
* LegoPalettePresenter - destroy function and destructor
* Update legopalettepresenter.h
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Bootstrap MxMediaPresenter
* Implement/match MxMediaPresenter::Tickle and related
* Implement AppendChunk and Enable
* Implement/match most of MxVideoPresenter
* Add missing offset
* MxQueue and parts of LegoInputManager
* Missed clang-format on mxqueue.h
* Fix declarations
* MxParamType -> NotificationId
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Add missing ClassName's and IsA's
Exceptions: LegoAnimActor as it does something weird with a call to another private/inlined function(?) and RaceStandsEntity which seems to have two vtables
* clang-format
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* commit code
* commit code
* Update mxdiskstreamprovider.cpp
* Update mxstreamprovider.h
* improve match + add html file to gitignore
* improve match of MxRAMStreamController::Open
* MxDiskStreamController::Open
* Match some functions, relocate m_target to `MxThread`
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Rename some functions and members
* Match LegoWorld::Notify to 100%
* Match MxOmni::Destroy to 100%
* Fix parameter prefix
* Fix another parameter
* Fix CR at EOF
* Fix CR at EOF
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* implement/match CalcLocalTransform
* fix odd build error
* address feedback
move vec.h to thirdparty folder
update vec.h
move all realtime code to realtime folder
move calclocaltransform out of legoutil and into realtime
cast shift to MxS32
add additional unroll hack to CalcLocalTransform to prevent msvc entropy
* Implement MxDSBuffer constructor, match FUN_100bffd0
* Match to 100%, minor style fixes
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxSoundPresenter
Destructor, destroy, function adding itself to the sound manager and vtable38.
* Fix virtual function declarations
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* mxvideopresenter
* Update mxvideopresenter.cpp
* use inline getter for rectange width/height
* Update mxvideopresenter.cpp
* Match MxVideoPresenter::Destroy to ~88%
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxMIDIPresenter destructor, stub Destroy for now
* MxMIDIPresenter::EndMIDIAction + update param name
m_MIDIInitialized is definitely public, since it is accessed from the global
MusicManager.
* Add getter for MIDIInitialized, fix virtual function decl
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Only include decomps
* One more function
* Add offset to endOfVariables
* Remove leftover header
* Use undefined where applicable
* Fixes, refactorings
* Fixes
* Fix calling convention
* Added offset comment
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Implemented the function wrapper for SetMatrixProduct labeled as
SetMatrixProductWrapper with 100% match.
* Rename for consistency
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxMusicPresenter destroy
* Implement MxMusicPresenter's Destroy method and move MxMediaPresenter's Destroy method to "protected"
* MxMediaPresenter Destroy to "protected", for real
* MxMusicPresenter Destroy
* MxStreamProvider and MxRamStreamProvider vtable
* Update mxramstreamprovider.h
* Match IsA
* Fixes, improvements
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxMusicPresenter vtable
vtable+0x34 adds the current presenter to the music manager
vtable+0x38 calls destroy with the param as "FALSE"
* Update mxmusicpresenter.cpp
* Update mxmusicpresenter.cpp
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* implement mxomni::create, and match MxStreamController::Open
* Use enum for mxparam type
* Fix return type
* Match MxOmni::Notify
* Remove unused variable
* Added override keywords
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Minor improvements all related to SetupCopyRect
* Rename inline getters. malloc/free -> new/delete
* MxTypes in TransitionManager. Remove stub marker (oops)
* MxSoundManager: dtor, destroy, update types
Also make MxThread's destructor public
* Minor adjustments
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Implement MxTransitionManager::EndTransition and GetCurrentWorld
* Match EndTransition
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxTransitionManager::Dissolve
* Some comments and better names
* use refs instead of pointers
* slightly improved name for rect
* Use MxS32 instead of int
* Pizza: fix type of m_unk98
* Fix pizza constructor
* Match Pizza::Pizza
* Use undefined type
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxDiskStreamProvider constructor
* Add work-in-progress list struct to MxDiskStreamProvider
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* LegoFullScreenMovie variable and related
* Changes after review
- Reduce scope on global strings
- Size assert for LegoGameState (based on the constructor references only)
- 1 -> TRUE for EnableFullScreenMovie
* implement some of MxTransitionManager
start working on MxTransitionManager::StartTransition
add TransitionType enum
implement/match MxTransitionManager::GetDDrawSurfaceFromVideoManager
implement/match global function SetAppCursor
* remove offset comment from mxomni.h
* remove misc offset comments from mxtransitionmanager.h
* address feedback
* merge m_unk20-24 into pad
* LegoEntity parse action string
* Reduced size assert for MxEntity
* remove override keyword for LegoEntity function
* Move global strings to new define.cpp file
* MxAudioManager: Destructor, LockedReinitialize
* MxAudioManager::Reinitialize, fix LockedReinitialize logic
* MxAudioManager cleanup
- fix param in LockedReinitialize, mark that function as private/give it a better param name
* Match LockedReinitialize, fix function declarations, add/match InitPresenters
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxDirect3D Constructor
* Implement MxDirect3D::Clear (not yet matching)
* Match MxDirect3D::Clear
* Building out MxDirect3D, link dxguid, add size asserts
* Move a few things around on the Enumerate context obj
* remove dupe mxdirect3d
* Match BuildErrorString and _DoEnumerate
* Fix style
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
Co-authored-by: disinvite <disinvite@users.noreply.github.com>
* pizza: fix type m_unk90
* Initial implementation of a lot of IslePathActor's
All IslePathActor's seem to have (for the most part), the same few variables in common,
probably some ID. SkateBoard, Pizza and TowTrack seem to be a bit more complicated with additional
fields surrounding it.
* Add missing ClassName(s) and IsA(s)
* Add decomp size asserts
* Fix size assertions
* Make legopathactor fields protected for now, fix a type in Pizza
* Fix TowTrack structure
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Match MxBitmap::vtable+40 (CopyColorData)
It's basically a call to StretchDIBits, which copies color data for a rectangle
* Name a ternary raster op
* Name variable m_unk18 (m_bmiColorsProvided)
Since this variable is passed to StretchDIBits, we can see what its supposed to mean.
We dont have DX5 docs, but we have docs of the current day, and this as its 'iUsage':
"Specifies whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or indexes."
The second part (about what the bmiColors contains) seems redundant, since we know this is a boolean.
Source: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-stretchdibits
* MxBitmap::CreatePalette is now up to 60%
* Add progress on MxBitmap::LoadFile, add the global bitmap signature, add Clone call in CreatePalette
* getting closer
* Implement MxBitmap::vtable18
* Got vtable18 into a better state
It's progress doesn't affect the status of CopyColorData, which is
back at 100%, as it makes sense the loop is a memcpy
* if you want to do more of vtable18 have fun
* Cleanup MxBitmap::LoadFile
* Begin work on FUN_100bd450 (ImportColorsToPalette)
This took a lot of time, finally I got a good understanding of it.
Primarily what's left now is the loop
https://hackmd.io/@KsNMFSBHTO2gxDyRIPRQ1g/H1LCVQXon
* Don’t include class name in method declaration
* yolo vtable38 (I can't test the build atm)
I moved up ImportColorsToPalette so other functions, including this one can use it
* Cleanup while i keep getting bored of matching these functions that wont match
* likely malloc is an operator new
* A few things for MxBitmap
* new struct MxBITMAPINFO
* vtable18 and ImportPalette 100%
* ImportColorsToPalette improvement
* Match vtable1c and vtable3c
* use MxResult return types
* CreatePalette - Use MxResult to track success
* Define types for the bit depth
That boolean is not really a boolean, its just a variable to store
the bit depth as some DWORD. 0 = 256 color, 1 = High Color (16-bit).
* Match MxBitmap::CreatePalette
* Match LoadFile
YEGYEEHEEHEHEHEHEHE3 YES THIS IS FINALLY DONE OMFG
* Reorder variable placement in CreatePalette
* Start vtable14
* Match MxBitmap vtable14, down to reg swap.
Maybe some import function?
* Name MxBitmap vtable functions
---------
Co-authored-by: disinvite <disinvite@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
* LegoNavController: Match CalculateNewTargetSpeed
Ghidra showed this correctly too, but the asm showed the problem simply, an incorrect comparison
* Match a MxPresenter vtable function
* Match known functions in LegoPhonemePresenter
* Revert "LegoNavController: Match CalculateNewTargetSpeed"
This reverts commit 718489923b4dd5a3f12d53510d299033924c5dea.
* MxPresenter: rename tickle flag fields
* LegoPhonemePresenter: add size assert
---------
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Implement MxAtomId and reference counter (stl set)
* Partial success in hiding 4786 warning spam.
* Build out most of MxOmni::Destroy since it also touches the set
* Add some size asserts
In newer versions of MSVC, this could have been achieved with /wd4237, however 4.2 doesn't have this option, it only seems to have the pragma. Ah well.
* MxStringVariable -> MxVariable
* cursor test
* GetVariable to 100
* meh
* node insert inline
* move to header file
* use reference to match available code
* variable table init in mxomni, some reshuffling
* Start MxBackgroundAudioManager
* Match MxBackgroundAudioManager constructor. This took WAY too much time.
* add size assert
* improve readability of MxBackgroundAudioManager::Enable
While the previous iteration wasn't incorrect, it definitely reads like pseudocode (i.e. it's very unlikely any actual developers would have written that). This is much more readable/likely to have been written and still results in the same asm.
---------
Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
* All of the MxVectors share an inheritance chain. MxVector4 inherits
from MxVector3 which inherits from MxVector2.
* They all operate on a shared `float*` data member which points to the
underlying storage.
* There are also MxVector3/4Data classes, which inherit from Vector3/4,
but add concrete storage for the Vector data rather than just an
abstract data pointer.
* The same is true for MxMatrix, with there being an abstract and a
concrete variant of it.
* Also improve reccmp.py register matching algorithm. It previously
could not recognize an effective match when a swap had to take place
between two registers used on the same line. It turns out this happens
a lot in floating point math code so I adjusted the implementation to
break the disassembly lines on spaces rather than just linebreaks
allowing the existing effective match code to handle that case too.
* Checkpoint to show MxTickleManager::SetClientTickleInterval match.
* Match MxTickleManager::~MxTickleManager, obliterate MxTickleManager::SetClientTickleInterval.
* Make conditional more realistic, move MxTime to mxtypes.h, add TODO for MxTickleManager::Tickle.
* Start IslePathActor
* Update types/add needed type in LegoPathActor for Pizza
Yes, this is a recommit because last time I pushed my cmake dir
* Fix types in islepathactor
* Adjust variables
* add size asserts
---------
Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
* MxDirectDraw functions and structures
* fix indents, and globals
* fix build, add mxdirectdraw build configuration
* add new files to cmake
* MxDirectDraw: Add code from my PR #19 on main repo
Merging in the missing functions from my pull request for MxDirectDraw on the main repo. Credit to @foxtacles for the GetPrimaryBitDepth function. All match 100% on reccmp except ErrorToString, but the problem there is with the jump table at the end.
Co-authored-by: Christian Semmler <mail@csemmler.com>
* improve match
* improve accuracy
* improve accuracy
* move _countof, impove up to 96.90%
* Update LEGO1/mxdirectdraw.h
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Update LEGO1/mxdirectdraw.cpp
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Update LEGO1/mxdirectdraw.cpp
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Update LEGO1/mxdirectdraw.cpp
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Update LEGO1/mxdirectdraw.cpp
* Update LEGO1/mxdirectdraw.cpp
---------
Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Co-authored-by: disinvite <disinvite@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
* start pizza
* Add some pizza vtable functions (they are stubs at the moment)
Unknown parameter types, likely either Pizzeria or PizzaMissionState.
* Pizza: Add/update functions as according to MxCore inheritance
IsleActor::Notify needs to be stubbed
---------
Co-authored-by: Kai Kaufman <ktkaufman@wpi.edu>
* match pizza destructor
* Update pizza members
* add size asserts
---------
Co-authored-by: Kai Kaufman <ktkaufman@wpi.edu>
Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
* Implementation of MXIOINFO. Not a 100% match, but we are very close. I don't wanna wrangle with this one any more, so I figured I would open it up for review in case anyone else has ideas.
**Known problems:**
- The Open function uses a `movzx` instruction on the value of parameter `fdwOpen` before pushing to OpenFile from the kernel. You can force this to appear by casting to `unsigned short`, but this disturbs the instructions for the rest of the file. To get the "best" overall match I decided to leave this out.
- Flush, Advance, and Descend differ only in the order of operands on a `cmp` instruction.
- This entire file is honestly pretty ugly. The main reason is all the nested ifs; we are constrained by returning a result value from each function, but only at the very end instead of bailing out with a `return`. By far the worst offender is the do/while loop in the Descend function.
**Design considerations:**
- We are casting the file handle from MMIOINFO to `HFILE` everywhere it is used, so I decided to just change the type. While doing that, I figured I might as well just pull out the members from the struct so we don't have `m_info` all over the place.
- Without using a struct member, we have the issue of the obvious `memset` used to zero out the values in the constructor. I changed this to work on the object itself, which would not be valid in most cases, but seems fine here since we have no virtual methods.
There is a lot of repeated code here, namely the call to `_llseek` to reset `m_lDiskOffset` based on the current file position. You could move this to an inline function, but maybe that's not appropriate.
There are probably strides to be made on code clarity and comments (if needed or wanted) here. I'm open to any suggestions.
* remove casts on read, add size assert
* Use more Mx* types and param style convention
* Fixing up MXIOINFO to prepare for merge.
* Following feedback from @stravant and @itsmattkc, reverted back to using `MMIOINFO` struct as the class member instead of adding its values directly. (We actually gained a little on accuracy with this change.)
* The memset to zero out the values in the constructor now acts on `m_info` instead of `this`. Strictly speaking we don't need the size assert any more but I decided to keep it in case we change the members later for some reason.
* Casting the `hmmio` member to `HFILE` (int) or `HMMIO` (WORD) typedefs where needed.
* Squelch a signed/unsigned type comparison warning
* Match MxDSChunk ctor/dtor
* Push work on MxDSAction/MediaAction/Sound
* MxDSMediaAction constructor is matching up to a mov location
* Match MxDSSound constructor by adding the missing member
just four bytes in between them in ghidra.. isn't that enough for ghidra to justify a member variable?
* Match MxDSMediaAction constructor
Today's lesson: ecx suggests '1'
* MxNotificationManager initial work.
* Add .swp files to .gitignore.
* Checkpoint before anything too crazy with param
* Cleanup and add MxParam.
* Checkpoint for everything except MxNotificationManager::Register.
* Add int return type to MxCore::GetId instead of relying on implicit function nonsense.
* Add stlcompat.h so this can still be built on modern compilers, fix affected type size asserts.
* Switch to Mx types
* Add BUILD_COMPAT option to CMake so the project can still be built with modern compilers.
* Change vtable14 and vtable18 to Register and Unregister in MxTickleManager.
* Remove last unsigned int reference to id type.
* Remove MxList, use one inherited class per type. Improves accuracy again.
* Address compiler compatibility code review.
* Match MxNotificationManager::Register.
* Re-enable MxNotificationManager DECOMP_SIZE_ASSERT.