Remove d3drm-wine (#75)

* remove d3drm-wine

* Update miniwin/miniwin/src/miniwin_ddraw.cpp

Co-authored-by: Anders Jenbo <anders@jenbo.dk>

* Run clang-format

* Update miniwin/miniwin/src/miniwin.cpp

Co-authored-by: Anders Jenbo <anders@jenbo.dk>

* Update miniwin/miniwin/src/miniwin_ddraw.cpp

Co-authored-by: Anders Jenbo <anders@jenbo.dk>

---------

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
This commit is contained in:
Anonymous Maarten 2025-05-13 21:18:20 +02:00 committed by GitHub
parent 83f092d8df
commit 537cde485a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
90 changed files with 1163 additions and 25080 deletions

View File

@ -12,7 +12,7 @@ jobs:
- name: Run clang-format - name: Run clang-format
run: | run: |
find CONFIG LEGO1 ISLE -iname '*.h' -o -iname '*.cpp' | xargs \ find CONFIG LEGO1 ISLE miniwin -iname '*.h' -o -iname '*.cpp' | xargs \
pipx run "clang-format>=17,<18" \ pipx run "clang-format>=17,<18" \
--style=file \ --style=file \
-i -i

View File

@ -37,7 +37,7 @@ jobs:
run: | run: |
cd build cd build
zip "isle-portable-linux-${{ matrix.build-type }}.zip" \ zip "isle-portable-linux-${{ matrix.build-type }}.zip" \
CONFIG ISLE LEGO1.so config isle liblego1.so
- name: Upload Build Artifacts - name: Upload Build Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -13,12 +13,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
toolchain: toolchain:
- { name: 'MSVC (32-bit, Release)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_x86', dx5-libs: true, d3drm-from-wine: false, build-type: 'Release' } - { name: 'MSVC (32-bit, Release)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_x86', dx5-libs: true, d3drm-wrapper: false, build-type: 'Release' }
- { name: 'MSVC (32-bit, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_x86', dx5-libs: true, d3drm-from-wine: false, build-type: 'Debug' } - { name: 'MSVC (32-bit, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_x86', dx5-libs: true, d3drm-wrapper: false, build-type: 'Debug' }
- { name: 'MSVC (64-bit, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64', dx5-libs: false, d3drm-from-wine: true, build-type: 'Debug' } - { name: 'MSVC (64-bit, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64', dx5-libs: false, d3drm-wrapper: true, build-type: 'Debug' }
- { name: 'MSVC (ARM64, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_arm64', dx5-libs: false, d3drm-from-wine: true, build-type: 'Debug' } - { name: 'MSVC (ARM64, Debug)', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true, vc-arch: 'amd64_arm64', dx5-libs: false, d3drm-wrapper: true, build-type: 'Debug' }
- { name: 'msys2 mingw32 (Debug)', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true, dx5-libs: false, d3drm-from-wine: true, build-type: 'Debug' } - { name: 'msys2 mingw32 (Debug)', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true, dx5-libs: false, d3drm-wrapper: false, build-type: 'Debug' }
- { name: 'msys2 mingw64 (Debug)', shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, clang-tidy: true, werror: true, dx5-libs: false, d3drm-from-wine: true, build-type: 'Debug' } - { name: 'msys2 mingw64 (Debug)', shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, clang-tidy: true, werror: true, dx5-libs: false, d3drm-wrapper: false, build-type: 'Debug' }
# - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, dx5-libs: true, d3drm-from-wine: true } # - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, dx5-libs: true, d3drm-from-wine: true }
steps: steps:
@ -63,7 +63,7 @@ jobs:
cmake -S . -B build -GNinja \ cmake -S . -B build -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.toolchain.build-type }} \ -DCMAKE_BUILD_TYPE=${{ matrix.toolchain.build-type }} \
-DISLE_USE_DX5=${{ matrix.toolchain.dx5-libs }} \ -DISLE_USE_DX5=${{ matrix.toolchain.dx5-libs }} \
-DISLE_D3DRM_FROM_WINE=${{ matrix.toolchain.d3drm-from-wine }} \ -DISLE_D3DRM_WRAPPER=${{ matrix.toolchain.d3drm-wrapper }} \
-DENABLE_CLANG_TIDY=${{ !!matrix.toolchain.clang-tidy }} \ -DENABLE_CLANG_TIDY=${{ !!matrix.toolchain.clang-tidy }} \
-DISLE_WERROR=${{ !!matrix.toolchain.werror }} \ -DISLE_WERROR=${{ !!matrix.toolchain.werror }} \
-Werror=dev -Werror=dev
@ -76,7 +76,7 @@ jobs:
run: | run: |
cd build cd build
7z a "isle-portable (${{ matrix.toolchain.name }}).zip" \ 7z a "isle-portable (${{ matrix.toolchain.name }}).zip" \
ISLE.EXE LEGO1.DLL SDL3.dll isle.exe lego1.dll sdl3.dll
- name: Upload Build Artifacts (MSVC (32-bit)) - name: Upload Build Artifacts (MSVC (32-bit))
if: ${{ matrix.toolchain.name == 'MSVC (32-bit, Release)' || matrix.toolchain.name == 'MSVC (32-bit, Debug)' }} if: ${{ matrix.toolchain.name == 'MSVC (32-bit, Release)' || matrix.toolchain.name == 'MSVC (32-bit, Debug)' }}

View File

@ -1,65 +0,0 @@
project(wine_d3drm LANGUAGES C)
set(CMAKE_C_CLANG_TIDY)
if(MSVC)
# FIXME: this is wrong.
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(def "${CMAKE_CURRENT_SOURCE_DIR}/d3dxof32.def")
else()
set(def "${CMAKE_CURRENT_SOURCE_DIR}/d3dxof64.def")
endif()
set(imp "${CMAKE_CURRENT_BINARY_DIR}/d3dxof.lib")
set(exp "${CMAKE_CURRENT_BINARY_DIR}/d3dxof.exp")
add_custom_command(OUTPUT "${imp}" "${exp}"
COMMAND "${CMAKE_AR}" "${CMAKE_STATIC_LINKER_FLAGS}" "/NOLOGO" "/DEF:${def}" "/OUT:${imp}"
DEPENDS "${def}"
)
add_custom_target(d3dxof-implib DEPENDS "${imp}")
target_sources(d3dxof-implib PRIVATE "${def}")
add_library(d3dxof INTERFACE)
target_link_libraries(d3dxof INTERFACE "${imp}")
add_dependencies(d3dxof "d3dxof-implib")
add_library(d3drm_guid STATIC d3drm_guid.c)
target_include_directories(d3drm_guid PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include")
else()
set(d3drm_guid)
add_library(d3drm_guid INTERFACE)
endif()
option(WINE_D3DRM_DYNAMIC_D3DXOF "Dynamic d3dxof" ON)
add_library(d3drm-wine SHARED
d3drm.c
d3drm_main.c
d3drm_private.h
d3drm.spec
device.c
face.c
frame.c
light.c
material.c
math.c
meshbuilder.c
texture.c
version.rc
viewport.c
d3drm.def
)
if(WINE_D3DRM_DYNAMIC_D3DXOF)
target_sources(d3drm-wine PRIVATE dyn_d3dxof.c dyn_d3dxof.h)
target_compile_definitions(d3drm-wine PRIVATE DYNAMIC_D3DXOF)
endif()
target_include_directories(d3drm-wine SYSTEM PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include")
if(NOT WINE_D3DRM_DYNAMIC_D3DXOF)
target_link_libraries(d3drm-wine PRIVATE d3dxof)
endif()
target_link_libraries(d3drm-wine PRIVATE ddraw)
set_property(TARGET d3drm-wine PROPERTY PREFIX "")
set_property(TARGET d3drm-wine PROPERTY OUTPUT_NAME "d3drm")
target_compile_definitions(d3drm-wine PRIVATE "__WINESRC__")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_TRACE_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_DEBUG_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "DECLSPEC_EXPORT=")

View File

@ -1,502 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,19 +0,0 @@
MODULE = d3drm.dll
IMPORTLIB = d3drm
IMPORTS = d3dxof ddraw
EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \
d3drm.c \
d3drm_main.c \
device.c \
face.c \
frame.c \
light.c \
material.c \
math.c \
meshbuilder.c \
texture.c \
version.rc \
viewport.c

2366
3rdparty/d3drm/d3drm.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
EXPORTS
D3DRMColorGetAlpha
D3DRMColorGetBlue
D3DRMColorGetGreen
D3DRMColorGetRed
D3DRMCreateColorRGB
D3DRMCreateColorRGBA
D3DRMMatrixFromQuaternion
D3DRMQuaternionFromRotation
D3DRMQuaternionMultiply
D3DRMQuaternionSlerp
D3DRMVectorAdd
D3DRMVectorCrossProduct
D3DRMVectorDotProduct
D3DRMVectorModulus
D3DRMVectorNormalize
D3DRMVectorRandom
D3DRMVectorReflect
D3DRMVectorRotate
D3DRMVectorScale
D3DRMVectorSubtract
Direct3DRMCreate
; DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE

View File

@ -1,23 +0,0 @@
@ stdcall D3DRMColorGetAlpha(long)
@ stdcall D3DRMColorGetBlue(long)
@ stdcall D3DRMColorGetGreen(long)
@ stdcall D3DRMColorGetRed(long)
@ stdcall D3DRMCreateColorRGB(float float float)
@ stdcall D3DRMCreateColorRGBA(float float float float)
@ stdcall D3DRMMatrixFromQuaternion(ptr ptr)
@ stdcall D3DRMQuaternionFromRotation(ptr ptr float)
@ stdcall D3DRMQuaternionMultiply(ptr ptr ptr)
@ stdcall D3DRMQuaternionSlerp(ptr ptr ptr float)
@ stdcall D3DRMVectorAdd(ptr ptr ptr)
@ stdcall D3DRMVectorCrossProduct(ptr ptr ptr)
@ stdcall D3DRMVectorDotProduct(ptr ptr)
@ stdcall D3DRMVectorModulus(ptr)
@ stdcall D3DRMVectorNormalize(ptr)
@ stdcall D3DRMVectorRandom(ptr)
@ stdcall D3DRMVectorReflect(ptr ptr ptr)
@ stdcall D3DRMVectorRotate(ptr ptr ptr float)
@ stdcall D3DRMVectorScale(ptr ptr float)
@ stdcall D3DRMVectorSubtract(ptr ptr ptr)
@ stdcall Direct3DRMCreate(ptr)
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)

View File

@ -1,3 +0,0 @@
#define INITGUID
#include <d3drm.h>
#include <d3drmwin.h>

View File

@ -1,150 +0,0 @@
/*
* Copyright 2004 Ivan Leo Puoti
* Copyright 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "initguid.h"
#include "d3drm_private.h"
void d3drm_object_init(struct d3drm_object *object, const char *classname)
{
object->ref = 1;
object->appdata = 0;
list_init(&object->destroy_callbacks);
object->classname = classname;
object->name = NULL;
}
struct destroy_callback
{
struct list entry;
D3DRMOBJECTCALLBACK cb;
void *ctx;
};
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct destroy_callback *callback;
if (!cb)
return D3DRMERR_BADVALUE;
if (!(callback = malloc(sizeof(*callback))))
return E_OUTOFMEMORY;
callback->cb = cb;
callback->ctx = ctx;
list_add_head(&object->destroy_callbacks, &callback->entry);
return D3DRM_OK;
}
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct destroy_callback *callback;
if (!cb)
return D3DRMERR_BADVALUE;
LIST_FOR_EACH_ENTRY(callback, &object->destroy_callbacks, struct destroy_callback, entry)
{
if (callback->cb == cb && callback->ctx == ctx)
{
list_remove(&callback->entry);
free(callback);
break;
}
}
return D3DRM_OK;
}
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name)
{
DWORD req_size;
if (!size)
return E_INVALIDARG;
req_size = strlen(object->classname) + 1;
if (name && *size < req_size)
return E_INVALIDARG;
*size = req_size;
if (name)
memcpy(name, object->classname, req_size);
return D3DRM_OK;
}
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name)
{
DWORD req_size;
if (!size)
return E_INVALIDARG;
req_size = object->name ? strlen(object->name) + 1 : 0;
if (name && *size < req_size)
return E_INVALIDARG;
if (name)
{
if (object->name)
memcpy(name, object->name, req_size);
else if (*size)
*name = 0;
}
*size = req_size;
return D3DRM_OK;
}
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
{
DWORD req_size;
free(object->name);
object->name = NULL;
if (name)
{
req_size = strlen(name) + 1;
if (!(object->name = malloc(req_size)))
return E_OUTOFMEMORY;
memcpy(object->name, name, req_size);
}
return D3DRM_OK;
}
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
{
struct destroy_callback *callback, *callback2;
LIST_FOR_EACH_ENTRY_SAFE(callback, callback2, &object->destroy_callbacks, struct destroy_callback, entry)
{
callback->cb(iface, callback->ctx);
list_remove(&callback->entry);
free(callback);
}
free(object->name);
object->name = NULL;
}

View File

@ -1,337 +0,0 @@
/*
* Direct3DRM private interfaces (D3DRM.DLL)
*
* Copyright 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DRM_PRIVATE_INCLUDED__
#define __D3DRM_PRIVATE_INCLUDED__
#define COBJMACROS
#include <assert.h>
#include <math.h>
#include "dxfile.h"
#include "d3drmwin.h"
#include "rmxfguid.h"
#include "wine/debug.h"
#include "wine/list.h"
#ifdef DYNAMIC_D3DXOF
#include "dyn_d3dxof.h"
#endif
struct d3drm_matrix
{
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
static inline struct d3drm_matrix *d3drm_matrix(D3DRMMATRIX4D m)
{
return (struct d3drm_matrix *)m;
}
struct d3drm_object
{
LONG ref;
LPVOID appdata;
struct list destroy_callbacks;
const char *classname;
char *name;
};
struct d3drm_texture
{
struct d3drm_object obj;
IDirect3DRMTexture IDirect3DRMTexture_iface;
IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
IDirect3DRM *d3drm;
D3DRMIMAGE *image;
IDirectDrawSurface *surface;
LONG decal_x;
LONG decal_y;
DWORD max_colors;
DWORD max_shades;
BOOL transparency;
D3DVALUE decal_width;
D3DVALUE decal_height;
};
struct d3drm_frame
{
struct d3drm_object obj;
IDirect3DRMFrame IDirect3DRMFrame_iface;
IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
IDirect3DRM *d3drm;
LONG ref;
struct d3drm_frame *parent;
SIZE_T nb_children;
SIZE_T children_size;
IDirect3DRMFrame3 **children;
SIZE_T nb_visuals;
SIZE_T visuals_size;
IDirect3DRMVisual **visuals;
SIZE_T nb_lights;
SIZE_T lights_size;
IDirect3DRMLight **lights;
struct d3drm_matrix transform;
D3DCOLOR scenebackground;
DWORD traversal_options;
};
struct d3drm_box
{
float left;
float top;
float right;
float bottom;
float front;
float back;
};
struct d3drm_viewport
{
struct d3drm_object obj;
struct d3drm_device *device;
IDirect3DRMFrame *camera;
IDirect3DRMViewport IDirect3DRMViewport_iface;
IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
IDirect3DViewport *d3d_viewport;
IDirect3DMaterial *material;
IDirect3DRM *d3drm;
struct d3drm_box clip;
D3DRMPROJECTIONTYPE projection;
};
struct d3drm_device
{
struct d3drm_object obj;
IDirect3DRMDevice IDirect3DRMDevice_iface;
IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
IDirect3DRM *d3drm;
IDirectDraw *ddraw;
IDirectDrawSurface *primary_surface, *render_target;
IDirectDrawClipper *clipper;
IDirect3DDevice *device;
BOOL dither;
D3DRMRENDERQUALITY quality;
DWORD rendermode;
DWORD height;
DWORD width;
};
struct d3drm_face
{
struct d3drm_object obj;
IDirect3DRMFace IDirect3DRMFace_iface;
IDirect3DRMFace2 IDirect3DRMFace2_iface;
LONG ref;
D3DCOLOR color;
};
struct d3drm_mesh_builder
{
struct d3drm_object obj;
IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
LONG ref;
IDirect3DRM *d3drm;
SIZE_T nb_vertices;
SIZE_T vertices_size;
D3DVECTOR *vertices;
SIZE_T nb_normals;
SIZE_T normals_size;
D3DVECTOR *normals;
DWORD nb_faces;
DWORD face_data_size;
void *pFaceData;
DWORD nb_coords2d;
struct coords_2d *pCoords2d;
D3DCOLOR color;
IDirect3DRMMaterial2 *material;
IDirect3DRMTexture3 *texture;
DWORD nb_materials;
struct mesh_material *materials;
DWORD *material_indices;
D3DRMRENDERQUALITY quality;
};
struct mesh_group
{
unsigned nb_vertices;
D3DRMVERTEX* vertices;
unsigned nb_faces;
unsigned vertex_per_face;
DWORD face_data_size;
unsigned* face_data;
D3DCOLOR color;
IDirect3DRMMaterial2* material;
IDirect3DRMTexture3* texture;
};
struct d3drm_mesh
{
struct d3drm_object obj;
IDirect3DRMMesh IDirect3DRMMesh_iface;
LONG ref;
IDirect3DRM *d3drm;
SIZE_T nb_groups;
SIZE_T groups_size;
struct mesh_group *groups;
};
struct d3drm_light
{
struct d3drm_object obj;
IDirect3DRMLight IDirect3DRMLight_iface;
LONG ref;
IDirect3DRM *d3drm;
D3DRMLIGHTTYPE type;
D3DCOLOR color;
D3DVALUE range;
D3DVALUE cattenuation;
D3DVALUE lattenuation;
D3DVALUE qattenuation;
D3DVALUE umbra;
D3DVALUE penumbra;
};
struct color_rgb
{
D3DVALUE r;
D3DVALUE g;
D3DVALUE b;
};
struct d3drm_material
{
struct d3drm_object obj;
IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
LONG ref;
IDirect3DRM *d3drm;
struct color_rgb emissive;
struct color_rgb specular;
D3DVALUE power;
struct color_rgb ambient;
};
struct d3drm_animation_key
{
D3DVALUE time;
union
{
D3DVECTOR position;
D3DVECTOR scale;
D3DRMQUATERNION rotate;
} u;
};
struct d3drm_animation_keys
{
struct d3drm_animation_key *keys;
SIZE_T count;
SIZE_T size;
};
struct d3drm_animation
{
struct d3drm_object obj;
IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
IDirect3DRMAnimation IDirect3DRMAnimation_iface;
LONG ref;
IDirect3DRM *d3drm;
IDirect3DRMFrame3 *frame;
D3DRMANIMATIONOPTIONS options;
struct d3drm_animation_keys position;
struct d3drm_animation_keys scale;
struct d3drm_animation_keys rotate;
};
struct d3drm_wrap
{
struct d3drm_object obj;
IDirect3DRMWrap IDirect3DRMWrap_iface;
LONG ref;
};
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm);
HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface);
void d3drm_device_destroy(struct d3drm_device *device);
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
IDirectDrawSurface *surface, BOOL create_z_surface);
void d3drm_object_init(struct d3drm_object *object, const char *classname);
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx);
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx);
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name);
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name);
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name);
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object);
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface);
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface);
struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface);
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm);
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm);
HRESULT d3drm_face_create(struct d3drm_face **face);
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm);
HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm);
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm);
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm);
HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm);
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm);
HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm);
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg);
struct d3drm_file_header
{
WORD major;
WORD minor;
DWORD flags;
};
extern char templates[];
static inline BYTE d3drm_color_component(float c)
{
if (c <= 0.0f)
return 0u;
if (c >= 1.0f)
return 0xffu;
return floor(c * 255.0f);
}
static inline void d3drm_set_color(D3DCOLOR *color, float r, float g, float b, float a)
{
*color = RGBA_MAKE(d3drm_color_component(r), d3drm_color_component(g),
d3drm_color_component(b), d3drm_color_component(a));
}
BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size);
#endif /* __D3DRM_PRIVATE_INCLUDED__ */

View File

@ -1,103 +0,0 @@
/*
* Copyright (C) 2010 Vijay Kiran Kamuju
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DRMWIN_H__
#define __D3DRMWIN_H__
#include <d3drm.h>
#include <ddraw.h>
#include <d3d.h>
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* Direct3DRMWinDevice interface GUID
*/
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1);
typedef struct IDirect3DRMWinDevice *LPDIRECT3DRMWINDEVICE, **LPLPDIRECT3DRMWINDEVICE;
/*****************************************************************************
* IDirect3DRMWinDevice interface
*/
#define INTERFACE IDirect3DRMWinDevice
DECLARE_INTERFACE_(IDirect3DRMWinDevice,IDirect3DRMObject)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DRMObject methods ***/
STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE;
STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(SetAppData)(THIS_ LPVOID data) PURE;
STDMETHOD_(LPVOID, GetAppData)(THIS) PURE;
STDMETHOD(SetName)(THIS_ const char *name) PURE;
STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE;
STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE;
/*** IDirect3DRMWinDevice methods ***/
STDMETHOD(HandlePaint)(THIS_ HDC) PURE;
STDMETHOD(HandleActivate)(THIS_ WORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DRMWinDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DRMWinDevice_Release(p) (p)->lpVtbl->Release(p)
/*** IDirect3DRMObject methods ***/
#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c)
#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b)
#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b)
#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a)
#define IDirect3DRMWinDevice_GetAppData(p) (p)->lpVtbl->GetAppData(p)
#define IDirect3DRMWinDevice_SetName(p,a) (p)->lpVtbl->SetName(p,a)
#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b)
/*** IDirect3DRMWinDevice methods ***/
#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->lpVtbl->HandlePaint(p,a)
#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->lpVtbl->HandleActivate(p,a)
#else
/*** IUnknown methods ***/
#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DRMWinDevice_AddRef(p) (p)->AddRef()
#define IDirect3DRMwinDevice_Release(p) (p)->Release()
/*** IDirect3DRMObject methods ***/
#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->Clone(a,b,c)
#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b)
#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b)
#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->SetAppData(a)
#define IDirect3DRMWinDevice_GetAppData(p) (p)->GetAppData()
#define IDirect3DRMWinDevice_SetName(p,a) (p)->SetName(a)
#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->GetName(a,b)
#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->GetClassName(a,b)
/*** IDirect3DRMWinDevice methods ***/
#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->HandlePaint(a)
#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->HandleActivate(a)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __D3DRMWIN_H__ */

View File

@ -1,4 +0,0 @@
LIBRARY d3dxof.dll
EXPORTS
DirectXFileCreate@4

View File

@ -1,4 +0,0 @@
LIBRARY d3dxof.dll
EXPORTS
DirectXFileCreate

1688
3rdparty/d3drm/device.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
#include "dyn_d3dxof.h"
static enum {
DYN_D3DXOF_INIT = 0,
DYN_D3DXOF_SUCCESS = 1,
} g_dyn_d3dxof_state = DYN_D3DXOF_INIT;
static HMODULE g_d3dxof;
static HRESULT (STDAPICALLTYPE * g_DynamicDirectXFileCreate)(LPDIRECTXFILE *lplpDirectXFile);
static void init_dyn_d3d(void) {
if (g_dyn_d3dxof_state == DYN_D3DXOF_SUCCESS) {
return;
}
g_d3dxof = LoadLibraryA("d3dxof.dll");
if (g_d3dxof == NULL) {
MessageBoxA(NULL, "Cannot find d3dxof.dll", "Cannot find d3dxof.dll", MB_ICONERROR);
abort();
}
g_DynamicDirectXFileCreate = (void*)GetProcAddress(g_d3dxof, "DirectXFileCreate");
if (g_d3dxof == NULL) {
MessageBoxA(NULL, "Missing symbols", "d3dxof.dll misses DirectXFileCreate", MB_ICONERROR);
abort();
}
g_dyn_d3dxof_state = DYN_D3DXOF_SUCCESS;
}
STDAPI DynamicDirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile)
{
init_dyn_d3d();
return g_DynamicDirectXFileCreate(lplpDirectXFile);
}

View File

@ -1,8 +0,0 @@
#ifndef __DYN_D3DXOF_H__
#define __DYN_D3DXOF_H__
#include <dxfile.h>
STDAPI DynamicDirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
#endif /* __DYN_D3DXOF_H__ */

651
3rdparty/d3drm/face.c vendored
View File

@ -1,651 +0,0 @@
/*
* Implementation of IDirect3DRMFace Interface
*
* Copyright 2013 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "d3drm_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
}
static inline struct d3drm_face *impl_from_IDirect3DRMFace2(IDirect3DRMFace2 *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace2_iface);
}
static HRESULT WINAPI d3drm_face1_QueryInterface(IDirect3DRMFace *iface, REFIID riid, void **out)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DRMFace)
|| IsEqualGUID(riid, &IID_IDirect3DRMObject)
|| IsEqualGUID(riid, &IID_IUnknown))
{
*out = &face->IDirect3DRMFace_iface;
}
else if(IsEqualGUID(riid, &IID_IDirect3DRMFace2))
{
*out = &face->IDirect3DRMFace2_iface;
}
else
{
*out = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static ULONG WINAPI d3drm_face1_AddRef(IDirect3DRMFace *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
ULONG refcount = InterlockedIncrement(&face->ref);
TRACE("%p increasing refcount to %lu.\n", iface, refcount);
return refcount;
}
static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
ULONG refcount = InterlockedDecrement(&face->ref);
TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
if (!refcount)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
free(face);
}
return refcount;
}
static HRESULT WINAPI d3drm_face1_Clone(IDirect3DRMFace *iface,
IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_AddDestroyCallback(IDirect3DRMFace *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return IDirect3DRMFace2_AddDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx);
}
static HRESULT WINAPI d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return IDirect3DRMFace2_DeleteDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx);
}
static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, LPVOID data)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, data %#lx.\n", iface, data);
face->obj.appdata = data;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, LPVOID data)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, data %#lx.\n", iface, data);
return d3drm_face2_SetAppData(&face->IDirect3DRMFace2_iface, data);
}
static LPVOID WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p.\n", iface);
return face->obj.appdata;
}
static LPVOID WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p.\n", iface);
return d3drm_face2_GetAppData(&face->IDirect3DRMFace2_iface);
}
static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&face->obj, name);
}
static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_face2_SetName(&face->IDirect3DRMFace2_iface, name);
}
static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&face->obj, size, name);
}
static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_face2_GetName(&face->IDirect3DRMFace2_iface, size, name);
}
static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name);
}
static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface,
DWORD vertex, DWORD normal)
{
FIXME("iface %p, vertex %lu, normal %lu stub!\n", iface, vertex, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
d3drm_set_color(&face->color, red, green, blue, 1.0f);
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface,
D3DVALUE red, D3DVALUE green, D3DVALUE blue)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
return d3drm_face2_SetColorRGB(&face->IDirect3DRMFace2_iface, red, green, blue);
}
static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, color 0x%08lx.\n", iface, color);
face->color = color;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p, color 0x%08lx.\n", iface, color);
return d3drm_face2_SetColor(&face->IDirect3DRMFace2_iface, color);
}
static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture)
{
FIXME("iface %p, texture %p stub!\n", iface, texture);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface,
DWORD vertex, D3DVALUE u, D3DVALUE v)
{
FIXME("iface %p, vertex %lu, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material)
{
FIXME("iface %p, material %p stub!\n", iface, material);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v)
{
FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface,
DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
{
FIXME("iface %p, index %lu, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface,
DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
{
FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
iface, vertex_count, coords, normals);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface,
DWORD vertex, D3DVALUE *u, D3DVALUE *v)
{
FIXME("iface %p, vertex %lu, u %p, v %p stub!\n", iface, vertex, u, v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v)
{
FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal)
{
FIXME("iface %p, normal %p stub!\n", iface, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture)
{
FIXME("iface %p, texture %p stub!\n", iface, texture);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material)
{
FIXME("iface %p, material %p stub!\n", iface, material);
return E_NOTIMPL;
}
static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface)
{
FIXME("iface %p stub!\n", iface);
return 0;
}
static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which)
{
FIXME("iface %p, which %lu stub!\n", iface, which);
return 0;
}
static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which)
{
FIXME("iface %p, which %lu stub!\n", iface, which);
return 0;
}
static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p.\n", iface);
return face->color;
}
static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
TRACE("iface %p.\n", iface);
return d3drm_face2_GetColor(&face->IDirect3DRMFace2_iface);
}
static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl =
{
d3drm_face1_QueryInterface,
d3drm_face1_AddRef,
d3drm_face1_Release,
d3drm_face1_Clone,
d3drm_face1_AddDestroyCallback,
d3drm_face1_DeleteDestroyCallback,
d3drm_face1_SetAppData,
d3drm_face1_GetAppData,
d3drm_face1_SetName,
d3drm_face1_GetName,
d3drm_face1_GetClassName,
d3drm_face1_AddVertex,
d3drm_face1_AddVertexAndNormalIndexed,
d3drm_face1_SetColorRGB,
d3drm_face1_SetColor,
d3drm_face1_SetTexture,
d3drm_face1_SetTextureCoordinates,
d3drm_face1_SetMaterial,
d3drm_face1_SetTextureTopology,
d3drm_face1_GetVertex,
d3drm_face1_GetVertices,
d3drm_face1_GetTextureCoordinates,
d3drm_face1_GetTextureTopology,
d3drm_face1_GetNormal,
d3drm_face1_GetTexture,
d3drm_face1_GetMaterial,
d3drm_face1_GetVertexCount,
d3drm_face1_GetVertexIndex,
d3drm_face1_GetTextureCoordinateIndex,
d3drm_face1_GetColor,
};
static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out);
}
static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface);
}
static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
return d3drm_face1_Release(&face->IDirect3DRMFace_iface);
}
static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface,
IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_add_destroy_callback(&face->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_delete_destroy_callback(&face->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_class_name(&face->obj, size, name);
}
static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface,
DWORD vertex, DWORD normal)
{
FIXME("iface %p, vertex %lu, normal %lu stub!\n", iface, vertex, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture)
{
FIXME("iface %p, texture %p stub!\n", iface, texture);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface,
DWORD vertex, D3DVALUE u, D3DVALUE v)
{
FIXME("iface %p, vertex %lu, u %.8e, v %.8e stub!\n", iface, vertex, u, v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material)
{
FIXME("iface %p, material %p stub!\n", iface, material);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v)
{
FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface,
DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal)
{
FIXME("iface %p, index %lu, vertex %p, normal %p stub!\n", iface, index, vertex, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface,
DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals)
{
FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n",
iface, vertex_count, coords, normals);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface,
DWORD vertex, D3DVALUE *u, D3DVALUE *v)
{
FIXME("iface %p, vertex %lu, u %p, v %p stub!\n", iface, vertex, u, v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v)
{
FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal)
{
FIXME("iface %p, normal %p stub!\n", iface, normal);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture)
{
FIXME("iface %p, texture %p stub!\n", iface, texture);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material)
{
FIXME("iface %p, material %p stub!\n", iface, material);
return E_NOTIMPL;
}
static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface)
{
FIXME("iface %p stub!\n", iface);
return 0;
}
static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which)
{
FIXME("iface %p, which %lu stub!\n", iface, which);
return 0;
}
static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which)
{
FIXME("iface %p, which %lu stub!\n", iface, which);
return 0;
}
static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
{
d3drm_face2_QueryInterface,
d3drm_face2_AddRef,
d3drm_face2_Release,
d3drm_face2_Clone,
d3drm_face2_AddDestroyCallback,
d3drm_face2_DeleteDestroyCallback,
d3drm_face2_SetAppData,
d3drm_face2_GetAppData,
d3drm_face2_SetName,
d3drm_face2_GetName,
d3drm_face2_GetClassName,
d3drm_face2_AddVertex,
d3drm_face2_AddVertexAndNormalIndexed,
d3drm_face2_SetColorRGB,
d3drm_face2_SetColor,
d3drm_face2_SetTexture,
d3drm_face2_SetTextureCoordinates,
d3drm_face2_SetMaterial,
d3drm_face2_SetTextureTopology,
d3drm_face2_GetVertex,
d3drm_face2_GetVertices,
d3drm_face2_GetTextureCoordinates,
d3drm_face2_GetTextureTopology,
d3drm_face2_GetNormal,
d3drm_face2_GetTexture,
d3drm_face2_GetMaterial,
d3drm_face2_GetVertexCount,
d3drm_face2_GetVertexIndex,
d3drm_face2_GetTextureCoordinateIndex,
d3drm_face2_GetColor,
};
HRESULT d3drm_face_create(struct d3drm_face **face)
{
static const char classname[] = "Face";
struct d3drm_face *object;
TRACE("face %p.\n", face);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#elif defined(_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4090 ) /* different 'const' qualifiers */
#endif
object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning( pop )
#endif
object->ref = 1;
d3drm_object_init(&object->obj, classname);
*face = object;
return S_OK;
}

3965
3rdparty/d3drm/frame.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,524 +0,0 @@
/*
* Copyright (C) 2005 Peter Berg Larsen
* Copyright (C) 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DRM_H__
#define __D3DRM_H__
#include <ddraw.h>
typedef struct IDirect3DRM *LPDIRECT3DRM, **LPLPDIRECT3DRM;
#include <d3drmobj.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Direct3DRM Object CLSID */
DEFINE_GUID(CLSID_CDirect3DRM, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
/* Direct3DRM Interface GUIDs */
DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
DEFINE_GUID(IID_IDirect3DRM2, 0x4516ecc8, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRM3, 0x4516ec83, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
typedef struct IDirect3DRM2 *LPDIRECT3DRM2, **LPLPDIRECT3DRM2;
typedef struct IDirect3DRM3 *LPDIRECT3DRM3, **LPLPDIRECT3DRM3;
HRESULT WINAPI Direct3DRMCreate(struct IDirect3DRM **d3drm);
/*****************************************************************************
* IDirect3DRMObject interface
*/
#ifdef WINE_NO_UNICODE_MACROS
#undef GetClassName
#endif
#define INTERFACE IDirect3DRM
DECLARE_INTERFACE_(IDirect3DRM,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DRM methods ***/
STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE;
STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame *parent, IDirect3DRMFrame **frame) PURE;
STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE;
STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder **mesh_builder) PURE;
STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE;
STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation **animation) PURE;
STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet **set) PURE;
STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture **texture) PURE;
STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE;
STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b,
IDirect3DRMLight **light) PURE;
STDMETHOD(CreateMaterial)(THIS_ D3DVALUE power, IDirect3DRMMaterial **material) PURE;
STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice **device) PURE;
STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw,
IDirectDrawSurface *surface, IDirect3DRMDevice **device) PURE;
STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D *d3d, IDirect3DDevice *d3d_device,
IDirect3DRMDevice **device) PURE;
STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid,
int width, int height, IDirect3DRMDevice **device) PURE;
STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface,
IDirect3DRMTexture **texture) PURE;
STDMETHOD(CreateShadow)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMLight *light,
D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
IDirect3DRMVisual **shadow) PURE;
STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice *device, IDirect3DRMFrame *camera,
DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) PURE;
STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz,
D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov,
D3DVALUE su, D3DVALUE sv, IDirect3DRMWrap **wrap) PURE;
STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE;
STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture **texture) PURE;
STDMETHOD(LoadTextureFromResource)(THIS_ HRSRC resource, IDirect3DRMTexture **texture) PURE;
STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE;
STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE;
STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE;
STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE;
STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE;
STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags,
D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx,
IDirect3DRMFrame *parent_frame) PURE;
STDMETHOD(Tick)(THIS_ D3DVALUE) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirect3DRM_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DRM_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DRM_Release(p) (p)->lpVtbl->Release(p)
/*** IDirect3DRM methods ***/
#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d)
#define IDirect3DRM_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b)
#define IDirect3DRM_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a)
#define IDirect3DRM_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a)
#define IDirect3DRM_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a)
#define IDirect3DRM_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a)
#define IDirect3DRM_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a)
#define IDirect3DRM_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b)
#define IDirect3DRM_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c)
#define IDirect3DRM_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e)
#define IDirect3DRM_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
#define IDirect3DRM_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c)
#define IDirect3DRM_CreateDeviceFromSurface(p,a,b,c,d) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d)
#define IDirect3DRM_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c)
#define IDirect3DRM_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e)
#define IDirect3DRM_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b)
#define IDirect3DRM_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DRM_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g)
#define IDirect3DRM_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c)
#define IDirect3DRM_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b)
#define IDirect3DRM_LoadTextureFromResource(p,a,b) (p)->lpVtbl->LoadTextureFromResource(p,a,b)
#define IDirect3DRM_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a)
#define IDirect3DRM_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a)
#define IDirect3DRM_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b)
#define IDirect3DRM_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a)
#define IDirect3DRM_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a)
#define IDirect3DRM_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a)
#define IDirect3DRM_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b)
#define IDirect3DRM_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b)
#define IDirect3DRM_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM_Tick(p,a) (p)->lpVtbl->Tick(p,a)
#else
/*** IUnknown methods ***/
#define IDirect3DRM_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DRM_AddRef(p) (p)->AddRef()
#define IDirect3DRM_Release(p) (p)->Release()
/*** IDirect3DRM methods ***/
#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d)
#define IDirect3DRM_CreateFrame(p,a,b) (p)->CreateFrame(a,b)
#define IDirect3DRM_CreateMesh(p,a) (p)->CreateMesh(a)
#define IDirect3DRM_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a)
#define IDirect3DRM_CreateFace(p,a) (p)->CreateFace(a)
#define IDirect3DRM_CreateAnimation(p,a) (p)->CreateAnimation(a)
#define IDirect3DRM_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a)
#define IDirect3DRM_CreateTexture(p,a,b) (p)->CreateTexture(a,b)
#define IDirect3DRM_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c)
#define IDirect3DRM_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e)
#define IDirect3DRM_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b)
#define IDirect3DRM_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c)
#define IDirect3DRM_CreateDeviceFromSurface(p,a,b,c,d) (p)->CreateDeviceFromSurface(a,b,c,d)
#define IDirect3DRM_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c)
#define IDirect3DRM_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e)
#define IDirect3DRM_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b)
#define IDirect3DRM_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i)
#define IDirect3DRM_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g)
#define IDirect3DRM_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c)
#define IDirect3DRM_LoadTexture(p,a,b) (p)->LoadTexture(a,b)
#define IDirect3DRM_LoadTextureFromResource(p,a,b) (p)->LoadTextureFromResource(a,b)
#define IDirect3DRM_SetSearchPath(p,a) (p)->SetSearchPath(a)
#define IDirect3DRM_AddSearchPath(p,a) (p)->AddSearchPath(a)
#define IDirect3DRM_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b)
#define IDirect3DRM_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a)
#define IDirect3DRM_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a)
#define IDirect3DRM_GetDevices(p,a) (p)->GetDevices(a)
#define IDirect3DRM_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b)
#define IDirect3DRM_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b)
#define IDirect3DRM_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM_Tick(p,a) (p)->Tick(a)
#endif
/*****************************************************************************
* IDirect3DRM2 interface
*/
#ifdef WINE_NO_UNICODE_MACROS
#undef GetClassName
#endif
#define INTERFACE IDirect3DRM2
DECLARE_INTERFACE_(IDirect3DRM2,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DRM2 methods ***/
STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE;
STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame *parent, IDirect3DRMFrame2 **frame) PURE;
STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE;
STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder2 **mesh_builder) PURE;
STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE;
STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation **animation) PURE;
STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet **set) PURE;
STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture2 **texture) PURE;
STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE;
STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b,
IDirect3DRMLight **light) PURE;
STDMETHOD(CreateMaterial)(THIS_ D3DVALUE power, IDirect3DRMMaterial **material) PURE;
STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice2 **device) PURE;
STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw,
IDirectDrawSurface *surface, IDirect3DRMDevice2 **device) PURE;
STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device,
IDirect3DRMDevice2 **device) PURE;
STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid,
int width, int height, IDirect3DRMDevice2 **device) PURE;
STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface,
IDirect3DRMTexture2 **texture) PURE;
STDMETHOD(CreateShadow)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMLight *light,
D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
IDirect3DRMVisual **shadow) PURE;
STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice *device, IDirect3DRMFrame *camera,
DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) PURE;
STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz,
D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov,
D3DVALUE su, D3DVALUE sv, IDirect3DRMWrap **wrap) PURE;
STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE;
STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture2 **texture) PURE;
STDMETHOD(LoadTextureFromResource)(THIS_ HMODULE module, const char *resource_name,
const char *resource_type, IDirect3DRMTexture2 **texture) PURE;
STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE;
STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE;
STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE;
STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE;
STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE;
STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags,
D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx,
IDirect3DRMFrame *parent_frame) PURE;
STDMETHOD(Tick)(THIS_ D3DVALUE) PURE;
STDMETHOD(CreateProgressiveMesh)(THIS_ IDirect3DRMProgressiveMesh **mesh) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirect3DRM2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DRM2_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DRM2_Release(p) (p)->lpVtbl->Release(p)
/*** IDirect3DRM2 methods ***/
#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d)
#define IDirect3DRM2_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b)
#define IDirect3DRM2_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a)
#define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a)
#define IDirect3DRM2_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a)
#define IDirect3DRM2_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a)
#define IDirect3DRM2_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a)
#define IDirect3DRM2_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b)
#define IDirect3DRM2_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c)
#define IDirect3DRM2_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e)
#define IDirect3DRM2_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
#define IDirect3DRM2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c)
#define IDirect3DRM2_CreateDeviceFromSurface(p,a,b,c,d) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d)
#define IDirect3DRM2_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c)
#define IDirect3DRM2_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e)
#define IDirect3DRM2_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b)
#define IDirect3DRM2_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DRM2_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g)
#define IDirect3DRM2_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM2_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c)
#define IDirect3DRM2_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b)
#define IDirect3DRM2_LoadTextureFromResource(p,a,b,c,d) (p)->lpVtbl->LoadTextureFromResource(p,a,b,c,d)
#define IDirect3DRM2_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a)
#define IDirect3DRM2_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a)
#define IDirect3DRM2_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b)
#define IDirect3DRM2_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a)
#define IDirect3DRM2_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a)
#define IDirect3DRM2_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a)
#define IDirect3DRM2_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b)
#define IDirect3DRM2_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b)
#define IDirect3DRM2_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM2_Tick(p,a) (p)->lpVtbl->Tick(p,a)
#define IDirect3DRM2_CreateProgressiveMesh(p,a) (p)->lpVtbl->CreateProgressiveMesh(p,a)
#else
/*** IUnknown methods ***/
#define IDirect3DRM2_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DRM2_AddRef(p) (p)->AddRef()
#define IDirect3DRM2_Release(p) (p)->Release()
/*** IDirect3DRM2 methods ***/
#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d)
#define IDirect3DRM2_CreateFrame(p,a,b) (p)->CreateFrame(a,b)
#define IDirect3DRM2_CreateMesh(p,a) (p)->CreateMesh(a)
#define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a)
#define IDirect3DRM2_CreateFace(p,a) (p)->CreateFace(a)
#define IDirect3DRM2_CreateAnimation(p,a) (p)->CreateAnimation(a)
#define IDirect3DRM2_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a)
#define IDirect3DRM2_CreateTexture(p,a,b) (p)->CreateTexture(a,b)
#define IDirect3DRM2_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c)
#define IDirect3DRM2_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e)
#define IDirect3DRM2_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b)
#define IDirect3DRM2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c)
#define IDirect3DRM2_CreateDeviceFromSurface(p,a,b,c,d) (p)->CreateDeviceFromSurface(a,b,c,d)
#define IDirect3DRM2_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c)
#define IDirect3DRM2_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e)
#define IDirect3DRM2_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b)
#define IDirect3DRM2_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i)
#define IDirect3DRM2_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g)
#define IDirect3DRM2_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM2_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c)
#define IDirect3DRM2_LoadTexture(p,a,b) (p)->LoadTexture(a,b)
#define IDirect3DRM2_LoadTextureFromResource(p,a,b,c,d) (p)->LoadTextureFromResource(a,b,c,d)
#define IDirect3DRM2_SetSearchPath(p,a) (p)->SetSearchPath(a)
#define IDirect3DRM2_AddSearchPath(p,a) (p)->AddSearchPath(a)
#define IDirect3DRM2_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b)
#define IDirect3DRM2_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a)
#define IDirect3DRM2_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a)
#define IDirect3DRM2_GetDevices(p,a) (p)->GetDevices(a)
#define IDirect3DRM2_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b)
#define IDirect3DRM2_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b)
#define IDirect3DRM2_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM2_Tick(p,a) (p)->Tick(a)
#define IDirect3DRM2_CreateProgressiveMesh(p,a) (p)->CreateProgressiveMesh(a)
#endif
/*****************************************************************************
* IDirect3DRM3 interface
*/
#ifdef WINE_NO_UNICODE_MACROS
#undef GetClassName
#endif
#define INTERFACE IDirect3DRM3
DECLARE_INTERFACE_(IDirect3DRM3,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DRM2 methods ***/
STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE;
STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame) PURE;
STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE;
STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder3 **mesh_builder) PURE;
STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace2 **face) PURE;
STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation2 **animation) PURE;
STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet2 **set) PURE;
STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture3 **texture) PURE;
STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE;
STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b,
IDirect3DRMLight **light) PURE;
STDMETHOD(CreateMaterial)(THIS_ D3DVALUE, IDirect3DRMMaterial2 **material) PURE;
STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice3 **device) PURE;
STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw,
IDirectDrawSurface *surface, DWORD flags, IDirect3DRMDevice3 **device) PURE;
STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device,
IDirect3DRMDevice3 **device) PURE;
STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid,
int width, int height, IDirect3DRMDevice3 **device) PURE;
STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface,
IDirect3DRMTexture3 **texture) PURE;
STDMETHOD(CreateShadow)(THIS_ IUnknown *object, IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz,
D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, IDirect3DRMShadow2 **shadow) PURE;
STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice3 *device, IDirect3DRMFrame3 *camera,
DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport) PURE;
STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame3 *reference,
D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv,
IDirect3DRMWrap **wrap) PURE;
STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE;
STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture3 **texture) PURE;
STDMETHOD(LoadTextureFromResource)(THIS_ HMODULE module, const char *resource_name,
const char *resource_type, IDirect3DRMTexture3 **texture) PURE;
STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE;
STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE;
STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE;
STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE;
STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE;
STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE;
STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags,
D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx,
IDirect3DRMFrame3 *parent_frame) PURE;
STDMETHOD(Tick)(THIS_ D3DVALUE) PURE;
STDMETHOD(CreateProgressiveMesh)(THIS_ IDirect3DRMProgressiveMesh **mesh) PURE;
STDMETHOD(RegisterClient)(THIS_ REFGUID guid, DWORD *id) PURE;
STDMETHOD(UnregisterClient)(THIS_ REFGUID rguid) PURE;
STDMETHOD(CreateClippedVisual)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMClippedVisual **clipped_visual) PURE;
STDMETHOD(SetOptions)(THIS_ DWORD) PURE;
STDMETHOD(GetOptions)(THIS_ DWORD *flags) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirect3DRM3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DRM3_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DRM3_Release(p) (p)->lpVtbl->Release(p)
/*** IDirect3DRM3 methods ***/
#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d)
#define IDirect3DRM3_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b)
#define IDirect3DRM3_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a)
#define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a)
#define IDirect3DRM3_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a)
#define IDirect3DRM3_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a)
#define IDirect3DRM3_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a)
#define IDirect3DRM3_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b)
#define IDirect3DRM3_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c)
#define IDirect3DRM3_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e)
#define IDirect3DRM3_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b)
#define IDirect3DRM3_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c)
#define IDirect3DRM3_CreateDeviceFromSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d,e)
#define IDirect3DRM3_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c)
#define IDirect3DRM3_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e)
#define IDirect3DRM3_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b)
#define IDirect3DRM3_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i)
#define IDirect3DRM3_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g)
#define IDirect3DRM3_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM3_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c)
#define IDirect3DRM3_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b)
#define IDirect3DRM3_LoadTextureFromResource(p,a,b,c,d) (p)->lpVtbl->LoadTextureFromResource(p,a,b,c,d)
#define IDirect3DRM3_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a)
#define IDirect3DRM3_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a)
#define IDirect3DRM3_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b)
#define IDirect3DRM3_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a)
#define IDirect3DRM3_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a)
#define IDirect3DRM3_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a)
#define IDirect3DRM3_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b)
#define IDirect3DRM3_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b)
#define IDirect3DRM3_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM3_Tick(p,a) (p)->lpVtbl->Tick(p,a)
#define IDirect3DRM3_CreateProgressiveMesh(p,a) (p)->lpVtbl->CreateProgressiveMesh(p,a)
#define IDirect3DRM3_RegisterClient(p,a,b) (p)->lpVtbl->RegisterClient(p,a,b)
#define IDirect3DRM3_UnregisterClient(p,a) (p)->lpVtbl->UnregisterClient(p,a)
#define IDirect3DRM3_CreateClippedVisual(p,a,b) (p)->lpVtbl->CreateClippedVisual(p,a,b)
#define IDirect3DRM3_SetOptions(p,a) (p)->lpVtbl->SetOptions(p,a)
#define IDirect3DRM3_GetOptions(p,a) (p)->lpVtbl->GetOptions(p,a)
#else
/*** IUnknown methods ***/
#define IDirect3DRM3_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DRM3_AddRef(p) (p)->AddRef()
#define IDirect3DRM3_Release(p) (p)->Release()
/*** IDirect3DRM3 methods ***/
#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d)
#define IDirect3DRM3_CreateFrame(p,a,b) (p)->CreateFrame(a,b)
#define IDirect3DRM3_CreateMesh(p,a) (p)->CreateMesh(a)
#define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a)
#define IDirect3DRM3_CreateFace(p,a) (p)->CreateFace(a)
#define IDirect3DRM3_CreateAnimation(p,a) (p)->CreateAnimation(a)
#define IDirect3DRM3_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a)
#define IDirect3DRM3_CreateTexture(p,a,b) (p)->CreateTexture(a,b)
#define IDirect3DRM3_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c)
#define IDirect3DRM3_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e)
#define IDirect3DRM3_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b)
#define IDirect3DRM3_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c)
#define IDirect3DRM3_CreateDeviceFromSurface(p,a,b,c,d,e) (p)->CreateDeviceFromSurface(a,b,c,d,e)
#define IDirect3DRM3_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c)
#define IDirect3DRM3_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e)
#define IDirect3DRM3_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b)
#define IDirect3DRM3_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i)
#define IDirect3DRM3_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g)
#define IDirect3DRM3_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q)
#define IDirect3DRM3_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c)
#define IDirect3DRM3_LoadTexture(p,a,b) (p)->LoadTexture(a,b)
#define IDirect3DRM3_LoadTextureFromResource(p,a,b,c,d) (p)->LoadTextureFromResource(a,b,c,d)
#define IDirect3DRM3_SetSearchPath(p,a) (p)->SetSearchPath(a)
#define IDirect3DRM3_AddSearchPath(p,a) (p)->AddSearchPath(a)
#define IDirect3DRM3_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b)
#define IDirect3DRM3_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a)
#define IDirect3DRM3_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a)
#define IDirect3DRM3_GetDevices(p,a) (p)->GetDevices(a)
#define IDirect3DRM3_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b)
#define IDirect3DRM3_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b)
#define IDirect3DRM3_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j)
#define IDirect3DRM3_Tick(p,a) (p)->Tick(a)
#define IDirect3DRM3_CreateProgressiveMesh(p,a) (p)->CreateProgressiveMesh(a)
#define IDirect3DRM3_RegisterClient(p,a,b) (p)->RegisterClient(a,b)
#define IDirect3DRM3_UnregisterClient(p,a) (p)->UnregisterClient(a)
#define IDirect3DRM3_CreateClippedVisual(p,a,b) (p)->CreateClippedVisual(a,b)
#define IDirect3DRM3_SetOptions(p,a) (p)->SetOptions(a)
#define IDirect3DRM3_GetOptions(p,a) (p)->GetOptions(a)
#endif
#define D3DRM_OK DD_OK
#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781)
#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782)
#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783)
#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784)
#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785)
#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786)
#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787)
#define D3DRMERR_BADFILE MAKE_DDHRESULT(788)
#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789)
#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790)
#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791)
#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792)
#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793)
#define D3DRMERR_LIBRARYNOTFOUND MAKE_DDHRESULT(794)
#define D3DRMERR_INVALIDLIBRARY MAKE_DDHRESULT(795)
#define D3DRMERR_PENDING MAKE_DDHRESULT(796)
#define D3DRMERR_NOTENOUGHDATA MAKE_DDHRESULT(797)
#define D3DRMERR_REQUESTTOOLARGE MAKE_DDHRESULT(798)
#define D3DRMERR_REQUESTTOOSMALL MAKE_DDHRESULT(799)
#define D3DRMERR_CONNECTIONLOST MAKE_DDHRESULT(800)
#define D3DRMERR_LOADABORTED MAKE_DDHRESULT(801)
#define D3DRMERR_NOINTERNET MAKE_DDHRESULT(802)
#define D3DRMERR_BADCACHEFILE MAKE_DDHRESULT(803)
#define D3DRMERR_BOXNOTSET MAKE_DDHRESULT(804)
#define D3DRMERR_BADPMDATA MAKE_DDHRESULT(805)
#define D3DRMERR_CLIENTNOTREGISTERED MAKE_DDHRESULT(806)
#define D3DRMERR_NOTCREATEDFROMDDS MAKE_DDHRESULT(807)
#define D3DRMERR_NOSUCHKEY MAKE_DDHRESULT(808)
#define D3DRMERR_INCOMPATABLEKEY MAKE_DDHRESULT(809)
#define D3DRMERR_ELEMENTINUSE MAKE_DDHRESULT(810)
#define D3DRMERR_TEXTUREFORMATNOTFOUND MAKE_DDHRESULT(811)
#define D3DRMERR_NOTAGGREGATED MAKE_DDHRESULT(812)
#ifdef __cplusplus
}
#endif
#endif /* __D3DRM_H__ */

View File

@ -1,470 +0,0 @@
/*
* Copyright 2007,2010 Vijay Kiran Kamuju
* Copyright 2007 David ADAM
* Copyright 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DRMDEFS_H__
#define __D3DRMDEFS_H__
#include <stddef.h>
#include <d3dtypes.h>
#if defined(__cplusplus)
extern "C" {
#endif
#ifndef __MSABI_LONG
#define __MSABI_LONG(X) (X)
#endif
typedef struct _D3DRMVECTOR4D
{
D3DVALUE x;
D3DVALUE y;
D3DVALUE z;
D3DVALUE w;
} D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
typedef D3DVALUE D3DRMMATRIX4D[4][4];
typedef struct _D3DRMQUATERNION {
D3DVALUE s;
D3DVECTOR v;
} D3DRMQUATERNION, *LPD3DRMQUATERNION;
typedef struct _D3DRMRAY {
D3DVECTOR dvDir;
D3DVECTOR dvPos;
} D3DRMRAY, *LPD3DRMRAY;
typedef struct _D3DRMBOX {
D3DVECTOR min;
D3DVECTOR max;
} D3DRMBOX, *LPD3DRMBOX;
typedef void (*D3DRMWRAPCALLBACK)(D3DVECTOR *vec, int *u, int *v, D3DVECTOR *a, D3DVECTOR *b, void *ctx);
typedef enum _D3DRMLIGHTTYPE {
D3DRMLIGHT_AMBIENT,
D3DRMLIGHT_POINT,
D3DRMLIGHT_SPOT,
D3DRMLIGHT_DIRECTIONAL,
D3DRMLIGHT_PARALLELPOINT
} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
typedef enum _D3DRMSHADEMODE {
D3DRMSHADE_FLAT = 0,
D3DRMSHADE_GOURAUD = 1,
D3DRMSHADE_PHONG = 2,
D3DRMSHADE_MASK = 7,
D3DRMSHADE_MAX = 8
} D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
typedef enum _D3DRMLIGHTMODE {
D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX,
D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX,
D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX,
D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX
} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
typedef enum _D3DRMFILLMODE {
D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX,
D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX,
D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX,
D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX
} D3DRMFILLMODE, *LPD3DRMFILLMODE;
typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
#define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1
#define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2
#define D3DRMRENDERMODE_LIGHTINMODELSPACE 8
#define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16
#define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32
typedef enum _D3DRMTEXTUREQUALITY {
D3DRMTEXTURE_NEAREST,
D3DRMTEXTURE_LINEAR,
D3DRMTEXTURE_MIPNEAREST,
D3DRMTEXTURE_MIPLINEAR,
D3DRMTEXTURE_LINEARMIPNEAREST,
D3DRMTEXTURE_LINEARMIPLINEAR
} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
#define D3DRMTEXTURE_FORCERESIDENT 0x00000001
#define D3DRMTEXTURE_STATIC 0x00000002
#define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004
#define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008
#define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010
#define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020
#define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040
#define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080
#define D3DRMTEXTURE_INVALIDATEONLY 0x00000100
#define D3DRMSHADOW_TRUEALPHA 0x00000001
typedef enum _D3DRMCOMBINETYPE {
D3DRMCOMBINE_REPLACE,
D3DRMCOMBINE_BEFORE,
D3DRMCOMBINE_AFTER
} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
typedef enum _D3DRMPALETTEFLAGS
{
D3DRMPALETTE_FREE,
D3DRMPALETTE_READONLY,
D3DRMPALETTE_RESERVED
} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
typedef struct _D3DRMPALETTEENTRY {
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char flags;
} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
typedef struct _D3DRMIMAGE {
int width;
int height;
int aspectx;
int aspecty;
int depth;
int rgb;
int bytes_per_line;
void* buffer1;
void* buffer2;
ULONG red_mask;
ULONG green_mask;
ULONG blue_mask;
ULONG alpha_mask;
int palette_size;
D3DRMPALETTEENTRY* palette;
} D3DRMIMAGE, *LPD3DRMIMAGE;
typedef enum _D3DRMWRAPTYPE {
D3DRMWRAP_FLAT,
D3DRMWRAP_CYLINDER,
D3DRMWRAP_SPHERE,
D3DRMWRAP_CHROME,
D3DRMWRAP_SHEET,
D3DRMWRAP_BOX
} D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
#define D3DRMWIREFRAME_CULL 1
#define D3DRMWIREFRAME_HIDDENLINE 2
typedef enum _D3DRMPROJECTIONTYPE
{
D3DRMPROJECT_PERSPECTIVE,
D3DRMPROJECT_ORTHOGRAPHIC,
D3DRMPROJECT_RIGHTHANDPERSPECTIVE,
D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC
} D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
#define D3DRMOPTIONS_LEFTHANDED 0x00000001
#define D3DRMOPTIONS_RIGHTHANDED 0x00000002
typedef enum _D3DRMXOFFORMAT {
D3DRMXOF_BINARY,
D3DRMXOF_COMPRESSED,
D3DRMXOF_TEXT
} D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
typedef DWORD D3DRMSAVEOPTIONS;
#define D3DRMXOFSAVE_NORMALS 1
#define D3DRMXOFSAVE_TEXTURECOORDINATES 2
#define D3DRMXOFSAVE_MATERIALS 4
#define D3DRMXOFSAVE_TEXTURENAMES 8
#define D3DRMXOFSAVE_ALL 15
#define D3DRMXOFSAVE_TEMPLATES 16
#define D3DRMXOFSAVE_TEXTURETOPOLOGY 32
typedef enum _D3DRMCOLORSOURCE {
D3DRMCOLOR_FROMFACE,
D3DRMCOLOR_FROMVERTEX
} D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
typedef enum _D3DRMFRAMECONSTRAINT {
D3DRMCONSTRAIN_Z,
D3DRMCONSTRAIN_Y,
D3DRMCONSTRAIN_X
} D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
typedef enum _D3DRMMATERIALMODE {
D3DRMMATERIAL_FROMMESH,
D3DRMMATERIAL_FROMPARENT,
D3DRMMATERIAL_FROMFRAME
} D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
typedef enum _D3DRMFOGMODE {
D3DRMFOG_LINEAR,
D3DRMFOG_EXPONENTIAL,
D3DRMFOG_EXPONENTIALSQUARED
} D3DRMFOGMODE, *LPD3DRMFOGMODE;
typedef enum _D3DRMZBUFFERMODE {
D3DRMZBUFFER_FROMPARENT,
D3DRMZBUFFER_ENABLE,
D3DRMZBUFFER_DISABLE
} D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
typedef enum _D3DRMSORTMODE {
D3DRMSORT_FROMPARENT,
D3DRMSORT_NONE,
D3DRMSORT_FRONTTOBACK,
D3DRMSORT_BACKTOFRONT
} D3DRMSORTMODE, *LPD3DRMSORTMODE;
typedef struct _D3DRMMATERIALOVERRIDE {
DWORD dwSize;
DWORD dwFlags;
D3DCOLORVALUE dcDiffuse;
D3DCOLORVALUE dcAmbient;
D3DCOLORVALUE dcEmissive;
D3DCOLORVALUE dcSpecular;
D3DVALUE dvPower;
IUnknown *lpD3DRMTex;
} D3DRMMATERIALOVERRIDE, *LPD3DRMMATERIALOVERRIDE;
#define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001
#define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002
#define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003
#define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004
#define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008
#define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010
#define D3DRMMATERIALOVERRIDE_POWER 0x00000020
#define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040
#define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080
#define D3DRMMATERIALOVERRIDE_ALL 0x000000FF
#define D3DRMFPTF_ALPHA 0x00000001
#define D3DRMFPTF_NOALPHA 0x00000002
#define D3DRMFPTF_PALETTIZED 0x00000004
#define D3DRMFPTF_NOTPALETTIZED 0x00000008
#define D3DRMSTATECHANGE_UPDATEONLY 0x000000001
#define D3DRMSTATECHANGE_VOLATILE 0x000000002
#define D3DRMSTATECHANGE_NONVOLATILE 0x000000004
#define D3DRMSTATECHANGE_RENDER 0x000000020
#define D3DRMSTATECHANGE_LIGHT 0x000000040
#define D3DRMDEVICE_NOZBUFFER 0x00000001
#define D3DRMCALLBACK_PREORDER 0
#define D3DRMCALLBACK_POSTORDER 1
#define D3DRMRAYPICK_ONLYBOUNDINGBOXES 0x01
#define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 0x02
#define D3DRMRAYPICK_INTERPOLATEUV 0x04
#define D3DRMRAYPICK_INTERPOLATECOLOR 0x08
#define D3DRMRAYPICK_INTERPOLATENORMAL 0x10
#define D3DRMADDFACES_VERTICESONLY 1
#define D3DRMGENERATENORMALS_PRECOMPACT 1
#define D3DRMGENERATENORMALS_USECREASEANGLE 2
#define D3DRMMESHBUILDER_DIRECTPARENT 1
#define D3DRMMESHBUILDER_ROOTMESH 2
#define D3DRMMESHBUILDER_RENDERENABLE 0x00000001
#define D3DRMMESHBUILDER_PICKENABLE 0x00000002
#define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1
#define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2
#define D3DRMADDMESHBUILDER_NOSUBMESHES 4
#define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001
#define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002
#define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004
#define D3DRMFVF_TYPE 0x00000001
#define D3DRMFVF_NORMAL 0x00000002
#define D3DRMFVF_COLOR 0x00000004
#define D3DRMFVF_TEXTURECOORDS 0x00000008
#define D3DRMVERTEX_STRIP 0x00000001
#define D3DRMVERTEX_FAN 0x00000002
#define D3DRMVERTEX_LIST 0x00000004
#define D3DRMCLEAR_TARGET 0x00000001
#define D3DRMCLEAR_ZBUFFER 0x00000002
#define D3DRMCLEAR_DIRTYRECTS 0x00000004
#define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | D3DRMCLEAR_ZBUFFER | D3DRMCLEAR_DIRTYRECTS)
#define D3DRMFOGMETHOD_VERTEX 0x00000001
#define D3DRMFOGMETHOD_TABLE 0x00000002
#define D3DRMFOGMETHOD_ANY 0x00000004
#define D3DRMFRAME_RENDERENABLE 0x00000001
#define D3DRMFRAME_PICKENABLE 0x00000002
typedef DWORD D3DRMANIMATIONOPTIONS;
#define D3DRMANIMATION_OPEN 0x00000001
#define D3DRMANIMATION_CLOSED 0x00000002
#define D3DRMANIMATION_LINEARPOSITION 0x00000004
#define D3DRMANIMATION_SPLINEPOSITION 0x00000008
#define D3DRMANIMATION_SCALEANDROTATION 0x00000010
#define D3DRMANIMATION_POSITION 0x00000020
typedef DWORD D3DRMINTERPOLATIONOPTIONS;
#define D3DRMINTERPOLATION_OPEN 0x0001
#define D3DRMINTERPOLATION_CLOSED 0x0002
#define D3DRMINTERPOLATION_NEAREST 0x0100
#define D3DRMINTERPOLATION_LINEAR 0x0004
#define D3DRMINTERPOLATION_SPLINE 0x0008
#define D3DRMINTERPOLATION_VERTEXCOLOR 0x0040
#define D3DRMINTERPOLATION_SLERPNORMALS 0x0080
typedef DWORD D3DRMLOADOPTIONS;
#define D3DRMLOAD_FROMFILE __MSABI_LONG(0x000)
#define D3DRMLOAD_FROMRESOURCE __MSABI_LONG(0x001)
#define D3DRMLOAD_FROMMEMORY __MSABI_LONG(0x002)
#define D3DRMLOAD_FROMSTREAM __MSABI_LONG(0x004)
#define D3DRMLOAD_FROMURL __MSABI_LONG(0x008)
#define D3DRMLOAD_BYNAME __MSABI_LONG(0x010)
#define D3DRMLOAD_BYPOSITION __MSABI_LONG(0x020)
#define D3DRMLOAD_BYGUID __MSABI_LONG(0x040)
#define D3DRMLOAD_FIRST __MSABI_LONG(0x080)
#define D3DRMLOAD_INSTANCEBYREFERENCE __MSABI_LONG(0x100)
#define D3DRMLOAD_INSTANCEBYCOPYING __MSABI_LONG(0x200)
#define D3DRMLOAD_ASYNCHRONOUS __MSABI_LONG(0x400)
typedef struct _D3DRMLOADRESOURCE
{
HMODULE hModule;
const char *lpName;
const char *lpType;
} D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
typedef struct _D3DRMLOADMEMORY
{
void *lpMemory;
DWORD dSize;
} D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
#define D3DRMPMESHSTATUS_VALID 0x01
#define D3DRMPMESHSTATUS_INTERRUPTED 0x02
#define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04
#define D3DRMPMESHSTATUS_COMPLETE 0x08
#define D3DRMPMESHSTATUS_RENDERABLE 0x10
#define D3DRMPMESHEVENT_BASEMESH 0x01
#define D3DRMPMESHEVENT_COMPLETE 0x02
typedef struct _D3DRMPMESHLOADSTATUS {
DWORD dwSize;
DWORD dwPMeshSize;
DWORD dwBaseMeshSize;
DWORD dwBytesLoaded;
DWORD dwVerticesLoaded;
DWORD dwFacesLoaded;
HRESULT dwLoadResult;
DWORD dwFlags;
} D3DRMPMESHLOADSTATUS, *LPD3DRMPMESHLOADSTATUS;
typedef enum _D3DRMUSERVISUALREASON {
D3DRMUSERVISUAL_CANSEE,
D3DRMUSERVISUAL_RENDER
} D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
typedef struct _D3DRMANIMATIONKEY
{
DWORD dwSize;
DWORD dwKeyType;
D3DVALUE dvTime;
DWORD dwID;
#if !defined(__cplusplus) || !defined(D3D_OVERLOADS)
union
{
D3DRMQUATERNION dqRotateKey;
D3DVECTOR dvScaleKey;
D3DVECTOR dvPositionKey;
} DUMMYUNIONNAME;
#else
D3DVALUE dvK[4];
#endif
} D3DRMANIMATIONKEY;
typedef D3DRMANIMATIONKEY *LPD3DRMANIMATIONKEY;
#define D3DRMANIMATION_ROTATEKEY 0x01
#define D3DRMANIMATION_SCALEKEY 0x02
#define D3DRMANIMATION_POSITIONKEY 0x03
typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
typedef struct _D3DRMVERTEX {
D3DVECTOR position;
D3DVECTOR normal;
D3DVALUE tu;
D3DVALUE tv;
D3DCOLOR color;
} D3DRMVERTEX, *LPD3DRMVERTEX;
typedef LONG D3DRMGROUPINDEX;
static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
void WINAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, D3DRMQUATERNION *q);
D3DRMQUATERNION * WINAPI D3DRMQuaternionFromRotation(D3DRMQUATERNION *x, D3DVECTOR *axis, D3DVALUE theta);
D3DRMQUATERNION * WINAPI D3DRMQuaternionMultiply(D3DRMQUATERNION *ret, D3DRMQUATERNION *x, D3DRMQUATERNION *y);
D3DRMQUATERNION * WINAPI D3DRMQuaternionSlerp(D3DRMQUATERNION *ret,
D3DRMQUATERNION *x, D3DRMQUATERNION *y, D3DVALUE alpha);
D3DVECTOR * WINAPI D3DRMVectorAdd(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y);
D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y);
D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *x, D3DVECTOR *y);
D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *x);
#define D3DRMVectorNormalise D3DRMVectorNormalize
D3DVALUE WINAPI D3DRMVectorModulus(D3DVECTOR *x);
D3DVECTOR * WINAPI D3DRMVectorRandom(D3DVECTOR *ret);
D3DVECTOR * WINAPI D3DRMVectorRotate(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *axis, D3DVALUE theta);
D3DVECTOR * WINAPI D3DRMVectorReflect(D3DVECTOR *ret, D3DVECTOR *ray, D3DVECTOR *normal);
D3DVECTOR * WINAPI D3DRMVectorScale(D3DVECTOR *ret, D3DVECTOR *x, D3DVALUE scale);
D3DVECTOR * WINAPI D3DRMVectorSubtract(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y);
D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE, D3DVALUE, D3DVALUE);
D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE);
D3DVALUE WINAPI D3DRMColorGetAlpha(D3DCOLOR);
D3DVALUE WINAPI D3DRMColorGetBlue(D3DCOLOR);
D3DVALUE WINAPI D3DRMColorGetGreen(D3DCOLOR);
D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR);
#if defined(__cplusplus)
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,103 +0,0 @@
/*
* Copyright (C) 2010 Vijay Kiran Kamuju
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DRMWIN_H__
#define __D3DRMWIN_H__
#include <d3drm.h>
#include <ddraw.h>
#include <d3d.h>
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* Direct3DRMWinDevice interface GUID
*/
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1);
typedef struct IDirect3DRMWinDevice *LPDIRECT3DRMWINDEVICE, **LPLPDIRECT3DRMWINDEVICE;
/*****************************************************************************
* IDirect3DRMWinDevice interface
*/
#define INTERFACE IDirect3DRMWinDevice
DECLARE_INTERFACE_(IDirect3DRMWinDevice,IDirect3DRMObject)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DRMObject methods ***/
STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE;
STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE;
STDMETHOD(SetAppData)(THIS_ LPVOID data) PURE;
STDMETHOD_(LPVOID, GetAppData)(THIS) PURE;
STDMETHOD(SetName)(THIS_ const char *name) PURE;
STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE;
STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE;
/*** IDirect3DRMWinDevice methods ***/
STDMETHOD(HandlePaint)(THIS_ HDC) PURE;
STDMETHOD(HandleActivate)(THIS_ WORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirect3DRMWinDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirect3DRMWinDevice_Release(p) (p)->lpVtbl->Release(p)
/*** IDirect3DRMObject methods ***/
#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c)
#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b)
#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b)
#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a)
#define IDirect3DRMWinDevice_GetAppData(p) (p)->lpVtbl->GetAppData(p)
#define IDirect3DRMWinDevice_SetName(p,a) (p)->lpVtbl->SetName(p,a)
#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b)
/*** IDirect3DRMWinDevice methods ***/
#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->lpVtbl->HandlePaint(p,a)
#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->lpVtbl->HandleActivate(p,a)
#else
/*** IUnknown methods ***/
#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirect3DRMWinDevice_AddRef(p) (p)->AddRef()
#define IDirect3DRMwinDevice_Release(p) (p)->Release()
/*** IDirect3DRMObject methods ***/
#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->Clone(a,b,c)
#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b)
#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b)
#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->SetAppData(a)
#define IDirect3DRMWinDevice_GetAppData(p) (p)->GetAppData()
#define IDirect3DRMWinDevice_SetName(p,a) (p)->SetName(a)
#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->GetName(a,b)
#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->GetClassName(a,b)
/*** IDirect3DRMWinDevice methods ***/
#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->HandlePaint(a)
#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->HandleActivate(a)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __D3DRMWIN_H__ */

View File

@ -1,303 +0,0 @@
/*
* Copyright 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DXFILE_H
#define __WINE_DXFILE_H
#include <objbase.h>
//#include <winnt.h>
#ifdef INTERFACE
#undef INTERFACE
#endif
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
typedef DWORD DXFILEFORMAT;
#define DXFILEFORMAT_BINARY 0
#define DXFILEFORMAT_TEXT 1
#define DXFILEFORMAT_COMPRESSED 2
typedef DWORD DXFILELOADOPTIONS;
#define DXFILELOAD_FROMFILE __MSABI_LONG(0x00)
#define DXFILELOAD_FROMRESOURCE __MSABI_LONG(0x01)
#define DXFILELOAD_FROMMEMORY __MSABI_LONG(0x02)
#define DXFILELOAD_FROMSTREAM __MSABI_LONG(0x04)
#define DXFILELOAD_FROMURL __MSABI_LONG(0x08)
typedef struct _DXFILELOADRESOURCE {
HMODULE hModule;
LPCSTR /*LPCTSTR*/ lpName;
LPCSTR /*LPCTSTR*/ lpType;
} DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
typedef struct _DXFILELOADMEMORY {
LPVOID lpMemory;
DWORD dSize;
} DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
typedef struct IDirectXFile *LPDIRECTXFILE;
typedef struct IDirectXFileEnumObject *LPDIRECTXFILEENUMOBJECT;
typedef struct IDirectXFileSaveObject *LPDIRECTXFILESAVEOBJECT;
typedef struct IDirectXFileObject *LPDIRECTXFILEOBJECT;
typedef struct IDirectXFileData *LPDIRECTXFILEDATA;
typedef struct IDirectXFileDataReference *LPDIRECTXFILEDATAREFERENCE;
typedef struct IDirectXFileBinary *LPDIRECTXFILEBINARY;
STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
#define INTERFACE IDirectXFile
DECLARE_INTERFACE_(IDirectXFile,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFile methods ***/
STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, LPDIRECTXFILEENUMOBJECT *) PURE;
STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, LPDIRECTXFILESAVEOBJECT *) PURE;
STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFile_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFile_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFile_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFile methods ***/
#define IDirectXFile_CreateEnumObject(p,a,b,c) (p)->lpVtbl->CreateEnumObject(p,a,b,c)
#define IDirectXFile_CreateSaveObject(p,a,b,c) (p)->lpVtbl->CreateSaveObject(p,a,b,c)
#define IDirectXFile_RegisterTemplates(p,a,b) (p)->lpVtbl->RegisterTemplates(p,a,b)
#endif
#define INTERFACE IDirectXFileEnumObject
DECLARE_INTERFACE_(IDirectXFileEnumObject,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFileEnumObject methods ***/
STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileEnumObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileEnumObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileEnumObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileEnumObject methods ***/
#define IDirectXFileEnumObject_GetNextDataObject(p,a) (p)->lpVtbl->GetNextDataObject(p,a)
#define IDirectXFileEnumObject_GetDataObjectById(p,a,b) (p)->lpVtbl->GetDataObjectById(p,a,b)
#define IDirectXFileEnumObject_GetDataObjectByName(p,a,b) (p)->lpVtbl->GetDataObjectByName(p,a,b)
#endif
#define INTERFACE IDirectXFileSaveObject
DECLARE_INTERFACE_(IDirectXFileSaveObject,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFileSaveObject methods ***/
STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE;
STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileSaveObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileSaveObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileSaveObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileSaveObject methods ***/
#define IDirectXFileSaveObject_SaveTemplates(p,a,b) (p)->lpVtbl->SaveTemplates(p,a,b)
#define IDirectXFileSaveObject_CreateDataObject(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDataObject(p,a,b,c,d,e,f)
#define IDirectXFileSaveObject_SaveData(p,a) (p)->lpVtbl->SaveData(p,a)
#endif
#define IUNKNOWN_METHODS(kind) \
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) kind; \
STDMETHOD_(ULONG,AddRef)(THIS) kind; \
STDMETHOD_(ULONG,Release)(THIS) kind
#define IDIRECTXFILEOBJECT_METHODS(kind) \
STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \
STDMETHOD(GetId) (THIS_ LPGUID) kind
#define INTERFACE IDirectXFileObject
DECLARE_INTERFACE_(IDirectXFileObject,IUnknown)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileObject_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileObject_GetId(p,a) (p)->lpVtbl->GetId(p,a)
#endif
#define INTERFACE IDirectXFileData
DECLARE_INTERFACE_(IDirectXFileData,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileData methods ***/
STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE;
STDMETHOD(GetType) (THIS_ const GUID **) PURE;
STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE;
STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE;
STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE;
STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileData_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileData_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileData_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileData_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileData methods ***/
#define IDirectXFileData_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c)
#define IDirectXFileData_GetType(p,a) (p)->lpVtbl->GetType(p,a)
#define IDirectXFileData_GetNextObject(p,a) (p)->lpVtbl->GetNextObject(p,a)
#define IDirectXFileData_AddDataObject(p,a) (p)->lpVtbl->AddDataObject(p,a)
#define IDirectXFileData_AddDataReference(p,a,b) (p)->lpVtbl->AddDataReference(p,a,b)
#define IDirectXFileData_AddBinaryObject(p,a,b,c,d,e) (p)->lpVtbl->AddBinaryObject(p,a,b,c,d,e)
#endif
#define INTERFACE IDirectXFileDataReference
DECLARE_INTERFACE_(IDirectXFileDataReference,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileDataReference methods ***/
STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileDataReference_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileDataReference_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileDataReference_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileDataReference_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileDataReference_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileDataReference methods ***/
#define IDirectXFileDataReference_Resolve(p,a) (p)->lpVtbl->Resolve(p,a)
#endif
#define INTERFACE IDirectXFileBinary
DECLARE_INTERFACE_(IDirectXFileBinary,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileBinary methods ***/
STDMETHOD(GetSize) (THIS_ DWORD *) PURE;
STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE;
STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileBinary_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileBinary_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileBinary_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileBinary_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileBinary_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileBinary methods ***/
#define IDirectXFileBinary_GetSize(p,a) (p)->lpVtbl->GetSize(p,a)
#define IDirectXFileBinary_GetMimeType(p,a) (p)->lpVtbl->GetMimeType(p,a)
#define IDirectXFileBinary_Read(p,a,b,c) (p)->lpVtbl->Read(p,a,b,c)
#endif
/* DirectXFile Object CLSID */
DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
/* DirectX File Interface GUIDs */
DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/* DirectX File Header template's GUID */
DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/* DirectX File errors */
#define _FACDD 0x876
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
#define DXFILE_OK 0
#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850)
#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851)
#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852)
#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853)
#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854)
#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855)
#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856)
#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857)
#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858)
#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859)
#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860)
#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861)
#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862)
#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863)
#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864)
#define DXFILEERR_BADFILE MAKE_DDHRESULT(865)
#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866)
#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867)
#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868)
#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869)
#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870)
#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871)
#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872)
#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873)
#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874)
#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875)
#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876)
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* __WINE_DXFILE_H */

403
3rdparty/d3drm/light.c vendored
View File

@ -1,403 +0,0 @@
/*
* Implementation of IDirect3DRMLight Interface
*
* Copyright 2012 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "d3drm_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
static inline struct d3drm_light *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_light, IDirect3DRMLight_iface);
}
static HRESULT WINAPI d3drm_light_QueryInterface(IDirect3DRMLight *iface, REFIID riid, void **out)
{
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DRMLight)
|| IsEqualGUID(riid, &IID_IDirect3DRMObject)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IDirect3DRMLight_AddRef(iface);
*out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI d3drm_light_AddRef(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
ULONG refcount = InterlockedIncrement(&light->ref);
TRACE("%p increasing refcount to %lu.\n", iface, refcount);
return refcount;
}
static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
ULONG refcount = InterlockedDecrement(&light->ref);
TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
if (!refcount)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
IDirect3DRM_Release(light->d3drm);
free(light);
}
return refcount;
}
static HRESULT WINAPI d3drm_light_Clone(IDirect3DRMLight *iface,
IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_light_AddDestroyCallback(IDirect3DRMLight *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_add_destroy_callback(&light->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_light_DeleteDestroyCallback(IDirect3DRMLight *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_delete_destroy_callback(&light->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_light_SetAppData(IDirect3DRMLight *iface, LPVOID data)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, data %#lx.\n", iface, data);
light->obj.appdata = data;
return D3DRM_OK;
}
static LPVOID WINAPI d3drm_light_GetAppData(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->obj.appdata;
}
static HRESULT WINAPI d3drm_light_SetName(IDirect3DRMLight *iface, const char *name)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&light->obj, name);
}
static HRESULT WINAPI d3drm_light_GetName(IDirect3DRMLight *iface, DWORD *size, char *name)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&light->obj, size, name);
}
static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_class_name(&light->obj, size, name);
}
static HRESULT WINAPI d3drm_light_SetType(IDirect3DRMLight *iface, D3DRMLIGHTTYPE type)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, type %#x.\n", iface, type);
light->type = type;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetColor(IDirect3DRMLight *iface, D3DCOLOR color)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, color 0x%08lx.\n", iface, color);
light->color = 0xff000000 | color;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetColorRGB(IDirect3DRMLight *iface,
D3DVALUE red, D3DVALUE green, D3DVALUE blue)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
d3drm_set_color(&light->color, red, green, blue, 1.0f);
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetRange(IDirect3DRMLight *iface, D3DVALUE range)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, range %.8e.\n", iface, range);
light->range = range;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetUmbra(IDirect3DRMLight *iface, D3DVALUE umbra)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, umbra %.8e.\n", iface, umbra);
light->umbra = umbra;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetPenumbra(IDirect3DRMLight *iface, D3DVALUE penumbra)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, penumbra %.8e.\n", iface, penumbra);
light->penumbra = penumbra;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetConstantAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
light->cattenuation = attenuation;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetLinearAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
light->lattenuation = attenuation;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_light_SetQuadraticAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p, attenuation %.8e.\n", iface, attenuation);
light->qattenuation = attenuation;
return D3DRM_OK;
}
static D3DVALUE WINAPI d3drm_light_GetRange(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->range;
}
static D3DVALUE WINAPI d3drm_light_GetUmbra(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", light);
return light->umbra;
}
static D3DVALUE WINAPI d3drm_light_GetPenumbra(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->penumbra;
}
static D3DVALUE WINAPI d3drm_light_GetConstantAttenuation(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->cattenuation;
}
static D3DVALUE WINAPI d3drm_light_GetLinearAttenuation(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->lattenuation;
}
static D3DVALUE WINAPI d3drm_light_GetQuadraticAttenuation(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->qattenuation;
}
static D3DCOLOR WINAPI d3drm_light_GetColor(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->color;
}
static D3DRMLIGHTTYPE WINAPI d3drm_light_GetType(IDirect3DRMLight *iface)
{
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
TRACE("iface %p.\n", iface);
return light->type;
}
static HRESULT WINAPI d3drm_light_SetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame *frame)
{
FIXME("iface %p, frame %p stub!\n", iface, frame);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_light_GetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame **frame)
{
FIXME("iface %p, frame %p stub!\n", iface, frame);
return E_NOTIMPL;
}
static const struct IDirect3DRMLightVtbl d3drm_light_vtbl =
{
d3drm_light_QueryInterface,
d3drm_light_AddRef,
d3drm_light_Release,
d3drm_light_Clone,
d3drm_light_AddDestroyCallback,
d3drm_light_DeleteDestroyCallback,
d3drm_light_SetAppData,
d3drm_light_GetAppData,
d3drm_light_SetName,
d3drm_light_GetName,
d3drm_light_GetClassName,
d3drm_light_SetType,
d3drm_light_SetColor,
d3drm_light_SetColorRGB,
d3drm_light_SetRange,
d3drm_light_SetUmbra,
d3drm_light_SetPenumbra,
d3drm_light_SetConstantAttenuation,
d3drm_light_SetLinearAttenuation,
d3drm_light_SetQuadraticAttenuation,
d3drm_light_GetRange,
d3drm_light_GetUmbra,
d3drm_light_GetPenumbra,
d3drm_light_GetConstantAttenuation,
d3drm_light_GetLinearAttenuation,
d3drm_light_GetQuadraticAttenuation,
d3drm_light_GetColor,
d3drm_light_GetType,
d3drm_light_SetEnableFrame,
d3drm_light_GetEnableFrame,
};
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
{
static const char classname[] = "Light";
struct d3drm_light *object;
TRACE("light %p.\n", light);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#elif defined(_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4090 ) /* different 'const' qualifiers */
#endif
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning( pop )
#endif
object->ref = 1;
object->d3drm = d3drm;
IDirect3DRM_AddRef(object->d3drm);
d3drm_object_init(&object->obj, classname);
*light = object;
return S_OK;
}

View File

@ -1,315 +0,0 @@
/*
* Implementation of IDirect3DRMMaterial2 interface
*
* Copyright 2012 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "d3drm_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
static inline struct d3drm_material *impl_from_IDirect3DRMMaterial2(IDirect3DRMMaterial2 *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_material, IDirect3DRMMaterial2_iface);
}
static HRESULT WINAPI d3drm_material_QueryInterface(IDirect3DRMMaterial2 *iface, REFIID riid, void **out)
{
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DRMMaterial2)
|| IsEqualGUID(riid, &IID_IDirect3DRMMaterial)
|| IsEqualGUID(riid, &IID_IDirect3DRMObject)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IDirect3DRMMaterial2_AddRef(iface);
*out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI d3drm_material_AddRef(IDirect3DRMMaterial2 *iface)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
ULONG refcount = InterlockedIncrement(&material->ref);
TRACE("%p increasing refcount to %lu.\n", iface, refcount);
return refcount;
}
static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
ULONG refcount = InterlockedDecrement(&material->ref);
TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
if (!refcount)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
IDirect3DRM_Release(material->d3drm);
free(material);
}
return refcount;
}
static HRESULT WINAPI d3drm_material_Clone(IDirect3DRMMaterial2 *iface,
IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_material_AddDestroyCallback(IDirect3DRMMaterial2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_add_destroy_callback(&material->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_material_DeleteDestroyCallback(IDirect3DRMMaterial2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_delete_destroy_callback(&material->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_material_SetAppData(IDirect3DRMMaterial2 *iface, LPVOID data)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, data %#lx.\n", iface, data);
material->obj.appdata = data;
return D3DRM_OK;
}
static LPVOID WINAPI d3drm_material_GetAppData(IDirect3DRMMaterial2 *iface)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p.\n", iface);
return material->obj.appdata;
}
static HRESULT WINAPI d3drm_material_SetName(IDirect3DRMMaterial2 *iface, const char *name)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&material->obj, name);
}
static HRESULT WINAPI d3drm_material_GetName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&material->obj, size, name);
}
static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_class_name(&material->obj, size, name);
}
static HRESULT WINAPI d3drm_material_SetPower(IDirect3DRMMaterial2 *iface, D3DVALUE power)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, power %.8e.\n", iface, power);
material->power = power;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_material_SetSpecular(IDirect3DRMMaterial2 *iface,
D3DVALUE r, D3DVALUE g, D3DVALUE b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
material->specular.r = r;
material->specular.g = g;
material->specular.b = b;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_material_SetEmissive(IDirect3DRMMaterial2 *iface,
D3DVALUE r, D3DVALUE g, D3DVALUE b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
material->emissive.r = r;
material->emissive.g = g;
material->emissive.b = b;
return D3DRM_OK;
}
static D3DVALUE WINAPI d3drm_material_GetPower(IDirect3DRMMaterial2 *iface)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p.\n", iface);
return material->power;
}
static HRESULT WINAPI d3drm_material_GetSpecular(IDirect3DRMMaterial2 *iface,
D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
*r = material->specular.r;
*g = material->specular.g;
*b = material->specular.b;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_material_GetEmissive(IDirect3DRMMaterial2 *iface,
D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
*r = material->emissive.r;
*g = material->emissive.g;
*b = material->emissive.b;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_material_GetAmbient(IDirect3DRMMaterial2 *iface,
D3DVALUE *r, D3DVALUE *g, D3DVALUE *b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b);
*r = material->ambient.r;
*g = material->ambient.g;
*b = material->ambient.b;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_material_SetAmbient(IDirect3DRMMaterial2 *iface,
D3DVALUE r, D3DVALUE g, D3DVALUE b)
{
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b);
material->ambient.r = r;
material->ambient.g = g;
material->ambient.b = b;
return D3DRM_OK;
}
static const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl =
{
d3drm_material_QueryInterface,
d3drm_material_AddRef,
d3drm_material_Release,
d3drm_material_Clone,
d3drm_material_AddDestroyCallback,
d3drm_material_DeleteDestroyCallback,
d3drm_material_SetAppData,
d3drm_material_GetAppData,
d3drm_material_SetName,
d3drm_material_GetName,
d3drm_material_GetClassName,
d3drm_material_SetPower,
d3drm_material_SetSpecular,
d3drm_material_SetEmissive,
d3drm_material_GetPower,
d3drm_material_GetSpecular,
d3drm_material_GetEmissive,
d3drm_material_GetAmbient,
d3drm_material_SetAmbient,
};
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm)
{
static const char classname[] = "Material";
struct d3drm_material *object;
TRACE("material %p, d3drm %p.\n", material, d3drm);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#elif defined(_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4090 ) /* different 'const' qualifiers */
#endif
object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning( pop )
#endif
object->ref = 1;
object->d3drm = d3drm;
IDirect3DRM_AddRef(object->d3drm);
object->specular.r = 1.0f;
object->specular.g = 1.0f;
object->specular.b = 1.0f;
d3drm_object_init(&object->obj, classname);
*material = object;
return S_OK;
}

263
3rdparty/d3drm/math.c vendored
View File

@ -1,263 +0,0 @@
/*
* Copyright 2007 David Adam
* Copyright 2007 Vijay Kiran Kamuju
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "d3drm_private.h"
/* Create a RGB color from its components */
D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue)
{
return D3DRMCreateColorRGBA(red, green, blue, 1.0f);
}
/* Create a RGBA color from its components */
D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha)
{
D3DCOLOR color;
d3drm_set_color(&color, red, green, blue, alpha);
return color;
}
/* Determine the alpha part of a color */
D3DVALUE WINAPI D3DRMColorGetAlpha(D3DCOLOR color)
{
return (RGBA_GETALPHA(color)/255.0);
}
/* Determine the blue part of a color */
D3DVALUE WINAPI D3DRMColorGetBlue(D3DCOLOR color)
{
return (RGBA_GETBLUE(color)/255.0);
}
/* Determine the green part of a color */
D3DVALUE WINAPI D3DRMColorGetGreen(D3DCOLOR color)
{
return (RGBA_GETGREEN(color)/255.0);
}
/* Determine the red part of a color */
D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR color)
{
return (RGBA_GETRED(color)/255.0);
}
/* Product of 2 quaternions */
D3DRMQUATERNION * WINAPI D3DRMQuaternionMultiply(D3DRMQUATERNION *q, D3DRMQUATERNION *a, D3DRMQUATERNION *b)
{
D3DRMQUATERNION temp;
D3DVECTOR cross_product;
D3DRMVectorCrossProduct(&cross_product, &a->v, &b->v);
temp.s = a->s * b->s - D3DRMVectorDotProduct(&a->v, &b->v);
temp.v.x = a->s * b->v.x + b->s * a->v.x + cross_product.x;
temp.v.y = a->s * b->v.y + b->s * a->v.y + cross_product.y;
temp.v.z = a->s * b->v.z + b->s * a->v.z + cross_product.z;
*q = temp;
return q;
}
/* Matrix for the Rotation that a unit quaternion represents */
void WINAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, D3DRMQUATERNION *q)
{
D3DVALUE w,x,y,z;
w = q->s;
x = q->v.x;
y = q->v.y;
z = q->v.z;
m[0][0] = 1.0-2.0*(y*y+z*z);
m[1][1] = 1.0-2.0*(x*x+z*z);
m[2][2] = 1.0-2.0*(x*x+y*y);
m[1][0] = 2.0*(x*y+z*w);
m[0][1] = 2.0*(x*y-z*w);
m[2][0] = 2.0*(x*z-y*w);
m[0][2] = 2.0*(x*z+y*w);
m[2][1] = 2.0*(y*z+x*w);
m[1][2] = 2.0*(y*z-x*w);
m[3][0] = 0.0;
m[3][1] = 0.0;
m[3][2] = 0.0;
m[0][3] = 0.0;
m[1][3] = 0.0;
m[2][3] = 0.0;
m[3][3] = 1.0;
}
/* Return a unit quaternion that represents a rotation of an angle around an axis */
D3DRMQUATERNION * WINAPI D3DRMQuaternionFromRotation(D3DRMQUATERNION *q, D3DVECTOR *v, D3DVALUE theta)
{
q->s = cos(theta/2.0);
D3DRMVectorScale(&q->v, D3DRMVectorNormalize(v), sin(theta/2.0));
return q;
}
/* Interpolation between two quaternions */
D3DRMQUATERNION * WINAPI D3DRMQuaternionSlerp(D3DRMQUATERNION *q,
D3DRMQUATERNION *a, D3DRMQUATERNION *b, D3DVALUE alpha)
{
D3DVALUE dot, epsilon, temp, theta, u;
D3DVECTOR v1, v2;
dot = a->s * b->s + D3DRMVectorDotProduct(&a->v, &b->v);
epsilon = 1.0f;
temp = 1.0f - alpha;
u = alpha;
if (dot < 0.0)
{
epsilon = -1.0;
dot = -dot;
}
if( 1.0f - dot > 0.001f )
{
theta = acos(dot);
temp = sin(theta * temp) / sin(theta);
u = sin(theta * alpha) / sin(theta);
}
q->s = temp * a->s + epsilon * u * b->s;
D3DRMVectorScale(&v1, &a->v, temp);
D3DRMVectorScale(&v2, &b->v, epsilon * u);
D3DRMVectorAdd(&q->v, &v1, &v2);
return q;
}
/* Add Two Vectors */
D3DVECTOR * WINAPI D3DRMVectorAdd(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVECTOR temp;
temp.x=s1->x + s2->x;
temp.y=s1->y + s2->y;
temp.z=s1->z + s2->z;
*d = temp;
return d;
}
/* Subtract Two Vectors */
D3DVECTOR * WINAPI D3DRMVectorSubtract(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVECTOR temp;
temp.x=s1->x - s2->x;
temp.y=s1->y - s2->y;
temp.z=s1->z - s2->z;
*d = temp;
return d;
}
/* Cross Product of Two Vectors */
D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVECTOR temp;
temp.x=s1->y * s2->z - s1->z * s2->y;
temp.y=s1->z * s2->x - s1->x * s2->z;
temp.z=s1->x * s2->y - s1->y * s2->x;
*d = temp;
return d;
}
/* Dot Product of Two vectors */
D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *s1, D3DVECTOR *s2)
{
D3DVALUE dot_product;
dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z;
return dot_product;
}
/* Norm of a vector */
D3DVALUE WINAPI D3DRMVectorModulus(D3DVECTOR *v)
{
D3DVALUE result;
result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z);
return result;
}
/* Normalize a vector. Returns (1,0,0) if INPUT is the NULL vector. */
D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *u)
{
D3DVALUE modulus = D3DRMVectorModulus(u);
if(modulus)
{
D3DRMVectorScale(u,u,1.0/modulus);
}
else
{
u->x=1.0;
u->y=0.0;
u->z=0.0;
}
return u;
}
/* Returns a random unit vector */
D3DVECTOR * WINAPI D3DRMVectorRandom(D3DVECTOR *d)
{
d->x = rand();
d->y = rand();
d->z = rand();
D3DRMVectorNormalize(d);
return d;
}
/* Reflection of a vector on a surface */
D3DVECTOR * WINAPI D3DRMVectorReflect(D3DVECTOR *r, D3DVECTOR *ray, D3DVECTOR *norm)
{
D3DVECTOR sca, temp;
D3DRMVectorSubtract(&temp, D3DRMVectorScale(&sca, norm, 2.0*D3DRMVectorDotProduct(ray,norm)), ray);
*r = temp;
return r;
}
/* Rotation of a vector */
D3DVECTOR * WINAPI D3DRMVectorRotate(D3DVECTOR *r, D3DVECTOR *v, D3DVECTOR *axis, D3DVALUE theta)
{
D3DRMQUATERNION quaternion1, quaternion2, quaternion3;
D3DVECTOR norm;
quaternion1.s = cos(theta * 0.5f);
quaternion2.s = cos(theta * 0.5f);
norm = *D3DRMVectorNormalize(axis);
D3DRMVectorScale(&quaternion1.v, &norm, sin(theta * 0.5f));
D3DRMVectorScale(&quaternion2.v, &norm, -sin(theta * 0.5f));
quaternion3.s = 0.0;
quaternion3.v = *v;
D3DRMQuaternionMultiply(&quaternion1, &quaternion1, &quaternion3);
D3DRMQuaternionMultiply(&quaternion1, &quaternion1, &quaternion2);
*r = *D3DRMVectorNormalize(&quaternion1.v);
return r;
}
/* Scale a vector */
D3DVECTOR * WINAPI D3DRMVectorScale(D3DVECTOR *d, D3DVECTOR *s, D3DVALUE factor)
{
D3DVECTOR temp;
temp.x=factor * s->x;
temp.y=factor * s->y;
temp.z=factor * s->z;
*d = temp;
return d;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +0,0 @@
/*
* Copyright (C) 2007 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_RMXFGUID_H
#define __WINE_RMXFGUID_H
/*****************************************************************************
* Define GUIDs
*/
DEFINE_GUID(TID_D3DRMAnimation, 0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMAnimationKey, 0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMAnimationOptions, 0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMAnimationSet, 0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMAppData, 0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f);
DEFINE_GUID(TID_D3DRMBoolean, 0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b);
DEFINE_GUID(TID_D3DRMBoolean2d, 0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMCamera, 0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMColorRGB, 0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMColorRGBA, 0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMCoords2d, 0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMExternalVisual, 0x98116aa0, 0xbdba, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71);
DEFINE_GUID(TID_D3DRMFloatKeys, 0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMFrame, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMFramePosition, 0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMFrameRotation, 0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMFrameTransformMatrix, 0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMFrameVelocity, 0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMGuid, 0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMIndexedColor, 0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMInfo, 0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMInlineData, 0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMLight, 0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMLightAttenuation, 0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b);
DEFINE_GUID(TID_D3DRMLightPenumbra, 0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f);
DEFINE_GUID(TID_D3DRMLightRange, 0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f);
DEFINE_GUID(TID_D3DRMLightUmbra, 0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f);
DEFINE_GUID(TID_D3DRMMaterial, 0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMMaterialAmbientColor, 0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialArray, 0x35ff44e1, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialDiffuseColor, 0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialEmissiveColor, 0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialPower, 0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialSpecularColor, 0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMaterialWrap, 0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMatrix4x4, 0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMesh, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMMeshFace, 0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMMeshFaceWraps, 0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b);
DEFINE_GUID(TID_D3DRMMeshMaterialList, 0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMeshNormals, 0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMeshTextureCoords, 0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMMeshVertexColors, 0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMProgressiveMesh, 0x8a63c360, 0x997d, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b);
DEFINE_GUID(TID_D3DRMPropertyBag, 0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71);
DEFINE_GUID(TID_D3DRMRightHanded, 0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71);
DEFINE_GUID(TID_D3DRMStringProperty, 0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71);
DEFINE_GUID(TID_D3DRMTextureFilename, 0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMTextureReference, 0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMTimedFloatKeys, 0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3);
DEFINE_GUID(TID_D3DRMUrl, 0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(TID_D3DRMVector, 0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
#endif /* __WINE_RMXFGUID_H */

1497
3rdparty/d3drm/texture.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
/*
* Copyright 2004 Ivan Leo Puoti
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine Direct3D Retained Mode Utility Functions"
#define WINE_FILENAME_STR "d3drm.dll"
#define WINE_FILEVERSION 5,0,2134,14
#define WINE_FILEVERSION_STR "5.0.2134.14"
#define WINE_PRODUCTVERSION 5,0,2134,14
#define WINE_PRODUCTVERSION_STR "5.0"
#include "wine/wine_common_ver.rc"

File diff suppressed because it is too large Load Diff

View File

@ -1,567 +0,0 @@
/*
* Wine debugging interface
*
* Copyright 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep install
#endif
#ifndef __WINE_WINE_DEBUG_H
#define __WINE_WINE_DEBUG_H
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#ifndef GUID_DEFINED
#include <guiddef.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _GUID;
/*
* Internal definitions (do not use these directly)
*/
enum __wine_debug_class
{
__WINE_DBCL_FIXME,
__WINE_DBCL_ERR,
__WINE_DBCL_WARN,
__WINE_DBCL_TRACE,
__WINE_DBCL_INIT = 7 /* lazy init flag */
};
struct __wine_debug_channel
{
unsigned char flags;
char name[15];
};
#ifndef WINE_NO_TRACE_MSGS
# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
#else
# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
#endif
#ifndef WINE_NO_DEBUG_MSGS
# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
#else
# define __WINE_GET_DEBUGGING_WARN(dbch) 0
# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
#endif
/* define error macro regardless of what is configured */
#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
(__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
#define __WINE_DPRINTF(dbcl,dbch) \
do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
struct __wine_debug_channel * const __dbch = (dbch); \
const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
__WINE_DBG_LOG
#define __WINE_DBG_LOG(...) \
wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
#if defined(__MINGW32__) || (!defined(__WINE_USE_MSVCRT) && (defined(__GNUC__) || defined(__clang__)))
#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
#else
#define __WINE_PRINTF_ATTR(fmt,args)
#endif
#ifdef WINE_NO_TRACE_MSGS
#define WINE_TRACE(...) do { } while(0)
#define WINE_TRACE_(ch) WINE_TRACE
#endif
#ifdef WINE_NO_DEBUG_MSGS
#define WINE_WARN(...) do { } while(0)
#define WINE_WARN_(ch) WINE_WARN
#define WINE_FIXME(...) do { } while(0)
#define WINE_FIXME_(ch) WINE_FIXME
#endif
NTSYSAPI int WINAPI __wine_dbg_write( const char *str, unsigned int len );
extern DECLSPEC_EXPORT unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
extern DECLSPEC_EXPORT const char * __cdecl __wine_dbg_strdup( const char *str );
extern DECLSPEC_EXPORT int __cdecl __wine_dbg_output( const char *str );
extern DECLSPEC_EXPORT int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
const char *function );
/*
* Exported definitions and macros
*/
/* These functions return a printable version of a string, including
quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */
#if 0//(defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
# define __wine_dbg_cdecl __cdecl
#else
# define __wine_dbg_cdecl
#endif
#if 0
static const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0);
static inline const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args )
{
char buffer[200];
vsnprintf( buffer, sizeof(buffer), format, args );
return __wine_dbg_strdup( buffer );
}
static const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... )
{
const char *ret;
va_list args;
va_start( args, format );
ret = wine_dbg_vsprintf( format, args );
va_end( args );
return ret;
}
static int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0);
static inline int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args )
{
char buffer[1024];
vsnprintf( buffer, sizeof(buffer), format, args );
return __wine_dbg_output( buffer );
}
static int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2);
static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... )
{
int ret;
va_list args;
va_start( args, format );
ret = wine_dbg_vprintf( format, args );
va_end( args );
return ret;
}
static int __wine_dbg_cdecl wine_dbg_vlog( enum __wine_debug_class cls,
struct __wine_debug_channel *channel, const char *func,
const char *format, va_list args ) __WINE_PRINTF_ATTR(4,0);
static inline int __wine_dbg_cdecl wine_dbg_vlog( enum __wine_debug_class cls,
struct __wine_debug_channel *channel,
const char *function, const char *format, va_list args )
{
int ret;
if (*format == '\1') /* special magic to avoid standard prefix */
{
format++;
function = NULL;
}
if ((ret = __wine_dbg_header( cls, channel, function )) != -1) ret += wine_dbg_vprintf( format, args );
return ret;
}
static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
struct __wine_debug_channel *channel, const char *func,
const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
static inline int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
struct __wine_debug_channel *channel,
const char *function, const char *format, ... )
{
va_list args;
int ret;
va_start( args, format );
ret = wine_dbg_vlog( cls, channel, function, format, args );
va_end( args );
return ret;
}
static inline const char *wine_dbgstr_an( const char *str, int n )
{
static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
char buffer[300], *dst = buffer;
if (!str) return "(null)";
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
#ifndef WINE_UNIX_LIB
if (IsBadStringPtrA( str, n )) return "(invalid)";
#endif
if (n == -1) for (n = 0; str[n]; n++) ;
*dst++ = '"';
while (n-- > 0 && dst <= buffer + sizeof(buffer) - 9)
{
unsigned char c = *str++;
switch (c)
{
case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
case '\t': *dst++ = '\\'; *dst++ = 't'; break;
case '"': *dst++ = '\\'; *dst++ = '"'; break;
case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
default:
if (c < ' ' || c >= 127)
{
*dst++ = '\\';
*dst++ = 'x';
*dst++ = hex[(c >> 4) & 0x0f];
*dst++ = hex[c & 0x0f];
}
else *dst++ = c;
}
}
*dst++ = '"';
if (n > 0)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return __wine_dbg_strdup( buffer );
}
static inline const char *wine_dbgstr_wn( const WCHAR *str, int n )
{
static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
char buffer[300], *dst = buffer;
if (!str) return "(null)";
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
#ifndef WINE_UNIX_LIB
if (IsBadStringPtrW( str, n )) return "(invalid)";
#endif
if (n == -1) for (n = 0; str[n]; n++) ;
*dst++ = 'L';
*dst++ = '"';
while (n-- > 0 && dst <= buffer + sizeof(buffer) - 10)
{
WCHAR c = *str++;
switch (c)
{
case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
case '\t': *dst++ = '\\'; *dst++ = 't'; break;
case '"': *dst++ = '\\'; *dst++ = '"'; break;
case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
default:
if (c < ' ' || c >= 127)
{
*dst++ = '\\';
*dst++ = hex[(c >> 12) & 0x0f];
*dst++ = hex[(c >> 8) & 0x0f];
*dst++ = hex[(c >> 4) & 0x0f];
*dst++ = hex[c & 0x0f];
}
else *dst++ = (char)c;
}
}
*dst++ = '"';
if (n > 0)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return __wine_dbg_strdup( buffer );
}
static inline const char *wine_dbgstr_a( const char *s )
{
return wine_dbgstr_an( s, -1 );
}
static inline const char *wine_dbgstr_w( const WCHAR *s )
{
return wine_dbgstr_wn( s, -1 );
}
#if defined(__hstring_h__) && defined(__WINSTRING_H_)
static inline const char *wine_dbgstr_hstring( HSTRING hstr )
{
UINT32 len;
const WCHAR *str = WindowsGetStringRawBuffer( hstr, &len );
return wine_dbgstr_wn( str, len );
}
#endif
static inline const char *wine_dbgstr_guid( const GUID *id )
{
if (!id) return "(null)";
if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
(unsigned int)id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
}
static inline const char *wine_dbgstr_fourcc( unsigned int fourcc )
{
char str[4] = { (char)fourcc, (char)(fourcc >> 8), (char)(fourcc >> 16), (char)(fourcc >> 24) };
if (!fourcc)
return "''";
if (isprint( str[0] ) && isprint( str[1] ) && isprint( str[2] ) && isprint( str[3] ))
return wine_dbg_sprintf( "'%.4s'", str );
return wine_dbg_sprintf( "0x%08x", fourcc );
}
static inline const char *wine_dbgstr_point( const POINT *pt )
{
if (!pt) return "(null)";
return wine_dbg_sprintf( "(%d,%d)", (int)pt->x, (int)pt->y );
}
static inline const char *wine_dbgstr_rect( const RECT *rect )
{
if (!rect) return "(null)";
return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", (int)rect->left, (int)rect->top,
(int)rect->right, (int)rect->bottom );
}
static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
{
if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
}
#if defined(__oaidl_h__) && defined(V_VT)
static inline const char *wine_dbgstr_vt( VARTYPE vt )
{
static const char *const variant_types[] =
{
"VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE",
"VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN",
"VT_DECIMAL","15","VT_I1","VT_UI1","VT_UI2","VT_UI4","VT_I8","VT_UI8",
"VT_INT","VT_UINT","VT_VOID","VT_HRESULT","VT_PTR","VT_SAFEARRAY",
"VT_CARRAY","VT_USERDEFINED","VT_LPSTR","VT_LPWSTR","32","33","34","35",
"VT_RECORD","VT_INT_PTR","VT_UINT_PTR","39","40","41","42","43","44","45",
"46","47","48","49","50","51","52","53","54","55","56","57","58","59","60",
"61","62","63","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE",
"VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID",
"VT_VERSIONED_STREAM"
};
static const char *const variant_flags[16] =
{
"",
"|VT_VECTOR",
"|VT_ARRAY",
"|VT_VECTOR|VT_ARRAY",
"|VT_BYREF",
"|VT_VECTOR|VT_BYREF",
"|VT_ARRAY|VT_BYREF",
"|VT_VECTOR|VT_ARRAY|VT_BYREF",
"|VT_RESERVED",
"|VT_VECTOR|VT_RESERVED",
"|VT_ARRAY|VT_RESERVED",
"|VT_VECTOR|VT_ARRAY|VT_RESERVED",
"|VT_BYREF|VT_RESERVED",
"|VT_VECTOR|VT_BYREF|VT_RESERVED",
"|VT_ARRAY|VT_BYREF|VT_RESERVED",
"|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED",
};
if (vt & ~VT_TYPEMASK)
return wine_dbg_sprintf( "%s%s", wine_dbgstr_vt(vt&VT_TYPEMASK), variant_flags[vt>>12] );
if (vt < sizeof(variant_types)/sizeof(*variant_types))
return variant_types[vt];
if (vt == VT_BSTR_BLOB)
return "VT_BSTR_BLOB";
return wine_dbg_sprintf( "vt(invalid %x)", vt );
}
static inline const char *wine_dbgstr_variant( const VARIANT *v )
{
if (!v)
return "(null)";
if (V_VT(v) & VT_BYREF) {
if (V_VT(v) == (VT_VARIANT|VT_BYREF))
return wine_dbg_sprintf( "%p {VT_VARIANT|VT_BYREF: %s}", v, wine_dbgstr_variant(V_VARIANTREF(v)) );
if (V_VT(v) == (VT_BSTR|VT_BYREF))
return wine_dbg_sprintf( "%p {VT_BSTR|VT_BYREF: %s}", v, V_BSTRREF(v) ? wine_dbgstr_w(*V_BSTRREF(v)) : "(none)" );
return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_BYREF(v) );
}
if (V_ISARRAY(v) || V_ISVECTOR(v))
return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_ARRAY(v) );
switch(V_VT(v)) {
case VT_EMPTY:
return wine_dbg_sprintf( "%p {VT_EMPTY}", v );
case VT_NULL:
return wine_dbg_sprintf( "%p {VT_NULL}", v );
case VT_I2:
return wine_dbg_sprintf( "%p {VT_I2: %d}", v, V_I2(v) );
case VT_I4:
return wine_dbg_sprintf( "%p {VT_I4: %d}", v, (int)V_I4(v) );
case VT_R4:
return wine_dbg_sprintf( "%p {VT_R4: %f}", v, V_R4(v) );
case VT_R8:
return wine_dbg_sprintf( "%p {VT_R8: %lf}", v, V_R8(v) );
case VT_CY:
return wine_dbg_sprintf( "%p {VT_CY: %s}", v, wine_dbgstr_longlong(V_CY(v).int64) );
case VT_DATE:
return wine_dbg_sprintf( "%p {VT_DATE: %lf}", v, V_DATE(v) );
case VT_LPSTR:
return wine_dbg_sprintf( "%p {VT_LPSTR: %s}", v, wine_dbgstr_a((const char *)V_BSTR(v)) );
case VT_LPWSTR:
return wine_dbg_sprintf( "%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) );
case VT_BSTR:
return wine_dbg_sprintf( "%p {VT_BSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) );
case VT_DISPATCH:
return wine_dbg_sprintf( "%p {VT_DISPATCH: %p}", v, V_DISPATCH(v) );
case VT_ERROR:
return wine_dbg_sprintf( "%p {VT_ERROR: %08x}", v, (int)V_ERROR(v) );
case VT_BOOL:
return wine_dbg_sprintf( "%p {VT_BOOL: %x}", v, V_BOOL(v) );
case VT_UNKNOWN:
return wine_dbg_sprintf( "%p {VT_UNKNOWN: %p}", v, V_UNKNOWN(v) );
case VT_I1:
return wine_dbg_sprintf( "%p {VT_I1: %d}", v, V_I1(v) );
case VT_UI1:
return wine_dbg_sprintf( "%p {VT_UI1: %u}", v, V_UI1(v) );
case VT_UI2:
return wine_dbg_sprintf( "%p {VT_UI2: %u}", v, V_UI2(v) );
case VT_UI4:
return wine_dbg_sprintf( "%p {VT_UI4: %u}", v, (unsigned int)V_UI4(v) );
case VT_I8:
return wine_dbg_sprintf( "%p {VT_I8: %s}", v, wine_dbgstr_longlong(V_I8(v)) );
case VT_UI8:
return wine_dbg_sprintf( "%p {VT_UI8: %s}", v, wine_dbgstr_longlong(V_UI8(v)) );
case VT_INT:
return wine_dbg_sprintf( "%p {VT_INT: %d}", v, V_INT(v) );
case VT_UINT:
return wine_dbg_sprintf( "%p {VT_UINT: %u}", v, V_UINT(v) );
case VT_VOID:
return wine_dbg_sprintf( "%p {VT_VOID}", v );
case VT_RECORD:
return wine_dbg_sprintf( "%p {VT_RECORD: %p %p}", v, V_RECORD(v), V_RECORDINFO(v) );
default:
return wine_dbg_sprintf( "%p {vt %s}", v, wine_dbgstr_vt(V_VT(v)) );
}
}
#endif
#endif /* defined(__oaidl_h__) && defined(V_VT) */
#ifndef WINE_TRACE
#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
#endif
#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
#ifndef WINE_WARN
#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
#endif
#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
#ifndef WINE_FIXME
#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
#endif
#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }; \
C_ASSERT(sizeof(#ch) <= sizeof(__wine_dbch_##ch.name))
#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }; \
C_ASSERT(sizeof(#ch) <= sizeof(__wine_dbch_##ch.name)); \
static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
#define WINE_MESSAGE wine_dbg_printf
#ifdef __WINESRC__
/* Wine uses shorter names that are very likely to conflict with other software */
#if 0
static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
static inline const char *debugstr_fourcc( unsigned int cc ) { return wine_dbgstr_fourcc( cc ); }
static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
#if defined(__hstring_h__) && defined(__WINSTRING_H_)
static inline const char *debugstr_hstring( struct HSTRING__ *s ) { return wine_dbgstr_hstring( s ); }
#endif
#if defined(__oaidl_h__) && defined(V_VT)
static inline const char *debugstr_vt( VARTYPE vt ) { return wine_dbgstr_vt( vt ); }
static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbgstr_variant( v ); }
#endif
#endif
#define TRACE WINE_TRACE
#define TRACE_(ch) WINE_TRACE_(ch)
#define TRACE_ON(ch) WINE_TRACE_ON(ch)
#define WARN WINE_WARN
#define WARN_(ch) WINE_WARN_(ch)
#define WARN_ON(ch) WINE_WARN_ON(ch)
#define FIXME WINE_FIXME
#define FIXME_(ch) WINE_FIXME_(ch)
#define FIXME_ON(ch) WINE_FIXME_ON(ch)
#if 0
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
#define ERR WINE_ERR
#define ERR_(ch) WINE_ERR_(ch)
#define ERR_ON(ch) WINE_ERR_ON(ch)
#else
static void ERR(const char *msg) {
/* Do something */
}
#endif
#define MESSAGE WINE_MESSAGE
#endif /* __WINESRC__ */
#ifdef __cplusplus
}
#endif
#endif /* __WINE_WINE_DEBUG_H */

View File

@ -1,270 +0,0 @@
/*
* Linked lists support
*
* Copyright (C) 2002 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_SERVER_LIST_H
#define __WINE_SERVER_LIST_H
#include <stddef.h>
struct list
{
struct list *next;
struct list *prev;
};
/* Define a list like so:
*
* struct gadget
* {
* struct list entry; <-- doesn't have to be the first item in the struct
* int a, b;
* };
*
* static struct list global_gadgets = LIST_INIT( global_gadgets );
*
* or
*
* struct some_global_thing
* {
* struct list gadgets;
* };
*
* list_init( &some_global_thing->gadgets );
*
* Manipulate it like this:
*
* list_add_head( &global_gadgets, &new_gadget->entry );
* list_remove( &new_gadget->entry );
* list_add_after( &some_random_gadget->entry, &new_gadget->entry );
*
* And to iterate over it:
*
* struct gadget *gadget;
* LIST_FOR_EACH_ENTRY( gadget, &global_gadgets, struct gadget, entry )
* {
* ...
* }
*
*/
/* add an element after the specified one */
static inline void list_add_after( struct list *elem, struct list *to_add )
{
to_add->next = elem->next;
to_add->prev = elem;
elem->next->prev = to_add;
elem->next = to_add;
}
/* add an element before the specified one */
static inline void list_add_before( struct list *elem, struct list *to_add )
{
to_add->next = elem;
to_add->prev = elem->prev;
elem->prev->next = to_add;
elem->prev = to_add;
}
/* add element at the head of the list */
static inline void list_add_head( struct list *list, struct list *elem )
{
list_add_after( list, elem );
}
/* add element at the tail of the list */
static inline void list_add_tail( struct list *list, struct list *elem )
{
list_add_before( list, elem );
}
/* remove an element from its list */
static inline void list_remove( struct list *elem )
{
elem->next->prev = elem->prev;
elem->prev->next = elem->next;
}
/* get the next element */
static inline struct list *list_next( const struct list *list, const struct list *elem )
{
struct list *ret = elem->next;
if (elem->next == list) ret = NULL;
return ret;
}
/* get the previous element */
static inline struct list *list_prev( const struct list *list, const struct list *elem )
{
struct list *ret = elem->prev;
if (elem->prev == list) ret = NULL;
return ret;
}
/* get the first element */
static inline struct list *list_head( const struct list *list )
{
return list_next( list, list );
}
/* get the last element */
static inline struct list *list_tail( const struct list *list )
{
return list_prev( list, list );
}
/* check if a list is empty */
static inline int list_empty( const struct list *list )
{
return list->next == list;
}
/* initialize a list */
static inline void list_init( struct list *list )
{
list->next = list->prev = list;
}
/* count the elements of a list */
static inline unsigned int list_count( const struct list *list )
{
unsigned count = 0;
const struct list *ptr;
for (ptr = list->next; ptr != list; ptr = ptr->next) count++;
return count;
}
/* move all elements from src to before the specified element */
static inline void list_move_before( struct list *dst, struct list *src )
{
if (list_empty(src)) return;
dst->prev->next = src->next;
src->next->prev = dst->prev;
dst->prev = src->prev;
src->prev->next = dst;
list_init(src);
}
/* move all elements from src to after the specified element */
static inline void list_move_after( struct list *dst, struct list *src )
{
if (list_empty(src)) return;
dst->next->prev = src->prev;
src->prev->next = dst->next;
dst->next = src->next;
src->next->prev = dst;
list_init(src);
}
/* move all elements from src to the head of dst */
static inline void list_move_head( struct list *dst, struct list *src )
{
list_move_after( dst, src );
}
/* move all elements from src to the tail of dst */
static inline void list_move_tail( struct list *dst, struct list *src )
{
list_move_before( dst, src );
}
/* move the slice of elements from begin to end inclusive to the head of dst */
static inline void list_move_slice_head( struct list *dst, struct list *begin, struct list *end )
{
struct list *dst_next = dst->next;
begin->prev->next = end->next;
end->next->prev = begin->prev;
dst->next = begin;
dst_next->prev = end;
begin->prev = dst;
end->next = dst_next;
}
/* move the slice of elements from begin to end inclusive to the tail of dst */
static inline void list_move_slice_tail( struct list *dst, struct list *begin, struct list *end )
{
struct list *dst_prev = dst->prev;
begin->prev->next = end->next;
end->next->prev = begin->prev;
dst_prev->next = begin;
dst->prev = end;
begin->prev = dst_prev;
end->next = dst;
}
/* iterate through the list */
#define LIST_FOR_EACH(cursor,list) \
for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next)
/* iterate through the list, with safety against removal */
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list) \
for ((cursor) = (list)->next, (cursor2) = (cursor)->next; \
(cursor) != (list); \
(cursor) = (cursor2), (cursor2) = (cursor)->next)
/* iterate through the list using a list entry */
#define LIST_FOR_EACH_ENTRY(elem, list, type, field) \
for ((elem) = LIST_ENTRY((list)->next, type, field); \
&(elem)->field != (list); \
(elem) = LIST_ENTRY((elem)->field.next, type, field))
/* iterate through the list using a list entry, with safety against removal */
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field) \
for ((cursor) = LIST_ENTRY((list)->next, type, field), \
(cursor2) = LIST_ENTRY((cursor)->field.next, type, field); \
&(cursor)->field != (list); \
(cursor) = (cursor2), \
(cursor2) = LIST_ENTRY((cursor)->field.next, type, field))
/* iterate through the list in reverse order */
#define LIST_FOR_EACH_REV(cursor,list) \
for ((cursor) = (list)->prev; (cursor) != (list); (cursor) = (cursor)->prev)
/* iterate through the list in reverse order, with safety against removal */
#define LIST_FOR_EACH_SAFE_REV(cursor, cursor2, list) \
for ((cursor) = (list)->prev, (cursor2) = (cursor)->prev; \
(cursor) != (list); \
(cursor) = (cursor2), (cursor2) = (cursor)->prev)
/* iterate through the list in reverse order using a list entry */
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field) \
for ((elem) = LIST_ENTRY((list)->prev, type, field); \
&(elem)->field != (list); \
(elem) = LIST_ENTRY((elem)->field.prev, type, field))
/* iterate through the list in reverse order using a list entry, with safety against removal */
#define LIST_FOR_EACH_ENTRY_SAFE_REV(cursor, cursor2, list, type, field) \
for ((cursor) = LIST_ENTRY((list)->prev, type, field), \
(cursor2) = LIST_ENTRY((cursor)->field.prev, type, field); \
&(cursor)->field != (list); \
(cursor) = (cursor2), \
(cursor2) = LIST_ENTRY((cursor)->field.prev, type, field))
/* macros for statically initialized lists */
#undef LIST_INIT
#define LIST_INIT(list) { &(list), &(list) }
/* get pointer to object containing list element */
#undef LIST_ENTRY
#define LIST_ENTRY(elem, type, field) \
((type *)((char *)(elem) - offsetof(type, field)))
#endif /* __WINE_SERVER_LIST_H */

View File

@ -1,152 +0,0 @@
/*
* Copyright 2001 Dmitry Timoshkov
* Copyright 2004 Ivan Leo Puoti
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep header
#endif
#include "winresrc.h"
/*
Assign WINE_FILEVERSION and WINE_FILEVERSION_STR high enough number
to make sure that programs, relying on the version numbers, will
never complain.
*/
#ifndef WINE_FILEVERSION_MAJOR
#define WINE_FILEVERSION_MAJOR 10
#endif
#ifndef WINE_FILEVERSION_MINOR
#define WINE_FILEVERSION_MINOR 0
#endif
#ifndef WINE_FILEVERSION_BUILD
#define WINE_FILEVERSION_BUILD 0
#endif
#ifndef WINE_FILEVERSION_PLATFORMID
#define WINE_FILEVERSION_PLATFORMID 0
#endif
#ifndef WINE_FILEVERSION
#define WINE_FILEVERSION WINE_FILEVERSION_MAJOR,WINE_FILEVERSION_MINOR,\
WINE_FILEVERSION_BUILD,WINE_FILEVERSION_PLATFORMID
#endif
#define WINE_VER_STRINGIZE2(x) #x
#define WINE_VER_STRINGIZE(x) WINE_VER_STRINGIZE2(x)
#define WINE_VER_HEXPREFIX2(x) 0x ## x
#define WINE_VER_HEXPREFIX(x) WINE_VER_HEXPREFIX2(x)
#ifndef WINE_FILEVERSION_STR
#define WINE_FILEVERSION_STR WINE_VER_STRINGIZE(WINE_FILEVERSION_MAJOR.WINE_FILEVERSION_MINOR.WINE_FILEVERSION_BUILD.WINE_FILEVERSION_PLATFORMID)
#endif
#ifndef WINE_FILEDESCRIPTION_STR
#define WINE_FILEDESCRIPTION_STR "Wine core dll"
#endif
#ifndef WINE_FILENAME
#define WINE_FILENAME ""
#endif
#ifndef WINE_FILENAME_STR
#define WINE_FILENAME_STR ""
#endif
#ifndef WINE_FILETYPE
#define WINE_FILETYPE VFT_DLL
#endif
#ifndef WINE_FILESUBTYPE
#define WINE_FILESUBTYPE VFT2_UNKNOWN
#endif
#ifndef WINE_LEGALCOPYRIGHT
#define WINE_LEGALCOPYRIGHT "Copyright (c) 1993-2024 the Wine project authors (see the file AUTHORS for a complete list)"
#endif
#ifndef WINE_PRODUCTVERSION
#define WINE_PRODUCTVERSION 1,0,0,0
#endif
#ifndef WINE_PRODUCTVERSION_STR
#define WINE_PRODUCTVERSION_STR "1.0"
#endif
#ifndef WINE_PRODUCTNAME_STR
#define WINE_PRODUCTNAME_STR "Wine"
#endif
#ifndef WINE_EXTRAVALUES
#define WINE_EXTRAVALUES
#endif
#ifndef WINE_CODEPAGE
#ifdef _WIN32
#define WINE_CODEPAGE 04B0 /* CP1200 (Unicode) */
#else
#define WINE_CODEPAGE 04E4 /* CP1252 for Win16 */
#endif
#endif
#ifndef WINE_CODEPAGE_STR
#define WINE_CODEPAGE_STR WINE_VER_STRINGIZE(WINE_CODEPAGE)
#endif
#ifndef WINE_CODEPAGE_HEX
#define WINE_CODEPAGE_HEX WINE_VER_HEXPREFIX(WINE_CODEPAGE)
#endif
#ifndef WINE_LANGID
#define WINE_LANGID 0409 /* LANG_ENGLISH/SUBLANG_DEFAULT */
#endif
#define WINE_LANGID_STR WINE_VER_STRINGIZE(WINE_LANGID)
#define WINE_LANGID_HEX WINE_VER_HEXPREFIX(WINE_LANGID)
VS_VERSION_INFO VERSIONINFO
FILEVERSION WINE_FILEVERSION
PRODUCTVERSION WINE_PRODUCTVERSION
FILEFLAGSMASK 63
FILEFLAGS 0
FILEOS VOS_UNKNOWN
FILETYPE WINE_FILETYPE
FILESUBTYPE WINE_FILESUBTYPE
{
BLOCK "StringFileInfo"
{
BLOCK WINE_LANGID_STR WINE_CODEPAGE_STR
{
VALUE "CompanyName", "Microsoft Corporation" /* GameGuard depends on this */
VALUE "FileDescription", WINE_FILEDESCRIPTION_STR
VALUE "FileVersion", WINE_FILEVERSION_STR
VALUE "InternalName", WINE_FILENAME
VALUE "LegalCopyright", WINE_LEGALCOPYRIGHT
VALUE "OriginalFilename", WINE_FILENAME_STR
VALUE "ProductName", WINE_PRODUCTNAME_STR
VALUE "ProductVersion", WINE_PRODUCTVERSION_STR
WINE_EXTRAVALUES
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", WINE_LANGID_HEX, WINE_CODEPAGE_HEX
}
}

View File

@ -1,27 +1,36 @@
cmake_minimum_required(VERSION 3.25 FATAL_ERROR) cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
# MSVC runtime library flags are selected by an abstraction
cmake_policy(SET CMP0091 NEW)
# To set BUILD_* variables for iniparser below. Is there another way?
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# Building on Linux
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(isle CXX C) project(isle CXX C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(CheckCXXSourceCompiles)
include(CMakeDependentOption)
include(CMakePushCheckState)
if (NOT MINGW)
set(NOT_MINGW ON)
else()
set(NOT_MINGW OFF)
endif()
option(ISLE_BUILD_APP "Build isle application" ON)
option(ISLE_ASAN "Enable Address Sanitizer" OFF)
option(ISLE_WERROR "Treat warnings as errors" OFF)
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
cmake_dependent_option(ISLE_MINIWIN "Use miniwin and minimfc" ON "NOT ISLE_USE_DX5" OFF)
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN" OFF)
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll")
# By configuring CMake with -DDOWNLOAD_DEPENDENCIES=ON/OFF, message(STATUS "Isle app: ${ISLE_BUILD_APP}")
# users can choose between downloading dependencies or using system libraries message(STATUS "Config app: ${ISLE_BUILD_CONFIG}")
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON) message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}")
message(STATUS "Internal miniwin: ${ISLE_MINIWIN}")
option(ISLE_ASAN "Enable AddressSanitizer" OFF) if (DOWNLOAD_DEPENDENCIES)
if(DOWNLOAD_DEPENDENCIES)
# FetchContent downloads and configures dependencies # FetchContent downloads and configures dependencies
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
@ -48,17 +57,12 @@ else()
find_package(SDL3 CONFIG REQUIRED) find_package(SDL3 CONFIG REQUIRED)
find_package(iniparser CONFIG COMPONENTS static) find_package(iniparser CONFIG COMPONENTS static)
if(NOT TARGET iniparser-static) if (NOT TARGET iniparser-static)
find_package(iniparser REQUIRED MODULE COMPONENTS static) find_package(iniparser REQUIRED MODULE COMPONENTS static)
endif() endif()
endif() endif()
include(CheckCXXSourceCompiles)
include(CMakeDependentOption)
include(CMakePushCheckState)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
if (ENABLE_CLANG_TIDY) if (ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_BIN NAMES "clang-tidy") find_program(CLANG_TIDY_BIN NAMES "clang-tidy")
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_BIN}") set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_BIN}")
@ -70,8 +74,28 @@ if (ISLE_ASAN)
add_link_options(-fsanitize=address) add_link_options(-fsanitize=address)
endif() endif()
#if (NOT WIN32)
add_library(miniwin STATIC EXCLUDE_FROM_ALL
miniwin/miniwin/src/miniwin.cpp
miniwin/miniwin/src/miniwin_ddraw.cpp
miniwin/miniwin/src/miniwin_d3d.cpp
miniwin/miniwin/src/miniwin_d3drm.cpp
)
target_include_directories(miniwin PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/miniwin/miniwin/include>")
target_compile_definitions(miniwin PUBLIC "MINIWIN")
target_link_libraries(miniwin PRIVATE SDL3::SDL3)
add_library(minimfc STATIC EXCLUDE_FROM_ALL
miniwin/minimfc/src/minimfc.cpp
)
target_include_directories(minimfc PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/miniwin/minimfc/include>")
target_compile_definitions(minimfc PUBLIC "MINIMFC")
target_link_libraries(minimfc PRIVATE SDL3::SDL3 miniwin)
set(isle_targets)
function(add_cxx_warning WARNING) function(add_cxx_warning WARNING)
if(ISLE_WERROR) if (ISLE_WERROR)
set(compiler_option "-Werror=${WARNING}") set(compiler_option "-Werror=${WARNING}")
else() else()
set(compiler_option "-W${WARNING}") set(compiler_option "-W${WARNING}")
@ -80,7 +104,7 @@ function(add_cxx_warning WARNING)
cmake_push_check_state(RESET) cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_FLAGS "${compiler_option} ") set(CMAKE_REQUIRED_FLAGS "${compiler_option} ")
if(MSVC) if (MSVC)
string(APPEND CMAKE_REQUIRED_FLAGS "/WX") string(APPEND CMAKE_REQUIRED_FLAGS "/WX")
else() else()
string(APPEND CMAKE_REQUIRED_FLAGS "-Werror") string(APPEND CMAKE_REQUIRED_FLAGS "-Werror")
@ -88,55 +112,43 @@ function(add_cxx_warning WARNING)
check_cxx_source_compiles("int main() { return 0; }" ${varname}) check_cxx_source_compiles("int main() { return 0; }" ${varname})
cmake_pop_check_state() cmake_pop_check_state()
if(${varname}) if (${varname})
add_compile_options(${compiler_option}) add_compile_options(${compiler_option})
endif() endif()
endfunction() endfunction()
if(NOT MINGW)
set(NOT_MINGW ON)
else()
set(NOT_MINGW OFF)
endif()
add_subdirectory(3rdparty EXCLUDE_FROM_ALL SYSTEM) add_subdirectory(3rdparty EXCLUDE_FROM_ALL SYSTEM)
option(ISLE_WERROR "Treat warnings as errors" OFF)
option(ISLE_BUILD_APP "Build ISLE.EXE application" ON)
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "NOT MINGW" OFF)
option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ${NOT_MINGW})
cmake_dependent_option(ISLE_D3DRM_FROM_WINE "Use d3drm from wine" "${MINGW}" "NOT ISLE_USE_DX5" OFF)
message(STATUS "Using internal DirectX5 SDK: ${ISLE_USE_DX5}")
message(STATUS "Using d3drm from wine: ${ISLE_D3DRM_FROM_WINE}")
add_cxx_warning(parentheses) add_cxx_warning(parentheses)
add_library(DirectX5::DirectX5 INTERFACE IMPORTED) add_library(DirectX5::DirectX5 INTERFACE IMPORTED)
target_include_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/inc") target_include_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/inc")
target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/lib") target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/lib")
add_subdirectory(3rdparty/d3drm EXCLUDE_FROM_ALL)
add_library(Vec::Vec INTERFACE IMPORTED) add_library(Vec::Vec INTERFACE IMPORTED)
target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec") target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec")
set(lego1_targets) add_library(lego1 SHARED
set(lego1_interface_targets) LEGO1/main.cpp
macro(add_lego1_static_library NAME) )
list(APPEND lego1_targets ${NAME}) set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL")
list(APPEND lego1_interface_targets ${NAME}-interface) target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
add_library(${NAME}-interface INTERFACE) target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1>")
add_library(${NAME}-objects STATIC ${ARGN}) target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/omni/include>")
target_link_libraries(${NAME}-objects PRIVATE ${NAME}-interface) target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/sources>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions>")
target_link_libraries(lego1 PRIVATE SDL3::SDL3)
target_link_libraries(lego1 PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>)
if(WIN32)
set_property(TARGET lego1 PROPERTY PREFIX "")
endif()
target_include_directories(${NAME}-objects PRIVATE $<$<BOOL:${ISLE_D3DRM_FROM_WINE}>:$<TARGET_PROPERTY:d3drm-wine,INTERFACE_INCLUDE_DIRECTORIES>>) target_compile_definitions(lego1 PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DIRECTX5_SDK>)
target_link_libraries(${NAME}-interface INTERFACE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5> SDL3::SDL3) list(APPEND isle_targets lego1)
target_compile_definitions(${NAME}-objects PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DIRECTX5_SDK>)
target_compile_definitions(${NAME}-objects PRIVATE $<$<BOOL:${ISLE_D3DRM_FROM_WINE}>:D3DRM_WINE>)
endmacro()
add_lego1_static_library(tglrl # tglrl sources
target_sources(lego1 PRIVATE
LEGO1/tgl/d3drm/camera.cpp LEGO1/tgl/d3drm/camera.cpp
LEGO1/tgl/d3drm/device.cpp LEGO1/tgl/d3drm/device.cpp
LEGO1/tgl/d3drm/group.cpp LEGO1/tgl/d3drm/group.cpp
@ -147,85 +159,74 @@ add_lego1_static_library(tglrl
LEGO1/tgl/d3drm/texture.cpp LEGO1/tgl/d3drm/texture.cpp
LEGO1/tgl/d3drm/view.cpp LEGO1/tgl/d3drm/view.cpp
) )
target_include_directories(tglrl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PUBLIC "${CMAKE_SOURCE_DIR}/LEGO1")
if(WIN32) # realtime sources
if(ISLE_D3DRM_FROM_WINE) target_sources(lego1 PRIVATE
target_link_libraries(tglrl-interface INTERFACE d3drm-wine)
else()
target_link_libraries(tglrl-interface INTERFACE d3drm)
endif()
else()
include_directories("${CMAKE_SOURCE_DIR}/miniwin")
add_library(miniwin STATIC
miniwin/miniwin.cpp
miniwin/miniwin_ddraw.cpp
miniwin/miniwin_d3d.cpp)
target_link_libraries(miniwin PRIVATE SDL3::SDL3)
target_link_libraries(tglrl-interface INTERFACE miniwin)
endif()
add_lego1_static_library(realtime
LEGO1/realtime/orientableroi.cpp LEGO1/realtime/orientableroi.cpp
LEGO1/realtime/realtime.cpp LEGO1/realtime/realtime.cpp
LEGO1/realtime/realtimeview.cpp LEGO1/realtime/realtimeview.cpp
) )
target_include_directories(realtime-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1")
target_link_libraries(realtime-interface INTERFACE Vec::Vec) target_link_libraries(lego1 PRIVATE Vec::Vec)
add_lego1_static_library(viewmanager # viewmanager sources
target_sources(lego1 PRIVATE
LEGO1/viewmanager/viewlod.cpp LEGO1/viewmanager/viewlod.cpp
LEGO1/viewmanager/viewlodlist.cpp LEGO1/viewmanager/viewlodlist.cpp
LEGO1/viewmanager/viewmanager.cpp LEGO1/viewmanager/viewmanager.cpp
LEGO1/viewmanager/viewroi.cpp LEGO1/viewmanager/viewroi.cpp
) )
target_include_directories(viewmanager-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1")
target_link_libraries(viewmanager-interface INTERFACE Vec::Vec) target_link_libraries(lego1 PRIVATE Vec::Vec)
add_lego1_static_library(mxdirectx # mxdirectx sources
target_sources(lego1 PRIVATE
LEGO1/mxdirectx/mxdirect3d.cpp LEGO1/mxdirectx/mxdirect3d.cpp
LEGO1/mxdirectx/mxdirectdraw.cpp LEGO1/mxdirectx/mxdirectdraw.cpp
LEGO1/mxdirectx/mxdirectxinfo.cpp LEGO1/mxdirectx/mxdirectxinfo.cpp
LEGO1/mxdirectx/legodxinfo.cpp LEGO1/mxdirectx/legodxinfo.cpp
) )
target_include_directories(mxdirectx-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1")
if(WIN32) if (WIN32)
target_link_libraries(mxdirectx-interface INTERFACE ddraw) target_link_libraries(lego1 PRIVATE ddraw)
endif() endif()
add_lego1_static_library(roi # roi sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/roi/legolod.cpp LEGO1/lego/sources/roi/legolod.cpp
LEGO1/lego/sources/roi/legoroi.cpp LEGO1/lego/sources/roi/legoroi.cpp
) )
target_include_directories(roi-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources")
target_link_libraries(roi-interface INTERFACE viewmanager-interface Vec::Vec) target_link_libraries(lego1 PRIVATE Vec::Vec)
add_lego1_static_library(geom # geom sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/geom/legoedge.cpp LEGO1/lego/sources/geom/legoedge.cpp
LEGO1/lego/sources/geom/legounkown100db7f4.cpp LEGO1/lego/sources/geom/legounkown100db7f4.cpp
LEGO1/lego/sources/geom/legoweedge.cpp LEGO1/lego/sources/geom/legoweedge.cpp
LEGO1/lego/sources/geom/legowegedge.cpp LEGO1/lego/sources/geom/legowegedge.cpp
) )
target_include_directories(geom-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources")
target_link_libraries(geom-interface INTERFACE)
add_lego1_static_library(shape # shape sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/shape/legocolor.cpp LEGO1/lego/sources/shape/legocolor.cpp
LEGO1/lego/sources/shape/legobox.cpp LEGO1/lego/sources/shape/legobox.cpp
LEGO1/lego/sources/shape/legomesh.cpp LEGO1/lego/sources/shape/legomesh.cpp
LEGO1/lego/sources/shape/legosphere.cpp LEGO1/lego/sources/shape/legosphere.cpp
LEGO1/lego/sources/shape/legovertex.cpp LEGO1/lego/sources/shape/legovertex.cpp
) )
target_include_directories(shape-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources")
target_link_libraries(shape-interface INTERFACE)
add_lego1_static_library(anim # anim sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/anim/legoanim.cpp LEGO1/lego/sources/anim/legoanim.cpp
) )
target_include_directories(anim-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources")
target_link_libraries(anim-interface INTERFACE)
add_lego1_static_library(misc # misc sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/misc/legocontainer.cpp LEGO1/lego/sources/misc/legocontainer.cpp
LEGO1/lego/sources/misc/legoimage.cpp LEGO1/lego/sources/misc/legoimage.cpp
LEGO1/lego/sources/misc/legostorage.cpp LEGO1/lego/sources/misc/legostorage.cpp
@ -233,19 +234,20 @@ add_lego1_static_library(misc
LEGO1/lego/sources/misc/legotree.cpp LEGO1/lego/sources/misc/legotree.cpp
LEGO1/lego/sources/misc/legounknown.cpp LEGO1/lego/sources/misc/legounknown.cpp
) )
target_include_directories(misc-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources")
target_link_libraries(misc-interface INTERFACE)
add_lego1_static_library(3dmanager # 3dmanager sources
target_sources(lego1 PRIVATE
LEGO1/lego/sources/3dmanager/lego3dmanager.cpp LEGO1/lego/sources/3dmanager/lego3dmanager.cpp
LEGO1/lego/sources/3dmanager/lego3dview.cpp LEGO1/lego/sources/3dmanager/lego3dview.cpp
LEGO1/lego/sources/3dmanager/legoview1.cpp LEGO1/lego/sources/3dmanager/legoview1.cpp
LEGO1/lego/sources/3dmanager/tglsurface.cpp LEGO1/lego/sources/3dmanager/tglsurface.cpp
) )
target_include_directories(3dmanager-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1")
target_link_libraries(3dmanager-interface INTERFACE Vec::Vec) target_link_libraries(lego1 PRIVATE Vec::Vec)
add_lego1_static_library(omni # omni sources
target_sources(lego1 PRIVATE
LEGO1/omni/src/action/mxdsaction.cpp LEGO1/omni/src/action/mxdsaction.cpp
LEGO1/omni/src/action/mxdsanim.cpp LEGO1/omni/src/action/mxdsanim.cpp
LEGO1/omni/src/action/mxdsevent.cpp LEGO1/omni/src/action/mxdsevent.cpp
@ -322,13 +324,14 @@ add_lego1_static_library(omni
LEGO1/omni/src/video/mxvideoparamflags.cpp LEGO1/omni/src/video/mxvideoparamflags.cpp
LEGO1/omni/src/video/mxvideopresenter.cpp LEGO1/omni/src/video/mxvideopresenter.cpp
) )
target_include_directories(omni-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1")
if(WIN32) if (WIN32)
target_link_libraries(omni-interface INTERFACE winmm) target_link_libraries(lego1 INTERFACE winmm)
endif() endif()
target_link_libraries(omni-interface INTERFACE libsmacker miniaudio) target_link_libraries(lego1 PRIVATE libsmacker miniaudio)
add_lego1_static_library(lego1_impl # lego1_impl sources
target_sources(lego1 PRIVATE
LEGO1/define.cpp LEGO1/define.cpp
LEGO1/lego/legoomni/src/actors/act2actor.cpp LEGO1/lego/legoomni/src/actors/act2actor.cpp
LEGO1/lego/legoomni/src/actors/act2genactor.cpp LEGO1/lego/legoomni/src/actors/act2genactor.cpp
@ -439,41 +442,10 @@ add_lego1_static_library(lego1_impl
LEGO1/lego/legoomni/src/worlds/score.cpp LEGO1/lego/legoomni/src/worlds/score.cpp
LEGO1/modeldb/modeldb.cpp LEGO1/modeldb/modeldb.cpp
) )
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/util") target_link_libraries(lego1 PRIVATE Vec::Vec)
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1") if (NOT ISLE_MINIWIN)
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include") target_link_libraries(lego1 PRIVATE d3drm dxguid)
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/lego/sources") target_compile_definitions(lego1 PRIVATE DIRECTINPUT_VERSION=0x0500)
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include")
target_include_directories(lego1_impl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions")
target_link_libraries(lego1_impl-interface INTERFACE omni-interface Vec::Vec)
if(MINGW)
target_compile_definitions(lego1_impl-interface INTERFACE DIRECTINPUT_VERSION=0x0500)
endif()
set(lego1_objects)
set(lego1_link_libraries)
if(WIN32)
list(APPEND lego1_link_libraries dxguid d3drm_guid)
else()
list(APPEND lego1_link_libraries miniwin)
endif()
foreach(lego1_library IN LISTS lego1_targets)
target_compile_definitions(${lego1_library}-objects PRIVATE LEGO1_DLL)
list(APPEND lego1_objects $<TARGET_OBJECTS:${lego1_library}-objects>)
list(APPEND lego1_link_libraries ${lego1_library}-interface)
endforeach()
add_library(lego1 SHARED
LEGO1/main.cpp
${lego1_objects}
)
target_link_libraries(lego1 PUBLIC ${lego1_link_libraries})
# Make sure filenames are ALL CAPS
set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1)
set_property(TARGET lego1 PROPERTY PREFIX "")
if(WIN32)
set_property(TARGET lego1 PROPERTY SUFFIX ".DLL")
endif() endif()
if (ISLE_BUILD_APP) if (ISLE_BUILD_APP)
@ -481,7 +453,8 @@ if (ISLE_BUILD_APP)
ISLE/res/isle.rc ISLE/res/isle.rc
ISLE/isleapp.cpp ISLE/isleapp.cpp
) )
if(WIN32) list(APPEND isle_targets isle)
if (WIN32)
add_custom_command(TARGET isle POST_BUILD add_custom_command(TARGET isle POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_RUNTIME_DLLS:isle> "$<TARGET_FILE_DIR:isle>" COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_RUNTIME_DLLS:isle> "$<TARGET_FILE_DIR:isle>"
COMMAND_EXPAND_LISTS COMMAND_EXPAND_LISTS
@ -497,23 +470,15 @@ if (ISLE_BUILD_APP)
target_link_libraries(isle PRIVATE SDL3::SDL3 iniparser-static) target_link_libraries(isle PRIVATE SDL3::SDL3 iniparser-static)
# Link DSOUND and WINMM # Link DSOUND and WINMM
if(WIN32) if (WIN32)
target_link_libraries(isle PRIVATE winmm) target_link_libraries(isle PRIVATE winmm)
endif() endif()
# Link LEGO1 # Link LEGO1
target_link_libraries(isle PRIVATE lego1) target_link_libraries(isle PRIVATE lego1)
target_include_directories(isle PRIVATE $<$<BOOL:${ISLE_D3DRM_FROM_WINE}>:$<TARGET_PROPERTY:d3drm-wine,INTERFACE_INCLUDE_DIRECTORIES>>)
# Make sure filenames are ALL CAPS
set_property(TARGET isle PROPERTY OUTPUT_NAME ISLE)
if(WIN32)
set_property(TARGET isle PROPERTY SUFFIX ".EXE")
endif()
endif() endif()
if (ISLE_BUILD_CONFIG) if (ISLE_BUILD_CONFIG)
set(config_SRC WIN32 add_executable(config WIN32
LEGO1/mxdirectx/mxdirectxinfo.cpp LEGO1/mxdirectx/mxdirectxinfo.cpp
LEGO1/mxdirectx/legodxinfo.cpp LEGO1/mxdirectx/legodxinfo.cpp
CONFIG/config.cpp CONFIG/config.cpp
@ -524,33 +489,30 @@ if (ISLE_BUILD_CONFIG)
CONFIG/StdAfx.cpp CONFIG/StdAfx.cpp
CONFIG/res/config.rc CONFIG/res/config.rc
) )
if(NOT WIN32) if (ISLE_MINIWIN)
list(APPEND config_SRC miniwin/stdafx.cpp) target_link_libraries(config PRIVATE minimfc)
endif()
add_executable(config ${config_SRC})
if(NOT WIN32)
target_link_libraries(config PUBLIC miniwin)
endif() endif()
list(APPEND isle_targets config)
target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG) target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
target_include_directories(config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/util" "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1") target_include_directories(config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) target_include_directories(config PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
target_link_libraries(config PRIVATE DirectX5::DirectX5) target_link_libraries(config PRIVATE DirectX5::DirectX5)
endif() endif()
target_compile_definitions(config PRIVATE DIRECT3D_VERSION=0x500) target_compile_definitions(config PRIVATE DIRECT3D_VERSION=0x500)
target_link_libraries(config PRIVATE SDL3::SDL3) target_link_libraries(config PRIVATE SDL3::SDL3)
if(WIN32) if (NOT ISLE_MINIWIN)
target_link_libraries(config PRIVATE ddraw dxguid) target_link_libraries(config PRIVATE ddraw dxguid)
endif() endif()
set_property(TARGET config PROPERTY OUTPUT_NAME "CONFIG") endif()
if(WIN32)
set_property(TARGET config PROPERTY SUFFIX ".EXE") if (ISLE_MINIWIN)
endif() set_property(TARGET ${isle_targets} APPEND PROPERTY LINK_LIBRARIES "miniwin")
set_property(TARGET config PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
endif() endif()
if (MSVC) if (MSVC)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15")
set_property(TARGET ${lego1_interface_targets} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS") set_property(TARGET ${isle_targets} APPEND PROPERTY COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS")
if (TARGET isle) if (TARGET isle)
target_compile_definitions(isle PRIVATE "_CRT_SECURE_NO_WARNINGS") target_compile_definitions(isle PRIVATE "_CRT_SECURE_NO_WARNINGS")
endif() endif()
@ -560,9 +522,7 @@ if (MSVC)
endif() endif()
# Visual Studio 2017 version 15.7 needs "/Zc:__cplusplus" for __cplusplus # Visual Studio 2017 version 15.7 needs "/Zc:__cplusplus" for __cplusplus
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.14.26428") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.14.26428")
foreach(tgt IN LISTS lego1_interface_targets) set_property(TARGET ${isle_targets} APPEND PROPERTY COMPILE_OPTIONS "-Zc:__cplusplus")
target_compile_options(${tgt} INTERFACE "-Zc:__cplusplus")
endforeach()
if (TARGET isle) if (TARGET isle)
target_compile_options(isle PRIVATE "-Zc:__cplusplus") target_compile_options(isle PRIVATE "-Zc:__cplusplus")
endif() endif()
@ -572,22 +532,22 @@ if (MSVC)
endif() endif()
endif() endif()
if(MSVC) if (MSVC)
target_link_options(isle PRIVATE "/SAFESEH:NO") target_link_options(isle PRIVATE "/SAFESEH:NO")
target_link_options(lego1 PRIVATE "/SAFESEH:NO") target_link_options(lego1 PRIVATE "/SAFESEH:NO")
endif() endif()
find_program(CLANGFORMAT_BIN NAMES clang-format) find_program(CLANGFORMAT_BIN NAMES clang-format)
if(EXISTS "${CLANGFORMAT_BIN}") if (EXISTS "${CLANGFORMAT_BIN}")
execute_process(COMMAND "${CLANGFORMAT_BIN}" --version execute_process(COMMAND "${CLANGFORMAT_BIN}" --version
OUTPUT_VARIABLE "CLANGFORMAT_VERSION_OUTPUT" OUTPUT_VARIABLE "CLANGFORMAT_VERSION_OUTPUT"
RESULT_VARIABLE "CLANGFORMAT_RESULT" RESULT_VARIABLE "CLANGFORMAT_RESULT"
) )
if(CLANGFORMAT_RESULT EQUAL 0 AND CLANGFORMAT_VERSION_OUTPUT MATCHES "version ([0-9\\.]+)") if (CLANGFORMAT_RESULT EQUAL 0 AND CLANGFORMAT_VERSION_OUTPUT MATCHES "version ([0-9\\.]+)")
set(CLANGFORMAT_VERSION "${CMAKE_MATCH_1}") set(CLANGFORMAT_VERSION "${CMAKE_MATCH_1}")
set(CLANGFORMAT_VERSION_REQUIRED "17.0") set(CLANGFORMAT_VERSION_REQUIRED "17.0")
message(DEBUG "Found clang-format version ${CLANGFORMAT_VERSION} (needs ${CLANGFORMAT_VERSION_REQUIRED}") message(DEBUG "Found clang-format version ${CLANGFORMAT_VERSION} (needs ${CLANGFORMAT_VERSION_REQUIRED}")
if(CLANGFORMAT_VERSION VERSION_GREATER_EQUAL "${CLANGFORMAT_VERSION_REQUIRED}") if (CLANGFORMAT_VERSION VERSION_GREATER_EQUAL "${CLANGFORMAT_VERSION_REQUIRED}")
file(GLOB_RECURSE isle_sources file(GLOB_RECURSE isle_sources
"${PROJECT_SOURCE_DIR}/ISLE/*.cpp" "${PROJECT_SOURCE_DIR}/ISLE/*.cpp"
"${PROJECT_SOURCE_DIR}/ISLE/*.h" "${PROJECT_SOURCE_DIR}/ISLE/*.h"

View File

@ -1,9 +1,9 @@
#include "MainDlg.h" #include "MainDlg.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
#include "AboutDlg.h" #include "AboutDlg.h"

View File

@ -2,6 +2,6 @@
// simple.pch will be the pre-compiled header // simple.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information // stdafx.obj will contain the pre-compiled type information
#ifdef _WIN32 #ifndef MINIMFC
#include "stdafx.h" #include "StdAfx.h"
#endif #endif

View File

@ -3,14 +3,14 @@
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#ifdef _WIN32 #ifdef MINIMFC
#include "minimfc.h"
#else
#include <afxext.h> // MFC extensions #include <afxext.h> // MFC extensions
#include <afxwin.h> // MFC core and standard components #include <afxwin.h> // MFC core and standard components
#ifndef _AFX_NO_AFXCMN_SUPPORT #ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls #include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT #endif // _AFX_NO_AFXCMN_SUPPORT
#else
#include "miniwin.h"
#endif #endif
#if 0 #if 0

View File

@ -4,17 +4,14 @@
#include "MainDlg.h" #include "MainDlg.h"
#include "detectdx5.h" #include "detectdx5.h"
#ifdef _WIN32
#include <direct.h> // _chdir
#else
#include "miniwin_direct.h"
#endif
#include <mxdirectx/legodxinfo.h> #include <mxdirectx/legodxinfo.h>
#include <mxdirectx/mxdirect3d.h> #include <mxdirectx/mxdirect3d.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <process.h> // _spawnl #include "miniwin_direct.h"
#else
#include "miniwin_process.h" #include "miniwin_process.h"
#else
#include <direct.h> // _chdir
#include <process.h> // _spawnl
#endif #endif
DECOMP_SIZE_ASSERT(CWinApp, 0xc4) DECOMP_SIZE_ASSERT(CWinApp, 0xc4)

View File

@ -5,10 +5,10 @@
#include "compat.h" #include "compat.h"
#include "decomp.h" #include "decomp.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3d.h>
#else
#include "miniwin_d3d.h" #include "miniwin_d3d.h"
#else
#include <d3d.h>
#endif #endif
class LegoDeviceEnumerate; class LegoDeviceEnumerate;

View File

@ -1,11 +1,11 @@
#include "detectdx5.h" #include "detectdx5.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#include <dinput.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#include "miniwin_dinput.h" #include "miniwin_dinput.h"
#else
#include <ddraw.h>
#include <dinput.h>
#endif #endif
typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter); typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);

View File

@ -1,10 +1,10 @@
#if !defined(AFX_DETECTDX5_H) #if !defined(AFX_DETECTDX5_H)
#define AFX_DETECTDX5_H #define AFX_DETECTDX5_H
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
extern BOOL DetectDirectX5(); extern BOOL DetectDirectX5();

View File

@ -8,10 +8,10 @@
#include <SDL3/SDL_mouse.h> #include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_video.h> #include <SDL3/SDL_video.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
// SIZE 0x8c // SIZE 0x8c

View File

@ -12,10 +12,10 @@
#include <SDL3/SDL_keyboard.h> #include <SDL3/SDL_keyboard.h>
#include <SDL3/SDL_keycode.h> #include <SDL3/SDL_keycode.h>
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
class LegoCameraController; class LegoCameraController;

View File

@ -5,10 +5,10 @@
#include "mxcore.h" #include "mxcore.h"
#include "mxgeometry.h" #include "mxgeometry.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
class Lego3DView; class Lego3DView;

View File

@ -4,12 +4,12 @@
#include "misc/legotypes.h" #include "misc/legotypes.h"
#include "tgl/tgl.h" #include "tgl/tgl.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3drmobj.h>
#include <ddraw.h>
#else
#include "miniwin_d3drm.h" #include "miniwin_d3drm.h"
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <d3drmobj.h>
#include <ddraw.h>
#endif #endif
class LegoTexture; class LegoTexture;

View File

@ -8,10 +8,10 @@
#include "mxtypes.h" #include "mxtypes.h"
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
#define WM_ISLE_SETCURSOR 0x5400 #define WM_ISLE_SETCURSOR 0x5400

View File

@ -6,12 +6,12 @@
#include "legophonemelist.h" #include "legophonemelist.h"
#include "mxvideomanager.h" #include "mxvideomanager.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3drm.h>
#include <ddraw.h>
#else
#include "miniwin_d3drm.h" #include "miniwin_d3drm.h"
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <d3drm.h>
#include <ddraw.h>
#endif #endif
class Lego3DManager; class Lego3DManager;

View File

@ -6,10 +6,10 @@
#include "mxcore.h" #include "mxcore.h"
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
class MxVideoPresenter; class MxVideoPresenter;

View File

@ -8,25 +8,6 @@ DECOMP_SIZE_ASSERT(TglSurface, 0x70);
using namespace Tgl; using namespace Tgl;
#ifdef D3DRM_WINE
#include <SDL3/SDL.h>
#define d3drm_wine_assert(COND) \
do { \
if (!(COND)) { \
SDL_Log( \
"%s:%d Assertion failed: \"%s\" (ignored because wine-d3d does not implement it)", \
__FILE__, \
__LINE__, \
#COND \
); \
} \
} while (0)
#else
#define d3drm_wine_assert(X) assert(X)
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// TglSurface // TglSurface
@ -145,11 +126,11 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
if (textureShadeCount != -1) { if (textureShadeCount != -1) {
result = pRenderer->SetTextureDefaultShadeCount(textureShadeCount); result = pRenderer->SetTextureDefaultShadeCount(textureShadeCount);
d3drm_wine_assert(Succeeded(result)); assert(Succeeded(result));
} }
if (textureColorCount != -1) { if (textureColorCount != -1) {
result = pRenderer->SetTextureDefaultColorCount(textureColorCount); result = pRenderer->SetTextureDefaultColorCount(textureColorCount);
d3drm_wine_assert(Succeeded(result)); assert(Succeeded(result));
} }
result = m_pDevice->SetColorModel(colorModel); result = m_pDevice->SetColorModel(colorModel);
@ -157,7 +138,7 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
result = m_pDevice->SetShadingModel(shadingModel); result = m_pDevice->SetShadingModel(shadingModel);
assert(Succeeded(result)); assert(Succeeded(result));
result = m_pDevice->SetShadeCount(shadeCount); result = m_pDevice->SetShadeCount(shadeCount);
d3drm_wine_assert(Succeeded(result)); assert(Succeeded(result));
result = m_pDevice->SetDither(dither); result = m_pDevice->SetDither(dither);
assert(Succeeded(result)); assert(Succeeded(result));

View File

@ -1,7 +1,7 @@
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
// FUNCTION: LEGO1 0x10091ee0 // FUNCTION: LEGO1 0x10091ee0

View File

@ -6,10 +6,10 @@
#include "mxdirectxinfo.h" #include "mxdirectxinfo.h"
#include "mxstl/stlcompat.h" #include "mxstl/stlcompat.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3d.h>
#else
#include "miniwin_d3d.h" #include "miniwin_d3d.h"
#else
#include <d3d.h>
#endif #endif
// VTABLE: LEGO1 0x100db800 // VTABLE: LEGO1 0x100db800

View File

@ -4,12 +4,12 @@
#include "lego1_export.h" #include "lego1_export.h"
#include "mxdirectxinfo.h" #include "mxdirectxinfo.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#include <windows.h>
#endif #endif
// VTABLE: LEGO1 0x100db818 // VTABLE: LEGO1 0x100db818

View File

@ -4,10 +4,10 @@
#include "decomp.h" #include "decomp.h"
#include "mxstl/stlcompat.h" #include "mxstl/stlcompat.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3d.h>
#else
#include "miniwin_d3d.h" #include "miniwin_d3d.h"
#else
#include <d3d.h>
#endif #endif
// SIZE 0x17c // SIZE 0x17c

View File

@ -7,10 +7,10 @@
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
#include <limits.h> // ULONG_MAX #include <limits.h> // ULONG_MAX
#include <math.h> #include <math.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -3,10 +3,10 @@
#include "decomp.h" #include "decomp.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
enum FLI_CHUNK_TYPE { enum FLI_CHUNK_TYPE {

View File

@ -5,10 +5,10 @@
#include "mxtypes.h" #include "mxtypes.h"
#include <SDL3/SDL_iostream.h> #include <SDL3/SDL_iostream.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>

View File

@ -5,10 +5,10 @@
#include "mxcore.h" #include "mxcore.h"
#include "mxvideoparam.h" #include "mxvideoparam.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
class MxBitmap; class MxBitmap;

View File

@ -7,10 +7,10 @@
#include "mxstring.h" #include "mxstring.h"
#include <SDL3/SDL_video.h> #include <SDL3/SDL_video.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
class MxAtomSet; class MxAtomSet;

View File

@ -4,10 +4,10 @@
#include "mxcore.h" #include "mxcore.h"
#include "mxtypes.h" #include "mxtypes.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
// VTABLE: LEGO1 0x100dc848 // VTABLE: LEGO1 0x100dc848

View File

@ -4,10 +4,10 @@
#include "mxmediamanager.h" #include "mxmediamanager.h"
#include "mxvideoparam.h" #include "mxvideoparam.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3d.h>
#else
#include "miniwin_d3d.h" #include "miniwin_d3d.h"
#else
#include <d3d.h>
#endif #endif
class MxDisplaySurface; class MxDisplaySurface;

View File

@ -7,10 +7,10 @@
#include "mxtypes.h" #include "mxtypes.h"
#include "mxvideoparamflags.h" #include "mxvideoparamflags.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
class MxPalette; class MxPalette;

View File

@ -4,10 +4,10 @@
#include "lego1_export.h" #include "lego1_export.h"
#include "mxtypes.h" #include "mxtypes.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
class MxVideoParamFlags { class MxVideoParamFlags {

View File

@ -6,10 +6,10 @@
#include "mxgeometry.h" #include "mxgeometry.h"
#include "mxmediapresenter.h" #include "mxmediapresenter.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <ddraw.h>
#else
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <ddraw.h>
#endif #endif
// VTABLE: LEGO1 0x100d4be8 // VTABLE: LEGO1 0x100d4be8

View File

@ -10,10 +10,10 @@
#include <SDL3/SDL_log.h> #include <SDL3/SDL_log.h>
#include <assert.h> #include <assert.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac); DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);

View File

@ -5,10 +5,10 @@
#include "mxgeometry/mxmatrix.h" #include "mxgeometry/mxmatrix.h"
#include "roi.h" #include "roi.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <windows.h>
#else
#include "miniwin.h" #include "miniwin.h"
#else
#include <windows.h>
#endif #endif
// VTABLE: LEGO1 0x100dbc08 // VTABLE: LEGO1 0x100dbc08

View File

@ -1,10 +1,10 @@
#include "impl.h" #include "impl.h"
#include <assert.h> #include <assert.h>
#ifdef _WIN32 #ifdef MINIWIN
#include <d3drmwin.h>
#else
#include "miniwin_d3drm.h" #include "miniwin_d3drm.h"
#else
#include <d3drmwin.h>
#endif #endif
using namespace TglImpl; using namespace TglImpl;

View File

@ -3,17 +3,13 @@
#include "decomp.h" #include "decomp.h"
#include "tgl/tgl.h" #include "tgl/tgl.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3drm.h>
#ifndef D3DRM_WINE
typedef DWORD LPD3DRM_APPDATA;
#else
typedef LPVOID LPD3DRM_APPDATA;
#endif
#else
#include "miniwin_d3drm.h" #include "miniwin_d3drm.h"
typedef void* LPD3DRM_APPDATA; typedef void* LPD3DRM_APPDATA;
#else
#include <d3drm.h>
typedef DWORD LPD3DRM_APPDATA;
#endif #endif
// Forward declare D3D types // Forward declare D3D types

View File

@ -1,17 +1,22 @@
#ifndef _tgl_h #ifndef _tgl_h
#define _tgl_h #define _tgl_h
#define RASTERCAPS 0x00000000
#include "tglvector.h" #include "tglvector.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3d.h>
#include <ddraw.h>
#include <windows.h>
#else
#include "miniwin.h"
#include "miniwin_d3d.h" #include "miniwin_d3d.h"
#include "miniwin_ddraw.h" #include "miniwin_ddraw.h"
#else
#include <d3d.h>
#include <ddraw.h>
#endif
#ifdef MINIWIN
#include "miniwin.h"
#else
#include <windows.h>
#endif #endif
namespace Tgl namespace Tgl

View File

@ -6,10 +6,10 @@
#include "realtime/realtimeview.h" #include "realtime/realtimeview.h"
#include "viewroi.h" #include "viewroi.h"
#ifdef _WIN32 #ifdef MINIWIN
#include <d3drm.h>
#else
#include "miniwin_d3drm.h" #include "miniwin_d3drm.h"
#else
#include <d3drm.h>
#endif #endif
// VTABLE: LEGO1 0x100dbd88 // VTABLE: LEGO1 0x100dbd88

View File

@ -0,0 +1,109 @@
#pragma once
#include "miniwin.h"
struct CWnd {
void* m_hWnd;
void EnableWindow(bool bEnable) {}
void SetWindowText(const char* text) {}
};
struct CPaintDC {
void* m_hDC;
CPaintDC(HWND hWnd) {}
void Draw() {}
};
struct CDataExchange {
bool m_bSaveAndValidate;
};
struct CDialog {
void* m_hWnd;
int m_nIDTemplate;
CWnd* m_pParentWnd;
CDialog() : m_nIDTemplate(0), m_pParentWnd(nullptr) {}
CDialog(int nIDTemplate) : m_nIDTemplate(nIDTemplate), m_pParentWnd(nullptr) {}
CDialog(int nIDTemplate, CWnd* pParent) : m_nIDTemplate(nIDTemplate), m_pParentWnd(pParent) {}
virtual BOOL OnInitDialog() { return TRUE; }
void OnCancel() {}
virtual void OnOK() {}
virtual void DoModal() {}
virtual void Default() {}
virtual void EndDialog(int nResult) {}
virtual void DoDataExchange(CDataExchange* pDX) {}
};
struct CMenu {
void* m_hMenu;
CMenu() : m_hMenu(nullptr) {}
static CMenu* FromHandle(void* hMenu)
{
CMenu* pMenu = new CMenu();
pMenu->m_hMenu = hMenu;
return pMenu;
}
bool InsertMenu(UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem) { return true; }
bool RemoveMenu(UINT uPosition, UINT uFlags) { return true; }
bool SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition = false) { return true; }
int GetMenuItemCount() const { return 0; }
};
struct CWinApp {
CWinApp();
virtual ~CWinApp();
virtual BOOL InitInstance();
virtual int ExitInstance();
};
struct CCommandLineInfo {
virtual void ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast) {}
};
inline BOOL IsDlgButtonChecked(int nIDButton)
{
return 0;
}
inline CWnd* GetDlgItem(int id)
{
return new CWnd();
}
inline BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
{
return TRUE;
}
inline BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
{
return TRUE;
}
inline BOOL CheckDlgButton(int nIDButton, BOOL uCheck)
{
return TRUE;
}
inline void Enable3dControls()
{
}
inline void ParseCommandLine(CCommandLineInfo& cmdInfo)
{
}
struct AFX_MODULE_STATE {
CWinApp* m_pCurrentWinApp;
};
extern char* afxCurrentAppName;
extern CWinApp* wndTop;
extern AFX_MODULE_STATE g_CustomModuleState;
#define afxCurrentWinApp AfxGetModuleState()->m_pCurrentWinApp
inline AFX_MODULE_STATE* AfxGetModuleState()
{
g_CustomModuleState.m_pCurrentWinApp = wndTop;
return &g_CustomModuleState;
}
void AfxMessageBox(const char* message);

View File

@ -0,0 +1,99 @@
#include "minimfc.h"
#include "miniwin.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <stdlib.h>
char* afxCurrentAppName;
AFX_MODULE_STATE g_CustomModuleState;
CWinApp* wndTop;
SDL_Window* window;
const char* title = "Configure LEGO Island";
CWinApp::CWinApp()
{
if (wndTop != NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "There can only be one CWinApp!");
abort();
}
wndTop = this;
}
CWinApp::~CWinApp() = default;
BOOL CWinApp::InitInstance()
{
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
SDL_Log("SDL_Init: %s\n", SDL_GetError());
return FALSE;
}
window = SDL_CreateWindow(title, 640, 480, 0);
return TRUE;
}
int CWinApp::ExitInstance()
{
SDL_Quit();
return 0;
}
static char* get_base_filename(const char* path)
{
for (;;) {
const char* next = SDL_strpbrk(path, "/\\");
if (next == NULL) {
break;
}
path = next + 1;
}
const char* end = SDL_strchr(path, '.');
size_t len;
if (end == NULL) {
len = SDL_strlen(path);
}
else {
len = end - path;
}
char* filename = new char[len + 1];
SDL_memcpy(filename, path, len);
filename[len] = '\0';
return filename;
}
int main(int argc, char* argv[])
{
afxCurrentAppName = get_base_filename(argv[0]);
if (wndTop == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No CWinApp created");
abort();
}
if (!wndTop->InitInstance()) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CWinApp::InitInstance failed");
}
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT) {
running = false;
}
}
SDL_Delay(16); // 60 FPS
}
int result = wndTop->ExitInstance();
free(afxCurrentAppName);
return result;
}
void AfxMessageBox(const char* message)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
}

View File

@ -1,68 +0,0 @@
#include "miniwin.h"
#include "miniwin_d3d.h"
#include "miniwin_d3drm.h"
#include "miniwin_ddraw.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_log.h>
bool IsEqualGUID(const GUID& a, const GUID& b)
{
return a.m_data1 == b.m_data1 && a.m_data2 == b.m_data2 && a.m_data3 == b.m_data3 && a.m_data4 == b.m_data4;
}
HRESULT IUnknown::QueryInterface(const GUID& riid, void** ppvObject)
{
if (!ppvObject) {
return DDERR_INVALIDPARAMS;
}
if (IsEqualGUID(riid, IID_IDirectDraw2)) {
*ppvObject = new IDirectDraw2();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirectDrawSurface3)) {
*ppvObject = new IDirectDrawSurface3();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirect3D2)) {
*ppvObject = new IDirect3D2();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirect3DRM2)) {
*ppvObject = new IDirect3DRM2();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirect3DRMWinDevice)) {
*ppvObject = new IDirect3DRMWinDevice();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirect3DRMMesh) ||
IsEqualGUID(riid, IID_IDirect3DRMMeshBuilder)) { // Work around bug in GroupImpl::Bounds()
*ppvObject = new IDirect3DRMMesh();
return S_OK;
}
if (IsEqualGUID(riid, IID_IDirect3DRMTexture2)) {
*ppvObject = new IDirect3DRMTexture2();
return S_OK;
}
return DDERR_INVALIDPARAMS;
}
void OutputDebugString(const char* lpOutputString)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString);
}
VOID WINAPI Sleep(DWORD dwMilliseconds)
{
SDL_Delay(dwMilliseconds);
}

View File

@ -8,6 +8,11 @@
#include <string.h> #include <string.h>
// --- Defines and Macros --- // --- Defines and Macros ---
#define RASTERCAPS 0x00000000
#define RC_PALETTE 0x00000000
#define SIZEPALETTE 256
#define MAKE_HRESULT(sev, fac, code) \
((HRESULT) (((uint32_t) (sev) << 31) | ((uint32_t) (fac) << 16) | ((uint32_t) (code))))
// This is not the right way to make a GUID // This is not the right way to make a GUID
#define DEFINE_GUID(GuidName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ #define DEFINE_GUID(GuidName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
@ -17,7 +22,9 @@
#define BEGIN_MESSAGE_MAP(class_name, base_class_name) #define BEGIN_MESSAGE_MAP(class_name, base_class_name)
#define DECLARE_MESSAGE_MAP() #define DECLARE_MESSAGE_MAP()
#define CALLBACK #define CALLBACK
#ifndef __cdecl
#define __cdecl #define __cdecl
#endif
#define FAR #define FAR
#define END_MESSAGE_MAP() #define END_MESSAGE_MAP()
#define ON_COMMAND(id, func) #define ON_COMMAND(id, func)
@ -30,8 +37,8 @@
#define FAILED(hr) (((HRESULT) (hr)) < 0) #define FAILED(hr) (((HRESULT) (hr)) < 0)
#define InterlockedIncrement(x) __sync_add_and_fetch(x, 1) #define InterlockedIncrement(x) __sync_add_and_fetch(x, 1)
#define INVALID_HANDLE ((HANDLE) - 1) #define INVALID_HANDLE ((HANDLE) -1)
#define INVALID_HANDLE_VALUE ((HANDLE) - 1) #define INVALID_HANDLE_VALUE ((HANDLE) -1)
#define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002) #define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
#define GWL_STYLE (-16) #define GWL_STYLE (-16)
#define HWND_NOTOPMOST (HWND) - 2 #define HWND_NOTOPMOST (HWND) - 2
@ -39,6 +46,7 @@
#define MAKEINTRESOURCE(i) (reinterpret_cast<LPCTSTR>((ULONG_PTR) ((WORD) (i)))) #define MAKEINTRESOURCE(i) (reinterpret_cast<LPCTSTR>((ULONG_PTR) ((WORD) (i))))
#define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) #define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
#define S_OK ((HRESULT) 0) #define S_OK ((HRESULT) 0)
#define E_NOINTERFACE (0x80004002)
#define VOID void #define VOID void
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
@ -121,7 +129,8 @@ typedef UINT_PTR WPARAM;
typedef LONG_PTR LPARAM, LRESULT; typedef LONG_PTR LPARAM, LRESULT;
typedef void* HANDLE; typedef void* HANDLE;
typedef HANDLE HMENU, HICON, HFONT; typedef HANDLE HMENU, HICON, HFONT;
typedef HANDLE HWND, HMODULE, HDC, HINSTANCE, HPALETTE, HFILE, HCURSOR; typedef struct HINSTANCE__* HINSTANCE;
typedef HANDLE HWND, HMODULE, HDC, HPALETTE, HFILE, HCURSOR;
typedef LONG HRESULT, LSTATUS, HKEY, REGSAM; typedef LONG HRESULT, LSTATUS, HKEY, REGSAM;
typedef HKEY* PHKEY; typedef HKEY* PHKEY;
@ -196,69 +205,12 @@ typedef GUID REFIID;
typedef GUID* LPGUID; typedef GUID* LPGUID;
struct IUnknown { struct IUnknown {
virtual ULONG AddRef() { return 0; } virtual ULONG AddRef() = 0;
virtual ULONG Release() { return 0; } virtual ULONG Release() = 0;
virtual HRESULT QueryInterface(const GUID& riid, void** ppvObject); virtual HRESULT QueryInterface(const GUID& riid, void** ppvObject) = 0;
}; };
typedef struct IUnknown* LPUNKNOWN; typedef struct IUnknown* LPUNKNOWN;
struct CWnd {
void* m_hWnd;
void EnableWindow(bool bEnable) {}
void SetWindowText(const char* text) {}
};
struct CPaintDC {
void* m_hDC;
CPaintDC(HWND hWnd) {}
void Draw() {}
};
struct CDataExchange {
bool m_bSaveAndValidate;
};
struct CDialog {
void* m_hWnd;
int m_nIDTemplate;
CWnd* m_pParentWnd;
CDialog() : m_nIDTemplate(0), m_pParentWnd(nullptr) {}
CDialog(int nIDTemplate) : m_nIDTemplate(nIDTemplate), m_pParentWnd(nullptr) {}
CDialog(int nIDTemplate, CWnd* pParent) : m_nIDTemplate(nIDTemplate), m_pParentWnd(pParent) {}
virtual BOOL OnInitDialog() { return TRUE; }
void OnCancel() {}
virtual void OnOK() {}
virtual void DoModal() {}
virtual void Default() {}
virtual void EndDialog(int nResult) {}
virtual void DoDataExchange(CDataExchange* pDX) {}
};
struct CMenu {
void* m_hMenu;
CMenu() : m_hMenu(nullptr) {}
static CMenu* FromHandle(void* hMenu)
{
CMenu* pMenu = new CMenu();
pMenu->m_hMenu = hMenu;
return pMenu;
}
bool InsertMenu(UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem) { return true; }
bool RemoveMenu(UINT uPosition, UINT uFlags) { return true; }
bool SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition = false) { return true; }
int GetMenuItemCount() const { return 0; }
};
struct CWinApp {
virtual ~CWinApp();
virtual BOOL InitInstance();
virtual int ExitInstance();
};
struct CCommandLineInfo {
virtual void ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast) {}
};
struct LOGPALETTE { struct LOGPALETTE {
WORD palVersion; WORD palVersion;
WORD palNumEntries; WORD palNumEntries;
@ -310,7 +262,7 @@ inline BOOL SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UIN
return TRUE; return TRUE;
} }
BOOL GetWindowRect(HWND hDlg, struct tagRECT *Rect); BOOL GetWindowRect(HWND hDlg, struct tagRECT* Rect);
inline BOOL GetClientRect(LPRECT lpRect) inline BOOL GetClientRect(LPRECT lpRect)
{ {
@ -337,9 +289,7 @@ inline BOOL GetVersionEx(OSVERSIONINFOA* version)
return TRUE; return TRUE;
} }
inline void GlobalMemoryStatus(MEMORYSTATUS* memory_status) void GlobalMemoryStatus(MEMORYSTATUS* memory_status);
{
}
inline HDC WINAPI GetDC(HWND hWnd) inline HDC WINAPI GetDC(HWND hWnd)
{ {
@ -489,56 +439,8 @@ inline LSTATUS RegCreateKeyEx(
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
inline BOOL IsDlgButtonChecked(int nIDButton)
{
return 0;
}
inline CWnd* GetDlgItem(int id)
{
return new CWnd();
}
inline BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
{
return TRUE;
}
inline BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
{
return TRUE;
}
inline BOOL CheckDlgButton(int nIDButton, BOOL uCheck)
{
return TRUE;
}
void OutputDebugString(const char* lpOutputString); void OutputDebugString(const char* lpOutputString);
inline void Enable3dControls()
{
}
inline void ParseCommandLine(CCommandLineInfo& cmdInfo)
{
}
struct AFX_MODULE_STATE {
CWinApp* m_pCurrentWinApp;
};
extern const char* afxCurrentAppName;
extern CWinApp* wndTop;
extern AFX_MODULE_STATE g_CustomModuleState;
#define afxCurrentWinApp AfxGetModuleState()->m_pCurrentWinApp
inline AFX_MODULE_STATE* AfxGetModuleState()
{
g_CustomModuleState.m_pCurrentWinApp = wndTop;
return &g_CustomModuleState;
}
void AfxMessageBox(const char* message);
inline void* GetProcAddress(HMODULE module, const char* name) inline void* GetProcAddress(HMODULE module, const char* name)
{ {
return 0; return 0;
@ -578,10 +480,8 @@ inline int DeleteObject(void*)
return 1; return 1;
} }
inline int _stricmp(const char* str1, const char* str2) int miniwin_stricmp(const char* str1, const char* str2);
{ #define _stricmp miniwin_stricmp
return strcasecmp(str1, str2);
}
inline BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle) inline BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
{ {
@ -644,3 +544,23 @@ inline LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{ {
return 0; return 0;
} }
inline HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette)
{
return nullptr;
}
inline int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
{
return 0;
}
inline int RealizePalette(HDC hdc)
{
return 0;
}
inline BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint)
{
return TRUE;
}

View File

@ -38,13 +38,8 @@ typedef D3DDEVICEDESC* LPD3DDEVICEDESC;
struct IDirect3DDevice2 : public IUnknown {}; struct IDirect3DDevice2 : public IUnknown {};
typedef HRESULT (*LPD3DENUMDEVICESCALLBACK)(LPGUID, LPSTR, LPSTR, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID); typedef HRESULT (*LPD3DENUMDEVICESCALLBACK)(LPGUID, LPSTR, LPSTR, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
struct IDirect3D2 { struct IDirect3D2 : public IUnknown {
virtual ULONG AddRef() { return 0; } virtual HRESULT CreateDevice(const GUID& guid, void* pBackBuffer, IDirect3DDevice2** ppDirect3DDevice) = 0;
virtual ULONG Release() { return 0; } virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx) = 0;
virtual HRESULT CreateDevice(const GUID& guid, void* pBackBuffer, IDirect3DDevice2** ppDirect3DDevice)
{
return DDERR_GENERIC;
}
virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx);
}; };
typedef IDirect3D2* LPDIRECT3D2; typedef IDirect3D2* LPDIRECT3D2;

View File

@ -0,0 +1,345 @@
#pragma once
#include "miniwin_d3d.h"
#include <stdlib.h> // abort // FIXME: remove
// --- Defines and Macros ---
#define D3DRM_OK DD_OK
#define MAXSHORT ((short) 0x7fff)
#define SUCCEEDED(hr) ((hr) >= D3DRM_OK)
#define D3DPTFILTERCAPS_LINEAR 0x00000001
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00000100
// --- Typedefs ---
typedef DWORD D3DRMMAPPING, *LPD3DRMMAPPING;
typedef float D3DVAL;
typedef void* LPD3DRM_APPDATA;
typedef unsigned long D3DRMGROUPINDEX;
typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
typedef DWORD D3DCOLOR, *LPD3DCOLOR;
typedef float D3DVALUE, *LPD3DVALUE;
// --- Enums ---
enum D3DRMCOMBINETYPE {
D3DRMCOMBINE_REPLACE,
D3DRMCOMBINE_BEFORE,
D3DRMCOMBINE_AFTER
};
typedef D3DRMCOMBINETYPE* LPD3DRMCOMBINETYPE;
enum D3DRMPALETTEFLAGS {
D3DRMPALETTE_READONLY
};
typedef D3DRMPALETTEFLAGS* LPD3DRMPALETTEFLAGS;
enum D3DRMTEXTUREQUALITY {
D3DRMTEXTURE_NEAREST,
D3DRMTEXTURE_LINEAR,
D3DRMTEXTURE_MIPNEAREST,
D3DRMTEXTURE_MIPLINEAR,
D3DRMTEXTURE_LINEARMIPNEAREST,
D3DRMTEXTURE_LINEARMIPLINEAR
};
typedef D3DRMTEXTUREQUALITY* LPD3DRMTEXTUREQUALITY;
enum D3DRMRENDERMODE {
D3DRMRENDERMODE_BLENDEDTRANSPARENCY
};
enum D3DRMMappingFlag {
D3DRMMAP_WRAPU = 1,
D3DRMMAP_WRAPV = 2,
D3DRMMAP_PERSPCORRECT = 4
};
enum D3DRMLIGHTTYPE {
D3DRMLIGHT_AMBIENT,
D3DRMLIGHT_POINT,
D3DRMLIGHT_SPOT,
D3DRMLIGHT_DIRECTIONAL,
D3DRMLIGHT_PARALLELPOINT
};
typedef D3DRMLIGHTTYPE* LPD3DRMLIGHTTYPE;
enum D3DRMMATERIALMODE {
D3DRMMATERIAL_FROMPARENT,
D3DRMMATERIAL_FROMFRAME,
D3DRMMATERIAL_FROMMESH
};
enum D3DRMRenderMode {
D3DRMRENDER_WIREFRAME = 0,
D3DRMRENDER_UNLITFLAT = 1,
D3DRMRENDER_FLAT = 2,
D3DRMRENDER_GOURAUD = 4,
D3DRMRENDER_PHONG = 8
};
enum D3DRMPROJECTIONTYPE {
D3DRMPROJECT_PERSPECTIVE,
D3DRMPROJECT_ORTHOGRAPHIC
};
typedef D3DRMPROJECTIONTYPE* LPD3DRMPROJECTIONTYPE;
// --- GUIDs ---
DEFINE_GUID(IID_IDirect3DRM2, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0x0eb16e60, 0xcbf4, 0x11cf, 0xa5, 0x3c, 0x00, 0x20, 0xaf, 0x70, 0x7e, 0xfd);
DEFINE_GUID(IID_IDirect3DRMMesh, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d1, 0x94, 0x26, 0x00, 0x60, 0x97, 0x0c, 0xf4, 0x0d);
// --- Structs ---
typedef struct D3DRMVECTOR4D {
float x, y, z, w;
} D3DRMVECTOR4D;
typedef struct D3DRMPALETTEENTRY {
unsigned char red, green, blue, flags;
} D3DRMPALETTEENTRY;
typedef struct D3DRMIMAGE {
unsigned int width, height, depth, bytes_per_line;
unsigned int red_mask, green_mask, blue_mask, alpha_mask;
unsigned int palette_size;
D3DRMPALETTEENTRY* palette;
void* buffer1;
void* buffer2;
void* data;
int rgb;
int aspectx, aspecty;
unsigned int format;
} D3DRMIMAGE;
typedef struct D3DRMMATRIX4D {
double* operator[](size_t i) { abort(); }
const double* operator[](size_t i) const { abort(); }
} D3DRMMATRIX4D;
struct D3DRMBOX {
D3DVECTOR min;
D3DVECTOR max;
};
struct D3DRMVERTEX {
D3DVECTOR position;
D3DVECTOR normal;
float tu, tv;
};
struct IDirect3DRMVisual : public IUnknown {};
typedef IDirect3DRMVisual* LPDIRECT3DRMVISUAL;
struct IDirect3DRMObject : public IUnknown {
virtual HRESULT Clone(void** ppObject) = 0;
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) = 0;
virtual HRESULT DeleteDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) = 0;
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) = 0;
virtual LPVOID GetAppData() = 0;
virtual HRESULT SetName(const char* name) = 0;
virtual HRESULT GetName(DWORD* size, char* name) = 0;
virtual HRESULT GetClassName(DWORD* size, char* name) = 0;
};
struct IDirect3DRMTexture : public IUnknown {
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) = 0;
virtual LPVOID GetAppData() = 0;
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) = 0;
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) = 0;
virtual HRESULT Changed(BOOL arg1, BOOL arg2) = 0;
};
typedef IDirect3DRMTexture* LPDIRECT3DRMTEXTURE;
struct IDirect3DRMTexture2 : public IDirect3DRMTexture {};
typedef IDirect3DRMTexture2* LPDIRECT3DRMTEXTURE2;
typedef struct IDirect3DRMMaterial *LPDIRECT3DRMMATERIAL, **LPLPDIRECT3DRMMATERIAL;
struct IDirect3DRMMesh : public IUnknown {
virtual HRESULT Clone(int flags, GUID iid, void** object) = 0;
virtual HRESULT GetBox(D3DRMBOX* box) = 0;
virtual HRESULT AddGroup(
int vertexCount,
int faceCount,
int vertexPerFace,
void* faceBuffer,
D3DRMGROUPINDEX* groupIndex
) = 0;
virtual HRESULT GetGroup(
int groupIndex,
unsigned int* vertexCount,
unsigned int* faceCount,
unsigned int* vertexPerFace,
DWORD* dataSize,
unsigned int* data
) = 0;
virtual HRESULT SetGroupColor(int groupIndex, D3DCOLOR color) = 0;
virtual HRESULT SetGroupColorRGB(int groupIndex, float r, float g, float b) = 0;
virtual HRESULT SetGroupTexture(int groupIndex, const IDirect3DRMTexture* texture) = 0;
virtual HRESULT SetGroupMaterial(int groupIndex, IDirect3DRMMaterial* material) = 0;
virtual HRESULT SetGroupMapping(int groupIndex, int mapping) = 0;
virtual HRESULT SetGroupQuality(int groupIndex, D3DRMRENDERQUALITY quality) = 0;
virtual HRESULT SetVertices(int groupIndex, int offset, int count, D3DRMVERTEX* vertices) = 0;
virtual HRESULT GetGroupTexture(int groupIndex, LPDIRECT3DRMTEXTURE* texture) = 0;
virtual HRESULT GetGroupMapping(int groupIndex) = 0;
virtual HRESULT GetGroupQuality(int groupIndex) = 0;
virtual HRESULT GetGroupColor(D3DRMGROUPINDEX index) = 0;
virtual HRESULT GetVertices(int groupIndex, int startIndex, int count, D3DRMVERTEX* vertices) = 0;
};
struct IDirect3DRMLight : public IUnknown {
virtual HRESULT SetColorRGB(float r, float g, float b) = 0;
};
struct IDirect3DRMLightArray : public IUnknown {
virtual DWORD GetSize() = 0;
virtual HRESULT GetElement(int index, IDirect3DRMLight** light) const = 0;
};
struct IDirect3DRMVisualArray : public IUnknown {
virtual DWORD GetSize() = 0;
virtual HRESULT GetElement(int index, IDirect3DRMVisual** visual) const = 0;
};
typedef struct IDirect3DRMFrameArray* LPDIRECT3DRMFRAMEARRAY;
struct IDirect3DRMFrame : public IUnknown {
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) = 0;
virtual LPVOID GetAppData() = 0;
virtual HRESULT AddChild(IDirect3DRMFrame* child) = 0;
virtual HRESULT DeleteChild(IDirect3DRMFrame* child) = 0;
virtual HRESULT SetSceneBackgroundRGB(float r, float g, float b) = 0;
virtual HRESULT AddLight(IDirect3DRMLight* light) = 0;
virtual HRESULT GetLights(IDirect3DRMLightArray** lightArray) = 0;
virtual HRESULT AddTransform(int combine, D3DRMMATRIX4D matrix) = 0;
virtual HRESULT GetPosition(int index, D3DVECTOR* position) = 0;
virtual HRESULT AddVisual(IDirect3DRMVisual* visual) = 0;
virtual HRESULT DeleteVisual(IDirect3DRMVisual* visual) = 0;
virtual HRESULT AddVisual(IDirect3DRMMesh* visual) = 0;
virtual HRESULT DeleteVisual(IDirect3DRMMesh* visual) = 0;
virtual HRESULT AddVisual(IDirect3DRMFrame* visual) = 0;
virtual HRESULT DeleteVisual(IDirect3DRMFrame* visual) = 0;
virtual HRESULT GetVisuals(IDirect3DRMVisualArray** visuals) = 0;
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) = 0;
virtual HRESULT GetTexture(IDirect3DRMTexture** texture) = 0;
virtual HRESULT SetColor(float r, float g, float b, float a) = 0;
virtual HRESULT SetColor(D3DCOLOR) = 0;
virtual HRESULT SetColorRGB(float r, float g, float b) = 0;
virtual HRESULT SetMaterialMode(D3DRMMATERIALMODE mode) = 0;
virtual HRESULT GetChildren(IDirect3DRMFrameArray** children) = 0;
};
typedef IDirect3DRMFrame* LPDIRECT3DRMFRAME;
struct IDirect3DRMFrame2 : public IDirect3DRMFrame {};
typedef IDirect3DRMFrame2* LPDIRECT3DRMFRAME2;
struct IDirect3DRMFrameArray : public IUnknown {
virtual DWORD GetSize() = 0;
virtual HRESULT GetElement(DWORD index, IDirect3DRMFrame** frame) = 0;
};
struct D3DRMPICKDESC {
IDirect3DRMVisual* visual;
IDirect3DRMFrame* frame;
float dist;
};
struct IDirect3DRMPickedArray : public IUnknown {
virtual DWORD GetSize() = 0;
virtual HRESULT GetPick(
DWORD index,
IDirect3DRMVisual** visual,
IDirect3DRMFrameArray** frameArray,
D3DRMPICKDESC* desc
) = 0;
};
typedef IDirect3DRMPickedArray* LPDIRECT3DRMPICKEDARRAY;
struct IDirect3DRMViewport : public IDirect3DRMObject {
virtual HRESULT Render(IDirect3DRMFrame* group) = 0;
virtual HRESULT ForceUpdate(int x, int y, int w, int h) = 0;
virtual HRESULT Clear() = 0;
virtual HRESULT SetCamera(IDirect3DRMFrame* camera) = 0;
virtual HRESULT GetCamera(IDirect3DRMFrame** camera) = 0;
virtual HRESULT SetProjection(D3DRMPROJECTIONTYPE type) = 0;
virtual D3DRMPROJECTIONTYPE GetProjection() = 0;
virtual HRESULT SetFront(D3DVALUE z) = 0;
virtual D3DVALUE GetFront() = 0;
virtual HRESULT SetBack(D3DVALUE z) = 0;
virtual D3DVALUE GetBack() = 0;
virtual HRESULT SetField(D3DVALUE field) = 0;
virtual D3DVALUE GetField() = 0;
virtual int GetWidth() = 0;
virtual int GetHeight() = 0;
virtual HRESULT Transform(D3DRMVECTOR4D* screen, D3DVECTOR* world) = 0;
virtual HRESULT InverseTransform(D3DVECTOR* world, D3DRMVECTOR4D* screen) = 0;
virtual HRESULT Pick(float x, float y, LPDIRECT3DRMPICKEDARRAY* pickedArray) = 0;
};
struct IDirect3DRMWinDevice : public IUnknown {
virtual HRESULT Activate() = 0;
virtual HRESULT Paint() = 0;
virtual void HandleActivate(WORD wParam) = 0;
virtual void HandlePaint(void* p_dc) = 0;
};
struct IDirect3DRMViewportArray : public IUnknown {
virtual DWORD GetSize() = 0;
virtual HRESULT GetElement(int index, IDirect3DRMViewport** viewport) = 0;
};
struct IDirect3DRMDevice2 : public IUnknown {
virtual unsigned long GetWidth() = 0;
virtual unsigned long GetHeight() = 0;
virtual HRESULT SetBufferCount(int count) = 0;
virtual HRESULT GetBufferCount() = 0;
virtual HRESULT SetShades(unsigned long shadeCount) = 0;
virtual HRESULT GetShades() = 0;
virtual HRESULT SetQuality(int quality) = 0;
virtual HRESULT GetQuality() = 0;
virtual HRESULT SetDither(int dither) = 0;
virtual HRESULT GetDither() = 0;
virtual HRESULT SetTextureQuality(D3DRMTEXTUREQUALITY quality) = 0;
virtual D3DRMTEXTUREQUALITY GetTextureQuality() = 0;
virtual HRESULT SetRenderMode(int mode) = 0;
virtual HRESULT GetRenderMode() = 0;
virtual HRESULT Update() = 0;
virtual HRESULT GetViewports(IDirect3DRMViewportArray** ppViewportArray) = 0;
};
struct IDirect3DRM : public IUnknown {
virtual HRESULT CreateDeviceFromD3D(
const IDirect3D2* d3d,
IDirect3DDevice2* d3dDevice,
IDirect3DRMDevice2** outDevice
) = 0;
virtual HRESULT CreateDeviceFromSurface(
const GUID* guid,
IDirectDraw* dd,
IDirectDrawSurface* surface,
IDirect3DRMDevice2** outDevice
) = 0;
virtual HRESULT CreateTexture(D3DRMIMAGE* image, IDirect3DRMTexture2** outTexture) = 0;
virtual HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE surface, IDirect3DRMTexture2** outTexture) = 0;
virtual HRESULT CreateMesh(IDirect3DRMMesh** outMesh) = 0;
virtual HRESULT CreateMaterial(D3DVAL power, IDirect3DRMMaterial** outMaterial) = 0;
virtual HRESULT CreateLightRGB(D3DRMLIGHTTYPE type, D3DVAL r, D3DVAL g, D3DVAL b, IDirect3DRMLight** outLight) = 0;
virtual HRESULT CreateFrame(IDirect3DRMFrame* parent, IDirect3DRMFrame2** outFrame) = 0;
virtual HRESULT CreateViewport(
IDirect3DRMDevice2* device,
IDirect3DRMFrame* camera,
int x,
int y,
int width,
int height,
IDirect3DRMViewport** outViewport
) = 0;
virtual HRESULT SetDefaultTextureShades(unsigned int count) = 0;
virtual HRESULT SetDefaultTextureColors(unsigned int count) = 0;
};
typedef IDirect3DRM *LPDIRECT3DRM, **LPLPDIRECT3DRM;
struct IDirect3DRM2 : public IDirect3DRM {};
// Functions
HRESULT WINAPI Direct3DRMCreate(IDirect3DRM** direct3DRM);
D3DCOLOR D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha);

View File

@ -7,10 +7,7 @@
#define DDENUMRET_OK 1 #define DDENUMRET_OK 1
#define DDFLIP_WAIT 0x00000004 #define DDFLIP_WAIT 0x00000004
#define DISCL_BACKGROUND 0x00000002 #define DISCL_BACKGROUND 0x00000002
#define RASTERCAPS 0x00000000
#define PC_NOCOLLAPSE 0x04 #define PC_NOCOLLAPSE 0x04
#define RC_PALETTE 0x00000000
#define SIZEPALETTE 256
// DirectDraw Surface Description flags // DirectDraw Surface Description flags
#define DDSD_CAPS 0x00000001 #define DDSD_CAPS 0x00000001
@ -62,8 +59,6 @@
#define DDSCL_EXCLUSIVE 0x00000002 #define DDSCL_EXCLUSIVE 0x00000002
#define DDSCL_ALLOWREBOOT 0x00000080 #define DDSCL_ALLOWREBOOT 0x00000080
#define MAKE_HRESULT(sev, fac, code) \
((HRESULT) (((uint32_t) (sev) << 31) | ((uint32_t) (fac) << 16) | ((uint32_t) (code))))
#define MAKE_DDHRESULT(code) MAKE_HRESULT(1, _FACDD, code) #define MAKE_DDHRESULT(code) MAKE_HRESULT(1, _FACDD, code)
#define DD_OK S_OK #define DD_OK S_OK
@ -218,67 +213,54 @@ typedef struct DDSURFACEDESC* LPDDSURFACEDESC;
typedef struct IDirectDraw* LPDIRECTDRAW; typedef struct IDirectDraw* LPDIRECTDRAW;
struct IDirectDrawPalette : public IUnknown { struct IDirectDrawPalette : public IUnknown {
virtual HRESULT GetCaps(LPDWORD lpdwCaps) { return DD_OK; } virtual HRESULT GetCaps(LPDWORD lpdwCaps) = 0;
virtual HRESULT GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) virtual HRESULT GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) = 0;
{ virtual HRESULT Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) = 0;
return DD_OK; virtual HRESULT SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) = 0;
}
virtual HRESULT Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) { return DD_OK; }
virtual HRESULT SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
{
return DD_OK;
}
}; };
typedef struct IDirectDrawPalette* LPDIRECTDRAWPALETTE; typedef struct IDirectDrawPalette* LPDIRECTDRAWPALETTE;
struct IDirectDrawClipper { struct IDirectDrawClipper : public IUnknown {
void Release() {} virtual HRESULT SetHWnd(DWORD unnamedParam1, HWND hWnd) = 0;
HRESULT SetHWnd(DWORD unnamedParam1, HWND hWnd) { return DD_OK; }
}; };
typedef IDirectDrawClipper* LPDIRECTDRAWCLIPPER; typedef IDirectDrawClipper* LPDIRECTDRAWCLIPPER;
typedef void *LPDDBLTFX, *LPDDENUMSURFACESCALLBACK; typedef void *LPDDBLTFX, *LPDDENUMSURFACESCALLBACK;
typedef struct IDirectDrawSurface* LPDIRECTDRAWSURFACE; typedef struct IDirectDrawSurface* LPDIRECTDRAWSURFACE;
struct IDirectDrawSurface : public IUnknown { struct IDirectDrawSurface : public IUnknown {
virtual HRESULT AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { return DD_OK; } virtual HRESULT AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) = 0;
virtual HRESULT Blt( virtual HRESULT Blt(
LPRECT lpDestRect, LPRECT lpDestRect,
LPDIRECTDRAWSURFACE lpDDSrcSurface, LPDIRECTDRAWSURFACE lpDDSrcSurface,
LPRECT lpSrcRect, LPRECT lpSrcRect,
DWORD dwFlags, DWORD dwFlags,
LPDDBLTFX lpDDBltFx LPDDBLTFX lpDDBltFx
) ) = 0;
{ virtual HRESULT BltFast(
return DD_OK; DWORD dwX,
} DWORD dwY,
virtual HRESULT BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) LPDIRECTDRAWSURFACE lpDDSrcSurface,
{ LPRECT lpSrcRect,
return DD_OK; DWORD dwTrans
} ) = 0;
virtual HRESULT DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { return DD_OK; } virtual HRESULT DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) = 0;
virtual HRESULT Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) { return DD_OK; } virtual HRESULT Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) = 0;
virtual HRESULT GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE* lplpDDAttachedSurface) virtual HRESULT GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE* lplpDDAttachedSurface) = 0;
{ virtual HRESULT GetCaps(LPDDSCAPS lpDDSCaps) = 0;
return DD_OK; virtual HRESULT GetDC(HDC* lphDC) = 0;
} virtual HRESULT GetOverlayPosition(LPLONG lplX, LPLONG lplY) = 0;
virtual HRESULT GetCaps(LPDDSCAPS lpDDSCaps) { return DD_OK; } virtual HRESULT GetPalette(LPDIRECTDRAWPALETTE* lplpDDPalette) = 0;
virtual HRESULT GetDC(HDC* lphDC) { return DD_OK; } virtual HRESULT GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat) = 0;
virtual HRESULT GetOverlayPosition(LPLONG lplX, LPLONG lplY) { return DD_OK; } virtual HRESULT GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc) = 0;
virtual HRESULT GetPalette(LPDIRECTDRAWPALETTE* lplpDDPalette) { return DDERR_GENERIC; } virtual HRESULT Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) = 0;
virtual HRESULT GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat) { return DD_OK; } virtual HRESULT IsLost() = 0;
virtual HRESULT GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; } virtual HRESULT Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) = 0;
virtual HRESULT Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; } virtual HRESULT ReleaseDC(HDC hDC) = 0;
virtual HRESULT IsLost() { return DD_OK; } virtual HRESULT Restore() = 0;
virtual HRESULT Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) virtual HRESULT SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper) = 0;
{ virtual HRESULT SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) = 0;
return DD_OK; virtual HRESULT SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) = 0;
} virtual HRESULT Unlock(LPVOID lpSurfaceData) = 0;
virtual HRESULT ReleaseDC(HDC hDC) { return DD_OK; }
virtual HRESULT Restore() { return DD_OK; }
virtual HRESULT SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper) { return DD_OK; }
virtual HRESULT SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) { return DD_OK; }
virtual HRESULT SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) { return DD_OK; }
virtual HRESULT Unlock(LPVOID lpSurfaceData) { return DD_OK; }
}; };
struct IDirectDrawSurface3 : public IDirectDrawSurface {}; struct IDirectDrawSurface3 : public IDirectDrawSurface {};
@ -286,74 +268,43 @@ typedef IDirectDrawSurface3* LPDIRECTDRAWSURFACE3;
typedef HRESULT (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); typedef HRESULT (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID);
struct IDirectDraw : public IUnknown { struct IDirectDraw : public IUnknown {
virtual HRESULT CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) virtual HRESULT CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) = 0;
{
return DDERR_GENERIC;
}
virtual HRESULT CreatePalette( virtual HRESULT CreatePalette(
DWORD dwFlags, DWORD dwFlags,
LPPALETTEENTRY lpColorTable, LPPALETTEENTRY lpColorTable,
LPDIRECTDRAWPALETTE* lplpDDPalette, LPDIRECTDRAWPALETTE* lplpDDPalette,
IUnknown* pUnkOuter IUnknown* pUnkOuter
) ) = 0;
{
return DDERR_GENERIC;
}
virtual HRESULT CreateSurface( virtual HRESULT CreateSurface(
LPDDSURFACEDESC lpDDSurfaceDesc, LPDDSURFACEDESC lpDDSurfaceDesc,
LPDIRECTDRAWSURFACE* lplpDDSurface, LPDIRECTDRAWSURFACE* lplpDDSurface,
IUnknown* pUnkOuter IUnknown* pUnkOuter
) ) = 0;
{
return DDERR_GENERIC;
}
virtual HRESULT EnumDisplayModes( virtual HRESULT EnumDisplayModes(
DWORD dwFlags, DWORD dwFlags,
LPDDSURFACEDESC lpDDSurfaceDesc, LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext, LPVOID lpContext,
LPDDENUMMODESCALLBACK lpEnumModesCallback LPDDENUMMODESCALLBACK lpEnumModesCallback
); ) = 0;
virtual HRESULT EnumSurfaces( virtual HRESULT EnumSurfaces(
DWORD dwFlags, DWORD dwFlags,
LPDDSURFACEDESC lpDDSD, LPDDSURFACEDESC lpDDSD,
LPVOID lpContext, LPVOID lpContext,
LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback
) ) = 0;
{ virtual HRESULT FlipToGDISurface() = 0;
return DD_OK; virtual HRESULT GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) = 0;
} virtual HRESULT GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) = 0;
virtual HRESULT FlipToGDISurface() { return DD_OK; } virtual HRESULT Initialize(GUID* lpGUID) = 0;
virtual HRESULT GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps); virtual HRESULT RestoreDisplayMode() = 0;
virtual HRESULT GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; } virtual HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags) = 0;
virtual HRESULT Initialize(GUID* lpGUID) { return DD_OK; } virtual HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) = 0;
virtual HRESULT RestoreDisplayMode() { return DD_OK; }
virtual HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags) { return DD_OK; }
virtual HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) { return DD_OK; }
}; };
struct IDirectDraw2 : public IDirectDraw {}; struct IDirectDraw2 : public IDirectDraw {};
typedef IDirectDraw2* LPDIRECTDRAW2; typedef IDirectDraw2* LPDIRECTDRAW2;
// --- Functions --- // --- Functions ---
inline HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette)
{
return nullptr;
}
inline int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
{
return 0;
}
inline int RealizePalette(HDC hdc)
{
return 0;
}
inline BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint)
{
return TRUE;
}
HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter); HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter);

View File

@ -0,0 +1,64 @@
#include "miniwin.h"
#include <SDL3/SDL.h>
#include <utility>
#include <vector>
static std::vector<std::pair<SDL_Window*, HWND>> sdl_hwnd_mapping;
SDL_Window* miniwin_GetSdlWindow(HWND hWnd)
{
for (size_t i = 0; i < sdl_hwnd_mapping.size(); i++) {
if (sdl_hwnd_mapping[i].second == hWnd) {
return sdl_hwnd_mapping[i].first;
}
}
return NULL;
}
void OutputDebugString(const char* lpOutputString)
{
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString);
}
VOID WINAPI Sleep(DWORD dwMilliseconds)
{
SDL_Delay(dwMilliseconds);
}
BOOL GetWindowRect(HWND hWnd, tagRECT* Rect)
{
int x, y, w, h;
if (!Rect) {
return FALSE;
}
SDL_Window* window = miniwin_GetSdlWindow(hWnd);
if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unregistered HWND %p", hWnd);
Rect->left = 0;
Rect->top = 0;
Rect->right = 640;
Rect->bottom = 480;
return FALSE;
}
SDL_GetWindowPosition(window, &x, &y);
SDL_GetWindowSize(window, &w, &h);
Rect->right = x;
Rect->top = y;
Rect->left = w + x;
Rect->bottom = h + y;
return TRUE;
}
int miniwin_stricmp(const char* str1, const char* str2)
{
return SDL_strcasecmp(str1, str2);
}
void GlobalMemoryStatus(MEMORYSTATUS* memory_status)
{
memory_status->dwLength = sizeof(*memory_status);
memory_status->dwTotalPhys = 1024 * SDL_GetSystemRAM();
}

View File

@ -0,0 +1 @@
#include "miniwin_d3d.h"

View File

@ -0,0 +1,11 @@
#include "miniwin_d3drm.h"
HRESULT WINAPI Direct3DRMCreate(IDirect3DRM** direct3DRM)
{
return DDERR_GENERIC;
}
D3DCOLOR D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha)
{
return 0;
}

View File

@ -0,0 +1,182 @@
#include "miniwin_ddraw.h"
#include "miniwin_d3d.h"
#include <SDL3/SDL.h>
struct DirectDrawImpl : public IDirectDraw2, public IDirect3D2 {
DirectDrawImpl() : m_refCount(1) {}
// IUnknown interface
ULONG AddRef() override
{
m_refCount += 1;
return m_refCount;
}
ULONG Release() override
{
m_refCount -= 1;
if (m_refCount == 0) {
delete this;
return 0;
}
return m_refCount;
}
HRESULT QueryInterface(const GUID& riid, void** ppvObject) override
{
if (SDL_memcmp(&riid, &IID_IDirectDraw2, sizeof(GUID)) == 0) {
AddRef();
*ppvObject = static_cast<IDirectDraw2*>(this);
return S_OK;
}
if (SDL_memcmp(&riid, &IID_IDirect3D2, sizeof(GUID)) == 0) {
AddRef();
*ppvObject = static_cast<IDirect3D2*>(this);
return S_OK;
}
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "DirectDrawImpl does not implement guid");
return E_NOINTERFACE;
}
// IDirecdtDraw interface
HRESULT CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) override
{
return DDERR_GENERIC;
}
HRESULT CreatePalette(
DWORD dwFlags,
LPPALETTEENTRY lpColorTable,
LPDIRECTDRAWPALETTE* lplpDDPalette,
IUnknown* pUnkOuter
) override
{
return DDERR_GENERIC;
}
HRESULT CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE* lplpDDSurface, IUnknown* pUnkOuter)
override
{
return DDERR_GENERIC;
}
HRESULT EnumDisplayModes(
DWORD dwFlags,
LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext,
LPDDENUMMODESCALLBACK lpEnumModesCallback
) override;
HRESULT EnumSurfaces(
DWORD dwFlags,
LPDDSURFACEDESC lpDDSD,
LPVOID lpContext,
LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback
) override
{
return DD_OK;
}
HRESULT FlipToGDISurface() override { return DD_OK; }
HRESULT GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) override;
HRESULT GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) override { return DD_OK; }
HRESULT Initialize(GUID* lpGUID) override { return DD_OK; }
HRESULT RestoreDisplayMode() override { return DD_OK; }
HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags) override { return DD_OK; }
HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) override { return DD_OK; }
// IDirect3D2 interface
HRESULT CreateDevice(const GUID& guid, void* pBackBuffer, IDirect3DDevice2** ppDirect3DDevice) override
{
return DDERR_GENERIC;
}
HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx) override;
private:
int m_refCount;
};
HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
{
if (!cb) {
return DDERR_INVALIDPARAMS;
}
GUID deviceGuid = {0xa4665c, 0x2673, 0x11ce, 0x8034a0};
char* deviceName = (char*) "MiniWin 3D Device";
char* deviceDesc = (char*) "Stubbed 3D device";
D3DDEVICEDESC halDesc = {};
halDesc.dcmColorModel = D3DCOLOR_RGB;
halDesc.dwDeviceZBufferBitDepth = DDBD_16;
halDesc.dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE;
D3DDEVICEDESC helDesc = {};
halDesc.dcmColorModel = D3DCOLOR_RGB;
halDesc.dwDeviceZBufferBitDepth = DDBD_16;
halDesc.dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE;
cb(&deviceGuid, deviceName, deviceDesc, &halDesc, &helDesc, ctx);
return S_OK;
}
HRESULT DirectDrawImpl::EnumDisplayModes(
DWORD dwFlags,
LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext,
LPDDENUMMODESCALLBACK lpEnumModesCallback
)
{
DDSURFACEDESC ddsd = {};
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd.dwWidth = 640;
ddsd.dwHeight = 480;
ddsd.lPitch = 0;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | D3DDD_DEVICEZBUFFERBITDEPTH;
ddsd.ddpfPixelFormat.dwRGBBitCount = 16; // Game only accpets 8 or 16
if (!lpEnumModesCallback(&ddsd, lpContext)) {
return DDERR_GENERIC;
}
return S_OK;
}
HRESULT DirectDrawImpl::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
{
if (lpDDDriverCaps) {
memset(lpDDDriverCaps, 0, sizeof(DDCAPS));
lpDDDriverCaps->dwSize = sizeof(DDCAPS);
lpDDDriverCaps->dwCaps = 0;
}
if (lpDDHELCaps) {
memset(lpDDHELCaps, 0, sizeof(DDCAPS));
lpDDHELCaps->dwSize = sizeof(DDCAPS);
lpDDHELCaps->dwCaps = 0;
}
return S_OK;
}
HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter)
{
if (!lplpDD) {
return DDERR_INVALIDPARAMS;
}
*lplpDD = new DirectDrawImpl;
return DD_OK;
}
HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context)
{
int numDrivers = SDL_GetNumVideoDrivers();
for (int i = 0; i < numDrivers; ++i) {
const char* driverName = SDL_GetVideoDriver(i);
if (!cb(NULL, (LPSTR) driverName, NULL, context)) {
return DDERR_GENERIC;
}
}
return DD_OK;
}

View File

@ -1,26 +0,0 @@
#include "miniwin_d3d.h"
HRESULT IDirect3D2::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
{
if (!cb) {
return DDERR_INVALIDPARAMS;
}
GUID deviceGuid = {0xa4665c, 0x2673, 0x11ce, 0x8034a0};
char* deviceName = (char*) "MiniWin 3D Device";
char* deviceDesc = (char*) "Stubbed 3D device";
D3DDEVICEDESC halDesc = {};
halDesc.dcmColorModel = D3DCOLOR_RGB;
halDesc.dwDeviceZBufferBitDepth = DDBD_16;
halDesc.dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE;
D3DDEVICEDESC helDesc = {};
halDesc.dcmColorModel = D3DCOLOR_RGB;
halDesc.dwDeviceZBufferBitDepth = DDBD_16;
halDesc.dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE;
cb(&deviceGuid, deviceName, deviceDesc, &halDesc, &helDesc, ctx);
return S_OK;
}

View File

@ -1,378 +0,0 @@
#pragma once
#include "miniwin_d3d.h"
// --- Defines and Macros ---
#define D3DRM_OK DD_OK
#define MAXSHORT ((short) 0x7fff)
#define SUCCEEDED(hr) ((hr) >= D3DRM_OK)
#define D3DPTFILTERCAPS_LINEAR 0x00000001
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00000100
// --- Typedefs ---
typedef DWORD D3DRMMAPPING, *LPD3DRMMAPPING;
typedef float D3DVAL;
typedef void* LPD3DRM_APPDATA;
typedef unsigned long D3DRMGROUPINDEX;
typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
typedef DWORD D3DCOLOR, *LPD3DCOLOR;
typedef float D3DVALUE, *LPD3DVALUE;
// --- Enums ---
enum D3DRMCOMBINETYPE {
D3DRMCOMBINE_REPLACE,
D3DRMCOMBINE_BEFORE,
D3DRMCOMBINE_AFTER
};
typedef D3DRMCOMBINETYPE* LPD3DRMCOMBINETYPE;
enum D3DRMPALETTEFLAGS {
D3DRMPALETTE_READONLY
};
typedef D3DRMPALETTEFLAGS* LPD3DRMPALETTEFLAGS;
enum D3DRMTEXTUREQUALITY {
D3DRMTEXTURE_NEAREST,
D3DRMTEXTURE_LINEAR,
D3DRMTEXTURE_MIPNEAREST,
D3DRMTEXTURE_MIPLINEAR,
D3DRMTEXTURE_LINEARMIPNEAREST,
D3DRMTEXTURE_LINEARMIPLINEAR
};
typedef D3DRMTEXTUREQUALITY* LPD3DRMTEXTUREQUALITY;
enum D3DRMRENDERMODE {
D3DRMRENDERMODE_BLENDEDTRANSPARENCY
};
enum D3DRMMappingFlag {
D3DRMMAP_WRAPU = 1,
D3DRMMAP_WRAPV = 2,
D3DRMMAP_PERSPCORRECT = 4
};
enum D3DRMLIGHTTYPE {
D3DRMLIGHT_AMBIENT,
D3DRMLIGHT_POINT,
D3DRMLIGHT_SPOT,
D3DRMLIGHT_DIRECTIONAL,
D3DRMLIGHT_PARALLELPOINT
};
typedef D3DRMLIGHTTYPE* LPD3DRMLIGHTTYPE;
enum D3DRMMATERIALMODE {
D3DRMMATERIAL_FROMPARENT,
D3DRMMATERIAL_FROMFRAME,
D3DRMMATERIAL_FROMMESH
};
enum D3DRMRenderMode {
D3DRMRENDER_WIREFRAME = 0,
D3DRMRENDER_UNLITFLAT = 1,
D3DRMRENDER_FLAT = 2,
D3DRMRENDER_GOURAUD = 4,
D3DRMRENDER_PHONG = 8
};
enum D3DRMPROJECTIONTYPE {
D3DRMPROJECT_PERSPECTIVE,
D3DRMPROJECT_ORTHOGRAPHIC
};
typedef D3DRMPROJECTIONTYPE* LPD3DRMPROJECTIONTYPE;
// --- GUIDs ---
DEFINE_GUID(IID_IDirect3DRM2, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0x0eb16e60, 0xcbf4, 0x11cf, 0xa5, 0x3c, 0x00, 0x20, 0xaf, 0x70, 0x7e, 0xfd);
DEFINE_GUID(IID_IDirect3DRMMesh, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d1, 0x94, 0x26, 0x00, 0x60, 0x97, 0x0c, 0xf4, 0x0d);
// --- Structs ---
typedef struct D3DRMVECTOR4D {
float x, y, z, w;
} D3DRMVECTOR4D;
typedef struct D3DRMPALETTEENTRY {
unsigned char red, green, blue, flags;
} D3DRMPALETTEENTRY;
typedef struct D3DRMIMAGE {
unsigned int width, height, depth, bytes_per_line;
unsigned int red_mask, green_mask, blue_mask, alpha_mask;
unsigned int palette_size;
D3DRMPALETTEENTRY* palette;
void* buffer1;
void* buffer2;
void* data;
int rgb;
int aspectx, aspecty;
unsigned int format;
} D3DRMIMAGE;
typedef struct D3DRMMATRIX4D {
double* operator[](size_t i) { return 0; }
const double* operator[](size_t i) const { return 0; }
} D3DRMMATRIX4D;
struct D3DRMBOX {
D3DVECTOR min;
D3DVECTOR max;
};
struct D3DRMVERTEX {
D3DVECTOR position;
D3DVECTOR normal;
float tu, tv;
};
struct IDirect3DRMVisual : public IUnknown {};
typedef IDirect3DRMVisual* LPDIRECT3DRMVISUAL;
struct IDirect3DRMObject : public IUnknown {
virtual HRESULT Clone(void** ppObject) { return DDERR_GENERIC; }
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
virtual HRESULT DeleteDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
virtual DWORD GetAppData() = 0;
virtual HRESULT SetName(const char* name) { return D3DRM_OK; }
virtual HRESULT GetName(DWORD* size, char* name) { return D3DRM_OK; }
virtual HRESULT GetClassName(DWORD* size, char* name) { return D3DRM_OK; }
};
struct IDirect3DRMTexture : public IUnknown {
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
virtual DWORD GetAppData() { return 0; }
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) { return D3DRM_OK; }
virtual HRESULT Changed(BOOL arg1, BOOL arg2) { return D3DRM_OK; }
};
typedef IDirect3DRMTexture* LPDIRECT3DRMTEXTURE;
struct IDirect3DRMTexture2 : public IDirect3DRMTexture {};
typedef IDirect3DRMTexture2* LPDIRECT3DRMTEXTURE2;
typedef struct IDirect3DRMMaterial *LPDIRECT3DRMMATERIAL, **LPLPDIRECT3DRMMATERIAL;
struct IDirect3DRMMesh {
virtual ULONG Release() { return 0; }
virtual HRESULT Clone(int flags, GUID iid, void** object) { return DDERR_GENERIC; }
virtual HRESULT GetBox(D3DRMBOX* box) { return D3DRM_OK; }
virtual HRESULT AddGroup(
int vertexCount,
int faceCount,
int vertexPerFace,
void* faceBuffer,
D3DRMGROUPINDEX* groupIndex
)
{
return D3DRM_OK;
}
virtual HRESULT GetGroup(
int groupIndex,
unsigned int* vertexCount,
unsigned int* faceCount,
unsigned int* vertexPerFace,
DWORD* dataSize,
unsigned int* data
)
{
return DDERR_GENERIC;
}
virtual HRESULT SetGroupColor(int groupIndex, D3DCOLOR color) { return D3DRM_OK; }
virtual HRESULT SetGroupColorRGB(int groupIndex, float r, float g, float b) { return D3DRM_OK; }
virtual HRESULT SetGroupTexture(int groupIndex, const IDirect3DRMTexture* texture) { return D3DRM_OK; }
virtual HRESULT SetGroupMaterial(int groupIndex, IDirect3DRMMaterial* material) { return D3DRM_OK; }
virtual HRESULT SetGroupMapping(int groupIndex, int mapping) { return D3DRM_OK; }
virtual HRESULT SetGroupQuality(int groupIndex, D3DRMRENDERQUALITY quality) { return D3DRM_OK; }
virtual HRESULT SetVertices(int groupIndex, int offset, int count, D3DRMVERTEX* vertices) { return D3DRM_OK; }
virtual HRESULT GetGroupTexture(int groupIndex, LPDIRECT3DRMTEXTURE* texture) { return DDERR_GENERIC; }
virtual HRESULT GetGroupMapping(int groupIndex) { return D3DRM_OK; }
virtual HRESULT GetGroupQuality(int groupIndex) { return D3DRM_OK; }
virtual HRESULT GetGroupColor(D3DRMGROUPINDEX index) { return D3DRM_OK; }
virtual HRESULT GetVertices(int groupIndex, int startIndex, int count, D3DRMVERTEX* vertices) { return D3DRM_OK; }
};
struct IDirect3DRMLight {
virtual ULONG AddRef() { return 0; }
virtual ULONG Release() { return 0; }
virtual HRESULT SetColorRGB(float r, float g, float b) { return D3DRM_OK; }
};
struct IDirect3DRMLightArray {
virtual ULONG Release() { return 0; }
virtual DWORD GetSize() { return 0; }
virtual HRESULT GetElement(int index, IDirect3DRMLight** light) const { return DDERR_GENERIC; }
};
struct IDirect3DRMVisualArray {
virtual ULONG Release() { return 0; }
virtual DWORD GetSize() { return 0; }
virtual HRESULT GetElement(int index, IDirect3DRMVisual** visual) const { return DDERR_GENERIC; }
};
typedef struct IDirect3DRMFrameArray* LPDIRECT3DRMFRAMEARRAY;
struct IDirect3DRMFrame {
virtual ULONG AddRef() { return 0; }
virtual ULONG Release() { return 0; }
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
virtual DWORD GetAppData() { return 0; }
virtual HRESULT AddChild(IDirect3DRMFrame* child) { return D3DRM_OK; }
virtual HRESULT DeleteChild(IDirect3DRMFrame* child) { return D3DRM_OK; }
virtual HRESULT SetSceneBackgroundRGB(float r, float g, float b) { return D3DRM_OK; }
virtual HRESULT AddLight(IDirect3DRMLight* light) { return D3DRM_OK; }
virtual HRESULT GetLights(IDirect3DRMLightArray** lightArray) { return DDERR_GENERIC; }
virtual HRESULT AddTransform(int combine, D3DRMMATRIX4D matrix) { return D3DRM_OK; }
virtual HRESULT GetPosition(int index, D3DVECTOR* position) { return D3DRM_OK; }
virtual HRESULT AddVisual(IDirect3DRMVisual* visual) { return D3DRM_OK; }
virtual HRESULT DeleteVisual(IDirect3DRMVisual* visual) { return D3DRM_OK; }
virtual HRESULT AddVisual(IDirect3DRMMesh* visual) { return D3DRM_OK; }
virtual HRESULT DeleteVisual(IDirect3DRMMesh* visual) { return D3DRM_OK; }
virtual HRESULT AddVisual(IDirect3DRMFrame* visual) { return D3DRM_OK; }
virtual HRESULT DeleteVisual(IDirect3DRMFrame* visual) { return D3DRM_OK; }
virtual HRESULT GetVisuals(IDirect3DRMVisualArray** visuals) { return DDERR_GENERIC; }
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) { return D3DRM_OK; }
virtual HRESULT GetTexture(IDirect3DRMTexture** texture) { return DDERR_GENERIC; }
virtual HRESULT SetColor(float r, float g, float b, float a) { return D3DRM_OK; }
virtual HRESULT SetColor(D3DCOLOR) { return D3DRM_OK; }
virtual HRESULT SetColorRGB(float r, float g, float b) { return D3DRM_OK; }
virtual HRESULT SetMaterialMode(D3DRMMATERIALMODE mode) { return D3DRM_OK; }
virtual HRESULT GetChildren(IDirect3DRMFrameArray** children) { return DDERR_GENERIC; }
};
typedef IDirect3DRMFrame* LPDIRECT3DRMFRAME;
struct IDirect3DRMFrame2 : public IDirect3DRMFrame {};
typedef IDirect3DRMFrame2* LPDIRECT3DRMFRAME2;
struct IDirect3DRMFrameArray : public IUnknown {
virtual DWORD GetSize() { return 0; }
virtual HRESULT GetElement(DWORD index, IDirect3DRMFrame** frame) { return DDERR_GENERIC; }
};
struct D3DRMPICKDESC {
IDirect3DRMVisual* visual;
IDirect3DRMFrame* frame;
float dist;
};
struct IDirect3DRMPickedArray {
virtual ULONG Release() { return 0; }
DWORD GetSize() { return 0; }
HRESULT GetPick(DWORD index, IDirect3DRMVisual** visual, IDirect3DRMFrameArray** frameArray, D3DRMPICKDESC* desc)
{
return DDERR_GENERIC;
}
};
typedef IDirect3DRMPickedArray* LPDIRECT3DRMPICKEDARRAY;
struct IDirect3DRMViewport : public IDirect3DRMObject {
virtual HRESULT Render(IDirect3DRMFrame* group) { return D3DRM_OK; }
virtual HRESULT ForceUpdate(int x, int y, int w, int h) { return D3DRM_OK; }
virtual HRESULT Clear() { return D3DRM_OK; }
virtual HRESULT SetCamera(IDirect3DRMFrame* camera) { return D3DRM_OK; }
virtual HRESULT GetCamera(IDirect3DRMFrame** camera) { return DDERR_GENERIC; }
virtual HRESULT SetProjection(D3DRMPROJECTIONTYPE type) { return D3DRM_OK; }
virtual D3DRMPROJECTIONTYPE GetProjection() { return D3DRMPROJECT_PERSPECTIVE; }
virtual HRESULT SetFront(D3DVALUE z) { return D3DRM_OK; }
virtual D3DVALUE GetFront() { return 1.0f; }
virtual HRESULT SetBack(D3DVALUE z) { return D3DRM_OK; }
virtual D3DVALUE GetBack() { return 100.0f; }
virtual HRESULT SetField(D3DVALUE field) { return D3DRM_OK; }
virtual D3DVALUE GetField() { return 1.0f; }
virtual int GetWidth() { return 640; }
virtual int GetHeight() { return 480; }
virtual HRESULT Transform(D3DRMVECTOR4D* screen, D3DVECTOR* world) { return D3DRM_OK; }
virtual HRESULT InverseTransform(D3DVECTOR* world, D3DRMVECTOR4D* screen) { return D3DRM_OK; }
virtual HRESULT Pick(float x, float y, LPDIRECT3DRMPICKEDARRAY* pickedArray) { return D3DRM_OK; }
};
struct IDirect3DRMWinDevice : public IUnknown {
virtual HRESULT Activate() { return D3DRM_OK; }
virtual HRESULT Paint() { return D3DRM_OK; }
virtual void HandleActivate(WORD wParam) {}
virtual void HandlePaint(void* p_dc) {}
};
struct IDirect3DRMViewportArray {
virtual ULONG AddRef() { return 0; }
virtual ULONG Release() { return 0; }
virtual DWORD GetSize() { return 0; }
virtual HRESULT GetElement(int index, IDirect3DRMViewport** viewport) { return DDERR_GENERIC; }
};
struct IDirect3DRMDevice2 : public IUnknown {
virtual unsigned long GetWidth() { return 640; }
virtual unsigned long GetHeight() { return 480; }
virtual HRESULT SetBufferCount(int count) { return D3DRM_OK; }
virtual HRESULT GetBufferCount() { return D3DRM_OK; }
virtual HRESULT SetShades(unsigned long shadeCount) { return D3DRM_OK; }
virtual HRESULT GetShades() { return D3DRM_OK; }
virtual HRESULT SetQuality(int quality) { return D3DRM_OK; }
virtual HRESULT GetQuality() { return D3DRM_OK; }
virtual HRESULT SetDither(int dither) { return D3DRM_OK; }
virtual HRESULT GetDither() { return D3DRM_OK; }
virtual HRESULT SetTextureQuality(D3DRMTEXTUREQUALITY quality) { return D3DRM_OK; }
virtual D3DRMTEXTUREQUALITY GetTextureQuality() { return D3DRMTEXTURE_NEAREST; }
virtual HRESULT SetRenderMode(int mode) { return D3DRM_OK; }
virtual HRESULT GetRenderMode() { return D3DRM_OK; }
virtual HRESULT Update() { return D3DRM_OK; }
virtual HRESULT GetViewports(IDirect3DRMViewportArray** ppViewportArray) { return DDERR_GENERIC; }
};
struct IDirect3DRM : public IUnknown {
virtual HRESULT CreateDeviceFromD3D(
const IDirect3D2* d3d,
IDirect3DDevice2* d3dDevice,
IDirect3DRMDevice2** outDevice
)
{
return DDERR_GENERIC;
}
virtual HRESULT CreateDeviceFromSurface(
const GUID* guid,
IDirectDraw* dd,
IDirectDrawSurface* surface,
IDirect3DRMDevice2** outDevice
)
{
return DDERR_GENERIC;
}
virtual HRESULT CreateTexture(D3DRMIMAGE* image, IDirect3DRMTexture2** outTexture) { return DDERR_GENERIC; }
virtual HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE surface, IDirect3DRMTexture2** outTexture)
{
return DDERR_GENERIC;
}
virtual HRESULT CreateMesh(IDirect3DRMMesh** outMesh) { return DDERR_GENERIC; }
virtual HRESULT CreateMaterial(D3DVAL power, IDirect3DRMMaterial** outMaterial) { return DDERR_GENERIC; }
virtual HRESULT CreateLightRGB(D3DRMLIGHTTYPE type, D3DVAL r, D3DVAL g, D3DVAL b, IDirect3DRMLight** outLight)
{
return DDERR_GENERIC;
}
virtual HRESULT CreateFrame(IDirect3DRMFrame* parent, IDirect3DRMFrame2** outFrame) { return DDERR_GENERIC; }
virtual HRESULT CreateViewport(
IDirect3DRMDevice2* device,
IDirect3DRMFrame* camera,
int x,
int y,
int width,
int height,
IDirect3DRMViewport** outViewport
)
{
return DDERR_GENERIC;
}
virtual HRESULT SetDefaultTextureShades(unsigned int count) { return D3DRM_OK; }
virtual HRESULT SetDefaultTextureColors(unsigned int count) { return D3DRM_OK; }
};
typedef IDirect3DRM *LPDIRECT3DRM, **LPLPDIRECT3DRM;
struct IDirect3DRM2 : public IDirect3DRM {};
// Functions
inline HRESULT WINAPI Direct3DRMCreate(IDirect3DRM** direct3DRM)
{
return DDERR_GENERIC;
}
inline D3DCOLOR D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha)
{
return 0;
}

View File

@ -1,71 +0,0 @@
#include "miniwin_ddraw.h"
#include <SDL3/SDL.h>
HRESULT IDirectDraw::EnumDisplayModes(
DWORD dwFlags,
LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext,
LPDDENUMMODESCALLBACK lpEnumModesCallback
)
{
DDSURFACEDESC ddsd = {};
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd.dwWidth = 640;
ddsd.dwHeight = 480;
ddsd.lPitch = 0;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | D3DDD_DEVICEZBUFFERBITDEPTH;
ddsd.ddpfPixelFormat.dwRGBBitCount = 16; // Game only accpets 8 or 16
if (!lpEnumModesCallback(&ddsd, lpContext)) {
return DDERR_GENERIC;
}
return S_OK;
}
HRESULT IDirectDraw::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
{
if (lpDDDriverCaps) {
memset(lpDDDriverCaps, 0, sizeof(DDCAPS));
lpDDDriverCaps->dwSize = sizeof(DDCAPS);
lpDDDriverCaps->dwCaps = 0;
}
if (lpDDHELCaps) {
memset(lpDDHELCaps, 0, sizeof(DDCAPS));
lpDDHELCaps->dwSize = sizeof(DDCAPS);
lpDDHELCaps->dwCaps = 0;
}
return S_OK;
}
HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter)
{
if (!lplpDD) {
return DDERR_INVALIDPARAMS;
}
*lplpDD = new IDirectDraw();
return DD_OK;
}
HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context)
{
int numDrivers = SDL_GetNumVideoDrivers();
for (int i = 0; i < numDrivers; ++i) {
const char* driverName = SDL_GetVideoDriver(i);
if (!cb(NULL, (LPSTR) driverName, NULL, context)) {
return DDERR_GENERIC;
}
}
return DD_OK;
}

View File

@ -1,78 +0,0 @@
#include "../CONFIG/config.h"
#include "miniwin.h"
#include <SDL3/SDL.h>
SDL_Window* window;
const char* title = "Configure LEGO Island";
BOOL CWinApp::InitInstance()
{
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
SDL_Log("SDL_Init: %s\n", SDL_GetError());
return FALSE;
}
window = SDL_CreateWindow(title, 640, 480, 0);
return TRUE;
}
int CWinApp::ExitInstance()
{
SDL_Quit();
return 0;
}
CWinApp::~CWinApp() = default;
const char* afxCurrentAppName = "";
AFX_MODULE_STATE g_CustomModuleState;
CWinApp* wndTop;
int main(int argc, char* argv[])
{
CWinApp base;
if (!base.InitInstance()) {
return 1;
}
CConfigApp app;
wndTop = &app;
if (!app.InitInstance()) {
return 1;
}
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT) {
running = false;
}
}
SDL_Delay(16); // 60 FPS
}
return base.ExitInstance() + app.ExitInstance();
}
BOOL GetWindowRect(HWND hDlg, tagRECT* Rect)
{
int x, y, w, h;
SDL_GetWindowPosition(window, &x, &y);
SDL_GetWindowSize(window, &w, &h);
Rect->right = x;
Rect->top = y;
Rect->left = w + x;
Rect->bottom = h + y;
return TRUE;
}
void AfxMessageBox(const char* message)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
}