* video/legohideanimpresenter: Init, dtor, most of destroy function
* Format
* Finish Destroy
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* MxControlPresenter
* Fixes
* Minor change
* Match MxControlPresenter::StartAction
* Use flags instead
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* cmake: detect older MSVC and define ENABLE_DECOMP_ASSERTS to enable decomp asserts
* Add /Zc:__cplusplus to define __cplusplus with c++ version number
* Silence deprecated CRT releated warnings
* LegoCameraController overrids some methods that are not defined in its parent(s)
* Tgl::Device::GetDrawnTriangleCount does not exist (FIXME: INCORRECT FIX -> Tgl::Device should be updated instead)
* Remove copy/pasted APP_ICON from lego1 resource.h header
* Implement empty ViewLODList::Dump method
* Also enable "compat mode" for newer MSVC compilers
* Only do decomp assertions when using older MSVC compilers
* msys2 mingw compat (cannot pass reference of rvalue)
* Fix msys2 mingw warning: declaration 'class Tgl::Group' does not declare anything
* Add FIXME comment to LEgo3DView::m_previousRenderTime
* LegoView1 is 16 bytes bigger then LegoView ==> 4 32-bit pointers
* include string.h for strlen
* Fix overrides
* Fix constness of method
* Fixes
* Formatting
* Add size assert for MxFrequencyMeter
* ci: build isle with msys2 + msvc on GitHub actions
* Set vcvars for msvc
* msys2 needs the msys2 shell
* Build in default shell
* isle is not 64-bit yet (I think)
* Print bitness
* Use amd64_x64 cross tools
* Minor updates
* Add more names
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Use COMPAT_MODE macro to fix errors with mingw gcc 12.2
* MxOmni::m_timerRunning is a MxBool
* MxDirect3D::m_unk0x88c is a MxBool
* MxBackgroundAudioManager::m_unk0x13c is a MxS32
* Fix warning: deleting 'void*' is undefined [-Wdelete-incomplete]
* Fix inline function 'void TglImpl::RendererImpl::Destroy()' used but never defined
* Fix warning: inline function 'MxStreamerSubClass1::MxStreamerSubClass1(undefined4)' used but never defined
* Use `FALSE` for m_timerRunning
* Format
* Format
* Remove comment
* Limit scope for variables in compat mode
* clang-format
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Add LEGO1.DLL resources
* Rename smack files to lowercase
This fixes casing issues with mingw on Linux
Also use double quotes for #error
* cmake: dxguid must come after dinput
* cmake: create LEGO1.DLL instead of libLEGO1.DLL, when using mingw
* act3actor.h was not including mxcore.h, and using incorrect override
* g_mcoreCount seem to be signed integers
* LegoCameraController: return references to static data in stub functions
* Include string.h, stdlib.h and stdio.h for use of libc functions
* Override MxAtomId::operator!=
* Fix use of STL's std::map + std::vector
* Fix template functions for mingw
* iterator object is used after the for loop
* IDirectDrawSurface::BltFast's first 2 arguments are x/y coordinates, not pointers
* Add stub ViewLODListManager::Lookup
* Fixes
* Format
* Remove unnecessary COMPAT_CONST use
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Improve accuracy of MxOmni::CreatePresenter
* Update mxactionnotificationparam.cpp
* Match to 100%
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Start MxDisplaySurface::SetPalette()
* Add Counting functions, more on SetPalette
* Finish base implementation of SetPalette and begin cleanup
* clang-format
* Fixes/improvements
* Format
* Fix naming
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Parser refactor:
- Handling LIRBARY and STRING markers
- Extracting global variable name for future comparison
- Marking function static variables
- More fluent error messages
* String constants annotated with STRING
* fix variable name
* Should compare LIBRARY markers
* push changes
* improve match of SwapBuffers
* rename function
* Improve match of MxDSBuffer::FUN_100c67b0
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Implement/match rest of MxSmkPresenter
* Fix include guard
* Update mxregion.cpp
* Match MxRegion::VTable0x18
* Fix
* Fix matches
* Remove class name
* implement EnableFullScreenMovie and FUN_100ba640
* Match MxDisplaySurface::FUN_100ba640
* Match LegoVideoManager::EnableFullScreenMovie
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
* Bootstrap MxSmack
* Add comment about incorrect structure
* Fix naming
* Fix name
* Add a comment about SDK
* Add names from Smacker SDK
* Use SMACK.LIB and interface
* Use RAD.H defined types
* Use different commets
* Fix member offset
* Update mxsmack.cpp
* 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.
* MxPalette - add missing member variables, Detach function
* mb
* MxPalette: give bob the builder his constructor
* push progress, gn
* avoid hexadecimal
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
* fix MxPalette::GetDefaultPalette
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
* aaaaaaaaaaaaaa
* Revert "fix MxPalette::GetDefaultPalette"
This reverts commit 63f2215737d3bcd286f67dcf1a04fdf8a234d41b.
* Implement MxPalette::Clone (doesn't match)
* fix MxPalette structure and match ctor/dtor
* Matching progress for MxPalette::GetDefaultPalette
* Implement ApplySystemEntriesToPalette except the memcpy calls
* implement SetSkyColor (doesn't match)
* Use MxTypes instead of generics
* prefer decimal values than hex for m_entries
* Update mxpalette.cpp
* Push MxPalette progress - read comments in code.
* improved MxPalette::operator==, will be 100% when MSVC feels like making it so
* improved MxPalette::SetSkyColor, will be 100% when MSVC feels like making it so
* improved MxPalette::Clone, will be 100% when MSVC feels like making it so
* Fixes
- reordered the functions in order of where they are in the hex because recmp.py sometimes kept saying it couldn't find the symbol (??)
- clone returns a pointer, not a ref
- worked a bit on setpalette/applysysentriestopalette
* Match GetDefaultPalette a bit more
* fix: MxPalette::GetDefaultPalette is now 100% matching
* fix: MxPalette::ApplySystemEntriesToPalette is now 100% matching
* tidy: rename `DC` var in GetDefaultPalette to `hdc`
* fix: MxPalette::SetPalette is now functionally matching
Not assembly matching yet because of MSVC weirdness.
At some point it will probably start matching, because
the structure seems to be accurate.
* fix: MxPalette rgbquad ctor functionally matches
Not quite ASM matching yet because of weird
register allocation mismatches.
* fix: I forgot to commit mxpalette.h...
* tidy: use Mx* primitives instead of builtins
* refactor: remove MxPalette::FromBitmapPalette
* fix: call ApplySystemEntriesToPalette from MxPalette(const RGBQUAD *)
* rename MxPalette::SetPalette to MxPalette::SetEntries
* fix: I once again forgot to commit mxpalette.h...
* feat: add/match MxPalette::Reset [0x100BF490]
* fix: add MVideoManager() to mxomni header
* refactor: change unk50 in MxVideoManager to LPDIRECTDRAW
* feat: add/match MxPalette::CreateNativePalette [0x100BF000]
* fix: MxPalette::SetSkyColor is 100% matching
* Annotate MxPalette members' offsets
* Annotate the global default aplette
* use hex size
* remove unnecessary variable offset listing
* Update LEGO1/mxpalette.cpp
---------
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
Co-authored-by: ktkaufman03 <ktkaufman@wpi.edu>
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* Add MxSemphore + MxThread and the two implementations I could find
of MxThread (consumers extend it and override the Run method).
* Implement a function in MxDiskStreamProvider which uses thread and
semaphore to confirm correct layout / size of those classes.
* All 100% match except two functions with a pair of registers swapped.
* MxFile and implementations 100% match
* Add MxFile and it's implementations, MxSystemFile and MxMemoryFile.
The names are chosen by me, we don't know their original naming.
* These expose a Read/Write/Seek/Tell interface for reading and writing
data, either from a file on disk or memory buffer.
* 100% match all functions.
* Change name to LegoStream
* Use p_ convention
* Assert size
* define MxLong/MxULong
The "long" type has different sizes on different platforms, and this may cause issues.
* use DWORD to match RegQueryValueExA arg
* Get Isle building on MinGW32 (#63)
* Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub
* Declare destructor of MxOmni and MxTransitionManager in class
* inline attribute must go first
* Stub LegoState::Vtable0x14 for Act3State
* MxStreamer::VTable0x14 is not an override
* Stub MxEntity::Destroy for LegoState::Destroy
* Stub MxUnknown100dc6e0 for MxSoundManager
* ::ClassName and ::IsA are const methods
* methods in the class body don't need a namespace
* MxSoundManager subclasses MxUnknown100dc6e0
* LegoInputManager subclasses MxPresenter
* NotificationId is an enum, and does not need __declspec(dllexport)
* Fix final #endif of legoomni.h and mxobjectfactory.h
* Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW
* Alternative approach to MinGW compatibility
* MinGW on Linux is case sensitve
* Don't delete a member variable. C++ automatically destructs member variables
---------
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
* MxatomId: implement inline operator==
* Add decomp.h header, containing macro's only used when matching the original binaries
* Add in-line constructor of MxPresenter
* MxMediaPresenter: add members to match size
* MxVideoPresenter: add members to match size
* MxCompositePresenter: add members to match size
* MxFlcPresenter: add members to match size
* MxSmkPresenter: add members to match size
* MxStillPresenter: add members to match size
* MxAudioPresenter: add members to match size
* MxWavePresenter: add members to match size
* MxMIDIPresenter: add members to match size
* MxEventPresenter: add members to match size
* MxLoopingFlcPresenter: add members to match size
* MxLoopingSmkPresenter: add members to match size
* MxLoopingMIDIPresenter: add check for size
* Implement MxObjectFactory::{MxObjectFactory,Create}
Matching of MxObjectFactory::Create is not good, because none of the other objects have been implemented.
* Implement a few MxPresenter methods
* Fix size of LegoInputManager
* Fix name of first padding member of legoinputmanager.h
* add DECOMP_SIZE_ASSERT macro
* Use DECOMP_SIZE_ASSERT macro + convert to hexadecimal
* fixed minor typos
---------
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
Co-authored-by: itsmattkc <itsmattkc@gmail.com>
* Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub
* Declare destructor of MxOmni and MxTransitionManager in class
* inline attribute must go first
* Stub LegoState::Vtable0x14 for Act3State
* MxStreamer::VTable0x14 is not an override
* Stub MxEntity::Destroy for LegoState::Destroy
* Stub MxUnknown100dc6e0 for MxSoundManager
* ::ClassName and ::IsA are const methods
* methods in the class body don't need a namespace
* MxSoundManager subclasses MxUnknown100dc6e0
* LegoInputManager subclasses MxPresenter
* NotificationId is an enum, and does not need __declspec(dllexport)
* Fix final #endif of legoomni.h and mxobjectfactory.h
* Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW
* Alternative approach to MinGW compatibility
* MinGW on Linux is case sensitve
* Don't delete a member variable. C++ automatically destructs member variables
---------
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
Now we can use our own compiled LEGO1.LIB rather than one generated from the original. Also implements a script that tests them to help ensure future commits don't break them.
* Stubbed a bunch of classes and annotated them for later use. Heavily wip and more of pseudocode right now.
* Converted pseudocode into real code!
* Created a bunch more classes and added more information to exisiting ones
Did not error check, this was pushed just for reference
* More classes and implementation details. Still not checked for any errors
* Fixed code and decided on a way to handle virtual table stubs
* Some additional fixes
* More smaller fixes
* Added classes to project and made it compile
* Fixed function adresses that caused the python script to fail
* More classes and virtual function resolves. Builds and compares fine.
* Again more classes and virtual function resolves. Builds and compares fine.
* No clue, I guess forced update for line endings
* Finished up some work, compiles fine. All functions are STUB annotated to not pollute reccmp.py output.
* line ending change
* rename GetClassName/IsClass
Mirroring recent changes from master
* further conform to current master
* update project
* cleanup
* project only updates when you close msdev
---------
Co-authored-by: Cydra <cydra95@gmail.com>
Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Followed the hint from @madebr in #31 that the next function in MxString was operator+. The one after that is operator+= and both are at 100%.
Squashed commits:
* Removed unnecessary consts
* Replaced malloc/free with new/delete, which solved swapped regs in operator=
* Use delete[] when freeing char* m_data
Was intended as a simple code improvement, however it also seems to make WinMain, MxString::operator=, MxDSFile::Open 100% (all of which just needed registers to be switched around)
* match WinProc
* minor accuracy improvement
* WndProc at 50%
* fix WM_DISPLAYCHANGE branching
* fix type
* fix x/y comparison
* WndProc 82%
* 84%
* 97%
* rearrange functions to get close to the original
* remove newline
* inline no longer necessary
* merge
* 100% Match of MxDSFile
* ...almost, MxDSFile::Open is still not quite matching but all of the
other methods are 100% matching.
* Turns out that most of the virtual methods and some of the members are
actually on the MxDSSource base class, which I've pulled out as part
of this.
* In order to implement the methods I added the MXIOINFO class, which
seems to be a thin wrapper around the MMIOINFO windows structure. We
can tell this because MMIOINFO::~MMIOINFO was included in the DLL
exports, and calls down to a function which deconstructs something
looking exactly like MMIOINFO.
* Add mxdssource.cpp
* mattkc feedback
* some accuracy improvements
* Use FOURCC macro
* Tirival solve in mxioinfo.cpp
* Update mxdsfile.cpp
0xFFFFFFFF -> -1
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>