Commit graph

8 commits

Author SHA1 Message Date
Christian Semmler
b449da1fa3
Introduce clang-format (#240) 2023-10-25 01:38:27 +02:00
MS
c7acbf559f
lego1: implement MXIOINFO (#54)
* 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
2023-07-16 18:37:21 -07:00
itsmattkc
8fa45bbe0f replace shorts with MxS16/MxU16/undefined2 2023-07-02 02:07:11 -07:00
MattKC
e16249b672
Define MxLong/MxULong (#71)
* define MxLong/MxULong

The "long" type has different sizes on different platforms, and this may cause issues.

* use DWORD to match RegQueryValueExA arg
2023-07-02 01:05:49 -07:00
itsmattkc
e7b5ea53df rename GetClassName/IsClass, declare mxtypes
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)
2023-06-27 19:04:07 -07:00
Mark Langen
51ec2c97c6
100% Match of MxDSFile (#51)
* 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>
2023-06-27 11:44:02 -07:00
Christian Semmler
7ff3acebb3
remove execute bits on files 2023-06-12 18:05:43 +02:00
itsmattkc
279d626279 import all functions from lego1 exports
This declares a bunch of classes and functions for us, as well as fixes some declarations that were slightly incorrect (e.g. missing "virtual", etc)
2023-06-11 18:03:54 -07:00